coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match
Chronological Thread
- From: Laurent Thery <Laurent.Thery AT inria.fr>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match
- Date: Tue, 20 Aug 2019 15:44:49 +0200
- Autocrypt: addr=thery AT sophia.inria.fr; prefer-encrypt=mutual; keydata= mQENBE3a3V8BCADTeORKU7I7UmBBcs4VhSCq1IgKD8vdmdrGAlF3IJSFng7Fk8+MgS2gWYcS Ukf5t+rjNM3Z6brfYXc1naZlf2JPGHvAGiz8+TkXL+/ZA6+gAoIKy/iKyD+hCD8m92WH3rPH vCX6EJ44FEI7gUJ37GlTjvuP0I55vaFcwEg8nDgkALaCJvrSHtePuPKR1Q+9q2dgR7fTObal HYGMAsgT6k6n2ofe4Q6VFRLJhruU02qAfV5zgIoa3xgrTwSr4RRDILHttAw7EN6aLG6JycJ7 sPsPsiQzrd/tFsNbiHYeojJCkU2pDSQ3pBtXAJL/z2pMWTeTXvA60l9w0sDO7M3mkC3vABEB AAG0J0xhdXJlbnQgVGjDqXJ5IDxMYXVyZW50LlRoZXJ5QGlucmlhLmZyPokBOAQTAQIAIgUC TdrdXwIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQHHaWvRTi0tpIgggAnSUYcU2N uchXkGGwmPuLmvSUMiLkyFPs9GF2YF1ONOuJtpnQMcpsseCkcmIjESz0h5OpknpyraUXvbh0 ZdFqaLC2E+GyV8/YQi71wSsTPgWP450u0XUt0ysjwkKW6aIxIhSzrtgNp4E6w5KzXVJxA/yM V5RNFHg/5uifgfv4b7xaGHV8L93NbSvedk1O7yje5Hqgfab0t6J5Kf0M3sG+pB3gEkDVK9B7 +0fhe7/5u1Nj5HoLWid8UNZfFzJzb18Xe2ckzNye0KdDtQFac8qGUzhLbEYt3ScYjRYTq9/d V4Cin39j7Oo64Nk71iiLBISyuk0Q9D+Jq7nwwcQr/R8s1rkBDQRN2t1fAQgA7H6aX6BfdO/X Vlf4EGEoyFQ5u/JDe+giIHWSS34YWDWVUYyp320CrAYAkh9lQ1Nvh1tsmgiUh5xnY7wY0tOi wJSm94XlYAmHrddmWVNXRn09GvZJhfI2LdVBg3oxPfc8+bV+Hz83z/5BMPLOogxB22QMPJ6e iD2EsUMPNsuCVQ8WNo6ZmueuuYe7vEUXLYdRXNumJJgekEuG/q1BD4xgfzWpWfUODm6WygWZ oov50DomcDcAHW03bgnHlqnYu20Qg00GqgR3FKlORTvnOxD5TMCXe+eLUxkQfvnjbIPhtrnJ hgJMKVkRBEoaQ/XA4FdvxloInYPbqxNZ72yd09BbewARAQABiQEfBBgBAgAJBQJN2t1fAhsM AAoJEBx2lr0U4tLaWNQH/2/fIaF9ngbKPBJbDxYa7glJuCfamJgy3R8mJ//VYsS4RbdroSX3 29EgWlTx2reu1b4C5n5k7l4KpLgsRIc3bLUasGv15nf8BqmKIMulidzsxJv86S2imY/0870Q NOiO9SElHE7/2q4J1m2ew77SegiqGVWHl6Zs+4ROfOILTy24o26BQMAZhPX7jEs04Atv6yjw OUIPbzFO+XRuKqkBwHn9S8+GQelT0Gh84Dc5D2jIF0+kWY7uHqe2O+2LPfgO2CYhqmVfr/Ym mZv2xUyhJ7gui2hYaggncQ96cM2KhnKlgMw8nStY0GTqVXLEjPYblz8mqtF8aBPRSk/DjjrF QeI=
- Openpgp: preference=signencrypt
> Fixpoint first_col {T : Type} {m n : nat} (M : @matrix T m (S n)) :
> @matrix T m 1 :=
>
> match m return @matrix T m 1 with
>
> | 0 => ()
>
> | S m' => ( (fst (fst M), ()), first_col (snd M))
>
> end.
>
as M depends on m you need to internalise it :
Fixpoint first_col {T : Type} {m n : nat} : @matrix T m (S n) -> matrix
m 1 :=
match m return matrix m (S n) -> matrix m 1 with
| 0 => fun M => ()
| S m' => fun M => ( (fst (fst M), ()), first_col (snd M))
end.
>
>
>
>
> Coq does not see that since m=S m', M has at least one row in “fst M”. I
> guess I need a more fancy in/as/return annotation for the match or some
> explicit type annotations here and there, but I can’t figure it out.
> Btw.: the return as given is required – without it Coq doesn’t accept
> the 0 case term.
>
>
>
> I guess this would be much easier with the Equations plugin. I guess it
> is due time to look into it, but I also find it worthwhile to understand
> how it would work in basic Coq.
>
> Best regards,
>
>
>
> Michael
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de
> Managing Directors: Christin Eisenschmid, Gary Kershaw
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
>
- [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Soegtrop, Michael, 08/20/2019
- Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Laurent Thery, 08/20/2019
- Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Laurent Thery, 08/20/2019
- RE: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Soegtrop, Michael, 08/20/2019
- RE: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Soegtrop, Michael, 08/21/2019
- Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Laurent Thery, 08/20/2019
- Re: [Coq-Club] Struggling to convert a simple Program Fixpoint using just induction and exact into a Fixpoint with match, Laurent Thery, 08/20/2019
Archive powered by MHonArc 2.6.18.