If the canonical terms are always "a=a", but "x+1" does not compute to the same term as "1+x", how do we create a term of "x+1 = 1+x"? We use the "R" function. (See §Natural Numbers above.) The "R" function's argument "P" is defined to be "(λ x:nat . x+1 = 1+x)". The other arguments act like the parts of an induction proof, where "PZ : P 0" becomes the base case "0+1 = 1+0" and "PS : P n \to P (S n)" becomes the inductive case. Essentially, this says that when "x+1 = 1+x" has "x" replaced with a canonical value, the expression will be the same as "reflexivity (x+1)". This application of the function "R" has type "x : nat \to x+1 = 1+x". We can use it and the function "J" to substitute "1+x" for "x+1" in any term. In this way, the identity type is able to capture equalities that are not possible with judgmental equality.
