1. Home
  2. Explore
  3. Computer Science
  4. Lambda Calculus Fundamentals

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Lambda Calculus Fundamentals

  • 44Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Lambda Foundations

What is the lambda calculus fundamentally a theory of?

44 questions

  1. 1

    What is the lambda calculus fundamentally a theory of?

    Model answer

    It is fundamentally a theory of functions and computation.

    Explanation

    The lambda calculus studies functions as mappings from inputs to outputs and provides a formal way to describe computation.

  2. 2

    In this context, what does a function do?

    Model answer

    A function maps an input to an output, such as mapping a number to its square.

    Explanation

    For example, the square function maps the input 222 to the output 444.

  3. 3

    Why describe a function using an arbitrary variable rather than listing every input and output?

    Model answer

    An arbitrary variable lets us describe the mapping generally instead of listing the output for every possible input.

    Explanation

    For instance, xxx can stand for any input in a function that maps it to x2x^2x2.

  4. 4

    What does it mean for two functions to be alpha equivalent?

    Model answer

    They are alpha equivalent when they differ only in the name of their bound input variable and represent the same mapping.

    Explanation

    Renaming xxx to yyy in a function such as λx.x2\lambda x.x^2λx.x2 does not change which inputs map to which outputs.

  5. 5

    What is alpha conversion?

    Model answer

    Alpha conversion is renaming a function's input variable and all occurrences of that variable in its body.

    Explanation

    The renamed function remains equivalent as long as the renaming does not change the function's meaning.

  6. 6

    What do the parts of the notation λx.M\lambda x.Mλx.M signify?

    Model answer

    The lambda marks a function, xxx names its input, the dot separates the input from the body, and MMM is the body.

    Explanation

    The dot is a separator; the Greek letter lambda is a visual marker indicating that a function is being defined.

  7. 7

    What is a lambda abstraction?

    Model answer

    A lambda abstraction is a function written using lambda notation, such as λx.M\lambda x.Mλx.M.

    Explanation

    This notation concisely specifies the function's input variable and the expression that forms its output.

  8. 8

    What is function application in the lambda calculus?

    Model answer

    Function application means supplying an input to a function; the input is written to the right of the function.

    Explanation

    Applying a function is the operation that allows its body to be evaluated for a particular input.

  9. 9

    What is beta reduction?

    Model answer

    Beta reduction evaluates a function application by substituting the supplied input for the function's input variable in its body.

    Explanation

    For a function with body MMM and input variable xxx, applying it to NNN replaces occurrences of xxx in MMM with NNN.

  10. 10

    How is beta reduction marked, and what does the mark indicate?

    Model answer

    It is marked with an arrow bearing a beta, →β\to_\beta→β​, to indicate that a reduction has occurred.

    Explanation

    The beta mark distinguishes this computation step from an ordinary function definition.

  11. 11

    What does applying λx.(x+1)\lambda x.(x+1)λx.(x+1) to 333 produce, and why?

    Model answer

    It produces 444, because beta reduction substitutes 333 for xxx, yielding 3+13+13+1.

    Explanation

    The function body is evaluated after replacing its input variable with the supplied number.

  12. 12

    Which three kinds of syntax are allowed in the lambda calculus described here?

    Model answer

    Variables, lambda abstractions, and applications.

    Explanation

    The calculus uses these three forms and beta reduction to compute, without requiring additional built-in syntax.

  13. 13

    What makes a function higher-order?

    Model answer

    A function is higher-order if it can accept functions as inputs or return functions as outputs.

    Explanation

    Higher-order functions are central to how the lambda calculus expresses more complex behavior using a small set of constructs.

  14. 14

    What claim about computational power is associated with the lambda calculus in the content?

    Model answer

    The lambda calculus can express anything a computer can compute, despite using only variables, abstractions, applications, and beta reduction.

    Explanation

    The content connects this result to the Church–Turing thesis and emphasizes that no extra syntax such as loops or booleans is required.

  15. 15

    How can a calculus whose abstractions each have one input represent a function that takes two inputs?

    Model answer

    It can take the first input and return another function that takes the second input.

    Explanation

    The returned function can use the first input when producing the final result after receiving the second.

  16. 16

    What happens when a two-input curried addition function is first applied to 111?

    Model answer

    It returns a function that takes an input yyy and produces 1+y1+y1+y.

    Explanation

    The first beta reduction substitutes 111 for xxx in the inner function's body.

  17. 17

    How does the curried addition example produce the sum of 111 and 222?

    Model answer

    After the first application returns a function computing 1+y1+y1+y, applying that function to 222 gives 1+2=31+2=31+2=3.

    Explanation

    The two inputs are supplied sequentially, with a beta reduction performed for each one.

  18. 18

    For λx.λy.L\lambda x.\lambda y.Lλx.λy.L, what result is obtained by applying it successively to mmm and nnn?

    Model answer

    The result is LLL with mmm substituted for xxx and nnn substituted for yyy.

    Explanation

    The first application substitutes mmm in the inner abstraction; the second substitutes nnn in its body.

  19. 19

    What is currying, and who is it named after?

    Model answer

    Currying represents a multiple-input function as a sequence of functions, each taking one input; it is named after logician Haskell Curry.

    Explanation

    Each function returns the next function, so inputs are supplied one at a time.

  20. 20

    How are true and false represented in the Boolean encoding described?

    Model answer

    True is λx.λy.x\lambda x.\lambda y.xλx.λy.x, which returns the first input; false is λx.λy.y\lambda x.\lambda y.yλx.λy.y, which returns the second.

    Explanation

    These encodings behave like Boolean values by selecting one of two supplied terms.

  21. 21

    How is an if-then-else operation encoded using a Boolean term?

    Model answer

    It is encoded as λb.λx.λy.b x y\lambda b.\lambda x.\lambda y.b\ x\ yλb.λx.λy.b x y, which applies the Boolean bbb to the two alternatives.

    Explanation

    The function takes a Boolean and two terms, then uses the Boolean's selection behavior to choose an output.

  22. 22

    Why does the encoded if operation return its first alternative when given true?

    Model answer

    True returns its first argument, so applying it to the two alternatives selects the first one.

    Explanation

    Under the encoding, true is λx.λy.x\lambda x.\lambda y.xλx.λy.x; the alternatives occupy the first and second argument positions.

  23. 23

    Why does the encoded if operation return its second alternative when given false?

    Model answer

    False returns its second argument, so applying it to the two alternatives selects the second one.

    Explanation

    Under the encoding, false is λx.λy.y\lambda x.\lambda y.yλx.λy.y.

  24. 24

    How does beta reduction demonstrate that the encoded if operation returns MMM when its Boolean input is true?

    Model answer

    Substituting true, then MMM and NNN, reduces the expression to true applied to MMM and NNN; true selects and returns MMM.

    Explanation

    The Boolean encoding returns its first argument, so the sequence of substitutions yields the first alternative.

  25. 25

    How can the not function be expressed using the encoded Boolean and conditional concepts?

    Model answer

    It can be written as λb.if b then false else true\lambda b.\text{if }b\text{ then false else true}λb.if b then false else true.

    Explanation

    This definition swaps the Boolean values: true produces false, and false produces true.

  26. 26

    Why can Boolean and conditional definitions often be used without expanding their full lambda-calculus encodings?

    Model answer

    Once their encodings are understood, they can be treated as familiar concepts without repeatedly unfolding their low-level definitions.

    Explanation

    This lets programs use Boolean terms and conditional expressions more conveniently.

  27. 27

    What is a type in the simply typed lambda calculus?

    Model answer

    A type is a label assigned to terms to indicate that they make sense as values of a particular kind.

    Explanation

    The example system uses types such as bool\text{bool}bool and num\text{num}num.

  28. 28

    How is the type of a term written, and what does true:bool\text{true}:\text{bool}true:bool mean?

    Model answer

    A type is written after a colon; true:bool\text{true}:\text{bool}true:bool says that true has Boolean type.

    Explanation

    The colon notation associates a term with its type.

  29. 29

    What does the function type A→BA\to BA→B specify?

    Model answer

    It specifies a function that takes an input of type AAA and produces an output of type BBB.

    Explanation

    The type before the arrow describes the input, and the type after it describes the output.

  30. 30

    How is the input type shown when writing a typed lambda abstraction?

    Model answer

    The input type is written next to the input variable in the abstraction.

    Explanation

    Annotating the variable makes the type required for that function's input explicit.

  31. 31

    What type rule governs applying a typed lambda abstraction to an argument?

    Model answer

    The argument must have the same type as the one specified for the abstraction's input variable.

    Explanation

    This restriction prevents applications that would produce nonsensical terms.

  32. 32

    Why does typing the not function as bool→bool\text{bool}\to\text{bool}bool→bool prevent applying it to 111?

    Model answer

    The function requires a Boolean input, but 111 has numeric type rather than Boolean type.

    Explanation

    The type rule rejects the application before reducing it to an expression such as an if statement applied to a number.

  33. 33

    What is the simply typed lambda calculus, and what kind of programming languages does it resemble?

    Model answer

    It is the lambda calculus with a type system attached, and it resembles statically typed languages such as C and Java.

    Explanation

    Its type rules limit which terms can be applied to one another, helping rule out ill-formed expressions.

  34. 34

    When was the lambda calculus developed, and what is notable about its timing?

    Model answer

    Alonzo Church developed it between the 1930s and 1940s, before programming and computer science were formally studied.

    Explanation

    The calculus predates the formal establishment of those fields.

  35. 35

    How are types interpreted in the Curry–Howard correspondence?

    Model answer

    Types are interpreted as propositions, and a term of a type is interpreted as a proof that the corresponding proposition is true.

    Explanation

    For example, a term of type AAA represents a proof of proposition AAA.

  36. 36

    Under the interpretation described, what does the absence of a term of type AAA indicate?

    Model answer

    It indicates that the proposition corresponding to AAA is false.

    Explanation

    In this interpretation, a term of type AAA serves as evidence that proposition AAA is true.

  37. 37

    What logical proposition corresponds to the function type A→BA\to BA→B?

    Model answer

    It corresponds to the implication “if AAA, then BBB.”

    Explanation

    A function of type A→BA\to BA→B transforms an input that serves as evidence for AAA into an output that serves as evidence for BBB.

  38. 38

    In the rain example, what does the proposition A→BA\to BA→B express if AAA means “it is raining” and BBB means “the ground is wet”?

    Model answer

    It expresses: “If it is raining, then the ground is wet.”

    Explanation

    The implication says that proof of the first proposition supports the second.

  39. 39

    How does applying a function of type A→BA\to BA→B to a term of type AAA demonstrate that BBB follows?

    Model answer

    The application produces a term of type BBB, which represents a proof of proposition BBB.

    Explanation

    The function supplies the logical implication, and the input term supplies evidence for its premise.

  40. 40

    What is the Curry–Howard correspondence?

    Model answer

    It is the relationship in which types correspond to propositions and programs or terms correspond to proofs.

    Explanation

    It connects the structure of typed computation with the structure of logical reasoning.

  41. 41

    What are proof assistants, and what role does the Curry–Howard correspondence enable them to play?

    Model answer

    Proof assistants are programming environments that use the correspondence to let users write mathematical proofs as computer code.

    Explanation

    Examples mentioned include Lean and Agda.

  42. 42

    What does it mean for a proof-assistant program to type-check, as in the example proof about prime numbers?

    Model answer

    It means the program satisfies the system's type rules and is accepted as a proof of its stated result.

    Explanation

    The content presents a Lean program proving that there are infinitely many prime numbers and says its correctness is confirmed by type-checking.

  43. 43

    Besides Boolean values and conditionals, what other programming concepts does the content say can be encoded in the lambda calculus?

    Model answer

    Numbers, recursion, and data structures such as pairs can also be encoded.

    Explanation

    These encodings show how a small formal language can represent concepts commonly built into larger programming languages.

  44. 44

    Why is the lambda calculus valuable even though it is not suited to real-world programming?

    Model answer

    It provides a minimal mathematical definition of computation and supports rigorous study of programs, theoretical computer science, and mathematical logic.

    Explanation

    Its small set of rules makes it useful for reasoning about computation even though encoding ordinary features directly can be tedious.

1 of 44
Question 1 of 44

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent