Skip to Content.
Sympa Menu

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

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Vector head/tail proof


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

Hi,

I was playing around with the trick posted by James McKinna a while back on
definition of head and tail on vectors without relying on inversion:

Section Vectors.

Variable (A : Set).

Inductive vec : nat -> Set :=
  | vnil : vec 0
  | vcons : forall n, A -> vec n -> vec (S n).

Definition vhead (n : nat) (v : vec (S n)) : A :=
  match v in vec m return (match m with 0 => True | S n' => A end) with
  | vnil => I
  | vcons _ head _ => head
  end.

Definition vtail (n : nat) (v : vec (S n)) : vec n :=
  match v in vec m return (match m with 0 => True | S n' => vec n' end) with
  | vnil => I
  | vcons _ _ tail => tail
  end.

This works quite nicely, but I got stuck in the following proof:

Lemma vec_decompose : forall (n : nat) (v : vec (S n)),
  v = vcons n (vhead n v) (vtail n v).

Any hints?

Thanks,

Edsko





Archive powered by MhonArc 2.6.16.

Top of Page