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

  • 100Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Lean Foundations

What is Lean, and what are two of its primary uses?

100 questions

  1. 1

    What is Lean, and what are two of its primary uses?

    Model answer

    Lean is an open-source interactive theorem prover and functional programming language. It is used for formalized mathematics, software verification, programming, and metaprogramming.

    Explanation

    Lean combines theorem proving with functional programming and metaprogramming capabilities.

  2. 2

    What type theory is Lean based on?

    Model answer

    Lean is based on dependent type theory.

    Explanation

    Dependent type theory allows types to depend on terms, which supports expressing richer mathematical properties in types.

  3. 3

    How is Lean's logical foundation characterized with respect to classical logic and homotopy type theory?

    Model answer

    Lean is classical rather than intuitionistic, and it is not based on homotopy type theory.

    Explanation

    Lean includes classical principles such as the law of excluded middle and uses proof irrelevance, which conflicts with standard homotopy type theory assumptions such as univalence.

  4. 4

    How is Lean's type theory related to the calculus of inductive constructions used by Coq?

    Model answer

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

    Explanation

    The systems share dependent types, universes, inductive types, and propositions-as-types, although their precise features differ.

  5. 5

    What is the role of the mathlib library in the Lean ecosystem?

    Model answer

    mathlib develops formalized pure mathematics as well as tools for programming and metaprogramming.

    Explanation

    The library extends Lean with a substantial body of reusable mathematical results and development tools.

  6. 6

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

    Model answer

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

    Explanation

    These three syntactic forms are the basic grammar of the untyped lambda calculus.

  7. 7

    What does a lambda abstraction do in the lambda calculus?

    Model answer

    A lambda abstraction binds a variable within a term and represents a function.

    Explanation

    The bound variable can occur in the abstraction's body and is replaced when the function is applied.

  8. 8

    What is beta reduction?

    Model answer

    Beta reduction evaluates an application by substituting the argument for the variable bound by a lambda abstraction.

    Explanation

    It transforms an application of the form of a function to an argument into the function body with the argument substituted for the bound variable.

  9. 9

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

    Model answer

    A reduction step may be performed at different applications within a term, so there may be multiple possible reduction sequences.

    Explanation

    A term can have several reducible subexpressions, and unrestricted reduction permits choosing any of them.

  10. 10

    What can happen to a reduction sequence in the untyped lambda calculus?

    Model answer

    A term may reduce to different intermediate terms, may have an infinite reduction sequence, or may have no applicable reduction.

    Explanation

    The unrestricted calculus does not guarantee that evaluation terminates.

  11. 11

    Who developed the lambda calculus, and what was it intended to model?

    Model answer

    Alonzo Church developed the lambda calculus as a simple model of computation.

    Explanation

    The lambda calculus is a foundational formal model for representing functions and computation.

  12. 12

    How does the computational power of the lambda calculus compare with that of Turing machines?

    Model answer

    The lambda calculus and Turing machines are equivalent in computational power.

    Explanation

    Each model can simulate the computations expressible by the other.

  13. 13

    What is the Church-Rosser theorem?

    Model answer

    It states that if an expression reduces to both e1e_1e1​ and e2e_2e2​, then there is a term e′e'e′ to which both e1e_1e1​ and e2e_2e2​ can reduce.

    Explanation

    This confluence property means that different reduction choices can eventually be joined, even if some reduction paths are infinite.

  14. 14

    How do call-by-value and call-by-name differ from unrestricted lambda-calculus reduction?

    Model answer

    Call-by-value and call-by-name impose specific strategies for choosing reductions, whereas unrestricted reduction permits all possible reduction choices.

    Explanation

    The underlying beta-reduction rule is the same, but the evaluation strategy restricts which redex is reduced and when.

  15. 15

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

    Model answer

    In the simply typed calculus, lambda-bound variables have explicit type annotations.

    Explanation

    Typing information restricts which applications and abstractions are well formed.

  16. 16

    What types are available in the basic simply typed system described?

    Model answer

    The system contains function types and a base type of individuals.

    Explanation

    The base type ensures that the theory contains at least one type, while function types describe mappings between types.

  17. 17

    What does the variable typing rule state?

    Model answer

    If the context \Gamma contains x:τx : \taux:τ, then xxx has type τ\tauτ in that context.

    Explanation

    The rule checks the context for an assumption assigning a type to the variable.

  18. 18

    What conditions are required to type an application e1e2e_1 e_2e1​e2​?

    Model answer

    The function e1e_1e1​ must have a function type with domain α\alphaα and codomain β\betaβ, and e2e_2e2​ must have type α\alphaα; then e1e2e_1 e_2e1​e2​ has type β\betaβ.

    Explanation

    The argument's type must match the function's domain before application is permitted.

  19. 19

    What does the lambda typing rule state?

    Model answer

    If eee has type β\betaβ in the context extended with x:αx : \alphax:α, then λx:α.e\lambda x : \alpha. eλx:α.e has type α→β\alpha \to \betaα→β.

    Explanation

    A lambda abstraction is typed as a function from the type of its parameter to the type of its body.

  20. 20

    What is strong normalization in the simply typed lambda calculus?

    Model answer

    Strong normalization is the property that every well-typed term eventually reduces to a normal form.

    Explanation

    Typing excludes nonterminating terms that exist in the untyped calculus, so every reduction sequence terminates.

  21. 21

    Why is the Y combinator not available in simple type theory?

    Model answer

    The Y combinator can be written in the untyped lambda calculus, but it has no valid typing in simple type theory.

    Explanation

    Its behavior would permit unrestricted self-application and nontermination, which conflicts with strong normalization.

  22. 22

    How does a dependent function type generalize an ordinary function type?

    Model answer

    A dependent function type has the form ∀x:α,β\forall x : \alpha, \beta∀x:α,β, where the result type β\betaβ may refer to the argument xxx.

    Explanation

    An ordinary arrow type α→β\alpha \to \betaα→β is the special case in which β\betaβ does not depend on xxx.

  23. 23

    How does application work for a dependent function?

    Model answer

    When a dependent function is applied to an argument, the argument is substituted for the bound variable in the result type.

    Explanation

    If a function has type ∀x:α,β(x)\forall x : \alpha, \beta(x)∀x:α,β(x) and receives a:αa : \alphaa:α, its result has type β(a)\beta(a)β(a).

  24. 24

    Why is a universe of types needed to define a polymorphic identity function?

    Model answer

    A polymorphic identity function must quantify over a variable that is itself a type, so the system needs a type whose elements are types.

    Explanation

    A universe such as UUU permits expressions that abstract over types rather than only over ordinary values.

  25. 25

    What is gained by combining terms and types into one class of expressions?

    Model answer

    The system can express functions whose results are types, enabling computation at the type level.

    Explanation

    This unified treatment is a major source of the expressive power of dependent type theory.

  26. 26

    Why is the rule Type:Type\mathrm{Type} : \mathrm{Type}Type:Type inconsistent?

    Model answer

    It permits a type to contain itself as an element, allowing a version of Russell's paradox and making every proposition inhabitable.

    Explanation

    Self-containing universes create a circularity that collapses the distinction between propositions and proofs.

  27. 27

    How does a hierarchy of universes avoid the inconsistency of Type:Type\mathrm{Type} : \mathrm{Type}Type:Type?

    Model answer

    It assigns each universe a higher universe as its type: Un:Un+1U_n : U_{n+1}Un​:Un+1​, preventing a universe from directly containing itself.

    Explanation

    The hierarchy breaks the circularity responsible for the paradox.

  28. 28

    How are universe levels combined when forming a dependent function type?

    Model answer

    The universe level of a dependent function is determined by the larger level of its components, using the universe-level operation imax.

    Explanation

    This prevents the resulting type from being assigned an artificially low universe level.

  29. 29

    What does the Curry-Howard correspondence say?

    Model answer

    It identifies propositions with types and proofs of propositions with terms inhabiting those types.

    Explanation

    Under this correspondence, proving a proposition means constructing an element of its corresponding type.

  30. 30

    How are false and provable propositions represented under Curry-Howard?

    Model answer

    A false proposition corresponds to an empty type, while a provable proposition has one or more inhabitants.

    Explanation

    The existence of a term of a proposition's type represents the existence of a proof.

  31. 31

    Why do the arrow and forall types correspond to logical implication and universal quantification?

    Model answer

    A function from proofs of one proposition to proofs of another represents implication, and a dependent function that works for every argument represents universal quantification.

    Explanation

    Thus P→QP \to QP→Q corresponds to PPP implying QQQ, while ∀x,P(x)\forall x, P(x)∀x,P(x) corresponds to a proof of P(x)P(x)P(x) for every xxx.

  32. 32

    What is the universe of propositions, and how is it denoted?

    Model answer

    The universe of propositions is the lowest universe, U0U_0U0​, and it is denoted by PPP or Prop.

    Explanation

    Propositions are treated as a special class of types whose inhabitants are proofs.

  33. 33

    Why would interpreting every proposition using the ordinary maximum of universe levels be undesirable?

    Model answer

    A proposition involving natural numbers could then be assigned to a higher universe rather than remaining in the universe of propositions.

    Explanation

    For example, combining a proposition in U0U_0U0​ with natural numbers in U1U_1U1​ would yield level U1U_1U1​ under ordinary max.

  34. 34

    What is imax, and why is it used for propositions?

    Model answer

    imax behaves like max, except that when the relevant proposition level is 000, it returns 000. This keeps quantified propositions in U0U_0U0​.

    Explanation

    This special rule is called impredicativity and allows higher-level objects to be reflected into the lowest universe of propositions.

  35. 35

    What is impredicativity in the described type theory?

    Model answer

    Impredicativity is the ability to form an object in a universe using quantification over a collection that includes the universe itself, allowing certain high-level constructions to return to U0U_0U0​.

    Explanation

    In Lean, the imax rule provides this behavior for propositions.

  36. 36

    Why is a convertibility judgment needed in a dependent type system?

    Model answer

    It allows terms whose types reduce or compute to the same expression to be accepted as having compatible types.

    Explanation

    Without convertibility, a term of type τ\tauτ might not be usable where a definitionally equal type such as the identity function applied to τ\tauτ is expected.

  37. 37

    What does it mean for two types to be definitionally equal?

    Model answer

    Two types are definitionally equal when the type theory identifies them through its built-in equality and computation rules.

    Explanation

    Definitional equality is checked by the type system rather than supplied as an ordinary proof.

  38. 38

    What are the three equivalence properties of definitional equality?

    Model answer

    Definitional equality is reflexive, symmetric, and transitive on well-typed terms.

    Explanation

    These properties make it an equivalence relation in the idealized typing theory.

  39. 39

    What do compatibility rules for definitional equality express?

    Model answer

    They state that if corresponding parts of compound expressions are definitionally equal, then the whole compound expressions are definitionally equal.

    Explanation

    For example, equal components of applications or function types produce equal applications or function types.

  40. 40

    What is the beta rule for definitional equality?

    Model answer

    The beta rule identifies the application of a lambda abstraction with the result of substituting its argument into the abstraction's body.

    Explanation

    It treats ordinary beta reduction as a definitional equality.

  41. 41

    What is the eta rule described in the type theory?

    Model answer

    If eee does not depend on xxx, then λx.ex\lambda x. e xλx.ex is definitionally equal to eee.

    Explanation

    Eta equality identifies a function with the lambda expression that applies it to an arbitrary argument.

  42. 42

    What are inductive types?

    Model answer

    Inductive types are types generated from a specified collection of labeled constructors, together with associated recursors and computation rules.

    Explanation

    They provide a general mechanism for defining data types and propositions constructively.

  43. 43

    How are the natural numbers specified as an inductive type?

    Model answer

    The natural numbers have a constructor zero and a constructor succ that maps a natural number to another natural number.

    Explanation

    They are the smallest type freely generated by these constructors.

  44. 44

    What does it mean for the natural numbers to be the smallest type freely generated by zero and successor?

    Model answer

    Every natural number is generated from zero by finitely many applications of succ, and no additional elements are included.

    Explanation

    This minimality is captured by the natural-number recursor and its induction principle.

  45. 45

    What is the purpose of the recursor for natural numbers?

    Model answer

    It defines a dependent function on natural numbers by providing a value at zero and a rule for producing the value at the successor of each number.

    Explanation

    Given a family C(n)C(n)C(n), a base case in C(0)C(0)C(0), and a step from C(n)C(n)C(n) to C(n+1)C(n+1)C(n+1), the recursor produces an element of C(n)C(n)C(n) for every nnn.

  46. 46

    What do the computation rules for the natural-number recursor specify?

    Model answer

    The recursor applied to zero reduces to its base case, and the recursor applied to a successor reduces using the step function and the recursive result for the predecessor.

    Explanation

    These rules make recursive definitions computationally meaningful.

  47. 47

    How does natural-number recursion yield mathematical induction?

    Model answer

    When the dependent family and recursor are placed in the proposition universe, the base and successor cases become the usual induction principle for natural numbers.

    Explanation

    The type-theoretic recursor is the computational form of the Peano induction axiom.

  48. 48

    How can existential propositions be represented as inductive types?

    Model answer

    An existential type has a constructor that takes an element xxx and a proof of P(x)P(x)P(x), producing a proof of ∃x,P(x)\exists x, P(x)∃x,P(x).

    Explanation

    Its recursor permits reasoning by cases on the witness and its proof.

  49. 49

    How can conjunction be represented as an inductive type?

    Model answer

    The conjunction P∧QP \land QP∧Q has a constructor that takes a proof of PPP and a proof of QQQ and produces a proof of P∧QP \land QP∧Q.

    Explanation

    The two constructor arguments correspond to the two required components of a conjunction proof.

  50. 50

    How can disjunction be represented as an inductive type?

    Model answer

    The disjunction P∨QP \lor QP∨Q has one constructor taking a proof of PPP and another taking a proof of QQQ.

    Explanation

    Either constructor is sufficient to produce a proof of the disjunction.

  51. 51

    How are false and true represented as inductive propositions?

    Model answer

    False is an inductive proposition with no constructors, while true has exactly one named constructor.

    Explanation

    No constructor means there is no proof of false, whereas the single constructor supplies the unique proof of true.

  52. 52

    What does strict positivity require of an inductive specification?

    Model answer

    The inductive type being defined cannot occur to the left of the left side of an arrow in a constructor argument.

    Explanation

    This restriction prevents negative recursive occurrences that can make the theory inconsistent.

  53. 53

    Why would the proposed negative inductive definition of bad be inconsistent?

    Model answer

    It would produce an injective function from the powerset of bad, represented as bad -> 2, into bad, contradicting Cantor's theorem.

    Explanation

    Because Cantor's theorem rules out such an injection, allowing the definition would yield a contradiction.

  54. 54

    How is equality defined as an inductive family?

    Model answer

    For a given xxx, equality is the least type inhabited only by the reflexivity constructor, which proves x=xx = xx=x.

    Explanation

    The constructor refl supplies reflexivity, and the inductive family is indexed by the terms being compared.

  55. 55

    What principle is represented by the equality recursor?

    Model answer

    The equality recursor expresses substitution: if x=yx = yx=y and a property or type family holds for xxx, it also holds for yyy.

    Explanation

    Equality allows one term to replace another in dependent contexts.

  56. 56

    What is a subsingleton?

    Model answer

    A subsingleton is a type with at most one element.

    Explanation

    If two elements exist in a subsingleton, they must be equal.

  57. 57

    What is proof irrelevance?

    Model answer

    Proof irrelevance states that any two proofs, viewed as elements of the proposition universe, are definitionally equal.

    Explanation

    The identity of a proof does not matter computationally or definitionally when the proof inhabits a proposition.

  58. 58

    Why does proof irrelevance conflict with homotopy type theory?

    Model answer

    Proof irrelevance is incompatible with univalence because univalence can produce equality types with multiple unequal inhabitants.

    Explanation

    Thus proof irrelevance, also related to axiom K, prevents Lean's system from supporting standard homotopy type theory.

  59. 59

    What is small elimination for a proposition with multiple constructors?

    Model answer

    If an inductive proposition has multiple possible inhabitants, its recursor may eliminate it only into propositions, not into arbitrary higher universes.

    Explanation

    This restriction prevents proof irrelevance from erasing computationally significant distinctions in larger types.

  60. 60

    What is subsingleton elimination?

    Model answer

    Subsingleton elimination permits an inductive proposition to eliminate into higher universes when its constructors ensure that it has at most one inhabitant.

    Explanation

    Because all inhabitants are already indistinguishable, using such a proposition to construct data in larger universes is considered safe.

  61. 61

    Why can equality eliminate into any universe despite being a proposition?

    Model answer

    Equality is a subsingleton-eliminating proposition because its structure ensures that its proofs are uniquely determined.

    Explanation

    Consequently, the equality recursor can be used to produce results in arbitrary universes.

  62. 62

    What condition allows some propositions to eliminate into higher universes?

    Model answer

    Their nonrecursive constructor arguments must themselves be propositions or must occur in the final result type in an allowed way.

    Explanation

    This condition ensures that eliminating the proposition does not reveal computational information that proof irrelevance should hide.

  63. 63

    What does propositional extensionality assert?

    Model answer

    If propositions PPP and QQQ imply each other, then PPP and QQQ are equal.

    Explanation

    It allows propositions with the same logical content to be substituted for one another and is a weak form of univalence at the propositional level.

  64. 64

    How are quotient types different from freely generated inductive types?

    Model answer

    Quotient types are generated up to an equivalence relation rather than freely from constructors.

    Explanation

    Their constructors and lifting operation respect a relation rrr, so related representatives are identified.

  65. 65

    What is the role of the lifting operation for quotient types?

    Model answer

    The lifting operation permits a function to be defined on quotient classes when the function preserves the quotient relation.

    Explanation

    A function must give the same result for related representatives in order to descend to the quotient.

  66. 66

    How is the proposition nonempty alpha defined?

    Model answer

    nonempty alpha is a proposition with one constructor that maps an element of α\alphaα to an element of nonempty alpha.

    Explanation

    It records only that α\alphaα has an inhabitant, without retaining a usable computational witness.

  67. 67

    What does the axiom of choice add to nonempty alpha?

    Model answer

    It provides an element of α\alphaα from an element of nonempty alpha.

    Explanation

    This direction has no computational interpretation and is included to support classical mathematics.

  68. 68

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

    Model answer

    The law of excluded middle follows, so the resulting logic is fully classical.

    Explanation

    The law of excluded middle states that every proposition is either true or false.

  69. 69

    How does nonempty alpha differ from propositional truncation?

    Model answer

    nonempty alpha lies in Prop and loses computational witness information, whereas propositional truncation through a quotient need not be a proposition and can preserve more information.

    Explanation

    The distinction affects whether proofs are definitionally identified and whether computational content can be recovered.

  70. 70

    Why do the combined axioms make the type system undecidable?

    Model answer

    Subsingleton elimination and related reduction behavior can encode computations whose termination depends on undecidable propositions.

    Explanation

    The interaction can make definitional equality depend on questions such as whether a computation eventually finds a counterexample.

  71. 71

    What does the inductive type acc represent?

    Model answer

    acc represents accessibility: an element is accessible when every element smaller than it is accessible.

    Explanation

    Accessibility is used to express well-foundedness of a relation.

  72. 72

    Why is acc important in the undecidability argument?

    Model answer

    acc is a proposition that nevertheless has a recursor into any universe because it is subsingleton eliminating and recursive.

    Explanation

    Its recursive elimination can repeatedly unfold computations without consuming ordinary computational fuel.

  73. 73

    How can an accessibility proof encode an unbounded search?

    Model answer

    A recursively defined function can test a proposition at successive natural numbers, continue when the test succeeds, and return zero when it finds a failure.

    Explanation

    Repeated reduction then simulates searching through all natural numbers, so termination can depend on an undecidable condition.

  74. 74

    Why can definitional equality depend on an undecidable proposition in the accessibility example?

    Model answer

    Two terms can be definitionally equal exactly when the encoded search eventually reaches a particular result, which can correspond to the existence of a counterexample to a universal proposition.

    Explanation

    Determining equality would therefore require solving an undecidable question.

  75. 75

    How can the undecidability argument be transferred out of an inconsistent context?

    Model answer

    Both sides of the definitional equality can be lambda-abstracted over the assumed accessibility proof, producing two functions whose definitional equality has the same undecidable dependence.

    Explanation

    This shows that the phenomenon is not merely an artifact of leaving an inconsistent assumption explicitly in the context.

  76. 76

    What is Lean's algorithmic typing judgment in relation to the ideal typing rules?

    Model answer

    It is an underapproximation of the ideal rules: Lean may reject a term that is theoretically well typed because it does not perform an unbounded computation.

    Explanation

    The algorithm favors a practical decision procedure over recognizing every instance of ideal definitional equality.

  77. 77

    Why can Lean's practical definitional equality fail to be transitive?

    Model answer

    If the algorithmic relation were transitive while remaining an underapproximation, it could recover the undecidable ideal relation.

    Explanation

    Therefore practical checking gives up transitivity in rare cases rather than becoming undecidable.

  78. 78

    How can identity functions sometimes help Lean recognize a desired type conversion?

    Model answer

    Inserting identity functions at intermediate types can break one difficult conversion into smaller conversion steps that Lean's algorithm can verify.

    Explanation

    The technique exposes a transitivity path that the checker may fail to discover in one large conversion.

  79. 79

    What is subject reduction, and does Lean have it in the described setting?

    Model answer

    Subject reduction is the property that reduction preserves typing. The described Lean system does not have this property for all of its evaluation behavior.

    Explanation

    Some inserted identity functions or related terms can act as blockers and cannot simply be reduced while preserving the expected typing judgment.

  80. 80

    Why might ordinary propositional equality be preferred over definitional equality in practice?

    Model answer

    Ordinary equality is often more stable because it avoids relying on fragile or unpredictable unfolding behavior in definitional equality.

    Explanation

    Dependent types still make conversion important, but developers may avoid depending on complex definitional reductions when possible.

  81. 81

    How does the set-theoretic model interpret types and their elements?

    Model answer

    A type is interpreted as a set, and an element of that type is interpreted as an element of the corresponding set.

    Explanation

    Dependent functions are interpreted as set-theoretic dependent functions.

  82. 82

    How are propositions interpreted in the described set-theoretic model?

    Model answer

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

    Explanation

    Classical logic and proof irrelevance force propositions to behave like sets with either zero or one element.

  83. 83

    What set-theoretic structures interpret the higher universes?

    Model answer

    Higher universes are interpreted as very large Grothendieck universes, corresponding to inaccessible cardinals.

    Explanation

    These structures must be closed under the relevant function types and inductive constructions.

  84. 84

    What does the soundness theorem say about typing and definitional equality?

    Model answer

    If eee has type α\alphaα, its interpretation is an element of the interpretation of α\alphaα; if two expressions are definitionally equal, their interpretations are ordinarily equal.

    Explanation

    This establishes that Lean's formal system is consistent with the set-theoretic interpretation.

  85. 85

    What is unique typing?

    Model answer

    Unique typing states that if an expression has two types, those types are definitionally equal.

    Explanation

    This ensures that an expression is associated with one universe level up to definitional equality.

  86. 86

    Why is unique typing needed for the set-theoretic model?

    Model answer

    The model needs each type to have a well-defined universe in which it lives.

    Explanation

    Unique typing prevents the same expression from being assigned incompatible universe levels.

  87. 87

    Why does universe cumulativity complicate the analogous unique-typing result in Coq?

    Model answer

    Cumulativity allows a type to be used at multiple universe levels through a subtyping relationship, so those levels need not be definitionally equal.

    Explanation

    Lean's stated unique-typing result is simpler because Lean does not use universe cumulativity.

  88. 88

    What is heterogeneous equality?

    Model answer

    Heterogeneous equality is an equality relation that can compare terms associated with potentially different types.

    Explanation

    The content notes that even the principle that application preserves heterogeneous equality is not generally provable.

  89. 89

    Why is it difficult to prove that two types are unequal in Lean?

    Model answer

    Many syntactically different types may be identified by the theory, so syntactic difference alone does not prove inequality.

    Explanation

    For example, even natural numbers and an independently defined identical copy of natural numbers may not be provably unequal.

  90. 90

    What is the strongest general method described for proving that two types are unequal?

    Model answer

    One can show that the types have different cardinalities, because equal types must have the same cardinality.

    Explanation

    Cardinality provides a semantic invariant that equality cannot violate.

  91. 91

    What does the Lean virtual machine do with casts during evaluation?

    Model answer

    The virtual machine ignores casts rather than evaluating their recursors all the way to reflexivity.

    Explanation

    This allows it to evaluate terms that may become temporarily ill typed during execution while still obtaining the intended final result.

  92. 92

    What is a type-erasure map intended to accomplish?

    Model answer

    A type-erasure map removes type information from terms while preserving the result of computation.

    Explanation

    Such a theory could help justify optimized virtual-machine implementations and valid VM overrides.

  93. 93

    What is a VM override?

    Model answer

    A VM override replaces one definition with another implementation in the virtual machine while aiming to preserve the original computational result.

    Explanation

    A sound theory of type erasure and reduction preservation would help establish when such replacements are valid.

  94. 94

    What is the difference between a decision procedure and a semidecision procedure for definitional equality?

    Model answer

    A decision procedure always terminates with a yes-or-no answer, whereas a semidecision procedure eventually confirms equality when it holds but may run forever otherwise.

    Explanation

    The more complete reduction strategy discussed can find a valid equality eventually but cannot guarantee termination on unequal terms.

  95. 95

    What design change was suggested as a way to recover decidability?

    Model answer

    The most direct proposal was to eliminate subsingleton elimination, possibly restricting it only to nonrecursive cases such as equality.

    Explanation

    Recursive subsingleton elimination, as used by accessibility, enables the problematic unbounded reductions.

  96. 96

    Why might restricting subsingleton elimination to nonrecursive propositions preserve more of Lean's ecosystem?

    Model answer

    Equality is nonrecursive, while accessibility is recursive, so this restriction could retain useful equality elimination while removing the source of the undecidability problem.

    Explanation

    The tradeoff is that some well-foundedness proofs would become ordinary types rather than propositions.

  97. 97

    Why might separating Prop from U0U_0U0​ simplify the universe rules?

    Model answer

    It would remove the need to use the special imax operation and avoid rules that behave differently when a universe level is zero.

    Explanation

    However, separating them could create duplication and interfere with universe-parametric definitions.

  98. 98

    What is universe parametricity?

    Model answer

    Universe parametricity allows definitions to be generalized over universe-level expressions or variables rather than being tied to one fixed level.

    Explanation

    A definition can therefore work uniformly for all suitable universe levels, including cases involving levels such as u+1u+1u+1.

  99. 99

    Why does universe parametricity make separating propositions from ordinary universes difficult?

    Model answer

    A universe-parametric definition may be a proposition at one level and an ordinary type at another, so separating the two categories would require handling such definitions throughout the language.

    Explanation

    Automation might duplicate definitions for the two cases, but this risks substantial code growth.

  100. 100

    What is one possible cost of automatically duplicating definitions for Prop and non-Prop cases?

    Model answer

    Automatic duplication could cause exponential blowup in the number of generated definitions.

    Explanation

    Multiple universe variables can create many combinations of proposition and non-proposition cases.

1 of 100
Question 1 of 100

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent