coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] How do I define Fixpoints on Records?
- Date: Tue, 2 Jun 2020 17:42:31 +0000
- Accept-language: en-CA, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N6DmJuOMQY67YK8sXuG0RIzdzP2fg2d6Tr9LcG19/oM=; b=hY5Pn3ynqkv/vXq26VCZvracf31hX9vDbV3VM1yUayfPn00CHTB6ombZdKdfn1cY0VrotUAjuXzXlBDhr5mPgzg0MuKAvJazrH96vPMSmyA8+z/rEaXnjKXFbB1F7H7nBPptwb0nV4s7od/Tfk0a5FC7UagLcze15p80iT/iih/MGJajS1qvIpX0H6lWEZJ9EBX6FqLYqIyebUJUTYhwEUQ50AhlC+yEMziJVSBnyvLw8asMM22yK93CROEzc9y9vbfL6vQOgo4L6u1zcxu2gKgtAyjQmWD5A5y0NxYRT2SuugN7Dk7Tg+2mlmzeBMnynpttahgb3WsdyIOSIekFQA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XXzwJr6FYrylVtHpiboNsxscmBZVfvlPs47rZ4/uJtHPxJgzVn3Msw/NWV4a4p/rVDfTQtR4/sRsixC2tLlztpBDQsmxR5ifatbRtxFvODKYnwTKalmN8X84WGawQ5xP/uSb1z2TNO9PFqt+k8sRs1sgNEbdF3JnX++BeGKMuLOX9bV+qdWZU+3yBJezbMCaAvYeGNwC4ZscYJuXQoBaP9hXz6f4w8sHpxzHjSMIsMLDl/r9DoyTssK0Mu3SZnUw41OznrmjzrJkgFm8RDp8nnXrrNPsYmL0sdRM0Tqj7+XXi0zFwMMxPvRgNccpywob42e/5bokyXeDIUneVNqCUw==
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=fdhzs2010 AT hotmail.com; spf=Pass smtp.mailfrom=fdhzs2010 AT hotmail.com; spf=Pass smtp.helo=postmaster AT NAM10-BN7-obe.outbound.protection.outlook.com
- Ironport-phdr: 9a23:1bnoKxZzNQFQLNp94aSWE03/LSx+4OfEezUN459isYplN5qZpsyzYh7h7PlgxGXEQZ/co6odzbaP7ua5AjNLsczJmUtBWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MRW7oR/MusQYg4ZuJaU8xgXUqXZUZupawn9lK0iOlBjm/Mew+5Bj8yVUu/0/8sNLTLv3caclQ7FGFToqK2866tHluhnFVguP+2ATUn4KnRpSAgjK9w/1U5HsuSbnrOV92S2aPcrrTbAoXDmp8qlmRAP0hCoBKjU293zZitFrjKJDvh2uuwB/zYDTYIGQLvV+f6Xdds4eSWdOWstdUipMDYSiYosIFeUBJvpYoJP5p1cXoxWzChWgCeH2xjNUiXL9wKk23uo9HQ3a2QAtGc8FvnbJo9XvLKocUf67wrTUzTvNbP1W1zXy55THfR06u/6AQa58fNDNxUUzCQ/IiEibp4z/PzOS0+QAq2yV4PB7VeKojW4sthh9rTuvxscrjInJiZ8exE3E9SpnxoY1KsS0Q1N5b965DZBdsC+aOJZ2QsIjWGFkpjo2xqAatZOgfCgKz4gnxxvFZPyGd4iE+A7sVOGUITphgn9uZb2wiQqo/0e61u38Ste70ExMriddjNTBqH8D2RPO5sWbTvZx4EOs1CqA2Q3X5O9KIUI5mK7bJpI93LI9iJUev0reEiH4m0j6kbKae1k69+S06+npbbPrrYKSOY9zjwHxKKUumsqnDOQ5NAgORWmb9v6m2L3t5031WLpKjvwqkqnZrZDVPt4XqbK+Aw9Qyooj5Be/Dyum0NQFhnYLNlNFeBWBgoP0OF/OOOj1APijj1i2lDpn2erKM7L9DpnXLXXPjq/tcahn5EJA1QY+yM1T649JBrwEPv3+VVP9uMDdAxI7LQO5wOTqBdB4244RRW2CBLKSPrnIvl+S/O0vJvGBZI8Ltzb5LPgo/+bggGM+l1MAYaWlxIYaZmi6E/h/JEWWemTjjs0GEWcXogoxV+vqiECEUTFOfXqyR7g85jYnCI24EYjDWoGtgLuH3CuhGZ1We3xGClSLEXfvdIWIQesDaCWXIsN5kzwEU6auS5M52ByhqAP20b5qIvTO9iAXqZ7vztt46/PLmRE37zN0DsCd02+XT2Fzm2MFXzE2071/oU180VePz7R0j+FEGdFI5/NJVRs6NZvGwOx7D9D+QB7OftCMSFq+WNWpHSkxTs4tw98Je0tyB9Kijgna0yW2B78ViqeECYcv8qPc2njxP9xyx2zH1KknlVkmQ9FAOXeohq5lpEDvANuDmEKA0q2uaK403SjX9W7Fw3DE9BVTVxc1WqHYV1geYFHXpJL3/BWRYaWpDOEFOxBGz4bHGKtNbNKhtlVLQvimcPTDKza/l2eiHkzQn+ukbI32fmwc2GPWD01SwFNbxmqPKQVrX3TpmGnZFjE7Tg6+OhK+waxFsHq+C3QM4USPZkxl2aCy/0dO1/ybV/Ya37ZCsyAk+WwtQQSNmunOAt/FnDJPOaVRZdRhvwVh/EeA70lXGMPlKKpvwFkDbw5wokXikQ1tDZlNmtQrq3VsyxduLaWf0xVKcDbKhMmsaI2SEXH7+VWUU4CTwkvXiY3E+qAT7f05rxPouwT7Tkc=
Function is documented in
https://coq.inria.fr/refman/language/gallina-extensions.html#coq:cmd.function
Equations is not builtin so you will need to install it separately:
https://github.com/mattam82/Coq-Equations
A function definition package for Coq. Contribute to mattam82/Coq-Equations development by creating an account on GitHub.
github.com
|
IMO, Equations is so much better than Function that Function will be eventually replaced. Last time I checked, Function has glitches like a well-foundedness measure only takes one argument, and there are some other constraints on how the body can be implemented.
Equations, on the other hand, even allows you to do mutual recursion with custom measure. It's even better than Agda's pattern matching to some extent.
From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
Sent: June 2, 2020 12:01 PM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: Re: [Coq-Club] How do I define Fixpoints on Records?
Sent: June 2, 2020 12:01 PM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: Re: [Coq-Club] How do I define Fixpoints on Records?
Thanks for the quick response!
Can you point me to some documentation for `_equation` or the "Equations" library? I could find the relevant equation by running `Search "equation"` but the documentation I can find does not explain a lot.
On Tue, Jun 2, 2020 at 10:53 AM Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com> wrote:
I believe Function provides `_equation` for you to rewrite.
if you can argue termination, Equations is a much more powerful and flexible solution. Equations has a funelim tactic which allows you to reduce functions in proof mode.
From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
Sent: June 2, 2020 11:49 AM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: [Coq-Club] How do I define Fixpoints on Records?Hi;
I have a record like this:
Record aggQueue : Type :=
{
ff : list B;
ffA : list B;
rr : list B;
rrA : list B;
}.
I want to define some kind of function on it, like this:
Fixpoint aggFlip (qq : aggQueue) : aggQueue :=
match (rr qq) with
| (r :: rs) =>
aggFlip {|
ff := r :: (ff qq);
ffA := (op r (aggff)) :: (ffA qq);
rr := rs;
rrA := tl (rrA qq)
|}
end.
When I try to define a function on a type expressed as a Record using a standard `Fixpoint` definition, Coq complains that the underlying data type is not recursive inductive.
One way to get around this problem seems to be to use the Function construct. However, when I do so, I cannot prove anything useful about the defined function because when I unfold it inside a proof it is terribly obscured by the surrounding proof terms.
Is there a way to do this cleanly?
--Agnishom
- [Coq-Club] How do I define Fixpoints on Records?, Agnishom Chattopadhyay, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Jason -Zhong Sheng- Hu, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Agnishom Chattopadhyay, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Jason -Zhong Sheng- Hu, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Agnishom Chattopadhyay, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Dominique Larchey-Wendling, 06/02/2020
- Re: [Coq-Club] How do I define Fixpoints on Records?, Jason -Zhong Sheng- Hu, 06/02/2020
Archive powered by MHonArc 2.6.19+.