Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Retain branch information in match for holes.

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Retain branch information in match for holes.


Chronological Thread 
  • From: Gabriel Scherer <gabriel.scherer AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Retain branch information in match for holes.
  • Date: Sat, 14 Aug 2021 14:38:41 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer AT gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer AT gmail.com; spf=None smtp.helo=postmaster AT mail-vs1-f52.google.com
  • Ironport-hdrordr: A9a23:VWfA7KtgfB2v/JZz9Xavawzz7skDEdV00zEX/kB9WHVpm6uj9vxG/c506faaskdzZJhNo6HjBEDiexzhHOBOgbX5VI3KNGKNhILCFu1fBOXZrgHdJw==
  • Ironport-phdr: A9a23:4hYuZhVUYtEyjrenIoSIcl/qOsvV8KwtVTF92vMcY1JmTK2v8tzYMVDF4r011RmVB92du60P0LeempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffRlEiCC+bL5wIxm7owXcvdQKjIV/Lao81gHHqWZSdeRMwmNoK1OTnxLi6cq14ZVu7Sdete8/+sBZSan1cLg2QrJeDDQ9LmA6/9brugXZTQuO/XQTTGMbmQdVDgff7RH6WpDxsjbmtud4xSKXM9H6QawyVD+/9KpgVgPmhzkbOD446GHXi9J/jKRHoBK6uhdzx5fYbJyJOPZie6/Qe84RS2hcUcZLTyFODY28YIkPAeQPPuhWspfzqEcVoBSkGQWhHvnixiNUinL026AxzuQvERvB3AwlB98AsW7bo87vNKcTT++1yLTDwyjfYPNWxzj98pbHcgo8qvyLUrJ/a9HeyVMuFwzbilWcs5flMC+V1usTqWiU8fBgWPmgi24isQ5xozyvyt0whYnOg4IY01bJ/jh2z4gpP9O3UlJ7YcK6H5tKsSGXL5V6T90iTmxnuCg0xKAKtJ25cSUJ1Zgr2wPTZvKIfYWG7B/uSemcLDRliX9hdr+yiAq//Ey9x+D+SsW631RHoyVDn9LRtX4NzwTe5tabRvZ55Eus2jaC2xrN5u1ZI004j6rWJ4Anz7UtjJQcq17DETXzmEjujK+ZaEEk+u+w5uTieLrmp5ucO5ZqigHlL6gig8K/DOQmPgQUUGib/uO81LLn/ULnWrlFkvo2kqzBvJDbI8QUuLK5DhdL3oo/7xuzFTSr3dQCkXUZMV5IegiLgoj3N13WJfD3F/a/g1CikDdxwPDGO6XsAprXIXfYirfhfKhy60pGxAoo0d9f54xbCqsfL/LpQULxu9nYAQU4Mwyw2eroFNJ91oYGVWKVHqCZKL/SsUOP5u83P+aMY5YVtC/hJPgh+v7hlmQ0mUQdfKmsxZsYcmq0HvVgI0WDYHrjmM0NEWkQvll2cOu/o1qbGRVXenz6C6k7/3QwDJ+sJYbFXIGkxrKbinSVBJpTM09PAEqNHHOgTI6EVu0BcmrGLcZriD0JUf66QI8szxy0nAD/wrtjaOHT/3tL5trYyNFp6riLxlkJ/jtuApHYijnVJ4mVtmYBRjtzwrsm5EIgkBGM1q93h/EeHttWtashuuISOpvVzug8ANf3CFqpljihR1OvQ9HgCjY0HItZ/g==

Dear Suneel (and list),

Instead of using Nat.ltb here, which returns a non-informative boolean, you can use
  if Compare_dec.lt_dec h 5 then ... else ...
which enriches the goal with the information (h < 5) and ~(h < 5). Then
  PeanoNat.Nat.ltb_nlt
(which I found with (Search "ltb".)) gives a translation between both notions of comparison.

Best


On Sat, Aug 14, 2021 at 1:37 PM Suneel Sarswat <suneel.sarswat AT gmail.com> wrote:
I have a simple problem. I can't find any web link/document for this kind of situation. I have a record type r as
 Record r:=mkr { x: nat; xc: Nat.ltb x 5 = false}.
Now I want to write a function which takes a list ell of natural numbers and returns a list of type r as
 Fixpoint f (ell:list nat):(list r).
 refine ( match ell with
  |nil => nil
  |h::ell' => if Nat.ltb h 5 then f ell' else (mkr h _)::f ell'
end ).

The problem is it gives me a goal to prove "Nat.ltb h 5 = false" without the branch information or any condition on term h. In general how to extract branch information/pass dependent proof terms in a specific branch of function?
Thanks in advance. 
Regards,
Suneel 



Archive powered by MHonArc 2.6.19+.

Top of Page