Section TNF.
Fixpoint list_nat_sum(ls:list nat):nat :=
match ls with
| nil => O
| h::t => h+(list_nat_sum t)
end.
Definition isHaltTrans(tr:option (Trans Σ)):nat :=
match tr with
| Some _ => 0
| None => 1
end.
Definition CountHaltTrans tm :=
list_nat_sum (map (fun s=>list_nat_sum (map (fun i => isHaltTrans (tm s i)) Σ_list)) St_list).

Lemma CountHaltTrans_upd {tm s i} tr:
tm s i = None ->
S (CountHaltTrans (TM_upd Σ Σ_eqb tm s i (Some tr))) =
(CountHaltTrans tm).