Calculus and Combinatory Logic

Calculus and Combinatory Logic

Type-Based Synthesis and the Inhabitation Problem Lecture 1: Typed λ-Calculus and Combinatory Logic Jakob Rehof TU Dortmund University, Germany The Second IPM Advanced School on Computing Theory and Practice of Programming Languages 27-31 August 2017 Tehran, Iran August 30, 2017 J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 1 / 38 λ-Calculus Untyped, pure λ-calculus H.P. Barendregt: The Lambda Calculus. Its Syntax and Semantics, Studies in Logic and the Foundations of Mathematics, 2nd Edition. Elsevier Science Publishers 1984. [Bar84] Hindley and Seldin: Lambda-Calculus and Combinators, an Introduction, Cambridge University Press 2008. [HS08] J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 2 / 38 Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 λ-Calculus in One Slide λ-calculus is a minimalistic formalism for defining functional expressions and computations with such (a minimalistic functional programming language): Assuming computational expressions such as x + 1 the operation of λ-abstraction constructs the expression λx.x + 1. An abstraction λx.M can be read as: \the function of x returning M(x)". Functional expressions are anonymous. Mathematicians sometimes use notation like x 7! x + 1, and that corresponds to λx.x + 1. In addition to the operation of abstraction there is a (dual) operation of application: If M and N are λ-expressions, then the application of M to N, written (MN), is also a λ-expression. Computation arises when abstractions are applied to arguments, for example ((λx.x + 1) 2). An expression of the form ((λx.M) N) is called a redex. Computation means substitution of arguments for the λ-abstracted variable of the function operator in a redex. For example: ((λx.x + 1) 2) !β (x + 1)[x := 2] ≡ 2 + 1 J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 3 / 38 λ-terms Let V denote a denumerable set of λ-variables, v1; v2; v3;:::. Let x; y; z; : : : denote a denumerable set of metavariables ranging over V. Definition 1 The set Λ of λ-terms, ranged over by M; N; P; Q; : : :, is defined inductively by: x 2 V ) x 2 Λ (variables) M; N 2 Λ ) (MN) 2 Λ (application) M 2 Λ; x 2 V ) (λxM) 2 Λ (abstraction) J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 4 / 38 λ-terms Notation 1 We may abbreviate (((FM1)M2) ··· Mn) by FM1M2 ··· Mn for n ≥ 0. We may abbreviate (λx1(λx2(··· (λxnM) ··· ))) by λx1.λx2: ··· λxn:M for n ≥ 0. And further, λx1.λx2: ··· λxn:M by λx1x2: ··· xn:M. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 5 / 38 λ-terms Definition 2 (Free and bound variables) The set of free variables of M, denoted FV(M), is defined by induction on M: FV(x) = fxg FV(MN) = FV(M) [ FV(N) FV(λx.M) = FV(M) n fxg A variable x 2 FV(M) is called bound in λx.M (by that λ). A term M 2 Λ is called closed, if FV(M) = ;. J. Rehof (TU Dortmund) IPM Tehran August 30, 2017 6 / 38 λ-terms Definition 3 (Syntactic identity) We write M ≡ N to denote that M and N are the same term under renaming of bound variables (α-conversion).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    53 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