Ltac is_X t :=
match goal with
| |-context[is_X ?X] =>
let f := fresh "EQ" in
destruct (is_X X) as [t|] eqn:f ;
[apply is_X_inv in f|]
end.
Ltac cnf_simpl :=
repeat match goal with
| |- context[and_cnf_opt cnf_ff _ ] => rewrite and_cnf_opt_cnf_ff
| |- context[and_cnf_opt _ cnf_ff] => rewrite and_cnf_opt_cnf_ff_r
| |- context[and_cnf_opt _ cnf_tt] => rewrite and_cnf_opt_cnf_tt
| |- context[or_cnf_opt cnf_ff _] => rewrite or_cnf_opt_cnf_ff
| |- context[or_cnf_opt _ cnf_ff] => rewrite or_cnf_opt_cnf_ff_r
end.

Lemma mk_iff_is_bool : forall (k: kind) (f1 f2:TFormula TX AF k) pol,
match is_bool f2 with
| Some isb => xcnf (if isb then pol else negb pol) f1
| None => mk_iff xcnf pol f1 f2
end = mk_iff xcnf pol f1 f2.