Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] : Lexicographic order well foundedness

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] : Lexicographic order well foundedness


Chronological Thread 
  • From: Castéran Pierre <pierre.casteran AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] : Lexicographic order well foundedness
  • Date: Thu, 26 Aug 2021 11:14:31 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=pierre.casteran AT gmail.com; spf=Pass smtp.mailfrom=pierre.casteran AT gmail.com; spf=None smtp.helo=postmaster AT mail-wr1-f48.google.com
  • Ironport-hdrordr: A9a23:tQnyF60kJr6/HiZR1yuk0AqjBNEkLtp133Aq2lEZdPUzSKylfqGV/cjzuiWetN98YhsdcLO7VpVoI0mxyXcd2+B4AV7IZmbbUQWTQb1f0Q==
  • Ironport-phdr: A9a23:EF5zQxdoeQpngETPFsiBA/ZClGM+1tnLVj580XLHo4xHfqnrxZn+JkuXvawr0AWRG9SCoK8bw8Pt8InYEVQa5piAtH1QOLdtbDQizfssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1JuPoEYLOksi7ze+/94PPbwlSgDexfLx+IRW0oA7MqsQYnIxuJ7orxBDUuHVIYeNWxW1pJVKXgRnx49q78YBg/SpNpf8v7tZMXqrmcas2S7xYFykmPHsu5ML3rxnDTBCA6WUaX24LjxdHGQnF7BX9Xpfsriv3s/d21SeGMcHqS70/RDKv5LppRhD1kicKLz43/33YhcJtgqxbrgyvqB58zYDTe4yaLuZyfqbHcNMaWWZMXMBcXDFBDIOmaIsPCvIMMPhCoInmu1sJtwG+ChOqBOz30DFIh2H53bcg0+s/DArL2xQgH9MQv3TOttX6Kr0eXvyvw6nT0TXMcelW1i376IXTfRAhpOuDXbN0ccbL1UYvEAbFg0yWpIf4MDybyv4DvHKH7+p8S+2vkWgnphl+rDWsyMohlpfEip8Xx13K6yl3z5s5KcCmRUN/btCpDJReuiOHOoV4Rs4vQW5ltigmxrAat5O2YCYHxZcjyhPcbfGMboaG4hXmVOmLIDd4gmpoeL2+hxau8Uig1/bzWtOo31ZNqypJisPDtmoM1xzP6siLUPV8/kmn1D2S1A7T8vlJLV4omaffMZIswb49moANvUjdAyP6gkr7gayOekk64Oek9/nrb7D6qZCHKoN5jgTzP6Y1lcG/BOk1PBYBU3SH9em52r3s4En0TbVPg/A1iabVrJTXKMEVq6KkHQBY3YMu5Aq7AjqozdgVm2QMIkhfdxKdlYfpPknDIPDmAve7hFShiDJryOrHPr3lG5nMIGLDnKr4cbZz5ENRyxA/zd9Y55JTBbEBJOz8VlXtu9zfCx81Kw20w+D5B9Vhzo4SR36DD6uDPK7RsVKE/PwjL/eRaIMPtzvwKOAp5/v0gn84nV8dc7Op3ZwSaH2gBvRmIluWYWD2gtgfC2sFohAxTPf2iFKcSz5cfXCyUrkz5jE+Eo2mDIPDSpqxj7yG2Se3BodWaXxeClCQDXfocJ2JVOsLaCKLO8NujjgEVaW6RII6zhGvtAr6y6J9IebO+y0Ys4jj1Nlv6OHJmxEy7288M8PI2GaUCmpwg2kgRjks3ak5r1Yu5E2E1P1TiudElMZa4cRxUwogL5OUm/R7BsroV0TKd8yVRUyvRP2pBDgwSpQ6xNpYMBU1IMmrkh2Wh3niOLQSjbHeXPTcF4rT2nHwI4B2zHOUjMHJYHEpR8JOMSutgastrmA75qbMmkSd0rmwLOESgH6L+2CEwm6D+kpfVVwoOZg=

Hi,

Here is a file which defines a simple lexicographic product (on non-dependent pairs) with a proof of well foundedness.

Example of use:

Example Ex1 : lexico lt lt (3,5) (4,2).
left;auto.
Qed.

Example Ex2 : lexico lt lt (3,5) (3,6).
right;auto.
Qed.

Best regards,

Pierre


 https://github.com/coq-community/hydra-battles/blob/master/theories/ordinals/Prelude/Simple_LexProd.v

Le 26 août 2021 à 10:56, Wendlasida Ouedraogo <ouedraogo.tertius AT gmail.com> a écrit :

Hi,
l am not familiar with this kind of data. 
lexicographic product is defined as :

Section Lexicographic_Product.

  Variable A : Type.
  Variable B : A -> Type.
  Variable leA : A -> A -> Prop.
  Variable leB : forall x:A, B x -> B x -> Prop.

  Inductive lexprod : sigT B -> sigT B -> Prop :=
...

But what I need would be like:

Section Lexicographic_Product.
Variable A : Type.
  Variable B : Type.
  Variable leA : A -> A -> Prop.
  Variable leB : B -> B -> Prop.

  Inductive lexprod : A * B -> A * B -> Prop :=
...
like in symprod but with left_sym : forall x x':A, leA x x' -> forall y y':B, symprod (x, y) (x', y'). 

Can you send me an example with lexprod and/or is there a library with a simpler definition (relation (A * B)) with well foundedness proof?

Thank you for your answers.

Le jeu. 26 août 2021 à 08:50, Castéran Pierre <pierre.casteran AT gmail.com> a écrit :
Hi,

  You will probably have to require also Relations.Operators_Properties (where well-roundedness of the lexicographic product of two wfs is proved).

  AFAIK, Relation_Operators defines the lexicographic product as a relation on dependent pairs. If you are not familiar with this kind of data, it may be useful to work with a simpler definition (i.e. of type relation (A * B).  If you are interested, I may send you such definitions.

Pierre




Le 26 août 2021 à 02:49, Jasper Hugunin <jasper AT hugunin.net> a écrit :

The simple answer is that you want lexprod (Lexicographic order) rather than symprod (Symmetric product), defined in Relations.Relation_Operators.
lexprod has the definition you expect.

Best,
- Jasper Hugunin

On Wed, Aug 25, 2021 at 5:22 PM Wendlasida Ouedraogo <ouedraogo.tertius AT gmail.com> wrote:
Dear List, I am trying to write some functions in coq whose termination proofs use lexicographic order. My minimized problem is :
-------------------------
Require Import FunInd.
Require Import Recdef Coq.Arith.Wf_nat ZArith Coq.ZArith.Zwf Omega.
Require Import Relations.Relation_Operators.

Function test (x: string * nat) {wf (symprod string nat (ltof string length) (ltof nat (fun id => id)) ) x} :=
match x with
| (EmptyString, 0) => 0
| (EmptyString, S n) => test (EmptyString, n)
| ((String a s), n) => test (s, n + 1)
end.

---------------
I cannot prove that the function terminates. It seems that the problem is due to the fact that in Relations.Relation_Operators.v, symprod is defined like following:

Inductive symprod : A * B -> A * B -> Prop :=
| left_sym :
  forall x x':A, leA x x' -> forall y:B, symprod (x, y) (x', y)
| right_sym :
  forall y y':B, leB y y' -> forall x:A, symprod (x, y) (x, y').

instead of :

Inductive symprod : A * B -> A * B -> Prop :=
| left_sym :
  forall x x':A, leA x x' -> forall y y':B, symprod (x, y) (x', y')
| right_sym :
  forall y y':B, leB y y' -> forall x:A, symprod (x, y) (x, y').

-------------------
Any ideas ? 
--
Regards,
M. Wendlasida OUEDRAOGO                                                        



--
Cordialement,
M. Wendlasida Tertius OUEDRAOGO
Mobile : 0751061208                                                                  




Archive powered by MHonArc 2.6.19+.

Top of Page