Definition cnf_normalise {T: Type} (t: Formula C) (tg: T) : cnf NFormula T :=
let f := normalise t in
if check_inconsistent f then cnf_ff _ _
else cnf_of_list (xnormalise f) tg.
Definition cnf_negate {T: Type} (t: Formula C) (tg: T) : cnf NFormula T :=
let f := normalise t in
if check_inconsistent f then cnf_tt _ _
else cnf_of_list (xnegate f) tg.

(* Specifications: *)
Lemma eq0_cnf : forall x,
(0 < x -> False) /\ (0 < - x -> False) <-> x == 0.
Lemma xnormalise_correct : forall env f,
(make_conj (fun x => eval_nformula env x -> False) (xnormalise f)) <-> eval_nformula env f.
Lemma xnegate_correct : forall env f,
(make_conj (fun x => eval_nformula env x -> False) (xnegate f)) <-> ~ eval_nformula env f.
Lemma cnf_normalise_correct : forall (T : Type) env t tg, eval_cnf (Annot:=T) eval_nformula env (cnf_normalise t tg) <-> eval_formula env t.
Lemma cnf_negate_correct : forall (T : Type) env t (tg:T), eval_cnf eval_nformula env (cnf_negate t tg) <-> ~ eval_formula env t.
Lemma eval_nformula_dec : forall env d, (eval_nformula env d) \/ ~ (eval_nformula env d).
Fixpoint xdenorm (jmp : positive) (p: Pol C) : PExpr C :=
match p with
| Pc c => PEc c
| Pinj j p => xdenorm  (Pos.add j jmp ) p
| PX p j q   => PEadd
(PEmul (xdenorm jmp p) (PEpow (PEX jmp) (Npos j)))
(xdenorm (Pos.succ jmp) q)
end.