Skip to content

Instantly share code, notes, and snippets.

@yoshihiro503
Last active August 15, 2018 05:05
Show Gist options
  • Save yoshihiro503/157c6482dde50a70f8e07e8855acc4e0 to your computer and use it in GitHub Desktop.
Save yoshihiro503/157c6482dde50a70f8e07e8855acc4e0 to your computer and use it in GitHub Desktop.
Vec 0の元は全部VNilであることの証明(see https://twitter.com/i/web/status/1027868640169717762)
Require Import JMeq.
Section Vec.
Variable A:Set.
Inductive Vec : nat -> Set :=
| VNil : Vec O
| VCons : forall n, A -> Vec n -> Vec (S n).
Lemma Vec0_is_JMeq_to_VNil : forall n (v : Vec n),
n = 0 -> JMeq v VNil.
Proof.
intros n v. destruct v.
- reflexivity.
- discriminate.
Qed.
Goal forall v : Vec 0, v = VNil.
Proof.
intros v. apply JMeq_eq.
now apply Vec0_is_JMeq_to_VNil.
Qed.
End Vec.
Section Vec.
Variable A:Set.
Inductive Vec : nat -> Set :=
| VNil : Vec O
| VCons : forall n, A -> Vec n -> Vec (S n).
Goal forall v : Vec 0, v = VNil.
Proof.
intros v.
refine(match v with
| VNil => _
| _ => _
end).
- reflexivity.
- exact idProp.
Qed.
End Vec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment