Let's say I have bool expressions <bexp>
consisting of true
, false
, variables, eqb
andb
, orb
and negb
. When I see an expression of the form bexp = true
or bexp = false
, I want to convert them to prop expressions involving b = true
, ~ b = true
, b1 = b2
, b1 <> b2
, \/
and /\
.
I want to do this so that I can use the usual tactic machinery like destruct
, etc to handle them.
For example, if I have a hypothesis
H: negb b && b0 || eqb b b0 && lexltb bs1 bs2 = true
I want it to become:
H : (~ b = true /\ b0 = true) \/ (b = b0 /\ lexltb bs1 bs2 = true)
I have tried implementing it this way:
Ltac propify :=
repeat match goal with
| [ H : ?b1 || ?b2 = true |- _ ] => apply orb_true_iff in H
| [ H : ?b1 || ?b2 = false |- _ ] => apply orb_false_iff in H
| [ H : ?b1 && ?b2 = true |- _ ] => apply andb_true_iff in H
| [ H : ?b1 && ?b2 = false |- _ ] => apply andb_false_iff in H
| [ H : negb ?b = true |- _ ] => apply negb_true_iff in H
| [ H : negb ?b = false |- _ ] => apply negb_false_iff in H
| [ H : eqb ?b1 ?b2 = true |- _ ] => apply eqb_prop in H
| [ H : eqb ?b1 ?b2 = false |- _ ] => apply eqb_false_iff in H
end.
However, this does not achieve this effect, since it only works at the hypothesis level, and does not further simplify parts of hypotheses.
How do I achieve this?