Algorithm Search⌘K

Theoremcore

Type soundness

Also called progress and preservation, well-typed programs do not go wrong.

A well-typed closed term never reaches a stuck state. For the simply typed lambda calculus it follows from progress (a value or a step) and preservation (a step keeps the type).

Type soundness is the theorem that a well-typed program cannot reach a state that the semantics leaves undefined. Milner (1978) stated it as "well-typed expressions do not go wrong" for a denotational semantics. Wright and Felleisen (1994) gave the syntactic form that most papers now use: it splits soundness into progress and preservation, two lemmas proved by induction on typing derivations. This page states and proves the theorem for one system, the simply typed lambda calculus with call-by-value small steps. Other systems follow the same plan with more lemmas.

Statement

The system is the one defined on the simply typed lambda calculus page: base types Bool\mathsf{Bool} and Int\mathsf{Int}, the arrow, conditionals and integer addition, with the typing rules T-Var, T-Abs, T-App, T-True, T-False, T-If, T-Int and T-Add, and the call-by-value small-step rules E-App1, E-App2, E-AppAbs, E-IfTrue, E-IfFalse, E-If, E-Add1, E-Add2 and E-AddInt. The values are the abstractions, true\mathsf{true}, false\mathsf{false} and the integer literals. A closed term is stuck if it is not a value and no rule gives it a next step.

Theorem (type soundness). Let tt be a closed term.

  1. Progress. If ⊢t:T\vdash t : T, then tt is a value or there is a t′t' with t→t′t \to t'.
  2. Preservation. If Γ⊢t:T\Gamma \vdash t : T and t→t′t \to t', then Γ⊢t′:T\Gamma \vdash t' : T.
  3. Safety. If ⊢t:T\vdash t : T and t→∗t′t \to^* t', then t′t' is not stuck. If t′t' is a value, then ⊢t′:T\vdash t' : T.

In plain words

Think of the program as a machine that rewrites itself one small step at a time. It can fail in only one way: it reaches a point where the next operation gets the wrong kind of value, such as adding a truth value to a number. The theorem says that this never happens to a program that passes the type checker. The proof has two halves. The first says that a typed program is either finished or can make one more step. The second says that a step never changes the type. Put the two together, step by step, and the program stays typed and never gets stuck. Both halves depend on the exact rules for running the program, so the guarantee is only as strong as those rules.

Proof

The proof file has the full proof. It uses four lemmas, in the order of Section 9.3 of Pierce's book.

  1. Inversion. The rules are syntax directed, so the form of a typed term fixes the last rule of its derivation and the types of its parts. For example, if Γ⊢t1 t2:R\Gamma \vdash t_1\,t_2 : R, then Γ⊢t1:T11→R\Gamma \vdash t_1 : T_{11} \to R and Γ⊢t2:T11\Gamma \vdash t_2 : T_{11} for some T11T_{11}.
  2. Canonical forms. A closed value of type Bool\mathsf{Bool} is true\mathsf{true} or false\mathsf{false}, a closed value of type Int\mathsf{Int} is a literal, and a closed value of type T1→T2T_1 \to T_2 is an abstraction λx:T1. t\lambda x{:}T_1.\,t. This holds because the three kinds of values get three different kinds of types.
  3. Permutation and weakening. Reordering the context, or adding a fresh variable to it, keeps every typing.
  4. Substitution. If Γ,x:S⊢t:T\Gamma, x{:}S \vdash t : T and Γ⊢s:S\Gamma \vdash s : S, then Γ⊢[x:=s] t:T\Gamma \vdash [x := s]\,t : T.

Progress goes by induction on the derivation of ⊢t:T\vdash t : T. T-Var cannot occur in the empty context. The value rules give values. For T-App, the induction hypothesis makes the function either step (E-App1) or a value, then the argument either step (E-App2) or a value, and in the last case canonical forms make the function an abstraction, so E-AppAbs applies. T-If and T-Add are the same, with canonical forms for Bool\mathsf{Bool} and Int\mathsf{Int}.

Preservation goes by induction on the derivation of Γ⊢t:T\Gamma \vdash t : T, with a case for each step rule. The congruence rules (E-App1, E-App2, E-If, E-Add1, E-Add2) use the induction hypothesis on the part that steps. E-IfTrue, E-IfFalse and E-AddInt are direct. The one real case is E-AppAbs: inversion gives Γ,x:T11⊢t12:T\Gamma, x{:}T_{11} \vdash t_{12} : T and Γ⊢v2:T11\Gamma \vdash v_2 : T_{11}, and the substitution lemma gives Γ⊢[x:=v2] t12:T\Gamma \vdash [x := v_2]\,t_{12} : T.

Safety follows by induction on the number of steps: preservation keeps the type along t→∗t′t \to^* t', and progress applied to t′t' says it is a value or steps.

Example of the E-AppAbs case. The term (λx:Int. x+1) 4(\lambda x{:}\mathsf{Int}.\ x + 1)\ 4 steps to 4+14 + 1. Inversion on the typing of the redex gives x:Int⊢x+1:Intx{:}\mathsf{Int} \vdash x + 1 : \mathsf{Int}, and ⊢4:Int\vdash 4 : \mathsf{Int}. The substitution lemma gives ⊢4+1:Int\vdash 4 + 1 : \mathsf{Int}. The trace of twice inc 3\mathit{twice}\ \mathit{inc}\ 3 on the STLC page has six steps, and each of the seven terms in it has type Int\mathsf{Int}.

Consequences

  • Erasure of run-time checks. A compiler for a sound language need not test the kind of a value before an operation. Canonical forms says the test would always pass.
  • Termination is separate. Soundness says nothing about termination. In the STLC every run ends, by strong normalization (see the STLC page), so a closed term of type TT ends in a value of type TT. With a fixed-point operator, a well-typed term may run forever, and soundness still holds, because an infinite run never gets stuck.
  • Other systems. The same plan proves soundness for many richer systems, each with extra lemmas.
    • Subtyping: preservation may lower the type to a subtype, and canonical forms needs inversion lemmas for the subtype relation (Pierce, Chapter 15).
    • System F and Hindley-Milner: a lemma on type substitution, [α:=S][\alpha := S], handles type application and instantiation.
    • References: the typing judgment gets a store typing Σ\Sigma, and preservation says the new store typing extends the old one (Pierce, Chapter 13). With let-polymorphism, references break preservation unless generalization is restricted, which is the value restriction.
    • Exceptions: progress allows a third outcome, an uncaught exception (Pierce, Chapter 14).
    • Recursive types: canonical forms for μ\mu types needs fold and unfold, or a coinductive type equality.
  • Mechanized proofs. Because the proof is a set of inductions on derivations, it is a standard benchmark for proof assistants, and full languages have mechanized soundness proofs, for example the definition of Standard ML in Twelf and the WebAssembly specification.
  • A link to program logic. Soundness says that the type of a term is an invariant of its run. Program logics such as the Hoare triple prove invariants that the programmer chooses. A type system proves one fixed, weak invariant for all programs, and it does so without help.

Tightness

Soundness depends on the semantics and on the meaning of "stuck". Add integer division t1/t2t_1 / t_2 with a rule T-Div that gives Int\mathsf{Int}, and a step rule E-DivInt for n1/n2n_1 / n_2 only when n2≠0n_2 \neq 0. Then 1/01 / 0 has type Int\mathsf{Int}, it is not a value, and no rule steps it. A script with a stepper for this extension confirms that 1/01/0 is stuck. So progress fails. There are two standard repairs. One adds a rule n/0→errorn / 0 \to \mathsf{error} and lets progress allow the outcome error\mathsf{error}, as with exceptions. The other leaves the term stuck and accepts that the theorem no longer covers it. Most real languages take the first repair, so a sound language can still fail at run time, with a defined error. The theorem rules out only the failures that the chosen semantics calls stuck.

Progress needs closed terms. The term xx has type Int\mathsf{Int} in the context x:Intx{:}\mathsf{Int}, but it is not a value and does not step.

A sound system rejects safe programs. The term if true then 1 else false\mathsf{if\ true\ then}\ 1\ \mathsf{else\ false} steps to the value 11 in one step and never gets stuck. But it has no type, because T-If needs both branches to have the same type. No sound and decidable type system for a Turing-complete language can accept exactly the safe programs (see type system). The same example shows that the converse of preservation, subject expansion, fails: 11 has type Int\mathsf{Int}, but the term that stepped to it has no type.

Each rule matters. If T-If did not require t1:Boolt_1 : \mathsf{Bool}, the stuck term if 0 then 1 else 2\mathsf{if}\ 0\ \mathsf{then}\ 1\ \mathsf{else}\ 2 would be typed, and progress would fail. If let-bound references were generalized without the value restriction, preservation would fail. Real languages have had soundness bugs of this kind. Amin and Tate (2016) gave Java and Scala programs that pass the type checker and then fail with a cast error where none was written, by combining null with wildcard or path-dependent types.

Proof: Progress and preservation for the simply typed lambda calculus with Booleans and integersfull

This file proves the statement on the page for the system defined on the simply typed lambda calculus page: types Bool\mathsf{Bool}, Int\mathsf{Int} and T1→T2T_1 \to T_2; terms xx, λx:T. t\lambda x{:}T.\,t, t1 t2t_1\,t_2, true\mathsf{true}, false\mathsf{false}, if t1 then t2 else t3\mathsf{if}\ t_1\ \mathsf{then}\ t_2\ \mathsf{else}\ t_3, integer literals nn and t1+t2t_1 + t_2; the typing rules T-Var, T-Abs, T-App, T-True, T-False, T-If, T-Int and T-Add; and the call-by-value rules E-App1, E-App2, E-AppAbs, E-IfTrue, E-IfFalse, E-If, E-Add1, E-Add2 and E-AddInt. The values are λx:T. t\lambda x{:}T.\,t, true\mathsf{true}, false\mathsf{false} and the literals nn.

Terms are taken up to the renaming of bound variables. We use the variable convention: in any term, context or rule instance under discussion, the bound variables are chosen different from each other and from the free variables and the variables of the context. Substitution [x:=s]t[x := s]t is capture avoiding. A context is a list of distinct variables with types, and we write x:S∈Γx{:}S \in \Gamma for membership.

The proof follows the order of Pierce, Types and Programming Languages, Section 9.3.

Lemma 1 (inversion)

  1. If Γ⊢x:R\Gamma \vdash x : R, then x:R∈Γx{:}R \in \Gamma.
  2. If Γ⊢λx:T1. t2:R\Gamma \vdash \lambda x{:}T_1.\,t_2 : R, then R=T1→R2R = T_1 \to R_2 for some R2R_2 with Γ,x:T1⊢t2:R2\Gamma, x{:}T_1 \vdash t_2 : R_2.
  3. If Γ⊢t1 t2:R\Gamma \vdash t_1\,t_2 : R, then there is a T11T_{11} with Γ⊢t1:T11→R\Gamma \vdash t_1 : T_{11} \to R and Γ⊢t2:T11\Gamma \vdash t_2 : T_{11}.
  4. If Γ⊢true:R\Gamma \vdash \mathsf{true} : R or Γ⊢false:R\Gamma \vdash \mathsf{false} : R, then R=BoolR = \mathsf{Bool}.
  5. If Γ⊢if t1 then t2 else t3:R\Gamma \vdash \mathsf{if}\ t_1\ \mathsf{then}\ t_2\ \mathsf{else}\ t_3 : R, then Γ⊢t1:Bool\Gamma \vdash t_1 : \mathsf{Bool}, Γ⊢t2:R\Gamma \vdash t_2 : R and Γ⊢t3:R\Gamma \vdash t_3 : R.
  6. If Γ⊢n:R\Gamma \vdash n : R, then R=IntR = \mathsf{Int}.
  7. If Γ⊢t1+t2:R\Gamma \vdash t_1 + t_2 : R, then R=IntR = \mathsf{Int}, Γ⊢t1:Int\Gamma \vdash t_1 : \mathsf{Int} and Γ⊢t2:Int\Gamma \vdash t_2 : \mathsf{Int}.

Proof. The typing relation is the smallest relation closed under the rules, so each derivation ends in some rule whose conclusion matches the term. For each form of term exactly one rule has a conclusion of that form: T-Var for variables, T-Abs for abstractions, T-App for applications, T-True and T-False for the two constants, T-If for conditionals, T-Int for literals and T-Add for sums. Each claim is the premise list of that rule, read off with the conclusion matched to RR. □\square

Lemma 2 (canonical forms)

Let vv be a value.

  1. If ⊢v:Bool\vdash v : \mathsf{Bool}, then vv is true\mathsf{true} or false\mathsf{false}.
  2. If ⊢v:Int\vdash v : \mathsf{Int}, then vv is a literal nn.
  3. If ⊢v:T1→T2\vdash v : T_1 \to T_2, then v=λx:T1. tv = \lambda x{:}T_1.\,t for some xx and tt.

Proof. A value has one of four forms. By Lemma 1, an abstraction has an arrow type, true\mathsf{true} and false\mathsf{false} have type Bool\mathsf{Bool}, and a literal has type Int\mathsf{Int}. The three types Bool\mathsf{Bool}, Int\mathsf{Int} and T1→T2T_1 \to T_2 are pairwise different, so in case 1 only the Boolean constants are possible, in case 2 only literals, and in case 3 only abstractions. In case 3, Lemma 1.2 also gives that the annotation is T1T_1. □\square

Theorem 1 (progress)

If ⊢t:T\vdash t : T (in the empty context), then tt is a value or there is a t′t' with t→t′t \to t'.

Proof. By induction on the derivation of ⊢t:T\vdash t : T. Consider the last rule.

  • T-Var. Impossible: the context is empty, so no premise x:T∈∅x{:}T \in \emptyset holds.
  • T-Abs, T-True, T-False, T-Int. The term is a value.
  • T-App. Here t=t1 t2t = t_1\,t_2 with ⊢t1:T11→T\vdash t_1 : T_{11} \to T and ⊢t2:T11\vdash t_2 : T_{11}. By the induction hypothesis on t1t_1, either t1→t1′t_1 \to t_1', and then E-App1 gives t1 t2→t1′ t2t_1\,t_2 \to t_1'\,t_2; or t1t_1 is a value. In the second case apply the induction hypothesis to t2t_2: either t2→t2′t_2 \to t_2', and E-App2 gives t1 t2→t1 t2′t_1\,t_2 \to t_1\,t_2'; or t2t_2 is a value too. In that last case, Lemma 2.3 gives t1=λx:T11. t12t_1 = \lambda x{:}T_{11}.\,t_{12}, and E-AppAbs gives t1 t2→[x:=t2] t12t_1\,t_2 \to [x := t_2]\,t_{12}.
  • T-If. Here t=if t1 then t2 else t3t = \mathsf{if}\ t_1\ \mathsf{then}\ t_2\ \mathsf{else}\ t_3 with ⊢t1:Bool\vdash t_1 : \mathsf{Bool}. By induction, either t1→t1′t_1 \to t_1' and E-If applies, or t1t_1 is a value. Then Lemma 2.1 gives t1=truet_1 = \mathsf{true} or t1=falset_1 = \mathsf{false}, and E-IfTrue or E-IfFalse applies.
  • T-Add. Here t=t1+t2t = t_1 + t_2 with both parts of type Int\mathsf{Int}. If t1t_1 steps, E-Add1 applies. Otherwise t1t_1 is a value. If t2t_2 steps, E-Add2 applies. Otherwise both are values, Lemma 2.2 makes them literals n1n_1 and n2n_2, and E-AddInt gives t→nt \to n with n=n1+n2n = n_1 + n_2.

Every case gives a value or a step. □\square

Lemma 3 (permutation and weakening)

  1. If Γ⊢t:T\Gamma \vdash t : T and Δ\Delta is a permutation of Γ\Gamma, then Δ⊢t:T\Delta \vdash t : T.
  2. If Γ⊢t:T\Gamma \vdash t : T and xx is not in the domain of Γ\Gamma, then Γ,x:S⊢t:T\Gamma, x{:}S \vdash t : T for every SS.

Proof. Both go by induction on the derivation. The only rule that reads the context is T-Var, and its premise y:T∈Γy{:}T \in \Gamma holds in any context with the same bindings, or with more bindings. T-Abs extends the context with its bound variable. By the variable convention, that variable differs from xx and from every variable of Γ\Gamma, so the extended context is still a list of distinct variables, and the induction hypothesis applies to the premise. Every other rule passes the context unchanged to its premises. □\square

Lemma 4 (substitution)

If Γ,x:S⊢t:T\Gamma, x{:}S \vdash t : T and Γ⊢s:S\Gamma \vdash s : S, then Γ⊢[x:=s] t:T\Gamma \vdash [x := s]\,t : T.

Proof. By induction on the term tt, for all Γ\Gamma and TT at once. Induction on the term, and not on the derivation, lets us use Lemma 3 on a premise and still apply the induction hypothesis, because the permuted derivation is a derivation for the same subterm. By Lemma 1, the last rule of the derivation is fixed by the form of tt.

  • T-Var, t=zt = z with z:T∈(Γ,x:S)z{:}T \in (\Gamma, x{:}S). If z=xz = x, then T=ST = S because the context binds xx once, and [x:=s] x=s[x := s]\,x = s, which has type SS under Γ\Gamma by assumption. If z≠xz \neq x, then [x:=s] z=z[x := s]\,z = z and z:T∈Γz{:}T \in \Gamma, so T-Var gives Γ⊢z:T\Gamma \vdash z : T.
  • T-Abs, t=λy:T2. t1t = \lambda y{:}T_2.\,t_1 with T=T2→T1T = T_2 \to T_1 and Γ,x:S,y:T2⊢t1:T1\Gamma, x{:}S, y{:}T_2 \vdash t_1 : T_1. By the variable convention, y≠xy \neq x and yy is not free in ss, so [x:=s] t=λy:T2. [x:=s] t1[x := s]\,t = \lambda y{:}T_2.\,[x := s]\,t_1. By Lemma 3.1, Γ,y:T2,x:S⊢t1:T1\Gamma, y{:}T_2, x{:}S \vdash t_1 : T_1. By Lemma 3.2, Γ,y:T2⊢s:S\Gamma, y{:}T_2 \vdash s : S. The induction hypothesis gives Γ,y:T2⊢[x:=s] t1:T1\Gamma, y{:}T_2 \vdash [x := s]\,t_1 : T_1, and T-Abs gives Γ⊢[x:=s] t:T2→T1\Gamma \vdash [x := s]\,t : T_2 \to T_1.
  • T-App, t=t1 t2t = t_1\,t_2. The premises are Γ,x:S⊢t1:T11→T\Gamma, x{:}S \vdash t_1 : T_{11} \to T and Γ,x:S⊢t2:T11\Gamma, x{:}S \vdash t_2 : T_{11}. The induction hypothesis gives the same judgments for [x:=s] t1[x := s]\,t_1 and [x:=s] t2[x := s]\,t_2 under Γ\Gamma, and T-App gives Γ⊢([x:=s] t1) ([x:=s] t2):T\Gamma \vdash ([x := s]\,t_1)\,([x := s]\,t_2) : T, which is [x:=s] t[x := s]\,t.
  • T-If and T-Add are the same as T-App: substitute into each premise by induction and apply the rule again.
  • T-True, T-False, T-Int. The term has no variables, so [x:=s] t=t[x := s]\,t = t, and the same rule types it under Γ\Gamma. □\square

Theorem 2 (preservation)

If Γ⊢t:T\Gamma \vdash t : T and t→t′t \to t', then Γ⊢t′:T\Gamma \vdash t' : T.

Proof. By induction on the derivation of Γ⊢t:T\Gamma \vdash t : T. Consider the last rule.

  • T-Var, T-Abs, T-True, T-False, T-Int. The term is a variable or a value. No evaluation rule has a variable or a value on its left side, so t→t′t \to t' is impossible, and the claim holds vacuously.
  • T-App, t=t1 t2t = t_1\,t_2 with Γ⊢t1:T11→T\Gamma \vdash t_1 : T_{11} \to T and Γ⊢t2:T11\Gamma \vdash t_2 : T_{11}. Three rules can give t→t′t \to t'.
    • E-App1: t′=t1′ t2t' = t_1'\,t_2 with t1→t1′t_1 \to t_1'. The induction hypothesis gives Γ⊢t1′:T11→T\Gamma \vdash t_1' : T_{11} \to T, and T-App gives Γ⊢t′:T\Gamma \vdash t' : T.
    • E-App2: t′=t1 t2′t' = t_1\,t_2' with t2→t2′t_2 \to t_2'. The same argument on t2t_2.
    • E-AppAbs: t1=λx:T11′. t12t_1 = \lambda x{:}T_{11}'.\,t_{12}, t2t_2 is a value, and t′=[x:=t2] t12t' = [x := t_2]\,t_{12}. Lemma 1.2 applied to Γ⊢t1:T11→T\Gamma \vdash t_1 : T_{11} \to T gives T11′=T11T_{11}' = T_{11} and Γ,x:T11⊢t12:T\Gamma, x{:}T_{11} \vdash t_{12} : T. Lemma 4 with s=t2s = t_2 gives Γ⊢t′:T\Gamma \vdash t' : T.
  • T-If, t=if t1 then t2 else t3t = \mathsf{if}\ t_1\ \mathsf{then}\ t_2\ \mathsf{else}\ t_3 with Γ⊢t1:Bool\Gamma \vdash t_1 : \mathsf{Bool}, Γ⊢t2:T\Gamma \vdash t_2 : T and Γ⊢t3:T\Gamma \vdash t_3 : T. For E-IfTrue, t′=t2t' = t_2, and for E-IfFalse, t′=t3t' = t_3; both have type TT by the premises. For E-If, t′=if t1′ then t2 else t3t' = \mathsf{if}\ t_1'\ \mathsf{then}\ t_2\ \mathsf{else}\ t_3 with t1→t1′t_1 \to t_1'; the induction hypothesis gives Γ⊢t1′:Bool\Gamma \vdash t_1' : \mathsf{Bool}, and T-If gives Γ⊢t′:T\Gamma \vdash t' : T.
  • T-Add, t=t1+t2t = t_1 + t_2 with T=IntT = \mathsf{Int}. For E-Add1 and E-Add2, use the induction hypothesis on the part that steps and apply T-Add again. For E-AddInt, t′t' is a literal, and T-Int gives Γ⊢t′:Int\Gamma \vdash t' : \mathsf{Int}. □\square

Corollary (safety)

If ⊢t:T\vdash t : T and t→∗t′t \to^* t', then t′t' is not stuck: t′t' is a value of type TT, or t′→t′′t' \to t'' for some t′′t''.

Proof. By induction on the number kk of steps in t→∗t′t \to^* t', Theorem 2 gives ⊢t′:T\vdash t' : T: for k=0k = 0 this is the assumption, and for k+1k + 1 apply Theorem 2 to the last step. Then Theorem 1 says t′t' is a value or steps. If it is a value, it has type TT. □\square

Remarks on the proof

  • Progress needs the empty context. The open term xx has type Int\mathsf{Int} under x:Intx{:}\mathsf{Int}, but it is not a value and does not step. Preservation holds in any context.
  • Progress uses canonical forms, and canonical forms use the fact that the types of the different kinds of values are different. If a rule gave true\mathsf{true} the type Int\mathsf{Int}, Lemma 2.2 would fail, and the term true+1\mathsf{true} + 1 would be well typed and stuck.
  • Preservation uses substitution only in the case E-AppAbs. That is the step where computation happens. In systems with type variables, a second substitution lemma, for types, is needed in the case of type application.
  • The proofs do not use the order of evaluation. With a call-by-name rule (λx:T. t) t2→[x:=t2] t(\lambda x{:}T.\,t)\,t_2 \to [x := t_2]\,t for every t2t_2, the same Lemma 4 gives preservation, and progress holds with the matching changes.

History

Curry and Feys (1958) proved the subject reduction theorem for typed combinatory logic: reduction keeps the type. Milner (1978) proved the first soundness theorem for a programming language with polymorphism. He gave a denotational semantics in which ill-typed operations produce a special value wrong, and he proved that the meaning of a well-typed expression is never wrong. That style needs a domain-theoretic model, and it is hard to extend to references and control. Wright and Felleisen (1994) replaced it with the syntactic method: a small-step semantics where errors are stuck terms, subject reduction for each step, and a separate lemma that typed terms are not stuck. They applied it to ML with references, exceptions and continuations. Pierce's book named the two lemmas progress and preservation and made this the standard form.

References

  1. Andrew K. Wright and Matthias Felleisen, A syntactic approach to type soundness, Information and Computation 115(1), 1994, pages 38 to 94, the syntactic method (soundness as subject reduction plus a progress lemma for a small-step semantics with stuck states), applied to ML with references, exceptions and continuations
  2. Robin Milner, A theory of type polymorphism in programming, Journal of Computer and System Sciences 17(3), 1978, pages 348 to 375, Section 3 (the semantic soundness theorem for a denotational semantics with the value "wrong")
  3. Benjamin C. Pierce, Types and Programming Languages, MIT Press, 2002, Section 8.3 (safety as progress plus preservation, Theorems 8.3.2 and 8.3.3), Section 9.3 (Lemma 9.3.1 inversion, Lemma 9.3.4 canonical forms, Theorem 9.3.5 progress, Lemmas 9.3.6 to 9.3.8 permutation, weakening and substitution, Theorem 9.3.9 preservation), Chapters 13 and 14 (references and exceptions)
  4. Haskell B. Curry and Robert Feys, Combinatory Logic, Volume I, North-Holland, 1958, the chapter on functionality (the subject reduction theorem for typed combinatory terms)
  5. Nada Amin and Ross Tate, Java and Scala's type systems are unsound: the existential crisis of null pointers, OOPSLA 2016, the counterexamples that combine null with path-dependent or wildcard types

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of correctness
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/ZB8M1Q/text.yaml