Upcoming SlideShare
×

# Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard isomorphism

404 views

Published on

A novel approach to giving an interpretation of logic inside category theory. This work has been developed as part of my sabbatical Marie Curie fellowship in Leeds.
Presented at the Logic Seminar, School of Mathematics, University of Leeds (2012).

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
404
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
4
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Intuitionistic First-Order Logic: Categorical semantics via the Curry-Howard isomorphism

1. 1. Intuitionistic First-Order LogicCategorical semantics via the Curry-Howard isomorphism Marco Benini M.Benini@leeds.ac.uk Department of Pure Mathematics University of Leeds 14th November 2012
2. 2. IntroductionAn observation: in part D of P. Johnstone’s Sketches of an Elephant, thereis a categorical semantics for the simply typed λ-calculus. In the very sameclass of models, one can give a semantics to the corresponding fragment ofpropositional logic.The problem:is it possible to do the same for full ﬁrst-order intuitionistic logic? 2 of 32
3. 3. IntroductionJohstone’s account comes from Lambek and Scott’s Introduction toHigher-Order Categorical Logic. The considered propositional logic isminimal logic limited to conjunction and implication.In Taylor, Practical Foundation of Mathematics, one ﬁnds that the treatmentof disjunction requires distributive categories in order to follow the samepattern as the previous works.To my knowledge, no categorical semantics appears in literature whichmodels the full ﬁrst-order intuitionistic logic AND the correspondingλ-calculus. 3 of 32
4. 4. The λ-calculusDeﬁnition 1 (Lambda signature)A λ-signature Σ = 〈S , F , R , Ax〉 is a structure where1. 〈S , F , R 〉 is a logical signature, i.e., 1.1 a set S of sort symbols; 1.2 a set F of function symbols, each one decorated as f : s1 × · · · × sn → s0 , with s0 , . . . , sn ∈ S; 1.3 a set R of relation symbols, each one decorated as r : s1 × · · · × sn , with s1 , . . . , sn ∈ S;2. Ax is the set of axiom symbols, each one decorated as a : A → B where A, B ∈ λTypes(Σ) and FV(A → B ) = .We call LTerms(Σ) the collection of logical terms constructed from thesignature Σ, assuming to have a denumerable set of variables Vs for eachs ∈ S. 4 of 32
5. 5. The λ-calculusDeﬁnition 2 (Lambda type)Fixed a λ-signature Σ, the λ-types on Σ are inductively deﬁned along withtheir free variables as follows:1. 0, 1 ∈ λTypes(Σ) and FV(0) = FV(1) = ;2. if p : s1 × · · · × sn ∈ R and t1 : s1 , . . . , tn : sn ∈ LTerms(Σ), then p(t1 , . . . , tn ) ∈ λTypes(Σ) and FV(p(t1 , . . . , tn )) = n=1 FV(ti : si ); i3. if A, B ∈ λTypes(Σ) then A × B , A + B , A → B ∈ λTypes(Σ) and FV(A × B ) = FV(A + B ) = FV(A → B ) = FV(A) ∪ FV(B );4. if x ∈ Vs and A ∈ λTypes(Σ) then ∀x : s. A, ∃x : s. A ∈ λTypes(Σ) and FV(∀x : s. A) = FV(∃x : s. A) = FV(A) {x : s}. 5 of 32
6. 6. The λ-calculusDeﬁnition 3 (Lambda term)Fixed a λ-signature Σ = 〈S , F , R , Ax〉, for each type t ∈ λTypes(Σ), weassume there is a denumerable set Wt of (typed) variables.A λ-term is inductively deﬁned together with its free variables as:1. if x ∈ Wt then x : t ∈ λTerms(Σ) and FV(x : t ) = {x : t };2. if f : A → B ∈ Ax and t : A ∈ λTerms(Σ) then f (t ): B ∈ λTerms(Σ) and FV(f (t ): B ) = FV(t : A);3. if s : A, t : B ∈ λTerms(Σ) then 〈s, t 〉 : A × B ∈ λTerms(Σ) and FV(〈s, t 〉 : A × B ) = FV(s : A) ∪ FV(t : B );4. if t : A × B ∈ λTypes(Σ) then fst(t ): A ∈ λTerms(Σ), snd(t ): B ∈ λTerms(Σ) and FV(fst(t ): A) = FV(snd(t ): B ) = FV(t : A × B ); → 6 of 32
7. 7. The λ-calculus → (Lambda term) 5. if t : A ∈ λTerms(Σ) then inlB (t ): A + B ∈ λTerms(Σ), inrB (t ): B + A ∈ λTerms(Σ) and FV(inlB (t ): A + B ) = FV(inrB (t ): B + A) = FV(t : A); 6. if s : A + B , t : A → C , r : B → C ∈ λTerms(Σ) then when(s, t , r ): C ∈ λTerms(Σ) and FV(when(s, t , r ): C ) = FV(s : A + B ) ∪ FV(t : A → C ) ∪ FV(r : B → C ); 7. if x ∈ WA and t : B ∈ λTerms(Σ) then (λx : A. t ): A → B ∈ λTerms(Σ) and FV((λx : A. t ): A → B ) = FV(t : B ) {x : A}; 8. if s : A → B , t : A ∈ λTerms(Σ) then s · t : B ∈ λTerms(Σ) and FV(s · t : B ) = FV(s : A → B ) ∪ FV(t : A); 9. ∗ : 1 ∈ λTerms(Σ) and FV(∗ : 1) = ;10. FA : 0 → A ∈ λTerms(Σ) and FV(FA : 0 → A) = ; → 7 of 32
8. 8. The λ-calculus → (Lambda term)11. if x ∈ Vs and t : A ∈ λTerms(Σ) where x : s ∈ FV∗ (t : A), then allI(λx : s. t ):(∀x : s. A) ∈ λTerms(Σ) and FV(allI(λx : s. t ):(∀x : s. A)) = FV(t : A);12. if t :(∀x : s. A) ∈ λTerms(Σ) and r : s ∈ LTerms(Σ) then allE(t , r ):(A[r /x ]) ∈ λTerms(Σ) and FV(allE(t , r ):(A[r /x ])) = FV(t :(∀x : s. A));13. if x ∈ Vs , r : s ∈ LTerms(Σ) and t :(A[r /x ]) ∈ λTerms(Σ) then exIx (t ):(∃x : s. A) ∈ λTerms(Σ) and FV(exIx (t ):(∃x : s. A)) = FV(t :(A[r /x ]));14. if t :(∃x : s. A), ∈ λTerms(Σ) and r : A → B ∈ λTerms(Σ) where x : s ∈ FV∗ (r : A → B ), then exE(t , (λx : s. r )): B ∈ λTerms(Σ) and FV(exE(t , (λx : s. r )): B ) = FV(t :(∃x : s. A)) ∪ FV(r : A → B ). In the previous deﬁnition, x : s ∈ FV∗ (t : A) if and only if there is r ∈ λTypes(Σ) and y ∈ Wr such that x : s ∈ FV(r ) and y : r ∈ FV(t : A). 8 of 32
9. 9. The λ-calculus Deﬁnition 4 (Lambda calculus) A derivation is inductively deﬁned by the following inference rules, whose antecedents and consequents are equalities-in-context within a ﬁxed λ-signature Σ:(eq0 ) x : A. s =C t y : B . s[r1 /x1 , . . . , rn /xn ] =C t [r1 /x1 , . . . , rn /xn ] where, for any 1 ≤ i ≤ n, y : B . ri : Ai is a term-in-context;  (x : A. s1 =B1 t1 )   . .(eq1 ) . x : A. r [s/y ] =C r [t /y ];  (x : A. sm =Bm tm ) (eq2 ) x : A. x =A x;(eq3 ) x : A, y : A. x =A y x : A, y : A. y =A x; (x : A, y : A, z : A. x =A y )(eq4 ) x : A, y : A, z : A. x =A z; (x : A, y : A, z : A. y =A z ) → 9 of 32
10. 10. The λ-calculus → (Lambda calculus)(eq5 ) x : A. s =C t x : A. (λy : B . s) =B →C (λy : B . t );(eq6 ) x : A. r =C t x : A. allI(λy : s. r ) =(∀y : s. C ) allI(λy : s. t );(eq7 ) x : A. u =C v x : A. exE(t , (λy : s. u )) =C exE(t , (λy : s. v ));(×0 ) x : 1. x =1 ∗;(×1 ) x : A, y : B . fst(〈x , y 〉) =A x;(×2 ) x : A, y : B . snd(〈x , y 〉) =B y ;(×3 ) z : A × B . 〈fst(z ), snd(z )〉 =A×B z;(+0 ) x : A. when(inlB (a), t , s) =C t · a;(+1 ) x : A. when(inrD (b), t , s) =C s · b; → 10 of 32
11. 11. The λ-calculus → (Lambda calculus)(+2 ) when y : A1 ∈ FV(x1 : A1 + A2 ) ∪ FV(x3 : B1 → C ) ∪ FV(x4 : B2 → C ) and y : A2 ∈ FV(x2 : A1 + A2 ) ∪ FV(x3 : B1 → C ) ∪ FV(x4 : B2 → C ) x0 : A1 + A2 , x1 : A1 → (B1 + B2 ), x2 : A2 → (B1 + B2 ), x3 : B1 → C , x4 : B2 → C . when(when(x0 , x1 , x2 ), x3 , x4 ) =C =C when(x0 , (λy : A1 . when(x1 · y , x3 , x4 )), (λy : A2 . when(x2 · y , x3 , x4 ))) ; (+3 ) x : A, y : 0. FA ·y =A x;(→0 ) x : A. (λy : C . s) · t =B s[t /y ];(→1 ) x : A. (λy : C . t · y ) =C →B t where y : C ∈ FV(t : C → B ); (∀0 ) x : A. allE(allI(λz : s. t ), r ) =B [r /z ] t [r /z ];(∀1 ) x : A. allE(u , r ) =B allE(v , r ) r : s∈LTerms(Σ) x : A. u =(∀z : s. B ) v ; → 11 of 32
12. 12. The λ-calculus → (Lambda calculus)(∃0 ) x : A. exE(exIz (t ), (λz : s. v )) =B (v [r /z ]) · t;(∃1 ) x : A. exE(u , (λz : s. r )) =B exE(u , (λz : s. t )) x : A. r =C →B t where FV(r : C → B ) = FV(t : C → B );(∃2 ) v :(∃y : s. A). w =B exE(v , (λy : s. (λz : A. w [exIy (z )/v ]))) with z : A ∈ FV(w : B );(∃3 ) x : A. exE(exE(a, (λy : s. (λz : D . b))), (λy : s. c )) =C =C exE(a, (λy : s. (λz : D . exE(b, (λy : s. c )))));(∃4 ) x : A. exE(a, (λy : s. (λz : C . b[exIy (z )/w ]))) =B b[a/w ] with z : C ∈ FV(b : B ). 12 of 32
13. 13. SemanticsDeﬁnition 5 (Logically distributive category)Fixed a λ-signature Σ = 〈S , F , R , Ax〉, a category C together with a mapM : λTypes(Σ) → Obj C is said to be logically distributive if it satisﬁes thefollowing seven conditions:1. C has ﬁnite products;2. C has ﬁnite co-products;3. C has exponentiation;4. C is distributive, i.e., for every A, B , C ∈ Obj C, the arrow ∆ = [1A × ι1 , 1A × ι2 ]: (A × B ) + (A × C ) → A × (B + C ) has an inverse, where [_, _] is the co-universal arrow of the (A × B ) + (A × C ) co-product, _ × _ is the product arrow, 1A is the identity arrow on A, and ι1 : B → B + C, ι2 : C → B + C are the canonical injections of the B + C co-product. → 13 of 32
14. 14. Semantics→ (Logically distributive category)For every s ∈ S, A ∈ λTypes(Σ), and x ∈ Vs , letΣA (x : s): LTerms(Σ)(s) → C be the functor from the discrete categoryLTerms(Σ)(s) = t : s | t : s ∈ LTerms(Σ) to C deﬁned by t : s → M (A[t /x ]).Also, for every s ∈ S, A ∈ λTypes(Σ), and x ∈ Vs , let C(∀x : s. A) be thesubcategory of C whose objects are the vertices of the cones on ΣA (x : s)such that they are of the form MB for some B ∈ λTypes(Σ) andx : s ∈ FV(B ). Moreover, the arrows of C(∀x : s. A) , apart identities, are thearrows in the category of cones over ΣA (x : s) having the objects ofC(∀x : s. A) as domain and M (∀x : s. A) as co-domain. → 14 of 32
15. 15. Semantics→ (Logically distributive category)Finally, for every s ∈ S, A ∈ λTypes(Σ), and x ∈ Vs , let C(∃x : s. A) be thesubcategory of C whose objects are the vertices of the co-cones onΣA (x : s) such that they are of the form MB for some B ∈ λTypes(Σ) andx : s ∈ FV(B ). Moreover, the arrows of C(∃x : s. A) , apart identities, are thearrows in the category of co-cones over ΣA (x : s) having the objects ofC(∃x : s. A) as co-domain and M (∃x : s. A) as domain.5. All the subcategories C(∀x : s. A) have terminal objects, and all the subcategories C(∃x : s. A) have initial objects; → 15 of 32
16. 16. Semantics→ (Logically distributive category)6. The M map is such that 6.1 M (0) = 0, the initial object of C; 6.2 M (1) = 1, the terminal object of C; 6.3 M (A × B ) = MA × MB, the binary product in C; 6.4 M (A + B ) = MA + MB, the binary co-prooduct in C; 6.5 M (A → B ) = MB MA , the exponential object in C; 6.6 M (∀x : s. A) is the terminal object in the subcategory C(∀x : s. A) ; 6.7 M (∃x : s. A) is the initial object in the subcategory C(∃x : s. A) ;7. For every x ∈ Vs , A, B ∈ λTypes(Σ) with x : s ∈ FV(A), MA × M (∃x : s. B ) is an object of C(∃x : s. A×B ) since, if M (∃x : s. B ), {δt }t : s∈LTerms(Σ) is a co-cone over ΣB (x : s), and there is one by condition (5), then MA × M (∃x : s. B ), {1MA ×δt }t : s∈LTerms(Σ) is a co-cone over ΣA×B (x : s). Thus, there is a unique arrow !: M (∃x : s. A × B ) → MA × M (∃x : s. B ) in C(∃x : s. A×B ) . Our last condition requires that the arrow ! has an inverse. 16 of 32
17. 17. SemanticsDeﬁnition 6 (Σ-structure)Given a λ-signature Σ = 〈S , F , R , Ax〉, a Σ-structure is a triple 〈C, M , MAx 〉such that C together with M forms a logically distributive category and MAxis a map from Ax such that MAx (a : A → B ) ∈ HomC (MA, MB ). 17 of 32
18. 18. SemanticsDeﬁnition 7 (λ-terms semantics)Fixed a Σ-structure 〈C, M , MAx 〉, let A ≡ A1 × · · · An , and letx ≡ x1 : A1 , . . . , xn : An be a context. The semantics of a term-in-contextx . t : B, notation x . t : B , is an arrow in HomC (MA, MB ) inductively deﬁnedas follows:1. x . xi : Ai = πi , the i-th projector of the product MA = MA1 × · · · × MAn ;2. if a : C → B ∈ Ax then x . a(t ): B = MAx a ◦ x . t : C ;3. x . 〈s, t 〉 : B × C = ( x . s : B , x . t : C ) where (_, _) is the universal arrow of the product MB × MC;4. x . fst(t ): B = π1 ◦ x . t : B × C where π1 is the ﬁrst canonical projector of the product MA × MB;5. x . snd(t ): C = π2 ◦ x . t : B × C where π2 is the second canonical projector of the product MA × MB; → 18 of 32
19. 19. Semantics→ (λ-terms semantics)6. x . (λz : C . t ): C → B is the exponential transpose of x , z : C . t : B : MA × MC → MB;7. x . s · t : B = ev ◦ ( x . s : C → B , x . t : C ) where ev is the exponential evaluation arrow;8. x . inlB (t ): C + B = ι1 ◦ x . t : C with ι1 the ﬁrst canonical injection of the co-product MC + MB;9. x . inrC (t ): C + B = ι2 ◦ x . t : B with ι2 the second canonical injection of the co-product MC + MB; → 19 of 32
20. 20. Semantics → (λ-terms semantics)10. calling [_, _] the co-universal arrow of (MA × MC1 ) + (MA × MC2 ), (_, _) the universal arrow of MA × (MC1 + MC2 ), and noticing that the arrow ∆ : (MA × MC1 ) + (MA × MC2 ) → MA × (MC1 + MC2 ) has an inverse because C with M is logically distributive x . when(t , u , v ): B = [ev ◦ ( x . u : C1 → B × 1MC1 ) , ev ◦ ( x . v : C2 → B × 1MC2 )] ◦ ◦ ∆−1 ◦ (1MA , x . t : C1 + C2 ) ;11. x . ∗ : 1 =!: MA → 1, the universal arrow of the terminal object;12. x . FB : 0 → B is the exponential transpose of (!: 0 → MB ) ◦ (πn+1 : MA × 0 → 0); → 20 of 32
21. 21. Semantics → (λ-terms semantics)13. x . allI(λz : s. t ):(∀z : s. B ) = β ◦ α where α ≡ 1MAi1 × · · · × 1MAik : MA → MA with A ≡ Ai1 × · · · × Aik , where x ≡ {xi1 : Ai1 , . . . , xik : Aik } = FV(t : B ), and β : MA → M (∀z : s. B ) is the universal arrow from MA to the terminal object in C∀z : s. B ;14. x . allE(t , r ): B [r /z ] = pr ◦ x . t :(∀z : s. B ) where pr : M (∀z : s. B ) → M (B [r /z ]) is the r -th projector of the unique cone on ΣB (z : s) whose vertex is M (∀z : s. B ). It is worth noticing that pr = w :(∀z : s. B ). allE(w , r ): B [r /z ] ;15. x . exIz (t ):(∃z : s. B ) = jr ◦ x . t : B [r /z ] where jr : M (B [r /z ]) → M (∃z : s. B ) is the r -th injection of the unique co-cone on ΣB (z : s) whose vertex is M (∃z : s. B ). It is worth noticing that jr = w : B [r /z ]. exIz (w ):(∃z : s. B ) ; → 21 of 32
22. 22. Semantics → (λ-terms semantics)16. x . exE(t , (λz : s. r )): B = γ ◦ β−1 ◦ (α, x . t :(∃z : s. C ) ) where 16.1 α ≡ 1MAi1 × · · · × 1MAik : MA → MA with A ≡ Ai1 × · · · × Aik , where x ≡ {xi1 : Ai1 , . . . , xik : Aik } = FV(t :(∃z : s. C )) ∪ FV(r : C → B ); 16.2 β : M (∃z : s. A × C ) → MA × M (∃z : s. C ) is the co-universal arrow in the subcategory C∃z : s. A ×C ; 16.3 γ : M (∃z : s. A × C ) → MB is the co-universal arrow in C∃z : s. A ×C . 22 of 32
23. 23. SoundnessDeﬁnition 8 (Validity)An equality-in-context x . s =A t is valid in the λ-theory T , a set ofequalities-in-context, when, in every logically distributive category C, eachmodel M of T is also a model of x . s =A t.A Σ-structure M in C is a model of a theory T when it is a model of each φin T .Finally, M is a model of an equality-in-context x . t =A s if x . t : A = x . s : A .Theorem 9 (Soundness)If an equation-in-context x . s =A t is derivable from a λ-theory T , thenx . s =A t is valid in each model of T in every logically distributive category. 23 of 32
24. 24. CompletenessDeﬁnition 10 (Syntactical equivalence)Given a λ-theory T , the syntactical equivalence of two terms-in-context isdeﬁned by ﬁxing the generated equivalence classes. Precisely, theequivalence class [x : A. t : B ] is deﬁned as the minimal set, composed byterms-in-context, such that1. x : A. t : B ∈ [x : A. t : B ]—reﬂexivity;2. if T y : D . s =C r , where y : D . s =C r is an equality-in-context, and y : D . s : C ∈ [x : A. t : B ], then y : D . r : C ∈ [x : A. t : B ]—closure under provable equivalence; → 24 of 32
25. 25. Completeness→ (Syntactical equivalence)3. if y : D . s : C is a term-in-context and, for some 1 ≤ i < m and z : Di × Di +1 ∈ FV(s : C ) ∪ y1 : D1 , . . . , ym : Dm , it happens that y1 : D1 , . . . , yi −1 : Di −1 , z : Di × Di +1 , yi +1 : Di +2 , . . . , ym : Dm . s[fst(z )/yi ][snd(z )/yi +1 ]: C ∈ [x : A. t : B ] , then y : D . s : C ∈ [x : A. t : B ]—closure under associativity in contexts;4. if y : D . s : C is a term-in-context and, for some 1 ≤ i < m and z : Di +1 × Di ∈ FV(s : C ) ∪ y1 : D1 , . . . , ym : Dm , it happens that y1 : D1 , . . . , yi −1 : Di −1 , z : Di +1 × Di , yi +1 : Di +2 , . . . , ym : Dm . s[snd(z )/yi ][fst(z )/yi +1 ]: C ∈ [x : A. t : B ] , then y : D . s : C ∈ [x : A. t : B ]—closure under commutativity in contexts; → 25 of 32
26. 26. Completeness→ (Syntactical equivalence)5. if y : D . s : C ∈ [x : A. y : B ] and z : Di ∈ FV(s : C ) ∪ y1 : D1 , . . . , ym : Dm for some 1 ≤ i ≤ m, then y1 : D1 , . . . , yi −1 : Di −1 , z : Di , yi +1 : Di +1 , . . . , ym : Dm . s[z /yi ]: C is in [x : A. t : B ]—closure under α-renaming in contexts. 26 of 32
27. 27. CompletenessDeﬁnition 11 (Syntactical category)Given a λ-theory T , the syntactical category CT has λTypes(Σ) as objects,where Σ is the λ-signature of T , and the equivalence classes[x : A. t : B ]: A → B as arrows.Identities are given by the classes [x : A. x : A]: A → A for each λ-type A,and composition is given by substitution: [y : B . s : C ] ◦ [x : A. t : B ] = [x : A. s[t /y ]: C ] .Moreover, the map MT : λTypes(Σ) → Obj CT is deﬁned as MT A = A. 27 of 32
28. 28. CompletenessProposition 12The CT category is logically distributive.Proposition 13Given a λ-theory T on the Σ signature, the Σ-structure 〈CT , MT , MAx 〉 onthe corresponding syntactical category is deﬁned by MAx which mapsf : A → B ∈ Ax to [x : A. f (x ): B ].This Σ-structure is a model for T and, moreover, it satisﬁes exactly thoseequalities-in-context which are provable in T . 28 of 32
29. 29. CompletenessProposition 14For every logically distributive category C, there is a biijection betweenequivalence classes, modulo natural equivalences, of structure-preservingfunctors CT → C and equivalence classes, modulo isomorphisms, ofmodels of T in C, induced by the map F → F (MT ).Theorem 15 (Completeness)If x . s =A t is an equality-in-context valid in every model for T in eachlogically distributive category, then T x . s =A t. 29 of 32
30. 30. Soundness and Completeness in LogicDeﬁnition 16 (Valid type)A λ-type A is valid in the model N = 〈N, N , NAx 〉 when there exists anarrow 1 → NA in N.A λ-type A is a logical consequence in the model N of the λ-typesB1 , . . . , Bn when there exists N (B1 × · · · × Bn ) → NA in N.A λ-type A is a logical consequence of B1 , . . . , Bn when it is a logicalconsequence of B1 , . . . , Bn in every model in every logically distributivecategory. 30 of 32
31. 31. Soundness and Completeness in LogicProposition 17A λ-type A is a logical consequence of B1 , . . . , Bn if and only if there exists aterm-in-context x : B1 × · · · × Bn . t : A.Corollary 18A λ-type A is a logical consequence of B1 , . . . , Bn if and only if there is aproof of A from the hypotheses B1 , . . . , Bn , when λ-types are interpreted aslogical formulae and λ-terms as logical proofs, according to theCurry-Howard isomorphism. 31 of 32
32. 32. The end Questions?32 of 32