Let R1,R2,…,Rk be primitive recursive relations on Nl such that ∀i,j∈{1,2,…,k}:Ri⟹¬Rj, that is, all relations are mutually exclusive ∀\tuplen1,n2,…,nl∈Nl:∃i∈{1,2,…,k}:\mapRin1,n2,…,nl, that is, the set of relations is exhaustive. Let ∀i∈{1,2,…,k}:gi:Nl→N be primitive recursive functions. Then the function f:Nl→N defined as \mapfn1,n2,…,nl=⎩⎨⎧\mapg1n1,n2,…,nl\mapg2n1,n2,…,nl⋮\mapgkn1,n2,…,nl:\mapR1n1,n2,…,nl:\mapR2n1,n2,…,nl⋮:\mapRkn1,n2,…,nl is primitive recursive.
Preamble
import Mathlib.Computability.Primrec
Formal statement
theorem Definition_by_Cases_is_Primitive_Recursive (R : ℕ → Prop) [DecidablePred R] (f g : ℕ → ℕ) (hR : Nat.Primrec (fun n => if R n then 1 else 0)) (hf : Nat.Primrec f) (hg : Nat.Primrec g) : Nat.Primrec (fun n => if R n then f n else g n) := by sorry