coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Yishuai Li <yishuai AT cis.upenn.edu>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Program Fixpoint and a function involving two lists
- Date: Tue, 11 Aug 2020 03:46:57 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=yishuai AT cis.upenn.edu; spf=Pass smtp.mailfrom=yishuai AT seas.upenn.edu; spf=None smtp.helo=postmaster AT mail-il1-f179.google.com
- Ironport-phdr: 9a23:FADLSx05+S87zskxsmDT+DRfVm0co7zxezQtwd8ZseITKvad9pjvdHbS+e9qxAeQG9mCtbQU2qGP6vCocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmTuwbalxIRiyogndq9QajIh/Iast1xXFpWdFdf5Lzm1yP1KTmBj85sa0/JF99ilbpuws+c1dX6jkZqo0VbNXAigoPGAz/83rqALMTRCT6XsGU2UZiQRHDg7Y5xznRJjxsy/6tu1g2CmGOMD9UL45VSi+46ptVRTljjoMOTwk/2HNksF/g6xbrxChqRJxwIDafZ+bO+ZxcK7GYdMaXHBMUtpNWyBdAI6xaZYEAeobPeZfqonwv1kBrRqlBQmsGePg0D5IjWLw0607zu8sFgHH3A07H9IOrXTbttT1ObwOXuC016nE1yjDb+tI1jf77ojEaA4uruyRXb9pd8fa1EYgGR/fgFqKtYzlIy2a1v4Ls2WD8+ZuVeaihmokpg9+ojai2tkghIfGiI8Wyl7J+zh0zYI7K9O3VkJ2f9GpHpVeui2EN4V7QcAvT3xstSonxLALvZi2dzUExpQgwh7Qcf2Hc46Q7x3+VeaROit3hHV4eLKlnBa971KsyuLmVsmzzVZKtixImcTPuHAVzxHf9NSLR/9n8kqi2TuDzR3f5+BFLEwuiKbWKZosz7gtnZQJq0vDBDX5mEDuga+WaEok/u+o5vziYrr8p5+cM5Z4igD6Mqgzg8C/D/k0PwoKUmSB9uS807rj/UL9QLpUlPE5jq7ZsJXCKcQaoK62HRNV35495xqjCzqqytcVkHkdIF5YeR+KjpLlN0zMLf38Ffu/hk6jkDZvx/DIJL3hBZDNI2DDkbfgZrZ961NcxxAyzd1E/JJbFKsOIOnpVk/srNzXEBk5Mwquz+n5Fdp9y5sSWXiTDa+BLKPSrViI6/ozLOmLfY8ZoSryK/w45/H1lnI5gl8cfayx3ZQNcny4H/JmI1+YYXX2mNsBH30K7UICS7nhj0THWjpObV6zWbg973c1EtGIF4DGE7Gsm7yc1SbzOpweMnFHEVCRGHbAfISfHeoUZSSUZMJtj2pXBvCaV4Y92ET250fBwL19I7+Mo3xKhdfYzNFwotbru1Q3/D1wAd6a1jjTHXp5l3hOWic72qY5rEBgmA7ajPpIxsdAHNkW3MtnFwc3MZmGkb5/AtH2HwPFJ5KHEQn3BNqhBj41Q5Q6xNpcOx8hSeXntQjK2m+RO5FQj6aCXcFm+aPHmWXpKsB7jXvKyft5gg==
Hi Suneel,
I've asked a similar question before:
https://coq.discourse.group/t/fixpoint-with-two-decreasing-arguments/544
Alternative solution are internal auxiliary fixpoint and Equations,
which are shown under that thread.
Hope it helps,
Yishuai
Suneel Sarswat <suneel.sarswat AT gmail.com> 于2020年8月11日周二 上午3:27写道:
>
> I am trying to write a function involving two lists. In each iteration, one
> of the lists decreases strictly. The Fixpoint doesn't work so tried Program
> Fixpoint with the measure on the sum of the length of the two lists. Here
> is a minimum working example
>
> Require Import Wf.
> Program Fixpoint either (l1:list nat) (l2: list nat) {measure (|l1| +
> |l2|)}:=
> match (l1,l2) with
> |(nil, _) => nil
> |(_,nil) => nil
> |(a1::l1',a2::l2') => match (Nat.leb a1 a2) with
> |true => a1::either l1' ((a2 -a1)::l2')
> |false => a2::either ((a1-a2)::l1') l2'
> end
> end.
>
> Next Obligation.
> simpl. omega. Qed.
>
> Lemma trivial1 (l1: list nat) (l2: list nat): (hd (either l1 l2)) = (hd
> l1)\/(hd (either l1 l2)) = (hd l2).
> Proof. simpl. induction l1 as [| a1 l1']. left. auto. case l2 as [|a2 l2'].
> right. auto.
> destruct (Nat.leb a1 a2) eqn:H1. right. unfold either. unfold either_func.
>
> After the last tactic, I got stuck. It gives me a huge goal which let alone
> proving, I don't even understand.
> I tried finding this out on the internet. I got a post on stack exchange
> regarding this but that is not working. I got an error "fix_sub_eq_ext" not
> recognized when I run 'rewrite fix_sub_eq_ext' as per the instruction on
> the post. Besides this, I also did not understand how do these tactics
> work. Is there any tutorial or paper where I can learn more about Program
> Fixpoint related tactics with a lot of examples?
>
> Besides this, is there an alternative way to write functions involving two
> or more lists where only one of them is strictly decreasing in each
> iteration. And prove their properties.
>
> Thanks,
> Suneel
>
- [Coq-Club] Program Fixpoint and a function involving two lists, Suneel Sarswat, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Yishuai Li, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Suneel Sarswat, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Dominique Larchey-Wendling, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Suneel Sarswat, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Jean-Francois Monin, 08/12/2020
- Message not available
- [Coq-Club] Equations viz Braga (was : Program Fixpoint and a function involving two lists), Jean-Francois Monin, 08/15/2020
- Message not available
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Jean-Francois Monin, 08/12/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Suneel Sarswat, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Dominique Larchey-Wendling, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Suneel Sarswat, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Yishuai Li, 08/11/2020
- Re: [Coq-Club] Program Fixpoint and a function involving two lists, Lasser, Samuel M., 08/12/2020
Archive powered by MHonArc 2.6.19+.