2014-10-26 22:47:29 +00:00
|
|
|
import logic data.nat.basic
|
|
|
|
open nat
|
|
|
|
|
|
|
|
inductive vector (A : Type) : nat → Type :=
|
|
|
|
vnil : vector A zero,
|
|
|
|
vcons : Π {n : nat}, A → vector A n → vector A (succ n)
|
|
|
|
|
|
|
|
namespace vector
|
2014-11-09 02:56:52 +00:00
|
|
|
print definition no_confusion
|
2014-10-26 22:47:29 +00:00
|
|
|
|
|
|
|
theorem vcons.inj₁ {A : Type} {n : nat} (a₁ a₂ : A) (v₁ v₂ : vector A n) : vcons a₁ v₁ = vcons a₂ v₂ → a₁ = a₂ :=
|
|
|
|
begin
|
|
|
|
intro h, apply (no_confusion h), intros, assumption
|
|
|
|
end
|
|
|
|
|
2014-11-09 02:56:52 +00:00
|
|
|
theorem vcons.inj₂ {A : Type} {n : nat} (a₁ a₂ : A) (v₁ v₂ : vector A n) : vcons a₁ v₁ = vcons a₂ v₂ → v₁ = v₂ :=
|
2014-10-26 22:47:29 +00:00
|
|
|
begin
|
2014-11-09 02:56:52 +00:00
|
|
|
intro h, apply heq.to_eq, apply (no_confusion h), intros, eassumption,
|
2014-10-26 22:47:29 +00:00
|
|
|
end
|
|
|
|
end vector
|