lean4-htt/tests/lean/run/1024.lean
Leonardo de Moura 5caf1bc692 chore: style
Use `·` instead of `.` for structuring tactics.
2022-03-11 16:12:46 -08:00

29 lines
898 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

inductive Vector (α : Type u): Nat → Type u where
| nil : Vector α 0
| cons (head : α) (tail : Vector α n) : Vector α (n+1)
namespace Vector
def nth : ∀{n}, Vector α n → Fin n → α
| n+1, cons x xs, ⟨ 0, _⟩ => x
| n+1, cons x xs, ⟨k+1, h⟩ => xs.nth ⟨k, sorry⟩
def snoc : ∀{n : Nat} (xs : Vector α n) (x : α), Vector α (n+1)
| _, nil, x' => cons x' nil
| _, cons x xs, x' => cons x (snoc xs x')
theorem nth_snoc_eq (k: Fin (n+1))(v : Vector α n)
(h: k.val = n):
(v.snoc x).nth k = x := by
cases k; rename_i k hk
induction v generalizing k <;> subst h
· simp only [nth]
· simp_all[nth]
theorem nth_snoc_eq_works (k: Fin (n+1))(v : Vector α n)
(h: k.val = n):
(v.snoc x).nth k = x := by
cases k; rename_i k hk
induction v generalizing k <;> subst h
· simp only [nth]
· simp[*,nth]
end Vector