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: Frédéric Dabrowski <frederic.dabrowski AT univ-orleans.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Stuck with (at first glance) obvious dependent inversion
  • Date: Wed, 3 Apr 2019 17:25:46 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=frederic.dabrowski AT univ-orleans.fr; spf=Pass smtp.mailfrom=frederic.dabrowski AT univ-orleans.fr; spf=None smtp.helo=postmaster AT sucre.univ-orleans.fr
  • Ironport-phdr: 9a23:JvxXpBTc2dyYdWyYf5Z6dtSbmtpsv+yvbD5Q0YIujvd0So/mwa6zZxaN2/xhgRfzUJnB7Loc0qyK6vmmATdLv87J8ChbNsAVD1ld0YRetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbdgMutyu+95YDYbRlWizqhe7NyKwi9oRnMusUMjoZuN7s9xgHVrnZGdOhbxH9kLk+Xkxrg+8u85pFu/zlMt/4768JMTaD2dLkkQLJFCzgrL3o779DxuxnZSguP6HocUmEInRdNHgPI8hL0UIrvvyXjruZy1zWUMsPwTbAvRDSt9LxrRwPyiCcGLDE27mfagdFtga1BoRKhoxt/w5PIYIyQKfFzcL/Rcc8cSGFcWMtaSi5PDZ6mb4YXD+QOIelXoZTzqVsAsxWxBwqiCuT0xzBSmnP22Lc30+Q9HQzE2gErAtIAsG7TrNXwLKocUfq1y7PVwjLZdfNW2Cvy55DGfB87uv6MR7VwcMTKyUksFgPOk1KdqYL/PzyLy+sCrXKb7+t8Wu61lmEosRp+oiKoxsYikYnJhYMVx0vZ9SV/wYY1O8S0SElhYd6gDpRfrSeaN5BsTsMsWWFloSA3waAIt568eSgF0pUnxxjHZvyadYiI4wzjWP+WITdigHJqZqiwhxCp8US6xO38TNG40EtMripEi9XMrWoC2AbJ6siDUPR9+Fqu1SyS2A/N7OxPPEM6lbLDJpI8xrM9mYAfvVnCEyL0gkn7grOael8g9+Wn8+jrf7Hrq5CGO4NpiwzzML4il8KjDegiMAUDXG6W8vmm2rL55032WrBKg+U2kqbHtJDaItwWprWkAwBJyIYs9QyzDyqg0NQZg3kLNVVFeAiDj4f3IV7OJuv4Ae2xg1S2iDtrxvbGMaP9ApjVM3TOlLjscaxg50Ndygc/195S645OBrwFL///Qkrxu8bZDh89PQy02eHnCNBl24MQQ2KAHLKWP73IsV+J+u0jOfSDa5UOtzbnLPgk6eXujXw4mVIGYKmp25oXaG6hEvRhOUWZZWTjjc0HEWcRpAY+QvbqhEWYUTFPf3ayQ7485jYjBY26CofDX5mhj6CF3CemBZJbfXtGC1CJEXfwbYqIQfYMaCSIIs9giDMIT7ahS5VynS2p4QT90v9sKvfe0iwer5PqktZvtMPJkhRn2yb1A0WH0mq6Y2h+hGQXXDw3lPRxu0Fxx02C2u50ivZCEsNI5PJhTwE7K9vb1eh3AtbpHAzbKITaAG26S8mrVGliBuk6xMUDNh4kSoeSyyvb1i/vOIc70rmCBZg66KXZhiejOsB81TPBzq0shl89BMVVZzT/2vxPsjPLDouMqH230r6wfP1DjjPL9XnGynCKsUheS0h+S/edBC1NVg7ttd38o3j6YfquBLAgaFAT0tOJMKYMd9vokxBBXvPuMdLFJWyryT+9

Thanks a lot. Now I know I should have looked at Equations earlier.

Best,
======================================================

Dr. Frédéric Dabrowski

======================================================
Maître de conférences, Université d’Orléans, LIFO
Responsable. de l’équipe Langages Modèles et Vérification (LMV)

======================================================
Associate Professor, University of Orléans, LIFO

Phone : +33 (0)2 38 49 27 51
======================================================

Le 3 avr. 2019 à 16:00, Yannick Forster <yannick AT yforster.de> a écrit :

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