coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Pierre Courtieu <pierre.courtieu AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Does Coq support higher-order rewrite of lambda terms?
- Date: Mon, 27 Aug 2018 17:34:02 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=pierre.courtieu AT gmail.com; spf=Pass smtp.mailfrom=pierre.courtieu AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f53.google.com
- Ironport-phdr: 9a23:v8HdlhBqOGFnLZgDstbDUyQJP3N1i/DPJgcQr6AfoPdwSPT4pMbcNUDSrc9gkEXOFd2Cra4c1KyO6+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglUhjexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfOpWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnMVhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Qiqp4bt1RxD0iScHLz85/3/Risxsl6JQvRatqwViz4LIfI2ZMfxzdb7fc9wHX2pMRsleVyJDDY28YYUBDPcPM/hEoIfyvFYOsQK+CBOwCO/z1jNFhHn71rA63eQ7FgHG2RQtEcgPsHvKttX1LrkdWv2rwanP0DXDde9W2Tbj54jVbxsspumMXbNufsrL00kgCRnJgUmXqYz4JTOVyuUNvHaG7+d7WuKvjnQoqwB1ojS12sgsjYzJi5sTx1vZ+yt5x4M1Kse5SE59edOkC4dQuDuGOIt1XMwjTH1nuCYgxb0Atp60YjIGx4ggxx7abfGMbouG4gr7WeqPPTt1gGhpdbG/ihqo70Ss1+7xWtO03VtEqCdOj8PCuWoX1xPJ78iKUvt98Vml2TaIzw3T7/tLIUEwlabCLJ4hw6I8moMdsUnDECL6gkr2jKiRdkUr/uin9f7rbanhpp+ZL4N0iwf+PboymsGnH+g0LgwDU3KY9Om8zrHv41D1TbZQgvA2nKTVqJXaKt4apq69DQ9VyIEj6xOnAje+0dQXg2MHLEhbdx6dk4fpPEzOIOrkDfe+nVusjSxmx//DPrL7A5XNKmLPn6vmfbZ480Jc0hY8zchD55JIDbEMOO78WkjotNDBEhA5NxG0zP38BdVm1oIeXHqPDbWDPKPTt1+I/OMvLPOWaI8bojauY8QistXplDcSnUIXNf2i2oJSY3SlFNxnJV+YaDzimIFSP30Nu18GTeHwklDKejlOfWqzUr90sik6BZi8AMHIQZ23nL2MwQ+0G5RXYiZNDVXaQiSgTJmNR/pZMHHaGcRmiDFREOH5E9ZwhyHrjxfzzv9cFsSR/yQZsZz5090svr/ckBgz8Xp/CMHPijjRHVExpXsBQnoN5I46uVZ0kw7R3q1xgvgeHttWtasQD1UKcKXExuk/MOjcHwLMetDTFQSjS9SiRDYwFpc/noRIbEF6FNGvyBvE2njyDg==
Hi,
Below an example about uncurrying: a (trivial) proof that from any
function is we can build IS that takes a pair of arguments instead of
two arguments and returns the same result. An example of rewriting
(inside a proof) follows.
You seem to be willing to use the coq typing system as the typing
system of your expressions (shallow embedding). Are ou aware that you
can also define a deep embedding of your semantics?
What is your goal with this semantics?
Best regards,
Pierre
---------------------------8X---------------------------
Section uncurry.
Variable e t:Type.
Variable is:(e->t)->(e->t).
Definition IS (arg: (e*(e -> t))): t := let (x,f) := arg in is f x.
Lemma is_is_IS: forall x f, is f x = IS (x,f).
Proof.
reflexivity.
Qed.
(* After that in proofs you can always use tactic "rewrite is_is_IS"
to replace (is a b) by IS (b,a) and (or "rewrite <- is_is_IS" for the
reverse).
Example: *)
Variable P: t -> Prop.
Lemma foo: forall x f, P (is x f).
Proof.
intros x f.
rewrite is_is_IS.
...
End uncurry.
---------------------------8X---------------------------
Le jeu. 23 août 2018 à 22:18, Alex Meyer
<alex153 AT outlook.lv>
a écrit :
>
> Hello!
>
> I have 2 questions that are based on the problem mentioned in my
> stackexchage question
> https://cs.stackexchange.com/questions/96533/how-to-transform-lambda-function-to-multi-argument-lambda-function-and-how-to-re
> which tries to implement in Coq the formal semantics of the natural
> language.
>
> 1) I have two functions with types is:(e->t)->(e->t) and IS:e->(e->t)->t
> and I wanted to know how can I rewrite lambda terms that uses 'is' into
> lambda terms, that uses 'IS'. The first reply to my stackexchange question
> gave answer that it is just re-currying. But I have great doubts that
> simple recurrying can change the type of functions in so important manner
> how it is required if one goes from 'is' to 'IS'. So - the question is - do
> I need there full higher-order rewrite of just currying is sufficient?
>
> 2) And the second question is - does Coq have some facilities to do such
> term rewrite as was mentioned in my first questions? As far as I know Coq,
> then Coq just compiles and confirms the proofs (terms) that were written by
> users, no code generation happens, at least in CoqIDE. But maybe there are
> some tools for higher-order term rewrite in Coq? Of course, the example
> (e.g. involving 'is' and 'IS') would be helpful.
>
> Alex
- [Coq-Club] Does Coq support higher-order rewrite of lambda terms?, Alex Meyer, 08/23/2018
- Re: [Coq-Club] Does Coq support higher-order rewrite of lambda terms?, Pierre Courtieu, 08/27/2018
Archive powered by MHonArc 2.6.18.