(** Another normalisation - this is used for cnf conversion **)

Definition xnormalise (f:NFormula) : list (NFormula)  :=
  let (e,o) := f in
  match o with
  | Equal     => (e , Strict) :: (popp e, Strict) :: nil
  | NonEqual  => (e , Equal) :: nil
  | Strict    => (popp e, NonStrict) :: nil
  | NonStrict => (popp e, Strict) :: nil
  end.Definition xnegate (t:NFormula) : list (NFormula)  :=
  let (e,o) := t in
    match o with
      | Equal  => (e,Equal) :: nil
      | NonEqual => (e,Strict)::(popp e,Strict)::nil
      | Strict  => (e,Strict) :: nil
      | NonStrict  => (e,NonStrict) :: nil
    end.Definition cnf_of_list {T : Type} (l:list NFormula) (tg : T) : cnf NFormula T :=
  List.fold_right (fun x acc =>
                     if check_inconsistent x then acc else ((x,tg)::nil)::acc)
                  (cnf_tt _ _)  l.Add Ring SORRing : (SORrt sor).

Lemma cnf_of_list_correct : forall (T : Type) env l tg, eval_cnf (Annot:=T) eval_nformula env (cnf_of_list l tg) <-> make_conj (fun x : NFormula => eval_nformula env x -> False) l.