test(library): test new tactics in the standard library
This commit is contained in:
parent
d0987eb3ac
commit
6db08c5519
4 changed files with 14 additions and 14 deletions
|
@ -185,7 +185,7 @@ assume h : x ∈ [a], or.elim (eq_or_mem_of_mem_cons h)
|
|||
|
||||
theorem mem_of_mem_cons_of_mem {a b : T} {l : list T} : a ∈ b::l → b ∈ l → a ∈ l :=
|
||||
assume ainbl binl, or.elim (eq_or_mem_of_mem_cons ainbl)
|
||||
(λ aeqb : a = b, by rewrite [aeqb]; exact binl)
|
||||
(λ aeqb : a = b, by substvars; exact binl)
|
||||
(λ ainl : a ∈ l, ainl)
|
||||
|
||||
theorem mem_or_mem_of_mem_append {x : T} {s t : list T} : x ∈ s ++ t → x ∈ s ∨ x ∈ t :=
|
||||
|
@ -221,8 +221,8 @@ theorem not_mem_of_not_mem_append_right {x : T} {s t : list T} : x ∉ s++t →
|
|||
|
||||
theorem not_mem_append {x : T} {s t : list T} : x ∉ s → x ∉ t → x ∉ s++t :=
|
||||
λ nxins nxint xinst, or.elim (mem_or_mem_of_mem_append xinst)
|
||||
(λ xins, absurd xins nxins)
|
||||
(λ xint, absurd xint nxint)
|
||||
(λ xins, by contradiction)
|
||||
(λ xint, by contradiction)
|
||||
|
||||
local attribute mem [reducible]
|
||||
local attribute append [reducible]
|
||||
|
@ -267,8 +267,8 @@ list.rec_on l
|
|||
(assume Hne : x ≠ h,
|
||||
have H1 : ¬(x = h ∨ x ∈ l), from
|
||||
assume H2 : x = h ∨ x ∈ l, or.elim H2
|
||||
(assume Heq, absurd Heq Hne)
|
||||
(assume Hp, absurd Hp Hn),
|
||||
(assume Heq, by contradiction)
|
||||
(assume Hp, by contradiction),
|
||||
have H2 : ¬x ∈ h::l, from
|
||||
iff.elim_right (not_iff_not_of_iff !mem_cons_iff) H1,
|
||||
decidable.inr H2)))
|
||||
|
@ -327,7 +327,7 @@ theorem sub_app_of_sub_right (l l₁ l₂ : list T) : l ⊆ l₂ → l ⊆ l₁+
|
|||
|
||||
theorem cons_sub_of_sub_of_mem {a : T} {l m : list T} : a ∈ m → l ⊆ m → a::l ⊆ m :=
|
||||
λ (ainm : a ∈ m) (lsubm : l ⊆ m) (x : T) (xinal : x ∈ a::l), or.elim (eq_or_mem_of_mem_cons xinal)
|
||||
(assume xeqa : x = a, eq.rec_on (eq.symm xeqa) ainm)
|
||||
(assume xeqa : x = a, by substvars; exact ainm)
|
||||
(assume xinl : x ∈ l, lsubm xinl)
|
||||
|
||||
theorem app_sub_of_sub_of_sub {l₁ l₂ l : list T} : l₁ ⊆ l → l₂ ⊆ l → l₁++l₂ ⊆ l :=
|
||||
|
@ -490,7 +490,7 @@ take q, qeq.induction_on q
|
|||
have aux : b::t = (b::l₁)++l₂ ∧ b::t' = (b::l₁)++(a::l₂),
|
||||
begin
|
||||
rewrite [and.elim_right h, and.elim_left h],
|
||||
exact (and.intro rfl rfl)
|
||||
constructor, repeat reflexivity
|
||||
end,
|
||||
exists.intro (b::l₁) (exists.intro l₂ aux))
|
||||
|
||||
|
@ -499,7 +499,7 @@ theorem sub_of_mem_of_sub_of_qeq {a : A} {l : list A} {u v : list A} : a ∉ l
|
|||
have xinv : x ∈ v, from s (or.inr xinl),
|
||||
have xinau : x ∈ a::u, from mem_cons_of_qeq q x xinv,
|
||||
or.elim (eq_or_mem_of_mem_cons xinau)
|
||||
(λ xeqa : x = a, absurd (xeqa ▸ xinl) nainl)
|
||||
(λ xeqa : x = a, by substvars; contradiction)
|
||||
(λ xinu : x ∈ u, xinu)
|
||||
end qeq
|
||||
end list
|
||||
|
|
|
@ -125,7 +125,7 @@ have gen : ∀ l₂, perm l₂ l → l₂ = [a] → l = [a], from
|
|||
injection e with e₁ e₂,
|
||||
rewrite [e₁, e₂ at p],
|
||||
have h₁ : l₂ = [], from eq_nil_of_perm_nil p,
|
||||
rewrite h₁
|
||||
substvars
|
||||
end)
|
||||
(λ x y l e, by injection e; contradiction)
|
||||
(λ l₁ l₂ l₃ p₁ p₂ r₁ r₂ e, r₂ (r₁ e)),
|
||||
|
|
|
@ -124,8 +124,7 @@ namespace vector
|
|||
revert H₁, generalize (append t []),
|
||||
rewrite [-add_eq_addl, add_zero],
|
||||
intro w H₁,
|
||||
rewrite [heq.to_eq H₁],
|
||||
apply heq.refl
|
||||
rewrite [heq.to_eq H₁]
|
||||
end
|
||||
|
||||
theorem map_append (f : A → B) : ∀ {n m : nat} (v : vector A n) (w : vector A m), map f (append v w) = append (map f v) (map f w)
|
||||
|
@ -240,7 +239,7 @@ namespace vector
|
|||
end
|
||||
|
||||
theorem of_list_to_list {A : Type} : ∀ {n : nat} (v : vector A n), of_list (to_list v) == v
|
||||
| 0 [] := !heq.refl
|
||||
| 0 [] := by reflexivity
|
||||
| (n+1) (a :: vs) :=
|
||||
begin
|
||||
change (a :: of_list (to_list vs) == a :: vs),
|
||||
|
@ -250,10 +249,10 @@ namespace vector
|
|||
rewrite length_to_list at *,
|
||||
intro vs', intro H,
|
||||
have H₂ : vs' = vs, from heq.to_eq H,
|
||||
rewrite H₂,
|
||||
apply heq.refl
|
||||
substvars
|
||||
end
|
||||
|
||||
|
||||
/- decidable equality -/
|
||||
open decidable
|
||||
definition decidable_eq [H : decidable_eq A] : ∀ {n : nat} (v₁ v₂ : vector A n), decidable (v₁ = v₂)
|
||||
|
|
|
@ -164,6 +164,7 @@ eq.drec_on H !heq.refl
|
|||
theorem of_heq_true {a : Prop} (H : a == true) : a :=
|
||||
of_eq_true (heq.to_eq H)
|
||||
|
||||
attribute heq.refl [refl]
|
||||
attribute heq.trans [trans]
|
||||
attribute heq.of_heq_of_eq [trans]
|
||||
attribute heq.of_eq_of_heq [trans]
|
||||
|
|
Loading…
Reference in a new issue