classical realizability in the cps target language
play

Classical realizability in the CPS target language Jonas Frey - PowerPoint PPT Presentation

Classical realizability in the CPS target language Jonas Frey Piriapolis, 20 July 2016 article: https://sites.google.com/site/jonasfreysite/mfps.pdf 1 / 24 Negative and CPS translation Glivenko (1929): A classically provable iff A


  1. Classical realizability in the CPS target language Jonas Frey Piriapolis, 20 July 2016 article: https://sites.google.com/site/jonasfreysite/mfps.pdf 1 / 24

  2. Negative and CPS translation • Glivenko (1929): A classically provable iff ¬¬ A intuitionistically provable (CBV, works for all connectives except ∀ • Plotkin (1975) uses continuation passing style (CPS) translations to simulate different evaluation strategies (CBN, CBV) within another • Felleisen et al. (1980ies) relate CPS translations and control operatos (like call/cc) on abstract machines • Griffin (1989) recognizes correspondence between CPS and negative translations via CH • in particular, the natural type of call/cc is Peirce’s law (PL) (( A ⇒ B ) ⇒ A ) ⇒ A • since PL axiomatizes classical logic, we get an extension of CH to classical logic – the foundation of Krivine’s realizability interpretation 2 / 24

  3. Classical 2nd order logic with proof terms • same language as int. 2nd order logic • proof system extended by one rule for PL Γ , a : A , ∆ ⊢ a : A Γ ⊢ c c : (( A ⇒ B ) ⇒ A ) ⇒ A Γ , a : A ⊢ t : B Γ ⊢ t : A ⇒ B Γ ⊢ u : A Γ ⊢ tu : B Γ ⊢ λ a . t : A ⇒ B Γ ⊢ t : A Γ ⊢ t : ∀ x . A Γ ⊢ t : ∀ x . A Γ ⊢ t : A [ τ/ x ] Γ ⊢ t : ∀ X n . A Γ ⊢ t : A Γ ⊢ t : ∀ X n . A Γ ⊢ t : A [ B [ � x ] / X ( � t /� t )] • realizability model based on operational model for λ -calculus + call/cc : the Krivine machine (KAM) 3 / 24

  4. The Krivine Machine Syntax: Terms: t ::= x | λ x . t | tt | c c | k π | . . . (non-logical instructions) Stacks: π ::= ε | t · π ( t closed ) Processes: p ::= t ⋆ π ( t closed ) reduction relation on processes: (push) tu ⋆ π ≻ t ⋆ u · π (pop) ( λ x . t [ x ]) ⋆ u · π ≻ t [ u ] ⋆ π (save) c c ⋆ t · π ≻ t ⋆ k π · π (restore) k π ⋆ t · ρ ≻ t ⋆ π • non-logical instructions necessary for non-trivial realizability models • Λ set of closed terms • Π set of stacks • Λ ⋆ Π set of processes • PL ⊆ Λ set of quasiproofs , i.e. terms w/o non-logical instructions 4 / 24

  5. Classical realizability • pole : set ‚ ⊆ Λ ⋆ Π of processes closed under inverse reduction • truth values are sets S , T ⊆ Π of stacks • realizability relation between closed terms and truth values t � S iff ∀ π ∈ S . t ⋆ π ∈ ‚ • predicates are functions ϕ, ψ : N k → P (Π) (more generally J → P (Π) ) • interpretation � A � ρ ∈ Σ of formulas defined relative to valuations (assigning individuals to 1st order vars and predicates to relation vars) � X ( � = ρ ( X )( � � t ) � ρ t � ρ ) � A ⇒ B � ρ = { t · π | t � � A � ρ , π ∈ � B � ρ } � ∀ x . A � ρ = � k ∈ N � A � ρ ( x �→ k ) � ∀ X n . A � ρ = � ϕ : N n → Σ � A � ρ ( X n �→ ϕ ) Theorem (Adequation) x : � u � � � If � A ⊢ t : B is derivable and � A � ρ then t [ � u /� x ] � � B � ρ . In particular, if B is closed and ⊢ t : B then t � � B � . 5 / 24

  6. Consistency • two ways of degeneracy • model arising from ‚ = ∅ equivalent to standard model • ‚ = Λ ⋆ Π inconsistent (all formulas realized) • more generally we have Lemma ‚ gives rise to a consistent model iff every process t ⋆ π ∈ ‚ contains a non-logical instruction. 6 / 24

  7. The termination pole • one non-logical instruction end denoting termination t ::= x | λ x . t | t t | c c | k π | end Terms: Stacks: π ::= ε | t · π t closed Processes: p ::= t ⋆ π t closed ∃ ρ . t ⋆ π ≻ ∗ end ⋆ ρ • notation: p ↓ ⇔ (‘ p terminates’) • termination pole: T = { p ∈ Λ ⋆ Π | p ↓} set of terminating processes • for f : N → { 0 , 1 } , consider the formula Φ ≡ ∀ x . Int ( x ) ⇒ f ( x ) � = 0 ⇒ f ( x ) � = 1 ⇒ ⊥ . • Φ equivalent to ∀ x . Int ( x ) ⇒ x = 0 ∨ x = 1, holds in standard model Theorem In the model arising from T , Φ is realized iff it f is computable. 7 / 24

  8. The PTIME pole • To define a pole of ‘PTIME processes’, we augment the syntax with a special variable α : Terms: t ::= x | λ x . t | t t | c c | k π | end | α Stacks: π ::= ε | t · π t closed Processes: p ::= t ⋆ π t closed • α never bound, ‘closed’ means ‘no free vars except α ’ • PL = { t ∈ Λ | end �∈ t } ( α may appear in proof-like terms) • PTIME pole given by P = { p | ∃ P ∈ N [ X ] ∀ σ ∈ { 0 , 1 } ∗ . p [ σ/α ] ↓ ≤ P ( | σ | ) } 8 / 24

  9. Classical realizability in the CPS target language 9 / 24

  10. Motivation • use explicit negative translation instead of c c • negative tranlsation doesn’t need full int. logic as target language • disjunction & minimal negation (w/o ex falso) sufficient • CPS target language is a term calculus for a system based on n -ary negated multi-disjunction like ¬ ( A 1 ∨ · · · ∨ A n ) but with labels and written � � ℓ 1 ( A 1 ) , . . . , ℓ n ( A n ) 10 / 24

  11. The CPS target language L countable set of labels, ℓ 1 , . . . , ℓ n , ℓ ∈ L . Expressions: Terms: s , t , u ::= x | � ℓ 1 ( x . p 1 ) , . . . , ℓ n ( x . p n ) � Programs: p , q ::= t ℓ u | . . . (non-logical instructions) Reduction of programs: � . . . , ℓ ( x . p ) , . . . � ℓ t ≻ p [ t / x ] 11 / 24

  12. 2nd order CPS target logic language consists of • individual variables x , y , z , . . . • n -ary relation variables X n , Y n , Z n , . . . for each n ≥ 0 • arithmetic constants and operations 0 , S , . . . t ) | ∃ x . A | ∃ X n . A | • formulas: A ::= X n ( � � ℓ 1 ( A 1 ) , . . . , ℓ n ( A n ) � n ≥ 0 proof system with proof terms: � � (App) Γ ⊢ t : . . . , ℓ ( B ) , . . . Γ ⊢ u : B (Var) Γ ⊢ x i : A i Γ ⊢ t ℓ u Γ , y : B 1 ⊢ p 1 · · · Γ , y : B m ⊢ p m (Abs) � � Γ ⊢ � ℓ 1 ( y . p 1 ) , . . . , ℓ m ( y . p m ) � : ℓ 1 ( B 1 ) , . . . , ℓ m ( B m ) Γ ⊢ t : A [ u / x ] Γ ⊢ t : ∃ x . A Γ , x : A ⊢ p [ x ] ( ∃ -I) ( ∃ -E) Γ ⊢ t : ∃ x . A Γ ⊢ p [ t ] Γ ⊢ t : ∃ X n . A Γ ⊢ t : A [ B [ � u /� x ] / X ( � u )] Γ , x : A ⊢ p [ x ] ( ∃ -I) ( ∃ -E) Γ ⊢ t : ∃ X n . A Γ ⊢ p [ t ] 12 / 24

  13. Admissible rules & subject reduction Admissible rules: Γ ⊢ s : A Γ , x : A ⊢ p Γ ⊢ s : A Γ , x : A ⊢ t : B (Cut) Γ ⊢ p [ s / x ] Γ ⊢ t [ s / x ] : B Γ ⊢ p Γ ⊢ t : B (Sym) σ (Γ) ⊢ t : B σ (Γ) ⊢ p Γ ⊢ p Γ ⊢ t : B (Weak) Γ , x : A ⊢ t : B Γ , x : A ⊢ p Γ , x : A , y : A ⊢ p Γ , x : A , y : A ⊢ t : B (Contr) Γ , x : A ⊢ p [ x / y ] Γ , x : A ⊢ t [ x / y ] : B Lemma (Subject reduction) If Γ ⊢ � . . . , ℓ ( x . p ) , . . . � ℓ t is derivable, then so is Γ ⊢ p [ t / x ] . 13 / 24

  14. Simplified notation suppressing labels • Assume L = N • Write ¬ ( A 0 , . . . , A n − 1 ) and � x 1 . p 0 , . . . , x 1 . p n − 1 � for record types and terms indexed by { 0 , . . . , n − 1 } • if indexing set is not an initial segment of N , write − for undefined entries 14 / 24

  15. CBV translation of classical 2nd order logic into 2nd order target language I give translation for types only, terms left as an exercise. • ( A ⇒ B ) ⊤ = ¬¬ ( ¬ A ⊤ , B ⊤ ) • ( ∀ x . A ) ⊤ = ¬∃ x . ¬ A ⊤ • ( ∀ X n . A ) ⊤ = ¬∃ X n . ¬ A ⊤ Theorem n ⊢ ¬¬ B ⊤ provable in target A 1 , . . . , A n ⊢ A classically provable iff A ⊤ 1 , . . . , A ⊤ language. 15 / 24

  16. Realizability in the CPS target language • T set of closed terms, T 0 set of pure closed terms (prooflike terms) • P set of closed programs • pole : ‚ ⊆ P closed under inverse ≻ • truth values : S , T ⊆ T • interpretation � A � ρ ⊆ T of formulas defined relative to valuations � X ( � = ρ ( X )( � � t ) � ρ t � ρ ) � � � ℓ 1 ( A 1 ) , . . . , ℓ n ( A n ) � ρ = { t ∈ T | ∀ i ∈ { 1 , . . . , n } ∀ s ∈ � A i � ρ . t ℓ i s ∈ ‚ } � ∃ x . A � ρ = � k ∈ N � A � ρ ( x �→ k ) � ∃ X n . A � ρ = � ϕ : N n → Σ � A � ρ ( X n �→ ϕ ) Adequation/Soundness x : � A ⊢ s : B and � t ∈ � � A � ρ then s [ � • If � t /� x ] ∈ � B � ρ x : � A ⊢ p and � t ∈ � � A � ρ then p [ � • If � t /� x ] ∈ ‚ Combined with negative translation x : � A ⊢ s : B is classically provable and � t ∈ � � A ⊤ � ρ then s ⊤ [ � If � t /� x ] ∈ � ¬¬ B ⊤ � ρ . 16 / 24

  17. Ordering on predicates • ‚ fixed pole • generalize predicates to arbitrary carrier sets: a predicate on J ∈ Set is a function ϕ : J → P ( T ) • predicates on J can be ordered ϕ ≤ ψ iff ∃ t [ a , b ] ∈ T 0 [ a , b ] ∀ j ∈ J ∀ u ∈ ϕ ( j ) ∀ v ∈ ¬ ψ ( i ) . t [ u , v ] ∈ ‚ • intuitively : the judgment ϕ ( j ) , ¬ ψ ( j ) ⊢ is realized 17 / 24

Recommend


More recommend