patternMinor
What is the eta-rule for nat?
Viewed 0 times
thewhatruleforetanat
Problem
As far as I am aware of, the beta-rule of the natural numbers type
But what does the eta-rule says? I wonder how the following formulation is correct / accurate / complete
nat states that (please correct me if I am wrong)natrec 0 t0 (lambda i ti. ts) := t0
natrec (succ k) t0 (lambda i ti. ts) := (fun i ti. ts)
But what does the eta-rule says? I wonder how the following formulation is correct / accurate / complete
natrec n 0 (lambda i ti. s i) := nSolution
I do not understand your notation, but the $\beta$-rule is not right (because you write down abstractions). It is:
\begin{align*}
\mathtt{natrec} \; 0 \; x \; f &= x \\
\mathtt{natrec} \; (\mathtt{succ}\;n) \; x \; f &= f \; n \; (\mathtt{natrec} \; n \; x \; f)
\end{align*}
where $x$ and $f$ are arbitrary (well-typed) terms. (Beware: not every term of a function type is of the form $\lambda x . e$!)
You can read $\beta$ rules as saying what happens when you apply a destructor to a constructor (for instance $\mathtt{fst} (a, b) = a$). An $\eta$-rule says what happens when you destruct a thing and then put it back together (for instance $u = (\mathtt{fst}\;u, \mathtt{snd}\;u)$.
We take numbers apart with $\mathtt{natrec}$ and put them together with $0$ and $\mathtt{succ}$, so the $\eta$-rule would be:
$$\mathtt{natrec} \; n \; 0 \; (\lambda \; x\; m \,.\, \mathtt{succ}\; m) = n.$$
\begin{align*}
\mathtt{natrec} \; 0 \; x \; f &= x \\
\mathtt{natrec} \; (\mathtt{succ}\;n) \; x \; f &= f \; n \; (\mathtt{natrec} \; n \; x \; f)
\end{align*}
where $x$ and $f$ are arbitrary (well-typed) terms. (Beware: not every term of a function type is of the form $\lambda x . e$!)
You can read $\beta$ rules as saying what happens when you apply a destructor to a constructor (for instance $\mathtt{fst} (a, b) = a$). An $\eta$-rule says what happens when you destruct a thing and then put it back together (for instance $u = (\mathtt{fst}\;u, \mathtt{snd}\;u)$.
We take numbers apart with $\mathtt{natrec}$ and put them together with $0$ and $\mathtt{succ}$, so the $\eta$-rule would be:
$$\mathtt{natrec} \; n \; 0 \; (\lambda \; x\; m \,.\, \mathtt{succ}\; m) = n.$$
Context
StackExchange Computer Science Q#63219, answer score: 6
Revisions (0)
No revisions yet.