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: Suneel Sarswat <suneel.sarswat 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 19:21:10 +0530
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=suneel.sarswat AT gmail.com; spf=Pass smtp.mailfrom=suneel.sarswat AT gmail.com; spf=None smtp.helo=postmaster AT mail-yb1-f176.google.com
  • Ironport-hdrordr: A9a23:wvLaDq5xjs66pr40YgPXwPHXdLJyesId70hD6qkRc20tTiX8raqTdZsgpHrJYVoqKRMdcJW7Scq9qBDnlKKdg7NhWYtKNTOO0ACVxcNZjbcKqAeQfBEWmNQts5uIsJITNDQzNzVHZArBjzVQ2uxP/OW6
  • Ironport-phdr: A9a23:UMMn+xP6r+gJV9P0tgQl6nbiDRdPi9zP1u491JMrhvp0f7i5+Ny6ZQqDv60r3ACCANmTwskHotKei7rnV20E7MTJm1E5W7sIaSU4j94LlRcrGs+PBB6zBvfraysnAJYKDwc9rDm0PkdPBcnxeUDZrGGs4j4OABX/Mhd+KvjoFoLIgMm7yfy+94fQbghKizawYbx/JwiqoAvMscUbnZFsIbsrxBvTpXtIdeVWxWd2Kl+Wgh3x+MS+8oN9/ipJo/4u+NJOXqv8f6QjULxXFy8mPHwv5M3qrhbMUw2C7WYBX2oMkxpIBw/F7AzmXpr0ryD3uPZx1DWcMMbrS70/RDas4LpxSBLwhygHOTw2/mHZhMJzkaxVvg6uqgdlzILIeoyYLuZycr/fcN4cWGFPXtxRVytEAo6kcoUPEuwBMvhGoIn5ulAAsAGxBRO3BOLh0DBImmL90Koh0+Q8FwHJwhIvH9YUvHTPttr1LrwSUO6vw6nU1jjDYPZW1i386IjMaBwuvfaMXbdpfMfX1EIgGB/LgE+Kpoz5IzOayP4Ns26D4uZ+VeyiiXIqph1+rDWxyckglpXFiI0Ixlza+it0zoc4KNOkREN4YNOpEp9duiCaOoV4Xs4uXWFltDs7x7MGu5O2ejUBxpc/xxPHdfCLb4yF7gjgWeuROzt0mm9pdbalixqv80Wty+vxXdSu3llQtCpKiNzMu2gN1xPN7siHTeNw/kK71jaO0wDf8+FFLlspmabCJZ4t37w9m5sJvUTMGS/2n0r2jKuIeUk+5ueo7OHnbq3npp+aKYB0lhnzProylsG7G+g1MQgDU3KF9eih0LDv51D1TbdLg/Eul6nWqpHaJcAVpq6jBA9V154u6w2iDzegztsXg30HIEheeB2dlYjpIF/PL+rkDfqkjFSslS1kx/HCPrH7HprNKX3DnK/7fblh805c1BYzzddH6p1IDbEBOev/VVP1tNzFFRA0KBe0wubiCNVlzIwSQ2OPAqmDMKPTq1CE/OwvI/PfLLMS7T36Mr0u4+PkxSsynkZYdq2017MWbmq5F7JoORPKT2Drh4I6DGEHsw52d+Xwk0KLTXYHfGu0Uq84oCoyEpm5BJvrSYWkgbjH1yC+SM4FLltaA0yBRC+7P76PXO0BPXr6yi5JlzUFUf2wQdZk20jx6kn1zL1oKueS8Sod58qLPD1d6OjalBV0/jtxXZz1O46lQGR9n2dOTDgzjvkXnA==

Here is another example of a similar problem.

Require Import Lists.List ssrbool.

Fixpoint memb (a:nat)(ell: list nat){struct ell}: bool:=
match ell with
| nil =>false
| a1::ell1 => (Nat.eqb a a1) || memb a ell1
end.

Record r:=mkr { x: nat; xc: Nat.ltb x 5 = false}.

Definition gt5 (ell: list nat)(x:nat):= if (memb x ell) then 6 else 0.

Fixpoint f (ell:list nat):(list r).
refine( match ell with
|nil => nil
|h::ell' => if (memb h ell') then f ell' else (mkr (gt5 ell h) _)::f ell'
end). 

Thanks,
Suneel

On Sat, Aug 14, 2021 at 6:44 PM Suneel Sarswat <suneel.sarswat AT gmail.com> wrote:
Thanks Gabriel, however it does not answer my question.
I am looking for a more general anwer, i.e., how to carry branch information during the proof. 
I am sorry if the example I created does not convey this. In my problem: for example, in one of the branches I have a condition that if 'h' belongs to 'ell' then 'O', where 'O' carries a hole and 
to prove the hole I need 'h' belongs to 'ell' in my hypothesis. Your answer is for a specific situation of comparison of numbers.
Let me know if a more elaborate example is needed if I am not making any sense. 
Regards,
Suneel



On Sat, Aug 14, 2021 at 6:09 PM Gabriel Scherer <gabriel.scherer AT gmail.com> wrote:
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