Presentation is loading. Please wait.

Presentation is loading. Please wait.

Continuations, Backtracking and Limits: a notion of ‘‘Construction’’ for Classical Logic (Ongoing work) Kyoto, November 2004 Stefano Berardi, Semantic.

Similar presentations


Presentation on theme: "Continuations, Backtracking and Limits: a notion of ‘‘Construction’’ for Classical Logic (Ongoing work) Kyoto, November 2004 Stefano Berardi, Semantic."— Presentation transcript:

1 Continuations, Backtracking and Limits: a notion of ‘‘Construction’’ for Classical Logic (Ongoing work) Kyoto, November 2004 Stefano Berardi, Semantic of Computation group C.S. Dept., Turin University, http://www.di.unito.it/~stefanohttp://www.di.unito.it/~stefano

2 Abstract of the talk We describe Classical Principles in term of ‘‘constructions’’, of a general kind, learning a value by trial-and-error, rather than computing it exactly. This notion of ‘‘construction’’ may be described in term of continuations and backtracking, or by Coquand’s game interpretation, or by Hayashi’s Limit Interpretation. 2

3 § 1. Heyting’s notion of construction Heyting defined a notion of ‘‘construction’’ for a formula F. For Heyting, a construction of F is something computing all informations about F we expect from a proof of F. We will now introduce Heyting’s notion of construction in some details. Later, we will consider a generalization of it: Limit Realizability.

4 An inductive definition of a construction for a formula F If F = P(t 1, …, t n ), with P decidable predicate, then a construction of F is anything, provided F is true. If F = F 1  F 2, then a construction r of F is any pair, with i  {1,2}, and s construction of F i. If F = F 1  F 2, then a construction r of F is any pair, with r 1 construction of F 1, and r 2 construction of F 2.

5 An inductive definition of a construction for a formula F If F =  x  I.G(x), then a construction r of F is any computable map f :I  {constructions of G(x), for some x  I} such that, for all x  I, f(x) is a construction of G(x). If F =  x.G(x), a construction r of F is a pair, with i  I, and s construction of G(i).

6 An inductive definition of a construction for a formula F If F = F 1  F 2, then a construction r of F is any computable map f :{constructions of F 1 }  {constructions of F 2 } If F =  G, a construction of F is anything, provided there is no construction of G.

7  0 n - and  0 2 -formulas  0 n -formulas are all formulas A(x 1, x 2, …) =  x 1  N.  x 2  N. …. P(x 1, x 2, …) with n alternating quantifiers, starting with , and with P decidable.  0 n -formulas are all formulas B(x 1, x 2, …) =  x1  N.  x2  N. …. P(x 1, x 2, …) with n alternating quantifiers, starting with , and with P decidable.

8 Constructions as programs By unfolding definitions, a construction r for a closed  0 2 -formula B =  x  N.  y  N. P(x,y) provides some map f, satisfying P(x,f(x)) for all x  N. If we think of B as a specification, a construction for B provides some program f satisfying the specification B.

9 Intuitionistic and Classical Proofs EM (Excluded Middle) is the axiom schema  x  N. A(x)   A(x) n-EM is the axiom schema EM restricted to  0 n - formulas. Intuitionistic proofs are all proofs not using Excluded Middle (in any equivalent form). Classical proofs are proofs possibly using Excluded Middle (in some form).

10 Intuitionistic Proofs are constructions We may interpret any intuitionistic proof of F as defining some construction of F, and therefore a program if F is  0 2 -formula. Programs extracted from proofs in this way are usually very naive, but they are a starting point in order to design real programs. Constructive interpretation of Heyting is a bridge between Mathematical proofs and applications.

11 Classical Proofs are not Heyting’s constructions There is no construction for Excluded Middle. Let A(x) =  y  N.P(x,y) be any  0 1 -formula. By unfolding definition, there is some construction for the formula:  x  N. A(x)   A(x) if and only if there is some computable characteristic map in N for A(x) (i.e.: some f:N  N such that f(x)=0 if and only if A(x) is true). But for some P, there is no computable characteristic map in N of A(x).

12 Preliminary Conclusion Most Mathematical proofs are Classical. By what we said, apparently, such proofs define no program. Therefore they have no applicative interest. This preliminary conclusion, however, is false.

13 Plan of the Talk We will define a relaxed notion of construction, obtained from Heyting’s by replacing everywhere “computable” with “limit computable”. With this new notion of construction there is a construction for Excluded Middle. Constructions of closed  0 2 -formulas still correspond to programs. Before introducing limit computability, we give a quick account of what is known about extraction of programs from Classical Proofs.

14 § 2. A constructive content for Classical Logic Call PA (Peano Arithmetic) Arithmetic with quantification over integers, Induction axiom for all formulas, and Excluded Middle. Call HA (Heyting Arithmetic) PA without Excluded Middle. Godel proved  0 2 -conservativity of PA w.r.t. HA: ‘‘If B is a  0 2 -formula and PA proves B, then HA proves B. Besides, there is a computable map turning every proof of B in PA into a proof of the same B in HA’’

15 Classical proofs are programs If we interpret proofs in HA by constructions,  0 2 -conservativity implies that every proof in PA of a  0 2 -formula B =  x  N.  y  N. P(x,y) may be turned into a program f such that P(x,f(x)).  0 2 -conservativity is a bridge between Mathematics and applications. However, this result has also some limitations, as we will see.

16 Some limitations of  0 2 -conservativity result No intuitive explanation is given. How can classical proofs of  0 2 -statements be programs, if they use Excluded Middle, and there is no construction for Excluded Middle? As a consequence, we miss a global understanding of the program we extract from a proof. This means that, if the program is naive, as usually is, we have no way of making it better. Therefore we have no real way of using it.

17 A refinement of  0 2 -conservativity result The first refinement of  0 2 -conservativity is due to Griffin (around 1980). Griffin defined a programming language in which classical proofs could both be written and executed: lambda calculus with Continuations. Griffin’s programming language was simplified by Parigot (  –calculus), and by Berardi (symmetric – calculus). Eventually Curien and Herbelin merged the last two calculus, defining symmetric  –calculus (possibly the best so far).

18 Continuations and Classical Logic There is a common idea underlying Griffin’s calculus and those who came later: to interpret Excluded Middle by means of Continuations. Let  be any computation. The continuations of  are some set of computation states M 1, …, M n, stored in the memory of . At any moment,  can store the current state E (or part of it) in the set of continuations.

19 Backtracking At any moment, the computation  can either: 1.move from the current state E to the next state E’ (an ordinary step) 2.move to some state M 1, …, M n in the set of continuation (an exceptional step). If M i is some previous state of the computation, we call this second choice backtracking.

20 Continuations and simply typed lambda –calculus We may add continuations to simply typed lambda – calculus by adding a constant C of type (  F  F), together with the rewrite rule ( C ) E[ C (M)] : False  M( x.E[x]) : False The axiom schema (  F  F) is intuitionistically equivalent to Excluded Middle. This is the connection between C and Classical Logic. The rule ( C ) say that M is a continuation: the computation of E can move to M. A copy of E, in the form x.E[x], is saved as argument of M. E can added by M to the set of continuations of the computation.

21 Advantages of continuations Using continuations, we may describe step-by- step the evaluation of the classical program extracted from a proof. Continuation are a major advance in extracting programs out of classical proofs.

22 Disadvantages of continuations Using continuations, we miss a global and intuitive understanding of the program. This means we cannot rewrite naive programs in order to obtain efficient programs. In fact, we still cannot use them. In the rest of the talk, we will outline a semantical constructive interpretations of classical proofs.

23 § 3. Semantic of Classical Proofs By a Tarski structure M for a language L we mean a set X, equipped with an equivalence relation ~, and, for each relation R and map f of L, some relation R M and some map f M, both compatible with ~. A formula F of L is true in M if it is is true the formula obtained by replacing, in F, the symbol = with ~, and all symbols R, f with R M, f M. A Tarski model of a theory T is a Tarski structure M for the language of T, such that all theorems of T are true in M.

24 Interpretation of a theory inside another one A model of a theory T is the usual way of explaining the mathematica concepts of T. An interpretation of a theory T inside a theory U defines some model M of T using predicates and maps of U, and proving in U that all theorem of T are true in the model. An interpretation of a theory T inside a theory U is the usual way of explaining the mathematical concepts of T in term of the mathematical concepts of U.

25 An example of interpretation We may interpre the theory H of Hyperbolic Plane inside the theory E of the Euclidian plane. The set of elements of H is some set of points of the Euclidean Plane. The equivalence relation is equality on the Euclidean Plane. Any geometrical operation or relation of H is defined through some geometrical operation or relation of the Euclidian Plane.

26  0 2 -sound models of PA A model M of PA is  0 2 -sound if all closed  0 2 - formula B =  x  N.  y  N. P(x,y) true in M are true in the usual sense: for all n  N there is some m  N such that P(n,m) If M, B are as above, then any intuitionistic proof that B is true in M provides some program f such that P(x,f(x)) for all x  N.

27 Interpreting PA inside HA We want to define an interpretation of PA inside HA, in order to interpret Excluded Middle as a construction in some structure. This is no easy task. There are several impossibility results we have to turn around (see [1]). We also want to get some intuitive explanation of the programs we extract from classical proofs. Therefore we only consider  0 2 -sound models M of PA.

28 The main result Let PA ,  be the variant of PA whose set of logical connectives is:  i  {1,…n}.A i,  i  {1,…n}.A i,  i  P(i),  i  N.P(i) Theorem. There exists a  0 2 -sound interpretation M of PA ,  in HA. We may interpret every step of every classical proof of PA by some construction in some model M, in such a way that a proof of a closed  0 2 - formula defines a program.

29 The model M of PA in HA M is the set of all iterated “limits” of integers, taken over List(N), the set of lists of integers. Definition of M generalizes Hayashi’s Limit Computable Mathematics [4], in which limits are taken over N, and M is defined in PA itself. Limits over List(N) are intended to give a more accurate descriptions of computations hidden in classical proofs. M is defined in HA in order to show we may completely describe EM in term of limits.

30 Conclusion and Future Work Eventually, we switched to a semantical interpretation of classical proofs, looking for some intuitive understanding of the programs we can extract from them. This is a work in progress. The model we found looks promising, but it should be checked against some relevant examples. We have also to implement the computations in the model in term of backtracking and continuation. We are quite confident this is possible.

31 § 4. Appendix. Intepreting HA +1-EM in HA We sketch the definition of the interpretation of PA in HA in a simple case: when EM is restricted to 1-EM. We define a structure we call N 1 (see [3]) The same construction also produces some model of (n+1)-EM out of any model of n-EM. A model of EM is obtained by defining a succession of models of 0-EM, 1-EM, 2-EM, …, then taking the direct limit of them.

32 A notion of Computation State Let S = List(N) be the set of all finite lists of integers, ordered by prefix. We call the elements of s computation states. Intuitively, s is a list of (codes of) pairs, …, of some integer n i and some  0 1 -formulas  x.P i (x). 1.If P=P i and P i (n i ) is false, we know that  x.P(x) is false. 2.Otherwise we assume that  x.P(x) is true.

33 Dynamic Integers We call any L:S  N a “dynamic integer”. Intuitively, L(s) is an hypothesis about a value, depending on the hypothesis about  0 1 -formulas associated to the state s =, …, If some hypothesis change, then L(s) can change. L(s) will be a convergent limit if “in any correct computation of L, eventually L(s) stops changing”

34 A notion of Agent Let P fin (N) be the set of all finite subsets of N. We call any F:S  P fin (N) an agent of the computation. Intuitively, F(s) is a set of elements of the same kind of those which are in the state s: F(s) = {, …, } The agent F requires to add the set F(s) above to the state s of the computation.

35 A notion of Computation Let  be any recursive weakly increasing successions s 0  s 1  s 2  … in S We say that  is a computation of an agent F, or  :F for short, if, eventually, any element a of F(s i ) either drops out of F(s i ), or it is added to s i. Formally:  :F if, for all a,n  N, there is some m  n such that either a  F(s m ), or a  s m. Remark that this definition describes a notion of parallel asyncronous computation.

36 Convergence and Equivalence of Dynamic Integers Let F:S  P fin (N) be an agent, L, M:S  N be dynamic integers. Abbreviate (L is convergent), (L, M are equivalent), with L , (L~M). Then we define: 1.F is a construction of L , or F:L  for short, if for all computations s 0  s 1  s 2  … of F, there is some n  N such that L(s n )=L(s n+1 ). 2.F is a construction of (L~M), or F:L~M for short, if for all computations s 0  s 1  s 2  … of F, there is some n  N such that L(s n ) = M(s n ).

37 The Tarski structure N 1 Let F:S  P fin (N), and L, M:S  N. For any n  N, define nº:S  N by nº(s) = n for all s  S. 1.L  if F:L  for some F 2.(L~M) if F: (L~M) for some F 3. N 1 is the set of all convergent dynamic integers, with equivalence relation ~. Maps of N 1 are all computable maps f: N 1  N 1 such that f(L)(s) = f(L(s)º)(s) for all s  S.

38 A construction for 1-EM in N 1 A characteristic map in N 1 for a  0 1 -formula  y  N.P(x,y) is any map f of N 1 such that, for all x  N 1, f(x) ~ Trueº if and only if Pº(x,y) is true for some y  N 1. Maps of N 1 are computable, yet they include characteristic maps for all  0 1 -formulas, and therefore some construction for 1-EM. Characteristic maps in N of  0 1 -formulas, usually, are not computable. This is no contradiction. Characteristic maps in N 1 are such only up to ~.

39 Bibliography [1] S. Berardi, “Intuitionistic Completeness for First Order Classical Logic, J.S.L., vol 63, Number 1, March 1999. [2] S. Berardi, Classical Logic as Limit Completion, MSCS, 15, 2004 (to appear). [3] S. Berardi, A Model for  0 2 -maps within Intuitionistic Arithmetic, Techical Report, Turin University, 2004.

40 Bibliography [4] S. Hayashi and M. Nakata, “Towards Limit Computable Mathematics”, Types for Proofs and Programs, Springer LNCS, 125--144, 2001. [5] Y. Akama, S. Berardi, S. Hayashi, U. Kohlenbach, “An Arithmetical Hierarchy of the Law of Excluded Middle and Related Principles”, pp. 192-201, 19th IEEE Symposium on Logic in Computer Science (LICS 2004), 14-17 July 2004, Turku, Finland, Proceedings.


Download ppt "Continuations, Backtracking and Limits: a notion of ‘‘Construction’’ for Classical Logic (Ongoing work) Kyoto, November 2004 Stefano Berardi, Semantic."

Similar presentations


Ads by Google