Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Question about a lemma concerning vectors

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Question about a lemma concerning vectors


Chronological Thread 
  • From: gallego AT cri.ensmp.fr (Emilio Jesús Gallego Arias)
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Question about a lemma concerning vectors
  • Date: Sun, 09 Nov 2014 14:12:13 +0100
  • Cancel-lock: sha1:yT7D5BY2oEAzXEbR7b2inSc9mf4=

Hello John,

"John Wiegley"
<johnw AT newartisans.com>
writes:

> I'm having difficulty proving the following, using Coq.Vectors.Vector:
>
> Lemma nth_replace {A : Type} : forall n (v : t A n) k x,
> nth (replace v k x) k = x.
>
> The induction principle is unable to accept an argument of type t A n.+1.
> Is
> this a case where a custom principle is needed? What form would that take?
> I've tried a few, but nothing so far has allowed me to progress.

I don't know how to prove it without using a destruction or
elimination principle specific for an n.+1 index.

The simplest proof may be to elim the vector, then destroy the (k : Fin
n.+1) using the Fin.caseS method:

,----
| Lemma nth_replace {A : Type} : forall n (v : t A n) k x,
| nth (replace v k x) k = x.
| Proof.
| move=>n.
| elim:n/ =>[H|x n v IH i].
| - inversion H.
| - move: n i v IH.
| by apply: Fin.caseS=>/=.
| Qed.
`----

Best regards,
Emilio




Archive powered by MHonArc 2.6.18.

Top of Page