Kleene realizability and negative translations

Similar documents
An introduction to classical realizability

Constructing classical realizability models of Zermelo-Fraenkel set theory

Classical realizability and arithmetical formulæ

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg

Concrete Models for Classical Realizability

hal , version 1-21 Oct 2009

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

On Forcing and Classical Realizability. Lionel Rieg

185.A09 Advanced Mathematical Logic

CHAPTER 11. Introduction to Intuitionistic Logic

Informal Statement Calculus

On the Complexity of the Reflected Logic of Proofs

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012

A call-by-name lambda-calculus machine

Notation for Logical Operators:

cse371/mat371 LOGIC Professor Anita Wasilewska Fall 2018

From pre-models to models

AN ALTERNATIVE NATURAL DEDUCTION FOR THE INTUITIONISTIC PROPOSITIONAL LOGIC

Notes for the Proof Theory Course

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge

Krivine s Intuitionistic Proof of Classical Completeness (for countable languages)

A simple proof that super-consistency implies cut elimination

Inducing syntactic cut-elimination for indexed nested sequents

Positive provability logic

TR : Tableaux for the Logic of Proofs

Gödel s Incompleteness Theorems

The Curry-Howard Isomorphism

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

An analysis of the constructive content of Henkin s proof of Gödel s completeness theorem DRAFT

Consequence Relations and Natural Deduction

Light Dialectica program extraction from a classical Fibonacci proof

The Calculus of Inductive Constructions

Nonclassical logics (Nichtklassische Logiken)

Constructive Forcing, CPS translations and Witness Extraction in Interactive Realizability

Forcing-based cut-elimination for Gentzen-style intuitionistic sequent calculus

Beyond First-Order Logic

TYPED REALIZABILITY FOR FIRST-ORDER CLASSICAL ANALYSIS

Fast Growing Functions and Arithmetical Independence Results

Propositional and Predicate Logic. jean/gbooks/logic.html

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Consequence Relations and Natural Deduction

1. Propositional Calculus

Realizing the axiom of dependent choice

Type Systems Winter Semester 2006

Marie Duží

On a computational interpretation of sequent calculus for modal logic S4

Structuring Logic with Sequent Calculus

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem

Categories, Proofs and Programs

MONADIC FRAGMENTS OF INTUITIONISTIC CONTROL LOGIC

Intersection Synchronous Logic

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Display calculi in non-classical logics

Subtyping and Intersection Types Revisited

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Propositional Logic Language

Proper multi-type display calculi for classical and intuitionistic inquisitive logic

Uniform Schemata for Proof Rules

Non-Idempotent Typing Operators, beyond the λ-calculus

Classical Propositional Logic

On Modal Logics of Partial Recursive Functions

Logic: The Big Picture

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

KRIPKE S THEORY OF TRUTH 1. INTRODUCTION

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification

On sequent calculi vs natural deductions in logic and computer science

First Order Logic: Syntax and Semantics

CS Lecture 19: Logic To Truth through Proof. Prof. Clarkson Fall Today s music: Theme from Sherlock

TR : Binding Modalities

Chapter 11: Automated Proof Systems (1)

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Chapter 11: Automated Proof Systems

The Peirce Translation and the Double Negation Shift

Subtractive Logic. To appear in Theoretical Computer Science. Tristan Crolard May 3, 1999

Introduction to dependent type theory. CIRM, May 30

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Evaluation Driven Proof-Search in Natural Deduction Calculi for Intuitionistic Propositional Logic

MAI0203 Lecture 7: Inference and Predicate Calculus

Chapter 3: Propositional Calculus: Deductive Systems. September 19, 2008

On the Correctness of the Krivine Machine

Applied Logic for Computer Scientists. Answers to Some Exercises

Propositional Logic: Syntax

An Introduction to Modal Logic III

Learning Goals of CS245 Logic and Computation

Gödel s Completeness Theorem

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Teaching Natural Deduction as a Subversive Activity

From Constructibility and Absoluteness to Computability and Domain Independence

On Urquhart s C Logic

Completeness Theorems and λ-calculus

Logic. Propositional Logic: Syntax

Existence and Consistency in Bounded Arithmetic

Propositional Logic Arguments (5A) Young W. Lim 11/8/16

5. Peano arithmetic and Gödel s incompleteness theorem

6- Normalization of classical call-by-need

Logic Michælmas 2003

From Operational Semantics to Abstract Machines

Transcription:

Q E I U G I C Kleene realizability and negative translations Alexandre Miquel O P. D E. L Ō A U D E L A R April 21th, IMERL

Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher negative translation

Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher negative translation

The language of realizers (recall) Terms of PCF Terms t, u ::= x λx. t tu pair fst snd 0 S rec (= λ-calculus + primitive pairs & integers) Syntactic worship: Free & bound variables. Renaming. Work up to α-conversion. Set of free variables: FV (t). Capture-avoiding substitution: t{x := u} Notations: t 1, t 2 := pair t 1 t 2, n := S n 0 (n N) Reduction rules (λx. t) u t{x := u} fst t 1, t 2 t 1 rec t 0 t 1 0 t 0 snd t 1, t 2 t 2 rec t 0 t 1 (S u) t 1 u (rec t 0 t 1 u) Grand reduction written t u (reflexive, transitive, context-closed)

Definition of the relation t A (recall) Recall: For each closed FO-term e, we write e N its denotation in N Definition of the realizability relation t A (t, A closed) t e 1 = e 2 e1 N = e2 N t 0 t t t 0 t A B u (u A tu B) t A B t 1 t 2 (t t 1, t 2 t 1 A t 2 B) t A B u ((t 0, u u A) (t 1, u u B)) t x A(x) n (t n A(n)) t x A(x) n u (t n, u u A(n)) Lemma (closure under anti-evaluation) If t t and t A, then t A

The main Theorem (recall) Lemma (Adequacy) Let d : (A 1,..., A n B) be a derivation in NJ. Then: for all valuations ρ, for all realizers t 1 A 1 [ρ],..., t n A n [ρ], we have: d [ρ]{z 1 := t 1,..., z n := t n } B[ρ] Lemma All axioms of HA are realized Theorem (Soundness) If HA A, then t A for some closed PCF-term t

Harrop formulas (1/2) The class of Harrop formulas Harrop formulas H ::= e 1 = e 2 H 1 H 2 A H x H Intuition: Harrop formulas do not contain the two problematic constructions and, except on the left-hand side of implications Therefore, Harrop formulas are classical: Proposition For each Harrop formula H( x): HA x (H( x) H( x)) Proof. By structural induction on H( x).

Harrop formulas (2/2) To each (possibly open) Harrop formula H, we associate a closed PCF-term t H that is computationally trivial: τ H := 0 (H atomic) τ A H = λ. τ H τ H1 H 2 = τ H1, τ H2 τ x H = λ. τ H Theorem For all closed Harrop formulas H: If H is realized, then τ H H Moreover, all realizers of H are computationally equivalent to τ H Intuition: Harrop formulas have computationally irrelevant realizers, that can be replaced by the trivial realizers τ H Useful for optimizing extracted programs (e.g. Fermat s last theorem) But shows that Harrop formulas are computationally irrelevant

Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher negative translation

How to cope with classical logic? Kleene realizability is definitely incompatible with classical logic: x (Halt(x) Halt(x)) any term x (Halt(x) Halt(x)) (The same holds for all variants of Kleene realizability) Two possible solutions: 1 Compose Kleene realizability with a negative translation from classical logic (LK) to intuitionistic logic (LJ) (next slide) 2 Reformulate the principles of realizability to make them compatible with classical logic: Krivine classical realizability (next talk)

The Gödel-Gentzen negative translation Idea: Turn positive constructions (atomic formulas,, ) into negative constructions (,,,, ) using De Morgan laws Every formula A is translated into a formula A G defined by: G := G := (A B) G := A G B G (e 1 = e 2 ) G := (e 1 = e 2 ) (A B) G := A G B G (A B) G := ( A G B G ) ( x A) G := x A G ( x A) G := x A G writing: A := A Theorem (Soundness) 1 LK A G A 2 If PA A, then HA A G

Realizing translated formulas Strategy: 1 Build a derivation d of A (in PA) 2 Turn it into a derivation d G of A G (in HA) 3 Turn d G into a Kleene realizer (program extraction) Does not work! Failure comes from: Proposition (Realizability collapse) For every closed formula A: 1 A G is a Harrop formula (computationally irrelevant) 2 Kleene s semantics for A G mimics Tarski s semantics for A: A G is realized iff τ A G A G iff N = A Proof. By structural induction on A. Conclusion: Kleene Gödel-Gentzen = Tarski

Friedman s R-translation (called A-translation by Friedman) Principle: In Gödel-Gentzen translation, replace each occurrence of (absurdity) by a fixed formula R, called the return formula Every formula A is translated into a formula A F defined by: F := F := R (A B) F := A F B F (e 1 = e 2 ) F := R R (e 1 = e 2 ) (A B) F := A F B F (A B) F := R ( R A F R B F ) ( x A) F := x A F ( x A) F := R x R A F writing: R A := A R Theorem (Soundness) If PA A, then HA A F (independently from the formula R) Beware! The formulas A and A F are no more classically equivalent (in general)

Friedman s trick Theorem (Kreisel-Friedman) PA conservatively extends HA over Π 0 2 -formulas: If PA x y f (x, y) = 0, then HA x y f (x, y) = 0 Proof. Assume that PA x y f (x, y) = 0. We have: HA x R y R R R f (x, y) = 0 (by R-translation) HA x R y R f (x, y) = 0 (since R R R R ) HA R y R f (x 0, y) = 0 ( -elim, x 0 fresh) HA y (f (x 0, y) = 0 R) R (def. of R ) We now let: R := y 0 f (x 0, y 0 ) = 0 (Friedman s trick!) From the def. of R: HA y (f (x 0, y) = 0 y 0 f (x 0, y 0 ) = 0) y 0 f (x 0, y 0 ) = 0 But the premise of the above implication is provable HA y (f (x 0, y) = 0 y 0 f (x 0, y 0 ) = 0) ( -intro) hence we get HA y 0 f (x 0, y 0 ) = 0 (modus ponens) HA x 0 y 0 f (x 0, y 0 ) = 0 ( -intro)

Realizing translated formulas, again Strategy: 1 Build a derivation d of a Π 0 2-formula A (in PA) 2 Turn it into a derivation F-trick(d F ) of A (in HA) 3 Turn F-trick(d F ) into a Kleene realizer of A (program extraction) This technique perfectly works in practice. However: The formula A F is not a Harrop formula (in general), even when A is. Possible fix: Introduce specific optimization techniques, e.g.: Refined Program Extraction [Berger et al. 2001] The translation A A F completely changes the structure of the underlying proof. Possible fix: cf next part

Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher negative translation

The Lafont-Reus-Streicher negative translation Idea: Translate each formula A into the (relative) negation of a formula A already representing the negation of A: A LRS := R A A R (A defined by induction on A) (Again, this translation is parameterized by a return formula R) To every predicate symbol p (source language) we associate a predicate symbol p representing its negation (target language) Definition of the translations A A and A A LRS : (p(e 1,..., e k )) := p(e 1,..., e k ) := (A B) := A LRS B ( x A) := x A A LRS := R A A R Theorem (Soundness) 1 When R : LK A A and LK A LRS A 2 If LK A, then LJ A LRS (independently from the formula R)

Computational interpretation Intuition: The translated formula A represents the type of stacks opposing (classical) terms of type A: (A 1 A n B) A LRS 1 A LRS n B (A 1 A n B) A LRS 1 A LRS n B To analyze the computational contents of the LRS-translation, we need to work across to λ-calculi: A source calculus to represent classical proofs: λ source = λ + cc : ((A B) A) A (Peirce s law) (Polymorphic constant cc introduces classical reasoning) An intuitionistic target calculus to represent translated proofs: λ target = λ, (In this calculus, pairs are used to represent stacks)

The source λ-calculus ({,, }-fragment of LK) Syntax Types A, B ::= p(e 1,..., e k ) A B x A Proof-terms t, u ::= z λz. t tu cc Classical logic obtained by introducing an inert constant cc (call/cc) for Peirce s law (taken as an axiom) Constructions,,, encoded using De Morgan laws (= full LK) Typing rules Γ z : A (z:a) Γ Γ, z : A t : B Γ λz. t : A B Γ t : A Γ t : x A x / FV (Γ) Γ Γ cc : ((A B) A) A Γ t : A B Γ u : A Γ tu : B t : x A Γ t : A{x := e} Γ t : Γ t : A Note: is treated uniformly: x A(x) x A(x) (no function argument!)

The target λ-calculus ({,,, }-fragment of LJ) Syntax Types A, B ::= p(e 1,..., e k ) A B A B x A Proof-terms t, u ::= z λz. t tu t, u fst(t) snd(t) + usual reduction rules for proof-terms Typing rules Γ z : A (z:a) Γ Γ, z : A t : B Γ λz. t : A B Γ t : A Γ t : B Γ t, u : A B Γ t : A{x := e} Γ t : x A Γ t : FV (t) dom(γ) Γ t : A B Γ u : A Γ tu : B Γ t : A B Γ fst(t) : A Γ t : ( x A) B Γ t : x (A B) Γ t : A B Γ snd(t) : B x / FV (B) Note: treated uniformly: x A(x) x A(x) (no witness!)

Remark: Uniform vs non-uniform quantifiers (1/2) In the Curry-Howard correspondence (and in realizability), there are two different ways to interpret quantifiers: Quantifier x A(x) x A(x) Uniform (ML/Haskell style) A(x) x D (intersection type) A(x) x D (union type) Non-uniform (Type Theory style) A(x) x D (type of dependent functions) A(x) x D (type of dependent pairs) Remark: Tarski/Kripke/Heyting/Cohen models do not distinguish the two interpretations: difference only appears in realizability

Remark: Uniform vs non-uniform quantifiers (2/2) 1st-, 2nd- and higher-order logic support both interpretations (But uniform interpretation is more concise & natural) The same holds for impredicative set theories: ZF, IZF C, IZF R Arithmetic (PA/HA) only supports the non-uniform interpretation (due to the induction principle) But in all cases, the non-uniform interpretation can be encoded from the uniform interpretation, using a relativization: (non-uniform) x A(x) := (uniform) x (x D A(x) ) }{{} type of functions (non-uniform) x A(x) := (uniform) x (x D A(x) ) }{{} type of pairs This is why we shall prefer the uniform interpretation (in what follows)

The Lafont-Reus-Streicher logical translation The logical translation A A LRS (p(e 1,..., e k )) := p(e 1,..., e k ) := (A B) := A LRS B ( x A) := x A A LRS := R A corresponds to a program transformation on untyped proof terms, called a continuation-passing style (CPS) translation: (z) LRS := λs. z s (λz. t) LRS := λ z, s. t LRS (tu) LRS := λs. t LRS u LRS, s (cc) LRS := λ z, s. z k s, s where k s := λ z,. z s Note: λ z, s. t defined as λz 0. (λzs. t) (fst(z 0 )) (snd(z 0 )) Theorem (Soundness) If Γ t : A (in the source λ-calculus) then Γ LRS t LRS : A LRS (in the target λ-calculus)

Towards the Krivine abstract machine From the computational behavior of translated proof terms t LRS... (λz. t) LRS @ u, s t LRS {z := u} @ s (tu) LRS @ s t LRS @ u LRS, s (cc) LRS @ u, s u @ k s, s k s @ u, s u @ s... we deduce evaluation rules for classical proof terms: Krivine Abstract Machine (KAM) Grab λz. t u π t{z := u} π Push tu π t u π Save cc u π u k π π Restore k π u π u π Reformulating Kleene realizability through the LRS translation (and its CPS), we get Krivine classical realizability (cf next talk)