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 18:44:20 +0530
  • Authentication-results: mail3-smtp-sop.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-f169.google.com
  • Ironport-hdrordr: A9a23:i91YLayEZ5zWGQ0C/fPYKrPwFb1zdoMgy1knxilNoH1uA7WlfqWV9sjzuiWE7Qr5NEtQ++xofZPwIk80lqQV3WByB8bHYOCOggLBR72Kr7GD/9SKIVyYygcy79YHT0G8MrHN5JpB4PoSLDPWLz/o+re6zJw=
  • Ironport-phdr: A9a23:xA7jwRC8DzvCskezXAREUyQUiUMY04WdBeb1wqQuh78GSKm/5ZOqZBWZua81yg+WFtiHo9t/yMPu+5j6XmIB5ZvT+FsjS7drEyE/tMMNggY7C9SEA0CoZNTjbig9AdgQHAQ9pyLzPkdaAtvxaEPPqXOu8zESBg//NQ1oLejpB4Lelcu62/6u95HJYAhFhjWxbLN9IR6rsQjfq84ajJd4JK0s0BXJuHxIe+pXxWNsO12emgv369mz8pB+7Sleouot+MFcX6r0eaQ4VqFYAy89M28p/s3rtALMQhWJ63ABT2gZiBtIAwzC7BHnQpf8tzbxu+Rh1CWGO8D9ULY5Uimg4ah2Uh/lkCgINzA7/2/XhMJ+j79Vrgy9qBFk2YHYfJuYOeBicq/Bf94XQ3dKUMZLVyxGB4Oxd5YBD/cHPelGsYb9o0YFowakCgm2H+PuxCVHhmPr1qA9yOQhDAfG0xI+ENIKqnjUt8/6NL0JUeG71qbI0S7Ob/xT2Tjn6YjIdgotru2LXbJ1aMfcz1QkGAzZgFuKs4PlIy+V2foXs2id9+dsS+Khhmw7pgxtrTai2MgihpXViowa11zI6yp3zYg0KNC2VEJ2Yt+pHZlUuiybN4Z4TN8vT39otSony7AIuZy2cS4Xw5ok3x7Sc+KLf5SM7x75V+ucIS10iGx4dL+7nRq+7Emtx+n6W8KpylhFtDBFncPJtn0V1xzc9MyHSvxl80ekwzmP1gTT5vhEIE8viKbXMpAhzqMxm5cXq0jDESj2mEL5jK+SaEoo4PSn6+PiYrn+p5+cMZF7ih3mP6gwhsCyBf40PwsOUmSB5+iwybnu8VfkTLhLivA6iqzZv4rbJcQfqK65GQhV0oM75hakEjem1soXkmcDLF5fYxKIlZLpO0rAIf/iEfeymFuskDJxyPDHOr3tGInCLn/GkLv5Z7Zy91ZcyBYvzdBY/59bFrYBIOvqVkDtsNzYEwQ2Phevw+fnDdV9zpkRVXiOAq+fKqPSsEWH6vghI+mWN8cpv2P2LOFg7PrzhzdtklgEOKKtwJE/aXaiH/0gLV/PMlT2hdJUKnoMswc6BNfjkkadWCIbM22vWa8x4ncgAZi9Eo7fbo+oib2Fmiy8G8sFNSh9FlmQHCKwJM2/UPAWZXfKSieEujMBXLmlDYQm0EP23OcV47ViJ+vQvCYfsMC6vDCUz+jalBV35DYtSsrEjTDLQGZzkWcFATQx2fInyXE=

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