チャーチ数とは、高階関数です。これは、引数が1つの関数fを受け取り、別の引数が1つの関数を返します。チャーチ数nは、関数f を引数として受け取り、 fのn乗合成、つまり関数f をn回自身と合成したものを返す関数です。これはf ( n )と表記され、実際にはfのn乗(演算子として考えた場合) です。f ( 0)は恒等関数として定義されます。関数の合成は結合法則を満たすため、単一の関数fのこのような繰り返し合成は、指数法則f ( m ) ∘ f ( n ) = f ( m+n )および( f ( n ) ) ( m ) = f ( m*n )の2 つの法則に従います。これが、これらの数が算術に使用できる理由です。 (チャーチのオリジナルのラムダ計算では、ラムダ式の仮引数は関数本体に少なくとも一度は出現する必要があり、そのため上記の0の定義は不可能だった。)
2 つの式PRED (SUCC n ) = nおよびPRED 0 = 0で指定される前任者関数は、かなり複雑です。
PRED := λ n .λ f .λ x。n (λ g .λ h . h ( g f )) (λ u . x ) (λ u . u )
Tが(λ g .λ h . h ( g f ))を表す場合、n > 0 に対してT ( n ) (λ u . x ) = (λ h . h ( f ( n −1) ( x )))となることを帰納的に示すことで検証できます。PREDの他の 2 つの定義を以下に示します。1 つは条件文を使用し、もう 1 つはペアを使用します。前任関数を使用すると、減算は簡単です。
≡ (λ p .λ q . p q p ) TRUE FALSE → β TRUE FALSE TRUE
≡ (λ x .λ y . x ) FALSE TRUE → β FALSE
そして、 AND TRUE FALSE はFALSEと同等であることがわかります。
A predicate is a function that returns a Boolean value. The most fundamental predicate is ISZERO, which returns TRUE if its argument is the Church numeral 0, but FALSE if its argument were any other Church numeral:
ISZERO:= λn.n (λx.FALSE) TRUE
The following predicate tests whether the first argument is less-than-or-equal-to the second:
LEQ:= λm.λn.ISZERO (SUB mn),
and since m = n if LEQ mn and LEQ nm, it is straightforward to build a predicate for numerical equality.
The availability of predicates and the above definition of TRUE and FALSE make it convenient to write "if-then-else" expressions in lambda calculus. For example, the predecessor function can be defined as:
which can be verified by showing inductively that n (λg.λk.ISZERO (g 1) k (PLUS (gk) 1)) (λv.0) is the add n − 1 function for n > 0.
Pairs
A pair (2-tuple) encapsulates two values, and is represented by an abstraction that expects a handler to which it will pass the two values. FIRST returns the first element of the pair, and SECOND returns the second.
PAIR:= λx.λy.λf.fxy
FIRST:= λp.p (λx.λy.x)
SECOND:= λp.p (λx.λy.y)
A linked list can either be NIL, representing the empty list, or a PAIR of an element (so-called head) and a smaller list (tail). The predicate NULL returns TRUE for the value NIL, and FALSE for a non-empty list:
NIL := λ f .TRUE
NULL := λ p。p (λ x .λ y .FALSE)
あるいは、NIL := FALSEの場合、構造( l (λ h .λ t .λ z . ... h ... t ...) _on_nil_)により、明示的な NULL テストは不要になります。
NIL := λ x .λ y . y
NULL := λ l。l (λ h .λ t .λ z .FALSE) TRUE
ペアの使用例として、( m , n )を( n , n + 1)にマッピングするシフトおよびインクリメント関数は次のように定義できます。
このletの注目すべき制約は、名前f をN内で参照できないことです。なぜなら、N は抽象化束縛fのスコープ外であり、そのスコープはMだからです。つまり、letを使用して再帰関数定義を記述することはできません。letrec [ f ]という構成を使用すれば、抽象化束縛fのスコープにNとMの両方が含まれる再帰関数定義を記述できます。あるいは、 Yコンビネータにつながるような自己適用を使用することもできます。
再帰と不動点
再帰とは、関数が自身を呼び出すことです。このような関数を表す値とはどのようなものでしょうか。定義が自身の中で自身を参照するように、何らかの方法で自身の中で自身を参照する必要があります。この値が値によって自身を含む場合、無限のサイズにならなければならず、それは不可能です。再帰をネイティブにサポートする他の表記法では、定義の中で関数を名前で参照することでこの問題を克服しています。ラムダ計算では、そもそも項に名前がなく、引数の名前、つまり抽象化のパラメータしかないため、これを表現することはできません。したがって、ラムダ式は引数として自身を受け取り、対応するパラメータの名前を介して自身(のコピー)を参照することができます。実際に自身を引数として呼び出した場合は、これはうまく機能します。たとえば、 (λ x . x x ) E = ( EE )は、 Eが再帰呼び出しを表現するために本体内でパラメータを自身に適用する抽象化である場合に再帰を表現します。このパラメータは値としてEを受け取るため、その自己適用は再び同じ(EE)になります。
Iは恒等関数です。SKとBCKW は、任意のラムダ項を表現できる 完全なコンビネータ計算システムを形成します。次のセクションを参照してください。ΩはUUであり、正規形を持たない最小の項です。YIも同様の項です。Y は標準であり、上記で定義されています。また、 Y = BU(CBU)と定義することもできるため、 Y g=g( Y g)となります。上記で定義されたTRUEとFALSE は、一般的にTとFと略記されます。
抽象化の排除
N が抽象化を持たないラムダ項であり、名前付き定数 (コンビネータ) を含む可能性がある場合、 λ x . Nと同等でありながら抽象化を持たないラムダ項T ( x , N )が存在する(名前付き定数の一部である場合を除く。ただし、これらが非原子的であるとみなされる場合)。これは変数の匿名化とも考えられ、T ( x , N ) はNからxのすべての出現箇所を削除する一方で、 Nにxが含まれている位置に引数の値を代入することは可能である。変換関数T は次のように定義できる。
T ( x , x ) := I
T ( x , N ) := K N、xがNに含まれていない 場合
T ( x , M N ) := S T ( x , M ) T ( x , N )
いずれの場合も、 T ( x , N ) Pの形式の項は、最初のコンビネータI、K、またはS が引数Pを取得することによって、 (λ x . N ) Pの β 還元と同様に還元されます。I はその引数を返します。K N は、 Nにx の自由な出現がない場合の(λ x . N )と同様に、引数を破棄します。S は、引数を適用の 2 つのサブ項に渡してから、最初の結果を 2 番目の結果に適用します。これは、(λ x . MN ) Pが((λ x . M ) P ) ((λ x . N ) P )と同じであるのと同様です。
表現する-削減、なぜなら(λ x . N x ) P は、このような場合N Pと同じであり、より長いシーケンスS ( K N ) Iの作成を回避できるからである。
型付きラムダ計算
型付きラムダ計算は、ラムダ記号 () to denote anonymous function abstraction. In this context, types are usually objects of a syntactic nature that are assigned to lambda terms; the exact nature of a type depends on the calculus considered (see Kinds of typed lambda calculi). From a certain point of view, typed lambda calculi can be seen as refinements of the untyped lambda calculus but from another point of view, they can also be considered the more fundamental theory and untyped lambda calculus a special case with only one type.[29]
Typed lambda calculi are foundational programming languages and are the base of typed functional programming languages such as ML and Haskell and, more indirectly, typed imperative programming languages. Typed lambda calculi play an important role in the design of type systems for programming languages; here typability usually captures desirable properties of the program, e.g., the program will not cause a memory access violation.
Whether a term is normalising or not, and how much work needs to be done in normalising it if it is, depends to a large extent on the reduction strategy used. Common lambda calculus reduction strategies include:[31][32][33]
Normal order
The leftmost outermost redex is reduced first. That is, whenever possible, arguments are substituted into the body of an abstraction before the arguments are reduced. If a term has a beta-normal form, normal order reduction will always reach that normal form.
Applicative order
The leftmost innermost redex is reduced first. As a consequence, a function's arguments are always reduced before they are substituted into the function. Unlike normal order reduction, applicative order reduction may fail to find the beta-normal form of an expression, even if such a normal form exists. For example, the term is reduced to itself by applicative order, while normal order reduces it to its beta-normal form .
Full β-reductions
Any redex can be reduced at any time. This means essentially the lack of any particular reduction strategy—with regard to reducibility, "all bets are off".
Weak reduction strategies do not reduce under lambda abstractions:
↑ Church, Alonzo (1940). "A Formulation of the Simple Theory of Types". Journal of Symbolic Logic . 5 (2): 56–68 . doi : 10.2307/2266170 . JSTOR 2266170 . S2CID 15889861 .
↑ Partee, BBH; ter Meulen, A. ; Wall, RE (1990). Mathematical Methods in Linguistics . Springer. ISBN97890277224542016年12月29日に取得。
↑ Alama, Jesse. Zalta, Edward N. (編). "ラムダ計算" .スタンフォード哲学百科事典(2013 年夏版) . 2020 年11 月 17 日取得.
↑ Felleisen, Matthias; Flatt, Matthew (2006), Programming Languages and Lambda Calculi (PDF) , p. 26, 2009年2月5日にオリジナル(PDF)からアーカイブ済み元の場所にある注記(2017年アクセス)によると、著者らは、最初に参照された作品は書籍によって置き換えられたと考えているようです。
↑ Selinger, Peter (2008), Lecture Notes on the Lambda Calculus (PDF) , vol. 0804, Department of Mathematics and Statistics, University of Ottawa, p. 9, arXiv : 0804.3434 , Bibcode : 2008arXiv0804.3434S
↑ブルース、キム・B. (2002).オブジェクト指向言語の基礎:型と意味論. MIT Press. p. 151. ISBN978-0-262-02523-2。
1 2 Zena M. Ariola および Stefan Blom、 Proc. TACS '94仙台、日本 1997 (1997) 巡回ラムダ計算114 ページ。
↑ Ker, Andrew D. 「ラムダ計算と型」(PDF) . p. 6 . 2022年1月14日取得.
↑ Dezani-Ciancaglini, Mariangiola; Ghilezan, Silvia (2014). "Preciseness of Subtyping on Intersection and Union Types" (PDF) . Rewriting and Typed Lambda Calculi . Lecture Notes in Computer Science. Vol. 8560. p. 196. doi : 10.1007/978-3-319-08918-8_14 . hdl : 2318/149874 . ISBN978-3-319-08917-12022年1月14日に取得。
↑ Forster, Yannick; Smolka, Gert (2019年8月) 「Coqにおける計算モデルとしての呼び出し値ラムダ計算」(PDF) . Journal of Automated Reasoning . 63 (2): 393– 413. doi : 10.1007/s10817-018-9484-2 . S2CID 53087112 . 2022年1月14日取得.
↑ Sestoft, Peter (2002). "ラムダ計算の簡約の実証" (PDF) . The Essence of Computation . Lecture Notes in Computer Science. Vol. 2566. pp. 420–435 . doi : 10.1007/3-540-36377-7_19 . ISBN978-3-540-00326-72022年8月22日に取得。
↑ Frandsen, Gudmund Skovbjerg; Sturtivant, Carl (1991年8月26日). 「λ計算の効率的な実装とは何か?」 .関数型プログラミング言語とコンピュータアーキテクチャ:第5回ACM会議。米国マサチューセッツ州ケンブリッジ、1991年8月26日~30日。議事録。Lecture Notes in Computer Science。第523巻。Springer -Verlag。pp. 289–312。CiteSeerX 10.1.1.139.6913。doi : 10.1007/ 3540543961_14。ISBN9783540543961。
↑ Sinot, F.-R. (2005). "Director Strings Revisited: A Generic Approach to the Efficient Representation of Free Variables in Higher-order Rewriting" (PDF) . Journal of Logic and Computation . 15 (2): 201– 218. doi : 10.1093/logcom/exi010 .
↑ Accattoli, Beniamino; Dal Lago, Ugo (2014年7月14日). 「ベータ還元は確かに不変である」.第23回EACSLコンピュータサイエンス論理年次会議(CSL)および第29回ACM/IEEEコンピュータサイエンス論理シンポジウム(LICS)合同会議議事録. pp. 1–10 . arXiv : 1601.01233 . doi : 10.1145/2603088.2603105 . ISBN9781450328869. S2CID 11485010 .
Barendregt, Hendrik Pieter、「論理学とコンピュータ科学におけるラムダ計算の影響」。『記号論理学紀要』第3巻、第2号、1997年6月。
Barendregt, Hendrik Pieter、「型自由ラムダ計算」、『数理論理学ハンドブック』 1091–1132ページ、North-Holland (1977) ISBN0-7204-2285-X
Cardone, Felice および Hindley, J. Roger、2006 年。「ラムダ計算と組み合わせ論理の歴史」 。Wayback Machineに 2021 年 5 月6 日にアーカイブされました。Gabbay および Woods (編)、Handbook of the History of Logic、第 5 巻。Elsevier。
Frink Jr., Orrin (1944). 「レビュー: Alonzo Church によるラムダ変換の計算」 (PDF) . Bulletin of the American Mathematical Society . 50 (3): 169– 172. doi : 10.1090/s0002-9904-1944-08090-7 .
Kleene, Stephen, A theory of positive integers in formal logic, American Journal of Mathematics, 57 (1935), pp.153–173 and 219–244. Contains the lambda calculus definitions of several familiar functions.
Landin, Peter, A Correspondence Between ALGOL 60 and Church's Lambda-Notation, Communications of the ACM, vol. 8, no. 2 (1965), pages 89–101. Available from the ACM site. A classic paper highlighting the importance of lambda calculus as a basis for programming languages.
Larson, Jim, An Introduction to Lambda Calculus and Scheme. A gentle introduction for programmers.
Michaelson, Greg (10 April 2013). An Introduction to Functional Programming Through Lambda Calculus. Courier Corporation. ISBN978-0-486-28029-5.[1]
Schalk, A. and Simmons, H. (2005) An introduction to λ-calculi and arithmetic with a decent selection of exercises. Notes for a course in the Mathematical Logic MSc at Manchester University.
de Queiroz, Ruy J.G.B. (2008). "On Reduction Rules, Meaning-as-Use and Proof-Theoretic Semantics". Studia Logica. 90 (2): 211–247. doi:10.1007/s11225-008-9150-5. S2CID11321602. A paper giving a formal underpinning to the idea of 'meaning-is-use' which, even if based on proofs, it is different from proof-theoretic semantics as in the Dummett–Prawitz tradition since it takes reduction as the rules giving meaning.
Hankin, Chris, An Introduction to Lambda Calculi for Computer Scientists,ISBN0954300653
Monographs/textbooks for graduate students
Sørensen, Morten Heine and Urzyczyn, Paweł (2006), Lectures on the Curry–Howard isomorphism, Elsevier, ISBN0-444-52077-5 is a recent monograph that covers the main topics of lambda calculus from the type-free variety, to most typed lambda calculi, including more recent developments like pure type systems and the lambda cube. It does not cover subtyping extensions.
Pierce, Benjamin (2002), Types and Programming Languages, MIT Press, ISBN0-262-16209-1 covers lambda calculi from a practical type system perspective; some topics like dependent types are only mentioned, but subtyping is an important topic.
Documents
A Short Introduction to the Lambda Calculus-(PDF) by Achim Jung
A Tutorial Introduction to the Lambda Calculus-(PDF) by Raúl Rojas
Lecture Notes on the Lambda Calculus-(PDF) by Peter Selinger
Graphic lambda calculus by Marius Buliga
Lambda Calculus as a Workflow Model by Peter Kelly, Paul Coddington, and Andrew Wendelborn; mentions graph reduction as a common means of evaluating lambda expressions and discusses the applicability of lambda calculus for distributed computing (due to the Church–Rosser property, which enables parallel graph reduction for lambda expressions).
External links
Graham Hutton, Lambda Calculus, a short (12 minutes) Computerphile video on the Lambda Calculus
Helmut Brandl, Step by Step Introduction to Lambda Calculus