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 or_is_X_inv : forall (k: kind) (f1 f2 : TFormula TX AF k),
or_is_X f1 f2 = true ->
exists k1, is_X f1 = Some k1 \/ is_X f2 = Some k1.