Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward dependent choice: a classical sequent calculus with dependent types Hugo Herbelin 1 , ´ Etienne Miquey 1,2 1 Team π r 2 (INRIA), PPS, Universit´ e Paris-Diderot 2 Fac. de Ingenier´ ıa, Universidad de la Rep´ ublica, Uruguay TYPES 2015 ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 1/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Curry-Howard correspondence Proof/program correspondence Proof theory Functional programming Proposition Type Deduction rule Typing rule A ⇒ B A → B Γ ⊢ t : A → B Γ ⊢ u : A Γ ⊢ A ⇒ B Γ ⊢ A Γ ⊢ ( t ) u : B Γ ⊢ B A first extension : Classical logic [Griffin’90] call/cc : (( A ⇒ B ) ⇒ A ) ⇒ A ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 2/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Extending more... Axiom of Choice AC A : ∀ x A ∃ y B P ( x , y ) → ∃ f A → B ∀ x A P ( x , f ( x )) Ingredients : Martin-L¨ of’s type theory Γ , x : T ⊢ p : A Γ , a : A ⊢ p : B Γ ⊢ λ a . p : A → B → I Γ ⊢ λ x . p : ∀ x T A ∀ I Γ ⊢ p : A [ t / x ] Γ ⊢ t : T Γ ⊢ p : ∃ x T A ( x ) ∃ I Γ ⊢ prf p : A ( wit p ) ∃ E Γ ⊢ ( t , p ) : ∃ x T A := λ H . ( λ x . wit ( Hx ) ,λ x . prf ( Hx )) AC A ∀ x A ∃ y B P ( x , y ) → ∃ f A → B ∀ x A P ( x , f ( x )) : ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 3/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art ... still more ? AC A := λ H . ( λ x . wit ( Hx ) , λ x . prf ( Hx )) In classical logic : H 0 := callcc α (1 , φ ( throw α (2 , p )) : ∃ xP ( x ) the witness may depend on the context, so do the proof ! reducing a term in different contexts, one might reach a contradiction : P (0 , 2) ���� ( wit ( AC A H ) 0 , prf ( AC A H ) 0) � ( wit H 0 , prf H 0 ) � (1 , ) p � �� � � �� � ∃ yP (0 , y ) ✘ ✘✘✘ ∃ yP ( x , y ) � idea : we need to share ... ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 4/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward a solution ? Restriction to countable choice : AC N : ∀ x N ∃ y B P ( x , y ) → ∃ f N → B ∀ x N P ( x , f ( x )) Proof : AC := λ H . ( λ n . wit ( Hn ) , λ n . prf ( Hn )) ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 5/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward a solution ? Restriction to countable choice : AC N : ∀ x N ∃ y B P ( x , y ) → ∃ f N → B ∀ x N 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 Toward dependent choice: a classical sequent calculus with dependent types 5/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward a solution ? Restriction to countable choice : AC N : ∀ x N ∃ y B P ( x , y ) → ∃ f N → B ∀ x N 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 Toward dependent choice: a classical sequent calculus with dependent types 5/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward a solution ? Restriction to countable choice : AC N : ∀ x N ∃ y B P ( x , y ) → ∃ f N → B ∀ x N P ( x , f ( x )) Proof : AC := λ H . let H ∞ = ( H 0 , H 1 , . . . , H n , . . . ) in ( λ n . nth n H ∞ , λ n . nth n H ∞ ) ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 5/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Toward a solution ? Restriction to countable choice : AC N : ∀ x N ∃ y B P ( x , y ) → ∃ f N → B ∀ x N P ( x , f ( x )) Proof : AC := λ H . let H ∞ = cofix 0 fn ( H n , f ( S ( n ))) in ( λ n . nth n H ∞ , λ n . nth n H ∞ ) We can easily adapt to dependent choice Intuitionistic proof ! ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 5/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art The recipe : dPA ω Ref : Hugo Herbelin (LICS’12) A Constructive Proof of Dependent Choice, Compatible with Classical Logic A formal system : classical : p , q ::= ... | catch α p | throw α p with dependent types : formulas : A , B ::= ... | [ a : A ] → B | t = u , terms : t , u ::= ... | wit p , proofs : p , q ::= ... | prf p a compartimentalization : Definition : Negative-elimination-free Values : V ::= a | () | λ x . p | λ a . p | ( t , p ) | ( V , V ) | ι i ( V ) N , M ::= ... | λ a . p | ( N , N ) | ι i ( N ) | prf N | let a = M in N | ... Γ ⊢ p : ∃ x T A ( x ) Γ ⊢ p : ∃ x T A ( x ) p Nef Γ , x : T , a : A ⊢ q : B Γ ⊢ prf p : A ( wit p ) Γ ⊢ dest p as (( x , a )) in q : B ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 6/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art The recipe : dPA ω Ref : Hugo Herbelin (LICS’12) A Constructive Proof of Dependent Choice, Compatible with Classical Logic A formal system : classical : p , q ::= ... | catch α p | throw α p with dependent types : formulas : A , B ::= ... | [ a : A ] → B | t = u , terms : t , u ::= ... | wit p , proofs : p , q ::= ... | prf p a compartimentalization , call-by-value and sharing : p , q ::= ... | let a = q in p with inductive and coinductive constructions : p , q ::= ... | ind t of [ p | ( x , a ) . q ] | cofix t bn p laziness on the cofix ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 6/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Main properties Subject reduction If Γ ⊢ p : A and p � q , then Γ ⊢ q : A . Normalisation If Γ ⊢ p : A then p is normalisable. Conservativity If A is → - ν - wit - ∀ -free, and ⊢ dPA ω p : A , then ⊢ HA ω p : A Consistency � dPA ω ⊥ ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 7/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Normalisation by CPS A translation � · � : dPA ω → λ something s.t. : ( � p � → + � q � ) ( p � q ) ⇒ Interest : highlights on negative translation and side effects If we are lucky : update-induction [Berger’04] Difficulties : − (Continuation+State)-passing-style − Typing ? − Laziness & cofix ? − Manipulation of contexts : t let a = cofix p = D [ a ] in ... ⊲ bx CPS : Ariola et al (FLOPS’12) Classical Call-by-Need Sequent Calculi : The Unity of Semantic Artifacts ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 8/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Sequent calculus : λµ ˜ µ Ref : Curien/Herbelin (ICFP’00) Syntax : The duality of computation, (Commands) c ::= � p | e � (Proofs) p , q ::= a | λ a . p | µα. c (Contexts) e ::= α | ˜ µ a . c | p · e Call-by-value reduction : � λ a . p | q · e � � � q | ˜ µ a . � p | e �� � V | ˜ µ a . c � � c [ V / a ] � µα. c | e � � c [ e /α ] Typing rules : Γ ⊢ e : A ⊥ ⊥ c : (Γ , α : A ⊥ ⊥ ) c : (Γ , a : A ) Γ ⊢ p : A ⊥ ˜ µ µ cut µ a . c : A ⊥ � p | e � : Γ Γ ⊢ µα. c : A Γ ⊢ ˜ ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 9/ 19
Curry-Howard Axiom of Dependent Choice Sequent calculus State of the art Adding sharing Ref : Ariola et al (FLOPS’12) Syntax : Classical Call-by-Need Sequent Calculi : (Commands) ::= � p | e � τ c The Unity of Semantic Artifacts (Proofs) p , q ::= a | λ a . p | µα. c (Contexts) ::= α | ˜ µ a . c | p · e e (Environments) τ ::= · | [ a = p ] τ Call-by-value reduction : � λ a . p | q · e � τ � � q | ˜ µ a . � p | e �� τ � µα. c | e � τ � c [ e /α ] τ � V | ˜ µ a . c � τ � c [ a = V ] τ � a | F � τ ′ [ a = p ] τ � � p | F � τ ′ [ a = p ] τ Typing rules : ... + � p | e � τ : (Γ) ::= � τ ( p ) | τ ( e ) � : (Γ) ´ Etienne Miquey Toward dependent choice: a classical sequent calculus with dependent types 10/ 19
Recommend
More recommend