coq-club AT inria.fr
Subject: The Coq mailing list
List archive
[Coq-Club] call/cc, shift/reset, duplication of evaluation contexts, and computational complexity implications of binder representations
Chronological Thread
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club <coq-club AT inria.fr>, Hugo Herbelin <Hugo.Herbelin AT inria.fr>
- Subject: [Coq-Club] call/cc, shift/reset, duplication of evaluation contexts, and computational complexity implications of binder representations
- Date: Wed, 14 Feb 2024 11:28:42 -0800
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-pl1-f182.google.com
- Ironport-data: A9a23:zUiM6quhEIMOqvb6uEn4tszs4+fnVBNVMUV32f8akzHdYApBsoF/q tZmKT2OOq7ZMGb8c9p3PNu090wC7ZXTnNAyHgtkry8xRS1HgMeUXt7xwmXYb3rDdJWbJK5Ex 5xDMYeYdJhcolv0/ErF3m3J9CEkvU2wbuOgTrSCYEidfCc8IA85kxVvhuUltYBhhNm9Emult Mj7yyHlEAbNNwVcbCRMtcpvlDs15K6u4GlB4gRkDRx2lAa2e0c9XMp3yZ6ZdCOQrrl8RoaSW +vFxbelyWLVlz9F5gSNz94X2mVTKlLjFVDmZkh+A8BOsTAezsAG6ZvXAdJHAathZ5plqPgqo DlFncTYpQ7EpcQgksxFO/VTO3kW0aGrZNYriJVw2CCe5xSuTpfi/xlhJHEzENxE+uUnPU9p0 /czMxULXjON2MvjldpXSsE07igiBMziPYdaonU5iD+AXaxgTpfETKHHo9Rf2V/chOgURaeYN 5dfM2MzKk2QOXWjOX9PYH46tOWhnX75fCdfs0nEjaUy6mnXigd21dABNfKMJ4bSHZgEzxvwS mTu5WXdMlJBNO6mlmC4+Um0m7TUoHL5YddHfFG/3qU32QXMlzJ75ActfVC8uLyyjlO0c8lOL lQdvCsot6k7skKxJvH9UgeyrXqFuDYOWt9aCeR86QeXy6OS7RzxO4QfZjtIadhjrMtvAD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Q6KwUV6eTOiEEQyvRnRz4btisjfbTCwnzJqbGfc8lesOM3UH4tyaQHsDJjmuETtGYdFbR0g HeA9Icw5Qv9w6/UkHw/F0Mfz1QDzJSCuUEoUUnA3r9HX3uMvBcE7GHKTg8Pu8MgENrk/aZZ1 tnIkqv3bjZE6dPdu8UGVYDSL4qcPXwtPACMenacBRYZTTOtKWDUhlBM2PCU+HqPq5Emq5/q0 JMQQ75fXVYxG7sUEENgVNAFJZ52WHsjn9v5xIYQ4mGiqRDKWMhAlpXOV/bXGfG2bTjA3eMCa BwPzrf1a48UM8yz2kBvbEV7gJWfG0fUWoMowGUpZQs1rUNRtXlmGzdrigS1N0X3uSNVTK7uz XtUwkNkbO8g9Snh+QIyL1vO/m4rlVUp3M/iinaXeSLwK6G5WcdXDTD1vg4/KMCeIU49YAusk EhjLDqBSahWiu4qd2lwjwnTo5xUAq90QqhNYRtWzvaSLaZNsxwUumC8yElL6PGQQ4Nljxcve IWwomho3gtiaJstIfWVKvMZlB5fgaWBuiLu3ec0ilx7RQ5F4CaZfygGv1YNP78tKn+z/+Bi3 geFniNKZGkGU/dCShNC80o8P6GYy3ul3ecTcAa+MOuQK67fsG/Fx5bgqrYY2UYBlk0D9r9zg 59Lm6W8WEUmzb/XHBMMZ5OqFA==
- Ironport-sdr: 65cd1479_NhNo6zuCpqb1a7iTBGWt8UVPG6vNY3+n4Lq9C/AAsWp1svV e1btf98agXCG4g8HKHwpZ7lN+rxAlah9tFBRz2w==
Splitting off from the thread on sig_forall_dec, I have a question about call/cc
> The basic interpretation is as an effectful program
> that duplicates its evaluation context, as would be allowed by the
> call-with-current-continuation (callcc) operator, or, to some extent,
> by setjmp/longjmp in C.
The phrase "duplication of evaluation context" suggests that call/cc should let me do something like partial evaluation under binders, but I don't believe it does.
Concretely, suppose I have a function `f : A -> B * C` and I want to turn this into `g : (A -> B) * (A -> C)` such that `forall a, (fst g) a = fst (f a) /\ (snd g) a = snd (g a)`, in such a way that, if I am the author of `f`, I can cause `g` to lift any computation in `f` that does not depend on its binder in such a way that the computation is shared between the two components of `g`. (I am ultimately interested in figuring out if there's a principled way to do this for functions deeply embedded in PHOAS, in linear time complexity, that doesn't involve routing through some first-order representation of binders, where such computation lifting is comparatively trivial.)
Is there any primitive that does this sort of thing? Or any existing literature on the computational complexity of various operations induced by different representations of binders?
Thank you,
Jason
On Wed, Feb 14, 2024, 02:59 Hugo Herbelin <Hugo.Herbelin AT inria.fr> wrote:
Hi,
The Limited Principle of Ominiscience (LPO) is indeed rather standard
in the context of the constructive study of real analysis where it
basically amounts to assuming the decidability of the disequality of
Cauchy reals [1]. The Coquelicot paper that Kile Stemen is mentioning
is, I guess, [2], section 3.2, where other applications are given.
There are computational interpretations of this axiom but not purely
functional ones. The basic interpretation is as an effectful program
that duplicates its evaluation context, as would be allowed by the
call-with-current-continuation (callcc) operator, or, to some extent,
by setjmp/longjmp in C.
So, to vizualise the computation, you have to consider a program p
that uses LPO. For the purpose of a decision that p expects from LPO,
the latter first assumes that (forall n, P n) holds, which is a safe
assumption until p eventually wants to exploit this assumption by
providing some natural number n₀ for which it wants to know (P n₀). At
this time, LPO uses its assumption on the decidability of P to
determine if (P n₀) or ~(P n₀) holds. In the first case, its initial
guess that (forall n, P n) holds is satisfied (for this particular n₀)
and the evaluation of p can go on, until p wants to use the assumption
(forall n, P n) for another n, in which case the process is
repeated. In the second case, LPO changes its mind, which is possible
because it memoized the evaluation context in which it was initially
called. So, it resumes to this former point of the evaluation and now
says that {n | ~P n} holds, taking n₀ as the witness.
Note that alternative computational interpretations of LPO specific to
the form of LPO have been provided, e.g. by Aschieri, Berardi and
Birolo [3].
I can also recommend Phil Wadler's nice story rephrasing in "demonic"
terms the "magic" behind excluded-middle ([4], top of page 7). Since
LPO is the particular instantiation of excluded-middle to
∑⁰₁-formulas, this story applies to LPO too.
In any case, that's a fascinating topic...
Best,
Hugo
[1] https://ncatlab.org/nlab/show/principle+of+omniscience#the_limited_principle_of_omniscience
[2] https://www.lri.fr/~melquion/doc/14-mcs.pdf
[3] https://dmg.tuwien.ac.at/aschieri/RealizabilityforHAEM1-ExceptionsProofs.pdf
[4] https://homepages.inf.ed.ac.uk/wadler/papers/dual/dual.pdf
On Wed, Feb 14, 2024 at 10:15:05AM +0000, mukesh tiwari wrote:
> Thanks Kyle!
>
> Best,
> Mukesh
>
> On Wed, 14 Feb 2024 at 05:12, Kyle Stemen <ncyms8r3x2 AT snkmail.com> wrote:
>
> That's the limited principle of omniscience. The Coquelicot paper explains
> how it's used for classical real analysis.
>
> On Tue, Feb 13, 2024 at 7:02 AM mukesh tiwari
> mukeshtiwari.iiitm-at-gmail.com |coq-club/Example Allow| <
> dsd13c3nm2whb1t AT sneakemail.com> wrote:
>
> Hi everyone,
>
> I was looking into Coq standard library and saw this axioms
> sig_forall_dec [1] by a mere accident. I am trying to understand the
> intuition behind this axiom but my programming intuition simply cannot
> get it. I admit it is a classical axiom but I am finding it very hard
> to wrap my head around it.
>
>
> The way I see *sig_forall_dec* is a function that takes a function P
> --which returns Prop for every natural number-- and a function f
> ((forall n, {P n} + {~P n})) —which takes a natural number return P n
> or ~P n-- and it returns a proof object {n | ~P n} or returns a
> function {forall n, P n}. This whole things, to me, appears like a
> magic because we are turning a function *f* into proof object ({n | ~P
> n}) or a function for which P holds for every natural number ({forall
> n, P n}). I will appreciate if someone can shed a light on the
> intuition behind this magic. I presume it is used in reasoning of real
> numbers so what kind of proofs about real numbers require this axioms?
>
>
>
> Axiom sig_forall_dec
> : forall (P : nat -> Prop),
> (forall n, {P n} + {~P n})
> -> {n | ~P n} + {forall n, P n}.
>
>
> Best,
> Mukesh
>
> [1] https://coq.inria.fr/doc/V8.17.1/stdlib/
> Coq.Reals.ClassicalDedekindReals.html
>
- [Coq-Club] call/cc, shift/reset, duplication of evaluation contexts, and computational complexity implications of binder representations, Jason Gross, 02/14/2024
Archive powered by MHonArc 2.6.19+.