Combinatory Logic and Lambda Calculus with Classical Types

Combinatory Logic and Lambda Calculus with Classical Types

Lagique A n a ly s e 137-138 (1992), 69-79 COMBINATORY LOGIC AND LAMBDA CALCULUS WITH CLASSICAL TYPES M.W. BUNDER Type Assignment in Lambda Calculus The primitive terms of lambda calculus are variables x, y, a n d possibly some constants. Other X-terms are formed by application (if X and Y are X-terms then poo is a X-term) and lambda abstraction (If X is a X-term and x a variable then (Xx.X) is a X-term). (XY) can be interpreted as the value of the function X at Y and (Xx.X) as the function whose value at x is X. There is an equality relation between X-terms which satisfies the following axiom (amongst others): (j3) ( Xx .M) N [N /x ]M( ') . Most X-terms can be assigned an associated "type". The intention is that the type tells us what kind of term we have. We will describe types and the rules for assigning them to X-terms. Types are constructed from a class of type variables and/or certain type constants using the binary operation ->. X: oQ/-* ge3 will be read "If U E oWthen (XU) E 93" Given an arbitrary assignment of types to the free variables (and constants) the types of compound X-terms are usually assigned by the following rules:( 2 ). [Nix1M is the result of substituting N for the free occurrences of x in M. For details of the definition and the full axioms and rules for equality see Hindley and Seldin [6]. ( 2 ) F o r f u l l d e t a i l s s e e H i n d l e y a n d S e l d i n [ 6 1 . 70 M W . B U N D E(X) R X : C , f2t g3 (Xx. Y): c),2"-• X:cs4T Y : (pm' (XY): Here is a formal definition of a type of a X-term and also of the principal type scheme of a X-term. Definition of Type and Principal Type Scheme (p.t.s.) If X: oWcan be derived by a n d -4., in a deduction that has no uncancelled hypotheses then X is said to have type mt. Every X-term that has a type has what is called a principal type scheme (p.t.s.) built up from type variables and A l l other types of a X-term X will be substitution instances of the p.t.s. Note that some X-terms such as (Xx.Xy.xyy)(Xz.z) have no types assigned by the rules. 1)1pe Assignment in Combinatory Logic The primitive terms of a combinatory logic are a finite set of operators called combinators. Other combinators are formed by application. Each combinator has associated with it an axiom; for example: KXY = X SXYZ = XZ(YZ) = X These combinators correspond to the following X-terms: K to Xx.Xy.x, S to Xx.Xy.Xz.xz(yz) and Ito kx.x. Given this identification and the type assignment rules of the lambda COMBINATORY LOGIC AND X CALCULUS WITH CLASSICAL TYPES 7 1 calculus we can derive the following p.t.s.s K : a ( b a ) and S : (a ( b c ) ) -0 ((a b ) ( a c ) ) . In this paper we will take these assignments of p.t.s.s to K and S as axioms and not use, directly, any of their substitution instances. To compen- sate for this we replace b y the following rule: Condensed Detachment (D) If X: nand Y: 913 and a, and 0 0 2 a r e t h e t'hes muaxbimsal ntumi bt eur otf di isotinnct type variables, then (XY) : W 1(Tshis, formulation is a somewhat more consice one than that in Hindley and (Moeredith [61f .) 0 tThe tyhpe assoignmenst axioms for K and S and rule (D) lead exactly to the p.t.s.s of combinators. In the same way p.t.s.s. of X-terms can be generated 5 e using a n d a generalised version of (D), provided that all hypotheses are i4nfitially of othe form x:a.r ) w h i = c h Faormulas as Types 2 A( special case of (D), where v, and v 2Tby :a r e i d e n t i t y s) u b s t i t u t i o n s X : c0--• : (JO ,W i s gh i v e n (XY) : a swh ich, ignoring the terms, looks like modus ponens if i s read as implica- tion and osiand g3 are formulas rather than types. t As the types for K and S are exactly the usual axioms for intuitionistic h logic and (D) encorporates some substitution and modus ponens it is not e surprising (for details see Hindley and Meredith [51) that the types are el xactly the theorems of implicational intuitionistic propositional logic. e a s t n u m b e r o f - 1 . s , f o r w h i c h a 1 ( 0 V ) h a s 72 M.W. BUNDER Classical Theorems as Types The aim of this paper is to extend the type theory and if necessary the combinatory logic or lambda calculus in such a way that the type theory becomes a full classical propositional logic rather than just an intuitionistic implicational one. The extension to classical logic can be achieved most simply by adding a constant proposition f and an axiom: ((a -4 , 0 The usual logical connectives- c-an then be defined by: o — aQt= f f pszt v = — ) and p!:2/ A Y6 — (ovt-÷ — - o We will assign a "new" combinator or X-term U the above type as p.t.s. i.e. a . : ((a -o 0 t ) -0 a The constant f seen in type terms, will be an empty type. What U does as a combinator will be investigated later. First we will look at certain classical theorems and their corresponding (extended) combinators. We will use some further combinators (definable using S and K) and their types (derivable from those for S and K): D( = X I = SKK BXYZ = X(YZ) where B = S(KS)K CXYZ = XZY C = S(BBS)(KK) WXY = XYY W CSI I : a -o a B : (a -0 b) ( ( c -0 a) -o (c -o b)) C : (a -o (b -o c)) -o (b -o (a -* c)) W : (a -o (a b ) ) -o (a -o b). COMBINATORY LOGIC AND X CALCULUS WITH CLASSICAL TYPES 7 3 Using (D) we obtain successively: BU: (c ( ( a -» 0 -• 0) ( c -• a) BUK : a Thus the p.t.s. of BUK is the well known theorem that false implies all propositions. Note also that BUK gives us exactly the proof of f -• a using the axioms or theorems B, U, and K and rule (D). The classical theorem a A b -• a can be written as ((a -* (t) 0 ) - b 0 - Its proof given by BU(CbB( BKa)) ca.n be written out as follows using (D). B: (a -0b) -• ((e -•a) -• (c -•b)) K; e -0 (d -•e) BK: (c -oe) -• (c -• (d -•e)) C: (g -•(h - • (h -.(g CB: (e -•a) -• ((a -0b) -• (c -•b)) CB(BK): ((c -• (d -0e)) -• b) ( ( c -•e) b ) U: (0 - BU: b(k 0- BU(CB(BK)): (-b(c ( d -00) -0 - • c *( The following are0 the r esults of the substitutions induced by the use of (D) in the above proof. - b k = (c -•(d -•e)) b , p j = c,I e - b b Thetheorem of cl0assical implicational logic (Peirce's law) which reduces intuitionistic logic to) cla ssical logic corresponds to the following combinator: ( BUMBS(CB)11B(BUK)])k : ((a b ) -• a) -• a 74 M.W. BUNDER Proof Transformations Combinators (or equivalently X-terms) do not only give a precise representa- tion of a proof, they also allow a proof to be transformed easily into one where the more basic axioms (of some weaker system) are used first and ones needed to extend the system to a stronger one as late as possible. We will treat the p.t.s.s of I, B, C, K and W as potential axioms for these weaker systems. The proof of a A b —> a can be rewritten as follows using the properties of B and C: BLI(CB(BK)) = CB(CB(B10)U = CB(B(CB)BK)U = B(CB)(B(CB)B)KU. As the equations for B and C preserve type (see Curry and Feys [3]) the combinator B(CB)(B(CB)B)KU also represents a proof of a A b a . Its initial part B(CB)(B(CB)B) represents the proof of a theorem in the very weak logic based on the p.t.s.s of B and C and Rule (D) and the proof is comple- ted by just two applications of (D) with respectively the types of K and U as minor premises. Note that as W is not used this is a theorem of a "classical BCK logic". We can summarise results of this kind in the following theorem. Theorem 1 Any proof in a (sub-) classical logic having at least B and C as theorems can be reorganised to the form: ZI IK KW WU -(1) where Z is a BC combinator and each of I, K, W and U will appear zero or more times. Proof A proof can be represented by a combinator involving zero or more of B, C, K, I, W and U.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us