classical realizability and side effects
play

Classical realizability and side-effects Etienne Miquey 1,2 1 - PowerPoint PPT Presentation

Introduction A constructive proof of DC Algebraic models of classical realizability Classical realizability and side-effects Etienne Miquey 1,2 1 Equipe r 2 (INRIA), IRIF, Universit e Paris-Diderot 2 IMERL, Fac. de Ingenier a,


  1. Introduction A constructive proof of DC Algebraic models of classical realizability Theory vs Model What is the status of axioms ( e.g. A ∨ ¬ A )? � neither true nor false in the ambient theory (here, true means provable ) There is another point of view: Theory : provability in an axiomatic representation (syntax) Model : validity in a particular structure (semantic) Example: A ∧ B A ∨ B A ¬ A A ∨ ¬ A B B ✓ ✗ ✓ ✗ A A ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✗ ✓ ✓ ✗ ✗ ✗ ✗ ✓ ✗ Valid formula ´ Etienne Miquey Classical realizability and side-effects 11/ 47

  2. Introduction A constructive proof of DC Algebraic models of classical realizability Teaser #2 Classical realizability: A �→ { t : t � A } (intuition: programs that share a common computational behavior given by A) Great news Classical realizability semantics gives surprisingly new models! In Part III, we will study the algebraic structure of these models. ´ Etienne Miquey Classical realizability and side-effects 12/ 47

  3. Introduction A constructive proof of DC Algebraic models of classical realizability Part II - A constructive proof of dependent choice compatible with classical logic ´ Etienne Miquey Classical realizability and side-effects 13/ 47

  4. Introduction A constructive proof of DC Algebraic models of classical realizability The axiom of choice Chapter 5 Axiom of Choice : ∀ x A . ∃ y B . P ( x , y ) → ∃ f A → B . ∀ x A . P ( x , f ( x )) AC : ´ Etienne Miquey Classical realizability and side-effects 14/ 47

  5. Introduction A constructive proof of DC Algebraic models of classical realizability The axiom of choice Chapter 5 Axiom of Choice : ∀ x A . ∃ y B . P ( x , y ) → ∃ f A → B . ∀ x A . P ( x , f ( x )) AC : : = λ H . ( λ x . wit ( H x ) , λ x . prf ( H x )) Computational content through dependent types: Γ ⊢ p : A [ t / x ] Γ ⊢ t : T Γ , x : T ⊢ t : A ( ∀ I ) ( ∃ I ) Γ ⊢ λ x . t : ∀ x T . A Γ ⊢ ( t , p ) : ∃ x T . A Γ ⊢ p : ∃ x T . A ( x ) Γ ⊢ p : ∃ x T . A ( x ) ( wit ) ( prf ) Γ ⊢ wit p : T Γ ⊢ prf p : A ( wit p ) ´ Etienne Miquey Classical realizability and side-effects 14/ 47

  6. Introduction A constructive proof of DC Algebraic models of classical realizability Incompatibility with classical logic Bad news dependent sum + classical logic = ❆ One can define: H 0 : = call/cc α ( 1 , throw α ( 0 , p )) : ∃ x . P ( x ) and reach a contradiction: P ( 0 ) ���� ( wit H 0 , prf H 0 ) → ( 1 , p ) � ����� �� ����� � ✘✘✘ ∃ x . P ( x ) We need to: � share � restrict dependent types ´ Etienne Miquey Classical realizability and side-effects 15/ 47

  7. Introduction A constructive proof of DC Algebraic models of classical realizability Incompatibility with classical logic Bad news dependent sum + classical logic = ❆ One can define: H 0 : = call/cc α ( 1 , throw α ( 0 , p )) : ∃ x . P ( x ) and reach a contradiction: P ( 0 ) ���� ( wit H 0 , prf H 0 ) → ( 1 , p ) � ����� �� ����� � ✘✘✘ ∃ x . P ( x ) We need to: � share � restrict dependent types ´ Etienne Miquey Classical realizability and side-effects 15/ 47

  8. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a solution ? Restriction to countable choice: AC � : ∀ x � . ∃ y B . P ( x , y ) → ∃ f � → B . ∀ x � . P ( x , f ( x )) Proof: AC : = λ H . ( λ n . if n = 0 then wit ( H 0 ) else λ n . if n = 1 then wit ( H 1 ) else ... , λ n . if n = 0 then prf ( H 0 ) else λ n . if n = 1 then prf ( H 1 ) else ... ) ´ Etienne Miquey Classical realizability and side-effects 16/ 47

  9. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a solution ? Restriction to countable choice: AC � : ∀ x � . ∃ y B . P ( x , y ) → ∃ f � → B . ∀ x � . P ( x , f ( x )) Proof: AC � : = λ H . let H 0 = H 0 in let H 1 = H 1 in ... ( λ n . if n = 0 then wit H 0 else λ n . if n = 1 then wit H 1 else ... , λ n . if n = 0 then prf H 0 else λ n . if n = 1 then prf H 1 else ... ) ´ Etienne Miquey Classical realizability and side-effects 16/ 47

  10. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a solution ? Restriction to countable choice: AC � : ∀ x � . ∃ y B . P ( x , y ) → ∃ f � → B . ∀ x � . P ( x , f ( x )) Proof: AC � : = λ H . let H ∞ = ( H 0 , H 1 ,. . . , H n ,. . . ) in ( λ n . wit ( nth n H ∞ ) , λ n . prf ( nth n H ∞ )) ´ Etienne Miquey Classical realizability and side-effects 16/ 47

  11. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a solution ? Restriction to countable choice: AC � : ∀ x � . ∃ y B . P ( x , y ) → ∃ f � → B . ∀ x � . P ( x , f ( x )) Proof: AC � : = λ H . let H ∞ = cofix 0 bn ( H n , b ( S ( n ))) in ( λ n . wit ( nth n H ∞ ) , λ n . prf ( nth n H ∞ )) ´ Etienne Miquey Classical realizability and side-effects 16/ 47

  12. Introduction A constructive proof of DC Algebraic models of classical realizability dPA ω (Herbelin’s recipe) A proof system: classical : p , q :: = ... | catch α p | throw α p with stratified dependent types : t , u :: = ... | wit p terms: A , B :: = ... | ∀ x T . A | ∃ x T . A | Π a : A . B | t = u formulas: p , q :: = ... | λ x . p | ( t , p ) | λ a . p proofs: a syntactical restriction of dependencies to nef proofs call-by-value and sharing : p , q :: = ... | let a = q in p with inductive and coinductive constructions: p , q :: = ... | ind t bn [ p | p ] | cofix t bn p lazy evaluation for the cofix ´ Etienne Miquey Classical realizability and side-effects 17/ 47

  13. Introduction A constructive proof of DC Algebraic models of classical realizability dPA ω (Herbelin’s recipe) A proof system: classical : p , q :: = ... | catch α p | throw α p with stratified dependent types : t , u :: = ... | wit p terms: A , B :: = ... | ∀ x T . A | ∃ x T . A | Π a : A . B | t = u formulas: p , q :: = ... | λ x . p | ( t , p ) | λ a . p proofs: a syntactical restriction of dependencies to nef proofs call-by-value and sharing : p , q :: = ... | let a = q in p with inductive and coinductive constructions: p , q :: = ... | ind t bn [ p | p ] | cofix t bn p lazy evaluation for the cofix ´ Etienne Miquey Classical realizability and side-effects 17/ 47

  14. Introduction A constructive proof of DC Algebraic models of classical realizability State of the art Subject reduction If Γ ⊢ p : A and p → q , then Γ ⊢ q : A . Normalization If Γ ⊢ p : A then p is normalizable. requires Consistency � dPA ω ⊥ ´ Etienne Miquey Classical realizability and side-effects 18/ 47

  15. Introduction A constructive proof of DC Algebraic models of classical realizability Roadmap dPA ω [Herbelin’12] : + control operators Subject reduction + dependent types + co-fixpoints + sharing & laziness typing/reduction preservation dLPA ω ? + sequent calculus Subject reduction + dependent types + co-fixpoints + sharing & laziness CPS-translation? ?-calculus Normalization ´ Etienne Miquey Classical realizability and side-effects 19/ 47

  16. Introduction A constructive proof of DC Algebraic models of classical realizability Roadmap dPA ω [Herbelin’12] : + control operators Subject reduction + dependent types + co-fixpoints + sharing & laziness typing/reduction preservation dLPA ω ? + sequent calculus Subject reduction + dependent types λ [ lv τ ⋆ ] + co-fixpoints + sharing & laziness CPS-translation? ?-calculus Normalization ´ Etienne Miquey Classical realizability and side-effects 19/ 47

  17. Introduction A constructive proof of DC Algebraic models of classical realizability Roadmap dPA ω [Herbelin’12] : + control operators Subject reduction + dependent types + co-fixpoints + sharing & laziness typing/reduction preservation dLPA ω ? + sequent calculus dL Subject reduction + dependent types + co-fixpoints + sharing & laziness CPS-translation? ?-calculus Normalization ´ Etienne Miquey Classical realizability and side-effects 19/ 47

  18. Introduction A constructive proof of DC Algebraic models of classical realizability Classical call-by-need Chapter 6 The λ [ lv τ ⋆ ] -calculus (Ariola et al. ): a sequent calculus with explicit stores Danvy’s method of semantics artifact: derive a small-step reduction system 1 derive context-free small-step reduction rules 2 derive an (untyped) CPS 3 Qestions: � Does it normalize? � Can the CPS be typed? � Can we define a realizability interpretation? ´ Etienne Miquey Classical realizability and side-effects 20/ 47

  19. Introduction A constructive proof of DC Algebraic models of classical realizability Danvy’s semantics artifacts Syntax: p :: = V | µα . c (Proofs) V :: = v | a (Weak values) v :: = λ a . p (Strong values) e :: = E | ˜ µ a . c (Contexts) E :: = α | F | ˜ µ [ a ] . � a || F � τ (Catchable contexts) F :: = p · E (Forcing contexts) c :: = � p || e � (Commands) l :: = c τ (Closures) τ :: = ϵ | τ [ a : = p ] (Store) Reduction rules: � p || ˜ µ a . c � τ c τ [ a : = p ] (Lazy storage) → � µα . c || E � τ ( c [ E / α ] ) τ → � a || F � τ [ a : = p ] τ ′ µ [ a ] . � a || F � τ ′ � τ � p || ˜ (Lookup) → µ [ a ] . � a || F � τ ′ � τ � V || F � τ [ a : = V ] τ ′ � V || ˜ (Forced eval.) → � λ a . p || q · E � τ � q || ˜ µ a . � p || E �� τ → ´ Etienne Miquey Classical realizability and side-effects 21/ 47

  20. Introduction A constructive proof of DC Algebraic models of classical realizability Danvy’s semantics artifacts Small steps: e � p || ˜ µ a . c � e τ c e τ [ a : = p ] → � p || E � e τ → � p || E � p τ p � µα . c || E � p τ → ( c [ E / α ] ) τ � V || E � p τ � V || E � E τ → µ [ a ] . � a || F � τ ′ � E τ � V || F � V τ [ a : = V ] τ ′ � V || ˜ E → � V || F � E τ → � V || F � V τ � a || F � V τ [ a : = p ] τ ′ µ [ a ] . � a || F � τ ′ � p τ → � p || ˜ V � λ a . p || F � V τ → � λ a . p || F � F τ F � λ a . p || q · E � F τ → � q || ˜ µ a . � p || E �� e τ ´ Etienne Miquey Classical realizability and side-effects 21/ 47

  21. Introduction A constructive proof of DC Algebraic models of classical realizability Danvy’s semantics artifacts CPS : � � p || e � τ � : = [ [ e ] ] e [ [ τ ] ] τ [ [ p ] ] p [ [˜ µ a . c ] ] e : = λτ p . � c � τ [ a : = p ] e [ [ E ] ] e : = λτ p . p τ [ [ E ] ] E [ [ µα . c ] ] p : = λτ E . ( [ [ c ] ] c τ ) [ E / α ] p [ [ V ] ] p : = λτ E . E τ [ [ V ] ] v λτ V . V τ [ a : = V ] τ ′ [ µ [ a ] . � a || F � τ ′ ] [ [˜ ] E : = [ F ] ] F E [ [ F ] ] E : = λτ V . V τ [ [ F ] ] F λτ F . τ ( a ) τ ( λτ V . V τ [ a : = V ] τ ′ [ [ [ a ] ] v : = [ F ] ] F ) V [ [ λ a . p ] ] v : = λτ F . F τ ( λ q τ E . [ [ p ] ] p τ [ a : = q ] E ) [ [ q · E ] ] F : = λτ v . v [ [ q ] ] p τ [ [ E ] ] E F ´ Etienne Miquey Classical realizability and side-effects 21/ 47

  22. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Store extension: τ ⊳ τ ′ Term-in-store ( t | τ ) : closed store τ s.t. FV ( t ) ⊆ dom ( τ ) . ( � generalizes closed terms) Pole : set of closures ⊥ ⊥ which is: saturated : c ′ τ ′ ∈ ⊥ c τ → c ′ τ ′ ⊥ and implies c τ ∈ ⊥ ⊥ closed by store extension : c τ ′ ∈ ⊥ τ ⊳ τ ′ c τ ∈ ⊥ ⊥ and implies ⊥ Compatible stores: τ ⋄ τ ′ ⊥ ( e | τ ′ ) : τ ⋄ τ ′ and � t || e � ττ ′ ∈ ⊥ Orthogonality ( t | τ ) ⊥ ⊥ . Realizers : definitions derived from the small-step rules! ´ Etienne Miquey Classical realizability and side-effects 22/ 47

  23. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Store extension: τ ⊳ τ ′ Term-in-store ( t | τ ) : closed store τ s.t. FV ( t ) ⊆ dom ( τ ) . ( � generalizes closed terms) Pole : set of closures ⊥ ⊥ which is: saturated : c ′ τ ′ ∈ ⊥ c τ → c ′ τ ′ ⊥ and implies c τ ∈ ⊥ ⊥ closed by store extension : c τ ′ ∈ ⊥ τ ⊳ τ ′ c τ ∈ ⊥ ⊥ and implies ⊥ Compatible stores: τ ⋄ τ ′ ⊥ ( e | τ ′ ) : τ ⋄ τ ′ and � t || e � ττ ′ ∈ ⊥ Orthogonality ( t | τ ) ⊥ ⊥ . Realizers : definitions derived from the small-step rules! ´ Etienne Miquey Classical realizability and side-effects 22/ 47

  24. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Adequacy ⊥ , if τ � Γ and Γ ⊢ c c , then c τ ∈ ⊥ For all ⊥ ⊥ . Normalization If ⊢ l c τ then c τ normalizes. Proof: The set ⊥ ⊥ ⇓ = { c τ ∈ C 0 : c τ normalizes } is a pole. (+ Bonus: typed CPS translation unveiling Kripke’s forcing.) ´ Etienne Miquey Classical realizability and side-effects 22/ 47

  25. Introduction A constructive proof of DC Algebraic models of classical realizability A classical sequent calculus with dependent types Chapter 7 Can this work? Π p Π q Π e . . . . . . . . . . . . Γ , a : A ⊢ p : B [ a ] | ∆ Γ ⊢ q : A | ∆ Γ | e : B [ q ] ⊢ ∆ q ∈ V ( → r ) ( → l ) Γ ⊢ λ a . p : Π a : A . B | ∆ Γ | q · e : Π a : A . B ⊢ ∆ ( Cut ) � λ a . p || q · e � : (Γ ⊢ ∆) −→ ´ Etienne Miquey Classical realizability and side-effects 23/ 47

  26. Introduction A constructive proof of DC Algebraic models of classical realizability A classical sequent calculus with dependent types Chapter 7 Can this work? Π p Π q Π e . . . . . . . . . . . . Γ , a : A ⊢ p : B [ a ] | ∆ Γ ⊢ q : A | ∆ Γ | e : B [ q ] ⊢ ∆ q ∈ V ( → r ) ( → l ) Γ ⊢ λ a . p : Π a : A . B | ∆ Γ | q · e : Π a : A . B ⊢ ∆ ( Cut ) � λ a . p || q · e � : (Γ ⊢ ∆) −→ ✚ ✟ Γ , a : A ⊢ p : ✚✚ Γ , a : A | e : ✟✟ B [ a ] | ∆ B [ q ] ⊢ ∆ Π q . Mismatch . � p || e � : (Γ , a : A ⊢ ∆) . . ( ˜ µ ) Γ ⊢ q : A | ∆ Γ | ˜ µ a . � p || e � : A ⊢ ∆ ( Cut ) � q || ˜ µ a . � p || e �� : (Γ ⊢ ∆) ´ Etienne Miquey Classical realizability and side-effects 23/ 47

  27. Introduction A constructive proof of DC Algebraic models of classical realizability A classical sequent calculus with dependent types Chapter 7 Can this work? � Π p Π q Π e . . . . . . . . . . . . Γ , a : A ⊢ p : B [ a ] | ∆ Γ ⊢ q : A | ∆ Γ | e : B [ q ] ⊢ ∆ q ∈ V ( → r ) ( → l ) Γ ⊢ λ a . p : Π a : A . B | ∆ Γ | q · e : Π a : A . B ⊢ ∆ ( Cut ) � λ a . p || q · e � : (Γ ⊢ ∆) −→ Γ , a : A ⊢ p : B [ a ] | ∆ Γ , a : A | e : B [ q ] ⊢ ∆ ; {·| p }{ a | q } Π q . ( Cut ) . � p || e � : Γ , a : A ⊢ ∆ ; { a | q } . . ( ˜ µ ) Γ ⊢ q : A | ∆ Γ | ˜ µ a . � p || e � : A ⊢ ∆ ; { . | q } ( Cut ) � q || ˜ µ a . � p || e �� : (Γ ⊢ ∆) ; {·|·} ´ Etienne Miquey Classical realizability and side-effects 23/ 47

  28. Introduction A constructive proof of DC Algebraic models of classical realizability dL A type system with: a list of dependencies : Γ | e : A ′ ⊢ ∆ ; σ {·| p } A ′ ∈ A σ Γ ⊢ p : A | ∆ ; σ ( Cut ) � p || e � : (Γ ⊢ ∆ ; σ ) a value restriction Is it enough? subject reduction normalization consistency as a logic suitable for CPS translation ´ Etienne Miquey Classical realizability and side-effects 24/ 47

  29. Introduction A constructive proof of DC Algebraic models of classical realizability dL A type system with: a list of dependencies : Γ | e : A ′ ⊢ ∆ ; σ {·| p } A ′ ∈ A σ Γ ⊢ p : A | ∆ ; σ ( Cut ) � p || e � : (Γ ⊢ ∆ ; σ ) a value restriction Is it enough? subject reduction � normalization � consistency as a logic � suitable for CPS translation ✗ ´ Etienne Miquey Classical realizability and side-effects 24/ 47

  30. Introduction A constructive proof of DC Algebraic models of classical realizability dL A type system with: a list of dependencies : Γ | e : A ′ ⊢ ∆ ; σ {·| p } A ′ ∈ A σ Γ ⊢ p : A | ∆ ; σ ( Cut ) � p || e � : (Γ ⊢ ∆ ; σ ) a value restriction Is it enough? subject reduction � normalization � consistency as a logic � suitable for CPS translation ✗ � q � � ˜ µ a . � p || e � � = � q � ( λ a . � p � � e � ) ���� ���� ���� ¬¬ A ¬¬ B ( a ) ¬ B ( q ) ´ Etienne Miquey Classical realizability and side-effects 24/ 47

  31. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (1/2) This is quite normal: we observed a desynchronization we compensated only within the type system � we need to do this already in the calculus! Who’s guilty ? � � q || ˜ µ a . � p || e �� � = � q � ( λ a . � p �� e � ) Moto: � p � shouldn’t be applied to � e � before � q � has reduced ( � q � ( λ a . � p � )) � e � So, we’re looking for: ´ Etienne Miquey Classical realizability and side-effects 25/ 47

  32. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (1/2) This is quite normal: we observed a desynchronization we compensated only within the type system � we need to do this already in the calculus! Who’s guilty ? � � q || ˜ µ a . � p || e �� � = � q � ( λ a . � p �� e � ) Moto: � p � shouldn’t be applied to � e � before � q � has reduced ( � q � ( λ a . � p � )) � e � So, we’re looking for: ´ Etienne Miquey Classical realizability and side-effects 25/ 47

  33. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (1/2) This is quite normal: we observed a desynchronization we compensated only within the type system � we need to do this already in the calculus! Who’s guilty ? � � q || ˜ µ a . � p || e �� � = � q � ( λ a . � p �� e � ) Moto: � p � shouldn’t be applied to � e � before � q � has reduced ( � q � ( λ a . � p � )) � e � So, we’re looking for: ´ Etienne Miquey Classical realizability and side-effects 25/ 47

  34. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (1/2) This is quite normal: we observed a desynchronization we compensated only within the type system � we need to do this already in the calculus! Who’s guilty ? � � q || ˜ µ a . � p || e �� � = � q � ( λ a . � p �� e � ) Moto: � p � shouldn’t be applied to � e � before � q � has reduced ( � q � ( λ a . � p � )) � e � So, we’re looking for: � λ a . p || q · e � → � µ ˆ µ a . � p || ˆ tp . � q || ˜ tp �� || e � ´ Etienne Miquey Classical realizability and side-effects 25/ 47

  35. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (2/2) ? � � λ a . p || q · e � � −→ ( � q � ( λ a . � p � )) � e � Qestions: Is any q compatible with such a reduction ? 1 Is this typable ? 2 ´ Etienne Miquey Classical realizability and side-effects 26/ 47

  36. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (2/2) ? � � λ a . p || q · e � � −→ ( � q � ( λ a . � p � )) � e � Qestions: Is any q compatible with such a reduction ? 1 � � p [ V / a ] �� e � If q eventually gives a value V : ✓ � t � e � If � q � → λ . t and drops its continuation: ✗ ´ Etienne Miquey Classical realizability and side-effects 26/ 47

  37. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (2/2) ? � � λ a . p || q · e � � −→ ( � q � ( λ a . � p � )) � e � Qestions: � q ∈ nef Is any q compatible with such a reduction ? 1 � � p [ V / a ] �� e � If q eventually gives a value V : ✓ � t � e � If � q � → λ . t and drops its continuation: ✗ Negative-elimination free (Herbelin’12) Values + one continuation variable + no application ´ Etienne Miquey Classical realizability and side-effects 26/ 47

  38. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (2/2) ? � � λ a . p || q · e � � −→ ( � q � ( λ a . � p � )) � e � Qestions: � q ∈ nef Is any q compatible with such a reduction ? 1 Is this typable ? 2 Naive atempt: ( � q � ( λ a . � p � )) � e � ���� � � �� � � ���� ( A →⊥ ) →⊥ Π ( a : A ) ¬¬ B ( a ) ¬ B [ q ] ´ Etienne Miquey Classical realizability and side-effects 26/ 47

  39. Introduction A constructive proof of DC Algebraic models of classical realizability Toward a CPS translation (2/2) ? � � λ a . p || q · e � � −→ ( � q � ( λ a . � p � )) � e � Qestions: � q ∈ nef Is any q compatible with such a reduction ? 1 Is this typable ? 2 Beter: ( � q � ( λ a . � p � )) � e � ���� � � �� � � ���� ∀ R . (Π ( a : A ) R ( a )) → R ( q ) Π ( a : A ) ¬¬ B ( a ) ¬ B [ q ] � ������������������������������������� �� ������������������������������������� � ¬¬ B ( q ) ( Remark: not possible without q ∈ nef ) ´ Etienne Miquey Classical realizability and side-effects 26/ 47

  40. Introduction A constructive proof of DC Algebraic models of classical realizability dL ˆ tp An extension of dL with: delimited continuations dependent types restricted to the nef fragment Regular mode Dependent mode Γ | e : A ⊢ d ∆ , ˆ Γ ⊢ p : A | ∆ tp : B ; σ {·| p } Γ ⊢ p : A | ∆ Γ | e : A ⊢ ∆ � p || e � : Γ ⊢ d ∆ , ˆ � p || e � : Γ ⊢ ∆ tp : B ; σ delimited scope of dependencies: c : (Γ ⊢ d ∆ , ˆ tp : A ; {·|·} ) B ∈ A σ ˆ ˆ tp I tp E Γ ⊢ µ ˆ Γ | ˆ tp : A ⊢ d ∆ , ˆ tp . c : A | ∆ tp : B ; σ {·| p } Mission accomplished? subject reduction (Bonus) embedding into Lepigre’s calculus � normalization � realizability consistency as a logic interpretation CPS translation ´ Etienne Miquey Classical realizability and side-effects 27/ 47

  41. Introduction A constructive proof of DC Algebraic models of classical realizability dL ˆ tp An extension of dL with: delimited continuations dependent types restricted to the nef fragment Regular mode Dependent mode Γ | e : A ⊢ d ∆ , ˆ Γ ⊢ p : A | ∆ tp : B ; σ {·| p } Γ ⊢ p : A | ∆ Γ | e : A ⊢ ∆ � p || e � : Γ ⊢ d ∆ , ˆ � p || e � : Γ ⊢ ∆ tp : B ; σ delimited scope of dependencies: c : (Γ ⊢ d ∆ , ˆ tp : A ; {·|·} ) B ∈ A σ ˆ ˆ tp I tp E Γ ⊢ µ ˆ Γ | ˆ tp : A ⊢ d ∆ , ˆ tp . c : A | ∆ tp : B ; σ {·| p } Mission accomplished � subject reduction � (Bonus) embedding into Lepigre’s calculus � normalization � consistency as a logic � � realizability CPS translation � interpretation ´ Etienne Miquey Classical realizability and side-effects 27/ 47

  42. Introduction A constructive proof of DC Algebraic models of classical realizability dLPA ω Chapter 8 A classical sequent calculus with: stratified dependent types : t , u :: = ... | wit p terms: formulas: A , B :: = ... | ∀ x T . A | ∃ x T . A | Π a : A . B | t = u p , q :: = ... | λ x . p | ( t , p ) | λ a . p proofs: a restriction to the nef fragment arithmetical terms: t , u :: = ... | 0 | S ( t ) | rec t xy [ t 0 | t S ] | λ x . t | t u stores : τ :: = ε | τ [ a : = p τ ] | τ [ α : = e ] inductive and coinductive constructions: p , q :: = ... | ind t bn [ p | p ] | cofix t bn p a call-by-value reduction and lazy evaluation of cofix ´ Etienne Miquey Classical realizability and side-effects 28/ 47

  43. Introduction A constructive proof of DC Algebraic models of classical realizability End of the road dPA ω + control operators Subject reduction + dependent types + co-fixpoints + sharing & laziness ? dLPA ω ? + sequent calculus Subject reduction + dependent types + co-fixpoints + sharing & laziness ? ?-calculus Normalization ´ Etienne Miquey Classical realizability and side-effects 29/ 47

  44. Introduction A constructive proof of DC Algebraic models of classical realizability End of the road dPA ω + control operators Subject reduction + dependent types + co-fixpoints + sharing & laziness macros � dLPA ω � + sequent calculus Subject reduction + dependent types + co-fixpoints + sharing & laziness Normalization realizability ´ Etienne Miquey Classical realizability and side-effects 29/ 47

  45. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Same methodology: small-step reductions 1 derive the realizability interpretation 2 Resembles λ [ lv τ ⋆ ] -interpretation, plus: dependent types from Lepigre’s calculus co-inductive formulas ´ Etienne Miquey Classical realizability and side-effects 30/ 47

  46. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Same methodology: small-step reductions 1 derive the realizability interpretation 2 Resembles λ [ lv τ ⋆ ] -interpretation, plus: dependent types from Lepigre’s calculus: � Π a : A . B ∀ a . ( a ∈ A → B ) co-inductive formulas ´ Etienne Miquey Classical realizability and side-effects 30/ 47

  47. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Same methodology: small-step reductions 1 derive the realizability interpretation 2 Resembles λ [ lv τ ⋆ ] -interpretation, plus: dependent types from Lepigre’s calculus co-inductive formulas: by finite approximations Xx A � f � � � ν t n ∈ � � F n A , t � f ´ Etienne Miquey Classical realizability and side-effects 30/ 47

  48. Introduction A constructive proof of DC Algebraic models of classical realizability Realizability interpretation Same methodology: small-step reductions 1 derive the realizability interpretation 2 Resembles λ [ lv τ ⋆ ] -interpretation, plus: dependent types from Lepigre’s calculus co-inductive formulas: by finite approximations Consequences of adequacy : Normalization If Γ ⊢ σ c , then c is normalizable. Consistency � dLPA ω p : ⊥ ´ Etienne Miquey Classical realizability and side-effects 30/ 47

  49. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion and further work Contributions of this part : classical call-by-need: realizability interpretation typed continuation-and-store-passing style translation dependent classical sequent calculus: list of dependencies use of delimited continuations for soundness dependently-typed continuation-passing style translation dLPA ω : soundness and normalization, realizability interpretation of co-fixpoints ´ Etienne Miquey Classical realizability and side-effects 31/ 47

  50. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion and further work Contributions of this part : classical call-by-need dependent classical sequent calculus dLPA ω Further work : Can dL tp be related to: 1 P´ edrot-Tabareau’s Baclofen Type Theory ? V´ ak´ ar’s categorical presentation ? Bowman et. al. CPS for CC ? Relation to Krivine’s realizability semantics of DC: 2 Compatible with quote ? Approximation of the limits required for bar recursion? Algebraic counterpart of side-effects in realizability structures? 3 ´ Etienne Miquey Classical realizability and side-effects 31/ 47

  51. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion and further work Contributions of this part : classical call-by-need dependent classical sequent calculus dLPA ω Further work : Can dL tp be related to: 1 P´ edrot-Tabareau’s Baclofen Type Theory ? V´ ak´ ar’s categorical presentation ? Bowman et. al. CPS for CC ? Relation to Krivine’s realizability semantics of DC: 2 Compatible with quote ? Approximation of the limits required for bar recursion? Algebraic counterpart of side-effects in realizability structures? 3 ´ Etienne Miquey Classical realizability and side-effects 31/ 47

  52. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion and further work Contributions of this part : classical call-by-need dependent classical sequent calculus dLPA ω Further work : Can dL tp be related to: 1 P´ edrot-Tabareau’s Baclofen Type Theory ? V´ ak´ ar’s categorical presentation ? Bowman et. al. CPS for CC ? Relation to Krivine’s realizability semantics of DC: 2 Compatible with quote ? Approximation of the limits required for bar recursion? Algebraic counterpart of side-effects in realizability structures? 3 ´ Etienne Miquey Classical realizability and side-effects 31/ 47

  53. Introduction A constructive proof of DC Algebraic models of classical realizability Part III - Algebraic models of classical realizability ´ Etienne Miquey Classical realizability and side-effects 32/ 47

  54. Introduction A constructive proof of DC Algebraic models of classical realizability Algebraization of classical realizability Chapter 9 Realizers: t � A defined as t ∈ � A � ⊥ ⊥ Key elements: the pole ⊥ ⊥ the latice ( P (Π) , ⊇ ) Observations: this induces a semantic subtyping: ⊥ B � A ≤ ⊥ � B � ⊆ � A � connectives/quantifiers: � ∀ = ∧ = × Realizability This is to be compared with: � ∀ = = ∧ Forcing ´ Etienne Miquey Classical realizability and side-effects 33/ 47

  55. Introduction A constructive proof of DC Algebraic models of classical realizability Algebraization of classical realizability Chapter 9 Realizers: t � A defined as t ∈ � A � ⊥ ⊥ Key elements: the pole ⊥ ⊥ the latice ( P (Π) , ⊇ ) Observations: this induces a semantic subtyping: ⊥ B � A ≤ ⊥ � B � ⊆ � A � connectives/quantifiers: � ∀ = ∧ = × Realizability This is to be compared with: � ∀ = = ∧ Forcing ´ Etienne Miquey Classical realizability and side-effects 33/ 47

  56. Introduction A constructive proof of DC Algebraic models of classical realizability Algebraization of classical realizability Chapter 9 Realizers: t � A defined as t ∈ � A � ⊥ ⊥ Key elements: the pole ⊥ ⊥ the latice ( P (Π) , ⊇ ) Observations: this induces a semantic subtyping: ⊥ B � A ≤ ⊥ � B � ⊆ � A � connectives/quantifiers: � ∀ = ∧ = × Realizability This is to be compared with: � ∀ = = ∧ Forcing ´ Etienne Miquey Classical realizability and side-effects 33/ 47

  57. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative structures Chapter 10 Types Formulas λ -terms Proofs In particular, a � b reads: a is a subtype of b a is a realizer of b the realizer a is more defined than b ´ Etienne Miquey Classical realizability and side-effects 34/ 47

  58. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative structures Chapter 10 Types Formulas ⊆ λ -terms Proofs In particular, a � b reads: a is a subtype of b a is a realizer of b the realizer a is more defined than b ´ Etienne Miquey Classical realizability and side-effects 34/ 47

  59. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative structures Chapter 10 Types Formulas λ -terms Proofs In particular, a � b reads: a is a subtype of b a is a realizer of b the realizer a is more defined than b ´ Etienne Miquey Classical realizability and side-effects 34/ 47

  60. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative structures Chapter 10 Definition: Complete meet-semilatice ( A , � , → ) s.t.: if a 0 � a and b � b 0 then ( a → b ) � ( a 0 → b 0 ) � b ∈ B ( a → b ) = a → � b ∈ B b Examples: complete Heyting/Boolean algebras classical realizability: A � P (Π) ; a � b � a ⊇ b ⊥ · b = { t · π : t ∈ a ⊥ a → b � a ⊥ ⊥ , π ∈ b } ´ Etienne Miquey Classical realizability and side-effects 34/ 47

  61. Introduction A constructive proof of DC Algebraic models of classical realizability Interpretating of λ -terms λ -terms: a @ b � � { c ∈ A : a � ( b → c ) } λ f � � a ∈A ( a → f ( a )) call/cc : cc � � a , b ∈A ((( a → b ) → a ) → a ) a � b → c a @ b � c Adjunction: ⇔ If ⊢ t : A then t A � A A Adequacy: In particular: = � k A a , b ∈A ( a → b → a ) = � s A a , b , c ∈A (( a → b → c ) → ( a → b ) → a → c ) ´ Etienne Miquey Classical realizability and side-effects 35/ 47

  62. Introduction A constructive proof of DC Algebraic models of classical realizability Interpretating of λ -terms λ -terms: a @ b � � { c ∈ A : a � ( b → c ) } λ f � � a ∈A ( a → f ( a )) call/cc : cc � � a , b ∈A ((( a → b ) → a ) → a ) a � b → c a @ b � c Adjunction: ⇔ If ⊢ t : A then t A � A A Adequacy: In particular: = � k A a , b ∈A ( a → b → a ) = � s A a , b , c ∈A (( a → b → c ) → ( a → b ) → a → c ) ´ Etienne Miquey Classical realizability and side-effects 35/ 47

  63. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative algebras Separator S : k A ∈ S , and s A ∈ S (Combinators) 1 If a ∈ S and a � b , then b ∈ S . 2 (Upwards closure) If ( a → b ) ∈ S and a ∈ S , then b ∈ S . (Modus ponens) 3 Implicative algebras: ( A , � , → ) + separator S Entailment: a ⊢ S b � a → b ∈ S . Adjunction a ⊢ S b → c if and only if a × b ⊢ S c ´ Etienne Miquey Classical realizability and side-effects 36/ 47

  64. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative algebras Separator S : k A ∈ S , and s A ∈ S (Combinators) 1 If a ∈ S and a � b , then b ∈ S . 2 (Upwards closure) If ( a → b ) ∈ S and a ∈ S , then b ∈ S . (Modus ponens) 3 Implicative algebras: ( A , � , → ) + separator S Entailment: a ⊢ S b � a → b ∈ S . Adjunction a ⊢ S b → c if and only if a × b ⊢ S c ´ Etienne Miquey Classical realizability and side-effects 36/ 47

  65. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative tripos Adjunction a ⊢ S b → c if and only if a × b ⊢ S c ( � ( A / S , ⊢ S , × , + , → ) is a Heyting algebra ) Tripos: � Set op → HA T : A I / S [ I ] I �→ Collapse criteria The following are equivalent: T is isomorphic to a forcing tripos 1 S ⊆ A is a principal filter of A . 2 S ⊆ A is finitely generated and ⋔ ∈ S . 3 ´ Etienne Miquey Classical realizability and side-effects 37/ 47

  66. Introduction A constructive proof of DC Algebraic models of classical realizability Implicative tripos Adjunction a ⊢ S b → c if and only if a × b ⊢ S c ( � ( A / S , ⊢ S , × , + , → ) is a Heyting algebra ) Tripos: � Set op → HA T : A I / S [ I ] I �→ Collapse criteria The following are equivalent: T is isomorphic to a forcing tripos 1 S ⊆ A is a principal filter of A . 2 S ⊆ A is finitely generated and ⋔ ∈ S . 3 ´ Etienne Miquey Classical realizability and side-effects 37/ 47

  67. Introduction A constructive proof of DC Algebraic models of classical realizability Decomposing the arrow Chapter 11 Logic: � A → B ¬ A ∨ B Different axiomatic: S 1 : ( A ∨ A ) → A S 3 : ( A ∨ B ) → ( B ∨ A ) : : S 2 A → ( A ∨ B ) S 4 ( A → B ) → (( C ∨ A ) → ( C ∨ B )) λ -calculus: λ x . t � ˜ µ ( [ x ] , β ) . � t || β � : ¬ A ` B L ` fragment of Munch-Maccagnoni’s system L embedding of the call-by-name λ -calculus ´ Etienne Miquey Classical realizability and side-effects 38/ 47

  68. Introduction A constructive proof of DC Algebraic models of classical realizability Disjunctive structures Complete meet-semilatice ( A , � , ` , ¬ ) : ¬ is anti-monotonic 1 ` is monotonic 2 � b ∈ B ( a ` b ) = a ` ( � � b ∈ B ( b ` a ) = ( � b ∈ B b ) b ∈ B b ) ` a and 3 ¬ � a ∈ A a = � a ∈ A ¬ a 4 Examples: complete Boolean algebras classical realizability in L ` : A � P (Π) a ` b � ( a , b ) a � b � a ⊇ b ¬ a � [ a ⊥ ⊥ ] Induced implication ( A , � , ` → b � ¬ a ` b is an implicative structure ` → ) with a ´ Etienne Miquey Classical realizability and side-effects 39/ 47

  69. Introduction A constructive proof of DC Algebraic models of classical realizability Disjunctive structures Complete meet-semilatice ( A , � , ` , ¬ ) : ¬ is anti-monotonic 1 ` is monotonic 2 � b ∈ B ( a ` b ) = a ` ( � � b ∈ B ( b ` a ) = ( � b ∈ B b ) b ∈ B b ) ` a and 3 ¬ � a ∈ A a = � a ∈ A ¬ a 4 Examples: complete Boolean algebras classical realizability in L ` : A � P (Π) a ` b � ( a , b ) a � b � a ⊇ b ¬ a � [ a ⊥ ⊥ ] Induced implication ( A , � , ` → b � ¬ a ` b is an implicative structure ` → ) with a ´ Etienne Miquey Classical realizability and side-effects 39/ 47

  70. Introduction A constructive proof of DC Algebraic models of classical realizability Disjunctive structures Complete meet-semilatice ( A , � , ` , ¬ ) : ¬ is anti-monotonic 1 ` is monotonic 2 � b ∈ B ( a ` b ) = a ` ( � � b ∈ B ( b ` a ) = ( � b ∈ B b ) b ∈ B b ) ` a and 3 ¬ � a ∈ A a = � a ∈ A ¬ a 4 Examples: complete Boolean algebras classical realizability in L ` : A � P (Π) a ` b � ( a , b ) a � b � a ⊇ b ¬ a � [ a ⊥ ⊥ ] Induced implication ( A , � , ` → b � ¬ a ` b is an implicative structure ` → ) with a ´ Etienne Miquey Classical realizability and side-effects 39/ 47

  71. Introduction A constructive proof of DC Algebraic models of classical realizability Interpreting L ` Terms: Contexts: µ − . c � � a ∈A { a : c ( a ) ∈ ⊥ ( a , b ) � a ` b ⊥} µ () . c � � [ a ] � ¬ a a , b ∈A { a ` b : c ( a , b ) ∈ ⊥ ⊥} µ + . c � � µ [] . c � � a ∈A { a : c ( a ) ∈ ⊥ ⊥} a ∈A {¬ a : c ( a ) ∈ ⊥ ⊥} Adequacy for any term t , if Γ ⊢ t : A | ∆ , then ( t [ σ ] ) A � A [ σ ] A ; 1 for any context e , if Γ | e : A ⊢ ∆ , then ( e [ σ ] ) A � A [ σ ] A ; 2 Besides: � � L ` λ -calculus [ ] A → [ ] A ` ι ( A → , � , → ) ( A ` , � , ` , ¬ ) ´ Etienne Miquey Classical realizability and side-effects 40/ 47

  72. Introduction A constructive proof of DC Algebraic models of classical realizability Interpreting L ` Terms: Contexts: µ − . c � � a ∈A { a : c ( a ) ∈ ⊥ ( a , b ) � a ` b ⊥} µ () . c � � [ a ] � ¬ a a , b ∈A { a ` b : c ( a , b ) ∈ ⊥ ⊥} µ + . c � � µ [] . c � � a ∈A { a : c ( a ) ∈ ⊥ ⊥} a ∈A {¬ a : c ( a ) ∈ ⊥ ⊥} Adequacy for any term t , if Γ ⊢ t : A | ∆ , then ( t [ σ ] ) A � A [ σ ] A ; 1 for any context e , if Γ | e : A ⊢ ∆ , then ( e [ σ ] ) A � A [ σ ] A ; 2 Besides: � � L ` λ -calculus [ ] A → [ ] A ` ι ( A → , � , → ) ( A ` , � , ` , ¬ ) ´ Etienne Miquey Classical realizability and side-effects 40/ 47

  73. Introduction A constructive proof of DC Algebraic models of classical realizability Disjunctive algebras Bourbaki’s axioms: � � s ` a ∈A [ ( a ` a ) → a ] � 1 � s ` a , b ∈A [ a → ( a ` b ) ] � 2 � s ` a , b ∈A [ ( a ` b ) → ( b ` a ) ] � 3 � s ` a , b , c ∈A [ ( a → b ) → ( c ` a ) → ( c ` b ) ] � 4 � s ` a , b , c ∈A [ ( a ` ( b ` c )) → (( a ` b ) ` c ) ] 5 Separator S : (1) If a ∈ S and a � b then b ∈ S (upward closure) (2) s 1 , s 2 , s 3 , s 4 and s 5 are in S (combinators) ` (3) If a → b ∈ S and a ∈ S then b ∈ S (closure under modus ponens) ´ Etienne Miquey Classical realizability and side-effects 41/ 47

  74. Introduction A constructive proof of DC Algebraic models of classical realizability Internal logic Recall: a ⊢ S b � a ` → b ∈ S Sum type: 1. a ` b ⊢ S a + b 2. a + b ⊢ S a ` b Negation: ` ` 1. ¬ a ⊢ S a → ⊥ 2. a → ⊥ ⊢ S ¬ a Double-negation elimination: 1. a ⊢ S ¬¬ a 2. ¬¬ a ⊢ S a Theorem S is an implicative separator ´ Etienne Miquey Classical realizability and side-effects 42/ 47

  75. Introduction A constructive proof of DC Algebraic models of classical realizability Internal logic Recall: a ⊢ S b � a ` → b ∈ S Sum type: 1. a ` b ⊢ S a + b 2. a + b ⊢ S a ` b Negation: ` ` 1. ¬ a ⊢ S a → ⊥ 2. a → ⊥ ⊢ S ¬ a Double-negation elimination: 1. a ⊢ S ¬¬ a 2. ¬¬ a ⊢ S a Theorem S is an implicative separator ´ Etienne Miquey Classical realizability and side-effects 42/ 47

  76. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion Disjunctive structures: induced by classical realizability allow to adequately embed L ` are implicative structures Disjunctive algebras: are intrinsically classical are implicative algebras do not necessarily collapse to a forcing situation Conclusion Implicative algebras are more general. ´ Etienne Miquey Classical realizability and side-effects 43/ 47

  77. Introduction A constructive proof of DC Algebraic models of classical realizability Conclusion Disjunctive structures: induced by classical realizability allow to adequately embed L ` are implicative structures Disjunctive algebras: are intrinsically classical are implicative algebras do not necessarily collapse to a forcing situation Conclusion Implicative algebras are more general. ´ Etienne Miquey Classical realizability and side-effects 43/ 47

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend