English
Let f and g be codes. The evaluation of the case (case f g) on a vector v is determined by the head of v: if v.headI yields the left branch, proceed with f on v.tail; otherwise apply g to (y :: v.tail) for the appropriate y obtained from v.headI.
Русский
Пусть f и g — коды. Оценка (case f g) на векторе v определяется головой вектора: если headI выбирает левый случай, идём к f на tail; иначе применяем g к (y :: tail) для соответствующего y.
LaTeX
$$$(case\\ f\\ g).eval(v) = v.headI.rec(f.eval(v.tail),\\ \\lambda y. g.eval(y::v.tail))$$$
Lean4
@[simp]
theorem case_eval (f g) : (case f g).eval = fun v => v.headI.rec (f.eval v.tail) fun y _ => g.eval (y :: v.tail) := by
simp [eval]