Inductive vector A: nat -> Type :=
| vnil: vector A 0
| vcons: forall (n: nat), A -> vector A n -> vector A (S n).
Theorem test A (v: vector A 0): v = vnil A.
Proof.
Admitted.
Thanks in advance.
set (n := 0) in v.
change (match n return vector A n -> Prop with
| 0 => fun v => v = vnil A
| S _ => fun _ => True
end v).
destruct v;trivial.
Thank you very much!
You can even let Coq fill in the S _
case with something like exact (match v in vector _ 0 => vnil _ => eq_refl end).
Lessness has marked this topic as resolved.
Turns out even the in
is not needed, so it comes out to the remarkably concise:
Inductive vector A: nat -> Type :=
| vnil: vector A 0
| vcons: forall (n: nat), A -> vector A n -> vector A (S n).
Theorem test A (v: vector A 0): v = vnil A.
Proof.
exact (match v with vnil _ => eq_refl end).
Qed.
(I'm just a beginner, so I'm still working on understanding why this works...)
Last updated: Oct 13 2024 at 01:02 UTC