1. Home
  2. Explore
  3. Computer Science
  4. Lean’s Dependent Type Theory

Study methods

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

Lean’s Dependent Type Theory

  • 87Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Lean Foundations
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is Lean?

Tap to flipClick to flipspace

An open-source interactive theorem prover and functional programming language based on dependent type theory.

Or swipe the card

87 cards

  1. What is Lean?

    An open-source interactive theorem prover and functional programming language based on dependent type theory.

  2. Who developed Lean originally, and where has its development been extended?

    Leonardo de Moura developed Lean at Microsoft Research; development has also been extended at Carnegie Mellon University and the University of Pittsburgh.

  3. What major library is actively developed for Lean?

    mathlib, which develops formalized pure mathematics and tools for programming and metaprogramming.

  4. What type-theoretic foundations does Lean use?

    Lean uses dependent type theory and is classical rather than intuitionistic.

  5. How does Lean compare with Coq's foundational system?

    Lean's system is very similar to the calculus of inductive constructions, or CIC, associated with Coq.

  6. What is the untyped lambda calculus?

    A simple model of computation developed by Alonzo Church, whose computational power is equivalent to that of Turing machines.

  7. What are the three forms of expression in the untyped lambda calculus?

    An expression is a variable, an application of one expression to another, or a lambda abstraction.

  8. What does a lambda abstraction do in the lambda calculus?

    It binds a variable within an expression.

  9. What is beta reduction?

    The process of applying a lambda abstraction to an argument by substituting the argument for the abstraction's bound variable.

  10. Why is reduction in the untyped lambda calculus described as nondeterministic?

    A term may contain multiple possible redexes, and reduction may proceed at any chosen application.

  11. What are call-by-value and call-by-name?

    They are restricted reduction strategies that specify when and where reductions are performed.

  12. What does the Church–Rosser theorem state?

    If a term reduces to two terms, then those two terms can both reduce to a common term.

  13. What is strong normalization in simple type theory?

    Every well-typed term eventually reaches a normal form under reduction.

  14. What is the main difference between the untyped and simply typed lambda calculi?

    Simply typed lambda calculus annotates lambda-bound variables with types and restricts applications using typing rules.

  15. What types are present in the basic simply typed lambda calculus described here?

    Function types and a base type of individuals.

  16. What does the variable typing rule state?

    If the context contains that variable xxx has type τ\tauτ, then xxx can be assigned type τ\tauτ.

  17. What conditions permit an application e1 e2e_1\ e_2e1​ e2​ to be typed?

    If e1e_1e1​ has a function type from α\alphaα to β\betaβ and e2e_2e2​ has type α\alphaα, then the application has type β\betaβ.

  18. What typing rule applies to a lambda abstraction?

    If, in a context extended with xxx of type α\alphaα, the body eee has type β\betaβ, then the lambda has function type from α\alphaα to β\betaβ.

  19. Why is the Y combinator not available in simply typed lambda calculus?

    It has no valid simple type.

  20. What is a dependent function type, or Pi type?

    A function type in which the result type may depend on the input value, written as a universal type such as ∀x:α, β(x)\forall x : \alpha,\ \beta(x)∀x:α, β(x).

  21. How does application work for a dependent function?

    Applying the function substitutes the argument for the bound variable in the result type.

  22. Why is a type of types needed in dependent type theory?

    It allows quantification over types, such as defining a polymorphic identity function.

  23. What is the purpose of treating terms and types as expressions in one unified system?

    It allows terms to compute at the type level and allows functions to return types.

  24. Why is the rule that type has type type inconsistent?

    It permits a version of Russell's paradox, making every proposition inhabited and therefore making all propositions provable.

  25. How does a hierarchy of universes avoid the type-in-type paradox?

    Each universe at level nnn is assigned a type in the next higher universe at level n+1n+1n+1, preventing a universe from containing itself directly.

  26. How is the universe level of a Pi type determined for ordinary universes?

    It is placed in the larger of the universes containing its domain and codomain.

  27. What is the Curry–Howard correspondence?

    The correspondence in which propositions behave like types and proofs behave like terms inhabiting those types.

  28. How are false and provable propositions represented under Curry–Howard?

    False propositions correspond to empty types; provable propositions have one or more inhabitants representing proofs.

  29. What is the universe of propositions in Lean?

    The lowest universe, denoted Prop\mathrm{Prop}Prop or U0U_0U0​, containing propositions.

  30. Why is the ordinary maximum universe rule unsuitable for propositions?

    A proposition involving a type from a higher universe could be assigned to that higher universe instead of remaining in the universe of propositions.

  31. What is the purpose of the function imax⁡\operatorname{imax}imax?

    It behaves like maximum except that when the codomain is in U0U_0U0​, the result remains in U0U_0U0​.

  32. What does impredicativity allow?

    It allows constructions involving higher-universe objects to produce propositions in the lowest universe.

  33. What problem does convertibility solve?

    It allows terms whose types reduce or compute to equivalent forms to be used interchangeably.

  34. What is definitional equality?

    A judgment that two expressions are equal by computation and the equality rules of the type theory.

  35. Which three properties make definitional equality an equivalence relation?

    Reflexivity, symmetry, and transitivity.

  36. What are compatibility rules for definitional equality?

    Rules stating that compound expressions are definitionally equal when their corresponding components are definitionally equal.

  37. What is the beta rule as a definitional equality?

    It identifies applying a lambda abstraction to an argument with the result of substituting that argument into the body.

  38. What is the eta rule?

    If eee does not depend on xxx, then a lambda that takes xxx and applies eee to xxx is definitionally equal to eee itself.

  39. What practical issue can arise from Lean's definitional equality?

    Its algorithmic approximation may fail to recognize some valid definitional equalities and can behave nontransitively.

  40. What is subject reduction?

    The property that reduction preserves typing.

  41. What are inductive types?

    Types generated from a specification containing labeled constructors.

  42. How are natural numbers represented as an inductive type?

    They have a constructor zero and a constructor successor that maps a natural number to another natural number.

  43. What does an inductive declaration provide besides the type itself?

    It provides the constructors and a recursor derived from the inductive specification.

  44. What is the natural-number recursor used for?

    Given a base element and a step function, it constructs an element for every natural number.

  45. What are the computation rules for the natural-number recursor?

    At zero, the recursor returns the base case; at a successor, it applies the step function to the predecessor and its recursive result.

  46. How does the natural-number recursor yield induction?

    When its result is a proposition, the base and step cases provide the Peano principle of induction.

  47. How can existential propositions be represented inductively?

    An inhabitant consists of a witness xxx together with a proof that the predicate holds at xxx.

  48. How can conjunction be represented as an inductive type?

    It has a constructor taking a proof of ppp and a proof of qqq, producing a proof of ppp and qqq.

  49. How can disjunction be represented as an inductive type?

    It has one constructor from a proof of ppp and another constructor from a proof of qqq.

  50. How are false and true represented inductively?

    False has no constructors, while true has exactly one constructor.

  51. What does strict positivity require for an inductive definition?

    The inductive type being defined cannot occur negatively, such as on the left side of the left side of an arrow.

  52. Why are non-strictly-positive inductive definitions rejected?

    They can produce contradictions, such as an injection from a powerset into the type itself, violating Cantor's theorem.

  53. How is equality defined as an inductive family?

    For a fixed xxx, equality is the least type inhabited only by equality of xxx with itself.

  54. What is the recursor for equality?

    It expresses substitution: if xxx equals yyy and a family CCC holds of xxx, then CCC holds of yyy.

  55. What is a subsingleton?

    A type with at most one element.

  56. What is proof irrelevance?

    Any two proofs, or inhabitants of a proposition in the lowest universe, are definitionally equal.

  57. Why is proof irrelevance incompatible with homotopy type theory?

    It conflicts with univalence because univalence can produce equality types with multiple unequal inhabitants.

  58. What is small elimination for a proposition?

    An inductive proposition with multiple possible inhabitants may be eliminated only into propositions.

  59. What is subsingleton elimination?

    It permits an inductive proposition known to have at most one inhabitant to eliminate into higher universes.

  60. Why can equality eliminate into any universe in Lean?

    Equality is a proposition that satisfies the conditions for subsingleton elimination.

  61. What is propositional extensionality?

    If propositions ppp and qqq imply each other, then they are equal.

  62. What are quotient types?

    Types generated from elements modulo an equivalence or relation, rather than freely generated by constructors.

  63. What does the axiom of choice add to Lean?

    It provides an element of a type from a proof that the type is nonempty.

  64. What logical principle follows from the axiom of choice in this system?

    The law of excluded middle, making the logic fully classical.

  65. How does nonempty differ from propositional truncation?

    nonempty is a proposition asserting that a type has an element, whereas truncation is a quotient-like construction that does not erase the same information through proof irrelevance.

  66. Why does the axiom of choice disrupt computational interpretation?

    It allows one to extract an element from a mere nonemptiness proof without providing computational data for that extraction.

  67. What is the accessibility predicate used to express?

    It expresses well-foundedness: an element is accessible when all elements smaller than it are accessible.

  68. Why is the accessibility predicate important for Lean's type theory?

    It is a recursive proposition that qualifies for subsingleton elimination into higher universes.

  69. Why can Lean's full type system be undecidable?

    Subsingleton elimination and recursive accessibility proofs can encode computations whose termination would decide an undecidable proposition.

  70. What is the distinction between ideal and algorithmic typing in Lean?

    Ideal typing uses the full definitional equality relation; algorithmic typing is an underapproximation that may reject terms that are theoretically well typed.

  71. Why can Lean's algorithmic definitional equality be nontransitive?

    If it were transitive, combining accepted conversion steps could recover the undecidable full definitional equality relation.

  72. How can identity functions sometimes help with Lean's conversion checking?

    Inserting identity functions at intermediate types can expose smaller conversion steps that Lean can recognize individually.

  73. What is a semi-decision procedure for definitional equality?

    A procedure that eventually confirms equality when the terms are definitionally equal but may run forever when they are not.

  74. How are types interpreted in the set-theoretic model?

    Types are interpreted as sets, and terms of those types are interpreted as elements of the corresponding sets.

  75. How are propositions interpreted in the set-theoretic model?

    False is interpreted as the empty set, while true is interpreted as a singleton set containing a proof object.

  76. What set-theoretic objects interpret the higher universes?

    Very large Grothendieck universes, corresponding to inaccessible cardinals.

  77. What does the soundness theorem for Lean's model state?

    If eee has type α\alphaα, then the interpretation of eee is an element of the interpretation of α\alphaα; definitional equality maps to ordinary equality.

  78. What is the unique typing theorem?

    If an expression has two types, those types are definitionally equal.

  79. Why does Lean have unique typing while Coq is more complicated in this respect?

    Lean does not have universe cumulativity, whereas Coq permits universe subtyping that can place a type in related but non-definitionally-equal universes.

  80. What is heterogeneous equality?

    An equality relation that can compare terms associated with potentially different types.

  81. What can be proved about equality of arbitrary types?

    It is generally difficult or impossible to prove that two distinct-looking types are unequal.

  82. What is the main way to distinguish two types as unequal in the discussed theory?

    Show that they have different cardinalities.

  83. How does Lean's virtual machine treat casts during evaluation?

    It ignores casts rather than necessarily reducing their recursors to a reflexivity proof.

  84. What is the purpose of a type-erasure map?

    It removes type information from terms while preserving the result of computation.

  85. What would a theory of VM overrides establish?

    It would show when replacing one definition with another in the virtual machine preserves computational results.

  86. What change was suggested to recover decidability of definitional equality?

    Restrict or eliminate subsingleton elimination, especially for recursive propositions such as accessibility.

  87. Why might separating Prop from the universe hierarchy be undesirable?

    Universe parametricity would be weakened, causing definitions that work uniformly across universe levels to require duplication or complicated special handling.

Card 1 of 87
Card 1 of 87

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent