Skip to content
The Lumenary

Each worksheet prints cleanly on A4 or Letter. Answer keys are on a separate page.

The Lumenary · Advanced undergraduate

Type theory and propositions as types

Name: ______________________

Date: ______________________

You will learn to

  • Type-check terms of the simply typed λ-calculus and read them as proofs in intuitionistic propositional logic
  • Explain dependent function (Π) and dependent pair (Σ) types and use them to express ∀ and ∃
  • Define the natural numbers and lists as inductive types and derive their induction principles from their recursors
  • Prove, with a Kripke model, that some classical tautologies such as Peirce's law are uninhabited types
  • Contrast a type-theoretic foundation such as Lean's, where every term has a type, with ZFC, where everything is a set
  1. 1.

    Under the propositions-as-types correspondence, what is a proof of A∧BA \wedge B?

    • A.A pair (a,b)(a, b) of a proof aa of AA and a proof bb of BB
    • B.A proof of AA or a proof of BB
    • C.A function from proofs of AA to proofs of BB
    • D.The truth value 'true' for both AA and BB
  2. 2.

    What is the most general simple type of λf. λg. λx. f (g x)\lambda f.\, \lambda g.\, \lambda x.\, f\,(g\, x), and hence which tautology does it prove?

    • A.(B→C)→(A→B)→A→C(B \to C) \to (A \to B) \to A \to C
    • B.(A→B)→(B→C)→A→C(A \to B) \to (B \to C) \to A \to C
    • C.(A→B)→A→B(A \to B) \to A \to B
    • D.A→B→CA \to B \to C
  3. 3.

    Which of these types are inhabited by a closed term (equivalently, are theorems of intuitionistic propositional logic)? Here p,qp, q are base types and ¬A=A→0\neg A = A \to 0. Choose all that apply.

    • A.p→¬¬pp \to \neg\neg p
    • B.¬¬p→p\neg\neg p \to p
    • C.(p→q)→(¬q→¬p)(p \to q) \to (\neg q \to \neg p)
    • D.p+¬pp + \neg p
    • E.¬¬¬p→¬p\neg\neg\neg p \to \neg p
  4. 4.

    In the two-state Kripke model w0≤w1w_0 \le w_1 with pp known only at w1w_1, which formulas are forced at w0w_0? (Rules: w⊩A→Bw \Vdash A \to B iff every v≥wv \ge w forcing AA forces BB; ⊥\bot is forced nowhere, ¬A=A→⊥\neg A = A \to \bot; w⊩A∨Bw \Vdash A \vee B iff w⊩Aw \Vdash A or w⊩Bw \Vdash B.) Choose all that apply.

    • A.¬¬p\neg\neg p
    • B.pp
    • C.¬p\neg p
    • D.p∨¬pp \vee \neg p
  5. 5.

    Let AA be a base type. How many closed β-normal terms of type A→A→AA \to A \to A are there (counting α-equivalent terms once)?

  6. 6.

    In the proof of soundness for Kripke models (Theorem 3), the →\to-introduction case goes: assume ww forces all of Γ\Gamma, let v≥wv \ge w force AA; then vv forces all of Γ,A\Gamma, A, so v⊩Bv \Vdash B by induction. Which fact justifies 'vv forces all of Γ\Gamma'?

    • A.Persistence: what is forced at ww stays forced at every v≥wv \ge w
    • B.Reflexivity of ≤\le
    • C.The induction hypothesis for Γ,A⊢B\Gamma, A \vdash B
    • D.Excluded middle at vv
  7. 7.

    With addition on N\N defined by m+zero=mm + \mathsf{zero} = m and m+succ n=succ(m+n)m + \mathsf{succ}\, n = \mathsf{succ}(m + n), why is n+0=nn + 0 = n true by computation while 0+n=n0 + n = n needs induction?

    • A.The recursion is on the second argument, so n+zeron + \mathsf{zero} unfolds by the first equation for any nn, but zero+n\mathsf{zero} + n cannot unfold until nn is known to be zero\mathsf{zero} or a successor.
    • B.Because addition is not commutative in type theory.
    • C.Because 0+n=n0 + n = n is false for some nn.
    • D.Because proofs by computation are not allowed for statements with variables.
  8. 8.

    The lesson's Lean file proves both peirce_classical (A B : Prop) : ((A → B) → A) → A and peirce_uninhabited : ¬ ∃ t, HasType [] t (((Ty.base 0 ⇒ Ty.base 1) ⇒ Ty.base 0) ⇒ Ty.base 0). Why is this not a contradiction?

    • A.The first is about Lean's own propositions and uses the axiom Classical.choice; the second is about a different formal system (the simply typed λ-calculus defined in the file), studied as a mathematical object.
    • B.One of the two proofs must contain sorry.
    • C.Lean is inconsistent.
    • D.Ty.base 0 and A are the same, so the statements contradict each other only when A is false.
  9. 9.

    Write forces(w, f, le, val) for implicational formulas in a finite Kripke model. A formula is either an atom (a string such as 'p') or a tuple ('imp', A, B). le is a set of pairs (u, v) meaning u≤vu \le v (reflexive and transitive), and val[w] is the set of atoms known at w. Use: atoms are forced when known; ('imp', A, B) is forced at w iff every v with (w, v) in le that forces A also forces B.

    Computational — Practice

Code: Apache-2.0 · Content: CC BY-SA 4.0