Definition trace_inputs (tr : list (name * (input + list output))) : nat :=
length (filterMap (fun e => match e with
| (primary, inl i) => Some i
| _ => None
end) tr).

(* Specifications: *)
Lemma trace_inputs_app :
forall tr1 tr2,
trace_inputs (tr1 ++ tr2) = trace_inputs tr1 + trace_inputs tr2.