This is the characteristic function of the set \(\textbf{Nat}\)
Notice the correspondence between the mathematical specification and the implementation
Derivations
A judgment holds if and only if we can compose applications of the inference rules to demonstrate it
\[
\mathsf{s}(\mathsf{s}(\mathsf{z}))
\]
this can be represented in code, as each judgment corresponds to a function call
defined functionisNatDerivation
Structural Equality
\[
\fbox{$n_1 \mathsf{=_{\textbf{Nat}}} n_2$}
\]
defined functioneqNat
Semantics
What if we want to turn our syntactical evaluation of \(\textbf{Nat}\)s into a semantical evaluation by deriving what integer value a \(\textbf{Nat}\) holds?
What is our judgment form?
What does \(\mathsf{z}\) evaluate to?
For our successor inference rule: given ??? as a premise, what does ??? evaluate to?
defined functioneval
Let’s try lists
Inductively define with judgments and inference rules