Index The main contribution of this (ongoing) work are ... • to provide adequate notions of patterns, substitutions and syntactic matching in a typed setting. We introduce delayed matching constraint, and the possibility for patterns in abstractions to evolve (by reduction or substitution) during execution • to propose an extension of PTSs supporting abstraction over patterns, and enjoying ⋆ confluence ⋆ subject reduction ⋆ conservativity over PTSs 2 T Ss ⋆ consistency for normalizing P 2 T S is an open problem . . . but it is ok for simple • Strong normalization for all P 2 T S-types (see Benjamin Wack SN-paper) and it “seems” ok for P 2 T S-types ( ❀ Rho gical Framework ) simple+dependent P � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 14
Index P 2 T S The Syntax � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 15
Index P 2 T S its time to be uniform! λA.B ∼ A → B � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 16
Index The Typed Syntax Γ ::= ∅ | Γ , X : A | Γ , f : A A ::= X | f | A → ∆ B | A A | [ A ≪ ∆ B ] C | A ; B � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 17
Index The Typed Syntax Γ ::= ∅ | Γ , X : A | Γ , f : A A ::= X | f | A → ∆ B | A A | [ A ≪ ∆ B ] C | A ; B 1. Term A → ∆ B is an abstraction (resp. product abstraction i . e . Π A :∆ .B ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 17
Index The Typed Syntax Γ ::= ∅ | Γ , X : A | Γ , f : A A ::= X | f | A → ∆ B | A A | [ A ≪ ∆ B ] C | A ; B 1. Term A → ∆ B is an abstraction (resp. product abstraction i . e . Π A :∆ .B ) 2. Term [ A ≪ ∆ B ] C is a delayed matching constraint � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 17
Index The Typed Syntax Γ ::= ∅ | Γ , X : A | Γ , f : A A ::= X | f | A → ∆ B | A A | [ A ≪ ∆ B ] C | A ; B 1. Term A → ∆ B is an abstraction (resp. product abstraction i . e . Π A :∆ .B ) 2. Term [ A ≪ ∆ B ] C is a delayed matching constraint 3. Term of the form A ; B is called a structure � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 17
Index P 2 T S Galleria & Glance � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 18
Index Galleria I: The Pattern Abstraction A → ∆ B • Generalisation of the λ -abstraction in PTSs. The rationale is: X → ( X : σ ) A ∼ λ X : σ. A � �� � ∆ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 19
Index Galleria I: The Pattern Abstraction A → ∆ B • Generalisation of the λ -abstraction in PTSs. The rationale is: f ( X Y ) → ( X : σ, Y : τ ) A ∼ λ f ( X Y ):( X : σ, Y : τ ) . A � �� � ∆ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 19
Index Galleria I: The Pattern Abstraction A → ∆ B • Generalisation of the λ -abstraction in PTSs. The rationale is: f ( X Y ) → ( X : σ, Y : τ ) A ∼ λ f ( X Y ):( X : σ, Y : τ ) . A � �� � ∆ • Instead of simple variables we abstract over sophisticated patterns • The free variables of A (bound in B ) are declared in the context ∆ , i . e . △ Fv ( A → ∆ B ) = ( Fv ( A ) ∪ Fv ( B ) ∪ Fv ( ∆ )) \ Dom ( ∆ ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 19
Index Galleria I: The Pattern Abstraction A → ∆ B • Generalisation of the λ -abstraction in PTSs. The rationale is: f ( X Y ) → ( X : σ, Y : τ ) A ∼ λ f ( X Y ):( X : σ, Y : τ ) . A � �� � ∆ • Instead of simple variables we abstract over sophisticated patterns • The free variables of A (bound in B ) are declared in the context ∆ , i . e . △ Fv ( A → ∆ B ) = ( Fv ( A ) ∪ Fv ( B ) ∪ Fv ( ∆ )) \ Dom ( ∆ ) • ∆ discriminates on which Fv ( A ) will be bound in B and which not cons ( T X nil ( T )) → ( X : T ) cons ( T X cons ( T X nil ( T ))) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 19
Index Galleria I: The Pattern Abstraction A → ∆ B • Generalisation of the λ -abstraction in PTSs. The rationale is: f ( X Y ) → ( X : σ, Y : τ ) A ∼ λ f ( X Y ):( X : σ, Y : τ ) . A � �� � ∆ • Instead of simple variables we abstract over sophisticated patterns • The free variables of A (bound in B ) are declared in the context ∆ , i . e . △ Fv ( A → ∆ B ) = ( Fv ( A ) ∪ Fv ( B ) ∪ Fv ( ∆ )) \ Dom ( ∆ ) • ∆ discriminates on which Fv ( A ) will be bound in B and which not cons ( T X nil ( T )) → ( X : T ) cons ( T X cons ( T X nil ( T ))) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 19
Index Galleria II: The Matching Constraint [ A ≪ ∆ B ] C • In the term [ A ≪ ∆ B ] C the matching equation [ A ≪ ∆ B ] is put on the stack, hence constraints and “de facto” blocks the evaluation of C • The body C will be evaluated (in case a matching solution exists) or delayed (in case no solution exists at this stage of the evaluation) • If a solution exists, the delayed matching constraint self-evaluates to Cσ , otherwise the evaluation is delayed to a later stage • The free variables of A declared in ∆ are bound in B but not in C , i . e . Fv ([ A ≪ ∆ B ] C ) = Fv (( A → ∆ C ) B ) △ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 20
Index P 2 T S Matching Algorithm HARD RUN EASY RUN SKIP � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 21
Index Less Easy Running ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � X ≺ X X ∧ X ≺ X Y KO!! � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � X ≺ X X ∧ X ≺ X Y KO!! ≺ Y • X → ( X : i ) f ( X Y ) ≺ ∅ X → ( X : i ) f ( X 3) � � � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � X ≺ X X ∧ X ≺ X Y KO!! ≺ Y • X → ( X : i ) f ( X Y ) ≺ ∅ X → ( X : i ) f ( X 3) � � ≺ Y ≺ Y ≺ Y ≺ Y X ≺ X X ∧ f ≺ X f ∧ X ≺ X X ∧ Y ≺ X 3 OK!! � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � X ≺ X X ∧ X ≺ X Y KO!! ≺ Y • X → ( X : i ) f ( X Y ) ≺ ∅ X → ( X : i ) f ( X 3) � � ≺ Y ≺ Y ≺ Y ≺ Y X ≺ X X ∧ f ≺ X f ∧ X ≺ X X ∧ Y ≺ X 3 OK!! ≺ Y • [ f ( X ) ≪ ( X : i ) f ( Y )] X ≺ ∅ [ f ( X ) ≪ ( X : i ) f (3)] .X � � � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Less Easy Running ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) X � X ≺ X X OK!! ≺ ? ≺ ? ≺ ? • X → ( X : i ) X ≺ ∅ X → ( X : i ) Y � X ≺ X X ∧ X ≺ X Y KO!! ≺ Y • X → ( X : i ) f ( X Y ) ≺ ∅ X → ( X : i ) f ( X 3) � � ≺ Y ≺ Y ≺ Y ≺ Y X ≺ X X ∧ f ≺ X f ∧ X ≺ X X ∧ Y ≺ X 3 OK!! ≺ Y • [ f ( X ) ≪ ( X : i ) f ( Y )] X ≺ ∅ [ f ( X ) ≪ ( X : i ) f (3)] .X � � ≺ Y ≺ Y ≺ Y ≺ Y ≺ Y f ≺ X f ∧ X ≺ X X ∧ X ≺ X X ∧ f ≺ ∅ f ∧ Y ≺ ∅ 3 OK!! � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 22
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( T 3 nil ( T )) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( T 3 nil ( T )) � ≺ X ≺ X X ≺ ∅ 3 ∧ T ≺ OK !! with σ = { 3 / X } ∅ T � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( T 3 nil ( T )) � ≺ X ≺ X X ≺ ∅ 3 ∧ T ≺ OK !! with σ = { 3 / X } ∅ T • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( i 3 nil ( i )) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( T 3 nil ( T )) � ≺ X ≺ X X ≺ ∅ 3 ∧ T ≺ OK !! with σ = { 3 / X } ∅ T • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( i 3 nil ( i )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( i 3 nil ( i )) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index Two Easy Running • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( T 3 nil ( T )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( T 3 nil ( T )) � ≺ X ≺ X X ≺ ∅ 3 ∧ T ≺ OK !! with σ = { 3 / X } ∅ T • ( cons ( T X nil ( T )) → ( X : i ) X ) cons ( i 3 nil ( i )) ≺ X Solve cons ( T X nil ( T )) ≺ ∅ cons ( i 3 nil ( i )) � ≺ X ≺ X X ≺ ∅ 3 ∧ T ≺ KO !! ∅ i � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 23
Index P 2 T S Type System � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 24
Index The Type System I ( s 1 , s 2 ) ∈ A ( Axioms ) ∅ ⊢ s 1 : s 2 � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 25
Index The Type System I ( s 1 , s 2 ) ∈ A ( Axioms ) ∅ ⊢ s 1 : s 2 Γ ⊢ A : C Γ ⊢ B : C ( Struct ) Γ ⊢ A ; B : C � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 25
Index The Type System I ( s 1 , s 2 ) ∈ A ( Axioms ) ∅ ⊢ s 1 : s 2 Γ ⊢ A : C Γ ⊢ B : C ( Struct ) Γ ⊢ A ; B : C Γ ⊢ A : s α �∈ Dom (Γ) ( Start ) Γ , α : A ⊢ α : A � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 25
Index The Type System I ( s 1 , s 2 ) ∈ A ( Axioms ) ∅ ⊢ s 1 : s 2 Γ ⊢ A : C Γ ⊢ B : C ( Struct ) Γ ⊢ A ; B : C Γ ⊢ A : s α �∈ Dom (Γ) ( Start ) Γ , α : A ⊢ α : A Γ ⊢ A : B Γ ⊢ C : s α �∈ Dom (Γ) ( Weak ) Γ , α : C ⊢ A : B � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 25
Index The Type System I ( s 1 , s 2 ) ∈ A ( Axioms ) ∅ ⊢ s 1 : s 2 Γ ⊢ A : C Γ ⊢ B : C ( Struct ) Γ ⊢ A ; B : C Γ ⊢ A : s α �∈ Dom (Γ) ( Start ) Γ , α : A ⊢ α : A Γ ⊢ A : B Γ ⊢ C : s α �∈ Dom (Γ) ( Weak ) Γ , α : C ⊢ A : B Γ ⊢ A : B Γ ⊢ C : D B = δ C ρ σ ( Conv ) Γ ⊢ A : C � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 25
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : Π C :∆ .D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : Π C :∆ .D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index The Type System II Γ , ∆ ⊢ B : C Γ ⊢ Π A :∆ .C : s ( Abs ) Γ ⊢ A → ∆ B : Π A :∆ .C Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 Γ ⊢ A : ΠC : ∆ . D Γ , ∆ ⊢ C : E Γ ⊢ B : E ( Appl ) Γ ⊢ A B : [ C ≪ ∆ B ] D Γ , ∆ ⊢ A : E Γ , ∆ ⊢ C : D Γ ⊢ B : D ( Subst ) Γ ⊢ [ C ≪ ∆ B ] A : [ C ≪ ∆ B ] ⊤ E � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 26
Index Fetch Your System Γ ⊢ C : s 1 ( s 1 , s 2 , s 3 ) ∈ R Γ , ∆ ⊢ A : C Γ , ∆ ⊢ B : s 2 ( Prod ) Γ ⊢ Π A :∆ .B : s 3 System Rules ρ → ( ∗ , ∗ , ∗ ) ( ∗ , ∗ , ∗ ) ( ✷ , ∗ , ∗ ) ρ 2 ( ∗ , ∗ , ∗ ) ρω ( ✷ , ✷ , ✷ ) ρω ( ∗ , ∗ , ∗ ) ( ∗ , ✷ , ✷ ) ( ✷ , ✷ , ✷ ) ρLF ( ∗ , ∗ , ∗ ) ( ∗ , ✷ , ✷ ) ρP 2 ( ∗ , ∗ , ∗ ) ( ✷ , ∗ , ∗ ) ( ∗ , ✷ , ✷ ) ( ∗ , ∗ , ∗ ) ( ∗ , ✷ , ✷ ) ρPω ( ✷ , ✷ , ✷ ) ( ∗ , ∗ , ∗ ) ( ✷ , ∗ , ∗ ) ( ∗ , ✷ , ✷ ) ρPω ( ✷ , ✷ , ✷ ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 27
Index P 2 T S Typed Examples � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 28
Index Example: Simple Type Derivation △ △ △ = i : ∗ , f :Π Z :Σ .i, 3: i, 4: i , and ∆ Let Γ = X : i , and Σ = Z : i , 3 ( ∗ , ∗ , ∗ ) ∈ R . . Γ ⊢ [ Z ≪ Σ X ] .i : ∗ . Γ , ∆ ⊢ ( λ 3: ∅ . 3) : Π3: ∅ .i 5 6 Γ , ∆ ⊢ [3 ≪ ∅ X ] .i : ∗ Γ , ∆ ⊢ ( λ 3: ∅ . 3) X : [3 ≪ ∅ X ] .i Γ ⊢ Π f ( X ):∆ . [3 ≪ ∅ X ] .i : ∗ Γ ⊢ λf ( X ):∆ . ( λ 3: ∅ . 3) X : Π f ( X ):∆ . [3 ≪ ∅ X ] .i 3 4 Γ ⊢ ( λf ( X ):∆ . ( λ 3: ∅ . 3) X ) f (3) : [ f ( X ) ≪ ∆ f (3)] . [3 ≪ ∅ X ] .i 1 2 Γ ⊢ ( λ f ( X ): ∆ . ( λ 3 : ∅ . 3 ) X ) f ( 3 ) : i △ △ where 1 = [ f ( X ) ≪ ∆ f (3)] . [3 ≪ ∅ X ] .i = δ i , and 2 = Γ ⊢ i : ∗ , and ρ σ △ △ = Γ , ∆ ⊢ f ( X ) : [ Z ≪ Σ X ] .i , and = Γ ⊢ f (3) : [ Z ≪ Σ 3] .i , and 3 4 △ △ 5 = Γ , ∆ ⊢ X : i , and 6 = Γ , ∆ ⊢ 3 : i . � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 29
Index Example: Simple Type Derivation △ △ △ = i : ∗ , f :Π Z :Σ .i, 3: i, 4: i , and ∆ Let Γ = X : i , and Σ = Z : i , 3 ( ∗ , ∗ , ∗ ) ∈ R . . Γ ⊢ [ Z ≪ Σ X ] .i : ∗ . Γ , ∆ ⊢ ( λ 3: ∅ . 3) : Π3: ∅ .i 5 6 Γ , ∆ ⊢ [3 ≪ ∅ X ] .i : ∗ Γ , ∆ ⊢ ( λ 3: ∅ . 3) X : [3 ≪ ∅ X ] .i Γ ⊢ Π f ( X ):∆ . [3 ≪ ∅ X ] .i : ∗ Γ ⊢ λf ( X ):∆ . ( λ 3: ∅ . 3) X : Π f ( X ):∆ . [3 ≪ ∅ X ] .i 3 4 Γ ⊢ ( λf ( X ):∆ . ( λ 3: ∅ . 3) X ) f (3) : [ f ( X ) ≪ ∆ f (3)] . [3 ≪ ∅ X ] .i 1 2 Γ ⊢ ( λ f ( X ): ∆ . ( λ 3 : ∅ . 3 ) X ) f ( 3 ) : i △ △ where 1 = [ f ( X ) ≪ ∆ f (3)] . [3 ≪ ∅ X ] .i = δ i , and 2 = Γ ⊢ i : ∗ , and ρ σ △ △ = Γ , ∆ ⊢ f ( X ) : [ Z ≪ Σ X ] .i , and = Γ ⊢ f (3) : [ Z ≪ Σ 3] .i , and 3 4 △ △ 5 = Γ , ∆ ⊢ X : i , and 6 = Γ , ∆ ⊢ 3 : i . � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 29
Index Playing with the Rho-cube: ρLF △ • Let Γ = i : ∗ , f :Π X :( X : i ) . ∗ , 3: i Γ , X : i ⊢ X : i Γ ⊢ i : ∗ Γ , X : i ⊢ ∗ : ✷ Γ ⊢ Π X :( X : i ) . ∗ : ✷ Γ ⊢ f : Π X :( X : i ) . ∗ Γ , X : i ⊢ X : i Γ ⊢ 3 : i Γ ⊢ f (3) : [ X ≪ ( X : i ) 3] ⊤ ∗ ≡ ∗ • Γ ⊢ Π X :( X : i ) . ∗ : ✷ can be derived thanks to the specific rule ( ∗ , ✷ , ✷ ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 30
Index Playing with the Rho-cube: ρ 2 • In this system the following polymorphic identity with pattern f ” can be derived (where f denotes f X ∗ → X ∗ ): ( Conv + Appl ) . . . ⊢ ∗ : ✷ ⊢ ∗ : ✷ ⊢ ∗ : ✷ ok ! ⊢ f ( Y X ∗ ) : X ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ . . . ⊢ ∗ : ✷ ⊢ Y X ∗ : X ∗ X : ∗ , Y : X ⊢ f ( Y X ∗ ) → X : ∗ ⊢ f ( Y X ∗ ) → X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ ∗ : ✷ ⊢ f ( Y X ∗ ) → Y X ∗ : f ( Y X ∗ ) → X ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → Y X ∗ : X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 31
Index Playing with the Rho-cube: ρ 2 • In this system the following polymorphic identity with pattern f ” can be derived (where f denotes f X ∗ → X ∗ ): ( Conv + Appl ) . . . ⊢ ∗ : ✷ ⊢ ∗ : ✷ ⊢ ∗ : ✷ ok ! ⊢ f ( Y X ∗ ) : X ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ . . . ⊢ ∗ : ✷ ⊢ Y X ∗ : X ∗ X : ∗ , Y : X ⊢ f ( Y X ∗ ) → X : ∗ ⊢ f ( Y X ∗ ) → X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ ∗ : ✷ ⊢ f ( Y X ∗ ) → Y X ∗ : f ( Y X ∗ ) → X ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → Y X ∗ : X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ • X : ∗ , Y : X ⊢ f ( Y X ∗ ) → X : ∗ can be derived thanks to ( ∗ , ∗ , ∗ ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 31
Index Playing with the Rho-cube: ρ 2 • In this system the following polymorphic identity with pattern f ” can be derived (where f denotes f X ∗ → X ∗ ): ( Conv + Appl ) . . . ⊢ ∗ : ✷ ⊢ ∗ : ✷ ⊢ ∗ : ✷ ok ! ⊢ f ( Y X ∗ ) : X ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ X ∗ : ∗ . . . ⊢ ∗ : ✷ ⊢ Y X ∗ : X ∗ X : ∗ , Y : X ⊢ f ( Y X ∗ ) → X : ∗ ⊢ f ( Y X ∗ ) → X ∗ : ∗ ⊢ X ∗ : ∗ ⊢ ∗ : ✷ ⊢ f ( Y X ∗ ) → Y X ∗ : f ( Y X ∗ ) → X ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → Y X ∗ : X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ • X : ∗ , Y : X ⊢ f ( Y X ∗ ) → X : ∗ can be derived thanks to ( ∗ , ∗ , ∗ ) • X : ∗ , Y : X ⊢ X ∗ → f ( Y X ∗ ) → X : ∗ can be derived thanks to ( ✷ , ∗ , ∗ ) � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 31
Index P 2 T S Metatheory CONCLUSIONS � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 32
Index 2 T S : Some Results P • Confluence The relation �→ δ is confluent ρ σ • Subject Reduction. If Γ ⊢ A : B , and A �→ δ C , then Γ ⊢ C : B ρ σ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 33
Index 2 T S : Some Results P • Confluence The relation �→ δ is confluent ρ σ • Subject Reduction. If Γ ⊢ A : B , and A �→ δ C , then Γ ⊢ C : B ρ σ 2 T S is logically consistent, i . e . • Consistency. Any normalizing P for every sort s ∈ S , X : s �⊢ A : X 2 T Ss are a conservative extension of PTSs: • Conservativity. P Γ † ⊢ P 2 T S A † : B † Γ ⊢ PTS A : B ⇐ ⇒ � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 33
Index Open Tracks • strong normalization, we conjecture that standard model construction ≪ techniques can be used to prove strong normalization of the λ -cube; Benj • type checking/inference, we conjecture that existing algorithms for PTSs adapt 2 T Ss; Luigi readily to P 2 T Ss with a limited form of decidable • it would be interesting to study P higher-order unification, in the style of λ -Prolog; Claude/Gop? • encoding dependent case analysis, dependent sum types (records) ` a la Coquand-Pollack-Luo; ? • explicit substitutions. The extension is not trivial, because of delayed matching constraints, but the resulting formalism could serve as the core engine of a little type-checker underneath of a powerful proof assistant; u:Claude-Germain,t:? � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 34
Index Challenge ... Extending the Curry-Howard Isomorphism • The extension can be considered from the point of view of sequent calculi, deduction modulo, and natural deduction respectively; 2 T Ss • From the point of view of sequent calculi, it remains to investigate how P can be used to extend previous results on term calculi for sequent calculi, and how their extension with matching theories can be used to provide suitable term calculi for deduction modulo; 2 T Ss correspond to an extension • From the point of view of natural deduction, P of natural deduction where parts of proof trees are discharged instead of assumptions; • To our best knowledge, such an extended form of natural deduction has not been considered previously, but it seems interesting to investigate whether such an extended natural deduction could find some applications in proof assistants, e . g . for transforming and optimizing proofs. END � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 35
Index Logics and Rho ` a la Church The relation with (intuitionistic) logic through the so-called Curry-Howard isomorphism, or ‘ formulae-as-types ’ principle, has been profoundly studied for Lambda. However, for Rho ` a la Church, this relation is less clear, as demonstrated by the authors. The principle could be adapted as follows: Given a typed term A , if we can derive for A a type τ in the typed system Rho, with a derivation D er T , then the term A can be seen as the coding of a logical proof, proving the formula ϕ that can be interpreted as the type τ assigned to A . � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 36
Index Curry from Church For those systems, if D er T is a typed derivation, and � − � is the above meant erasing function, then by applying � − � to the “subject” of every judgment in D er T , we obtain a valid type assignment derivation D er U with the same structure of the typed one. Vice versa, every type assignment derivation can be viewed as the result of an application of � − � to a typed one. In particular, the erasing function � − � induces an isomorphism between every typed system and the corresponding type assignment system. △ � [ P ≪ ∆ A ] .B � [ P ≪ � A � ] . � B � = △ � f � f = △ � P → ∆ A � P → � A � = △ � X � X = △ � A B � � A � � B � = △ � A τ � � A � = △ � A ; B � � A � ; � B � = � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 37
Index Logics and Rho ` a la Curry For the type assignment system Rho the relation with logic is less clear even for the corresponding type assignments for the Lambda. The ‘formulae-as-types’ principle of Curry and Howard could be extended to the above type assignment systems as follows: Given an untyped term U , if we can assign a type τ in the type assignment system Rho, with a derivation D er U , then: • D er U can be interpreted as the coding of a proof for the logic formulas ϕ which corresponds to the interpretation of the type τ assigned to U ; • U can be interpreted as the coding of a “logical proof schema”, whose instances (of the schema) prove, respectively, all the logic formulas ϕ i ’s that can be interpreted as the types τ i ’s that can be assigned to U . � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 38
Index Typed and Untyped Judgments and Derivations ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ � D er � ▲ ☞ ▲ ☞ ✲ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ D er T D er U ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ � D er U � − 1 ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ✛ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ ▲ ☞ � · � ✲ ✛ Γ ⊢ T A : τ Γ ⊢ U � A � : τ � · � − 1 � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 39
Index Thanks for you ρ attention ... ≪ ≪ ✲ ✲ ❃ λ ω λ Pω PROP ω PRED ω ✚ ❃ ✚ ❃ ✚ ✚ ❃ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✻ ✻ ✻ ✻ ≪ 2 ≪ ✲ ✲ λ λ P 2 PROP2 PRED2 ✻ ✻ ✻ ✻ ≪ ≪ ✲ ✲ ❃ λ ω λ Pω PROP ω PRED ω ✚ ✚ ❃ ❃ ✚ ✚ ❃ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ≪ ≪ ✲ ✲ → λ λ P PROP PRED PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROP ω weakly higher-order PROP PRED ω weakly higher-order PRED PROP ω higher-order PROP PRED ω higher-order PRED � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 40
Index Thanks for you ρ attention ... ≪ ≪ ✲ ✲ ❃ λ ω λ Pω PROP ω PRED ω ✚ ❃ ✚ ❃ ✚ ✚ ❃ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✻ ✻ ✻ ✻ ≪ 2 ≪ ✲ ✲ λ λ P 2 PROP2 PRED2 ✻ ✻ ✻ ✻ ≪ ≪ ✲ ✲ ❃ λ ω λ Pω PROP ω PRED ω ✚ ✚ ❃ ❃ ✚ ✚ ❃ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ✚✚✚✚ ≪ ≪ ✲ ✲ → λ λ P PROP PRED PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROP ω weakly higher-order PROP PRED ω weakly higher-order PRED PROP ω higher-order PROP PRED ω higher-order PRED � Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 40
Recommend
More recommend