(* Elimination of a semi-free point *)
Fixpoint free_elim (cc : coef) x a b c d (l : list tuple)
(accu: list tuple) e :=
match l with
| nil => einsert cc (rev _ accu l) e
| t ::l1 =>
if tin x t then
let (c1,t1) := tsort (tsubst x b t) in
let cc1 := cscale a (scmp c1 cc) in
let (c2,t2) := tsort (tsubst x d t) in
let cc2 := cscale c (scmp c2 cc) in
einsert0
cc1 (linsert t1 (rev _ accu l1))
(einsert0
cc2 (linsert t2 (rev _ accu l1))
e)
else free_elim cc x a b c d l1 (t ::accu) e
end.

(* Specifications: *)
Lemma free_elim_c cc x a b c d l accu e :
{v[x]} = {k[a]} .* {v[b]} + {k[c]} .* {v[d]} :> vect K ->
{e[free_elim cc x a b c d l accu e]} =
({c[cc]} * {l[l]} * {l[accu]} + {e[e]})%f.