Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Vector head/tail proof

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Vector head/tail proof


chronological Thread 
  • From: Edsko de Vries <devriese AT cs.tcd.ie>
  • To: Matthieu Sozeau <sozeau AT lri.fr>
  • Cc: coq-club <coq-club AT pauillac.inria.fr>
  • Subject: Re: [Coq-Club] Vector head/tail proof
  • Date: Mon, 26 May 2008 20:12:56 +0100
  • List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>

Hi,

> The same can be achieved without special tactics using:
> 
> <<
> Require Import JMeq.
> 
> Lemma vec_decompose : forall (n : nat) (v : vec (S n)),
>  v = vcons n (vhead n v) (vtail n v).
> Proof.
>   intros.
>   refine ((_
>              :forall (gen_x : nat) (v0 : vec gen_x),
>                JMeq v0 v ->
>               gen_x = S n -> v = vcons n (vhead n v) (vtail n v))
>               (S n) v (JMeq_refl v) (refl_equal (S n))).
>   induction v0 ; intros Hv Hx ; subst.
>   discriminate.
>   inversion Hx ; subst.
>   apply JMeq_eq in Hv. subst.
>   simpl.
>   reflexivity.
> Qed.
> >>
> 
> Note the use of heterogeneous equality to keep the equality between  
> [v] and the generalized [v0] variable.

Thanks for your detailed answer. I'm however not sure why we have to
give this non-trivial (at least to me!) proof. Can you give me an
intuition?

Edsko





Archive powered by MhonArc 2.6.16.

Top of Page