Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Stuck with (at first glance) obvious dependent inversion

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Stuck with (at first glance) obvious dependent inversion


Chronological Thread 
  • From: Yannick Forster <yannick AT yforster.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Stuck with (at first glance) obvious dependent inversion
  • Date: Wed, 3 Apr 2019 16:00:01 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=yannick AT yforster.de; spf=None smtp.mailfrom=yannick AT yforster.de; spf=None smtp.helo=postmaster AT vela.uberspace.de
  • Ironport-phdr: 9a23:u1T/OBNuUm23xLEKv6kl6mtUPXoX/o7sNwtQ0KIMzox0Iv3zrarrMEGX3/hxlliBBdydt6sdzbKN+Py8ESxYuNDd6ShEKMQNHzY+yuwu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9Kev6AJPdgNqq3O6u5ZLTfx9IhD2gar9uMRm6twrcutQLjYd4Nqo8xBTFr3RHdu9LwW9kOU+fkwzz68ut4JJv6Thct+4k+8VdTaj0YqM0QKBCAj87KW41/srrtRfCTQuL+HQRV3gdnwRLDQbY8hz0R4/9vSTmuOVz3imaJtD2QqsvWTu+9adrSQTnhzkBOjUk7WzYkM1wjKZcoBK8uxxyxpPfbY+JOPZieK7WYNUXTndDUMlMTSxMGp6yYZUBD+QBPuhWoYfyqFQMohSiCgehH//vxzxSi3PqwaE33eYsHAfb1wIgBdIOt3HUoc33O6gIV+C1yqjIwinAb/hL2Tn975LIcgs9of6SR7J7bM3cyEk1GAPDiFWQqJDqPzCO2+UNvWib6PBgVfmzi2E5sQF9uCWgydk1h4TPm4kbxFfE9SBjz4Y0I921UFN7YdilEJtOri2aMJF2Qsc8TG5yviY60acKuZChfCQS1ZQnwR/fZ+Wcc4eS+B3jTuKRLi1+hH14Yr6wmgi9/E69weP/Tsm5yFJHoypfntXRuX0A2Qbf5tWFR/dj5EutxDKC2x7V5+pZO047j7DbJIQkwrMolpocr0DDHijulUXokqCWcl8r9vK16+v8fLrmvIScN5duhQ7iLKsigNGwDvogPggPWWiU5/i82aXn8ED5WrlGk/I7n6fDvJzHJ8kXuLS1DxJR34o98xq/Ci2p0NUcnXkJNlJFfxeHgpDpOl7UJvD4C/a/jEivkDpwx/HGMLrhAo/WLnjfjrjhZ6xx5FNCxwYr19BQ+4pUCq0dIPL0QkL+qNvYDgYgPwOox+bnFc5y25gFWWOPB6+ZKLndvUWJ5uIpOemMZZUatCzzK/g/tLbSiioynkZYdq2017MWbmq5F7JoORa3e33p1+YIF2ELtQl2Yuvwk0GPS3YHdn+0WaM35RkqBoW8FpvOXMahjerSj2+AApRKazUeWRi3GnDyetDcAqZeWGepOsZk1wc8e/2kQo4l2wupsVahmatpKfDP5iAC857uhoAsu7/j0Coq/DkxNPyzlnmXRjgvzHIGQCUtwK1l50BwmA/ajPpIxsdAHNkW3MtnFwc3MZmFnr5kBtT7HB/Lc82SUF+tT5OqDGNpQw==

Equations can indeed do it quite easily:


From Equations Require Import Equations.

Inductive eType : Set := Integer | Boolean.

Inductive unop : eType -> Type :=
Neg : unop Integer
| Not : unop Boolean.

Derive NoConfusion for eType.

Lemma a : forall x : unop Integer, x = Neg.
Proof.
intros. dependent elimination x. reflexivity.
Qed.
Print Assumptions a.


This gives "Closed under the global context" (at least on beta2 and master). The proof term will be a bit more convoluted than the one using match, but in bigger proofs that shouldn't matter.

Best,
Yannick

--
PhD student, Programming Systems Lab, Saarland University
https://www.ps.uni-saarland.de/~forster/


On 03/04/2019 15:39, Gaëtan Gilbert wrote:
The Equations plugin should be able to do it today
or you can "dependent induction x" today, however this uses an axiom

Gaëtan Gilbert

On 03/04/2019 15:22, Frédéric Dabrowski wrote:
Thanks Vincent and Gaetan

So it is because of Integer that I can’t perform a dependent inversion.
Do you thinks there is any chance that dependent inversion will be able to deal with this some day?

Best regards,
F.


======================================================

Dr. Frédéric Dabrowski
Laboratoire d’Informatique Fondamentale d’Orléans <https://www.univ-orleans.fr/lifo/>

======================================================
Maître de conférences, Université d’Orléans, LIFO
Responsable. de l’équipe Langages Modèles et Vérification <http://www.univ-orleans.fr/lifo/equipes/LMV/?Home> (LMV)

Site web : http://www.univ-orleans.fr/lifo/Members/Frederic.Dabrowski/
Téléphone :+33 (0)2 38 49 27 51 <tel:+33(0)238492751>
======================================================
Associate Professor, University of Orléans, LIFO
Head of the team Languages Models and Verification <http://www.univ-orleans.fr/lifo/equipes/LMV/?Home>(LMV)

Home : http://www.univ-orleans.fr/lifo/Members/Frederic.Dabrowski/
Phone : +33 (0)2 38 49 27 51 <tel:+33(0)238492751>
======================================================

Le 3 avr. 2019 à 15:13, Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net <mailto:gaetan.gilbert AT skyskimmer.net>> a écrit :

Coq will automatically do small inversion when pattern matching, so this works:
Definition a (x:unop Integer) : x = Neg :=
 match x with Neg => eq_refl end.
you can "Print a." to see what it generates

If you want to do it by hand the idea is to generalize your statement so that the thing you match on has indices which are independent variables, and when instantiated properly it implies what you want

For instance

Lemma a : forall x : unop Integer, x = Neg.
Proof.
 assert (forall t (x:unop t), x = match t with Integer => Neg | Boolean => Not end).
 { intros t x;destruct x;reflexivity. }
 intros x;apply (H Integer).
Qed.

or

Lemma a : forall x : unop Integer, x = Neg.
Proof.
 assert (forall t (x:unop t), match t with Integer => fun x => x = Neg | Boolean => fun _ => True end x).
 { intros t x;destruct x;reflexivity. }
 intros x;apply (H Integer).
Qed.

Gaëtan Gilbert

On 03/04/2019 15:01, Frédéric Dabrowski wrote:
Dear all,
I’m stuck with the following simple example for which I did not expect to spend more than 5 seconds …
How do I remove this ugly Admitted?
Best regards,
Inductive eType : Set := Integer | Boolean.
Inductive unop : eType -> Type :=
  Neg : unop Integer
| Not : unop Boolean.
Lemma a : forall x : unop Integer, x = Neg.
Proof.
Admitted.
======================================================
Dr. Frédéric Dabrowski
Laboratoire d’Informatique Fondamentale d’Orléans <https://www.univ-orleans.fr/lifo/>
======================================================
Maître de conférences, Université d’Orléans, LIFO
Responsable. de l’équipe Langages Modèles et Vérification <http://www.univ-orleans.fr/lifo/equipes/LMV/?Home> (LMV)
Site web : http://www.univ-orleans.fr/lifo/Members/Frederic.Dabrowski/
Téléphone :+33 (0)2 38 49 27 51 <tel:+33(0)238492751>
======================================================
Associate Professor, University of Orléans, LIFO
Head of the team Languages Models and Verification <http://www.univ-orleans.fr/lifo/equipes/LMV/?Home>(LMV)
Home : http://www.univ-orleans.fr/lifo/Members/Frederic.Dabrowski/
Phone : +33 (0)2 38 49 27 51 <tel:+33(0)238492751>
======================================================





Archive powered by MHonArc 2.6.18.

Top of Page