(* Substitution *)
Definition tsubst i j (t : tuple) :=
let (i1,i2,i3) := t in
match tvcompare i i1 with
| Eq => Tuple j i2 i3
| _ =>
match tvcompare i i2 with
| Eq => Tuple i1 j i3
| _ =>
match tvcompare i i3 with
| Eq => Tuple i1 i2 j
| _ => t
end
end
end.
Definition s2k (s: sign) : K :=
match s with S0 => 0%f | S1 => 1%f | Sm1 => (-(1))%f end.

(* Specifications: *)
Lemma tsubst_c i t :
if tin i t then exists a, exists b, exists s,
({t[t]} = s2k s * {t[Tuple i a b]} /\
forall j, {t[tsubst i j t]} = s2k s * {t[Tuple j a b]})%f else True.