Zulip Chat Archive
Stream: lean4
Topic: Omega + Decide
Siddharth Bhat (Feb 23 2024 at 14:55):
I've started to get goal states that contain boolean combinations of decide
of arithmetic statements:
example {i w : Nat} (h : (i < w + 1) ∧ (w ≤ w - i)) : (i = 0) := by
omega
example (i w : Nat) : decide (i < w + 1) && (w ≤ w - i) = (i = 0) := by
omega -- omega did not find a contradiction: trivial
I'm wondering what the correct approach to this is. am I using omega incorrectly, and it should be able to solve this?
Implementation-wise, I guess we would want to teach omega to try and convert decide(P)
when P
is arithmetic into a case split over P
plus a call to omega?
Geoffrey Irving (Feb 23 2024 at 14:57):
What does simp?
produce for the second example?
Siddharth Bhat (Feb 23 2024 at 15:03):
that is indeed correct, I can just run a simp
. I ought to have tried that, duh!
Siddharth Bhat (Feb 23 2024 at 15:03):
Thanks!
Siddharth Bhat (Feb 23 2024 at 15:07):
Hmm, this does not seem to help with the larger goal state that I have from which I MWE'd this:
theorem intMin_getMsb (w : Nat) : (intMin (w+1)).getMsb i = decide (i = 0) := by
simp [intMin, getMsb, getLsb, Nat.testBit_one_eq]
-- ▶ 1 goal
-- i w : Nat
-- ⊢ (decide (i < w + 1) && (decide (w - i < w + 1) && (decide (w ≤ w - i) && decide (w - i - w = 0)))) = decide (i = 0)
Siddharth Bhat (Feb 23 2024 at 15:11):
@Geoffrey Irving any idea what's going on in this case?
Geoffrey Irving (Feb 23 2024 at 15:32):
In that case I (perhaps ignorantly) usually use simp lemmas in reverse, in particular Bool.decide_and
and friends. Then you'll end up with decide ... = decide ...
, which will simplify to a non-decide thing. But using simp lemmas in reverse is a bit ugly, so I'm not sure this approach is optimal.
Kim Morrison (Feb 23 2024 at 21:39):
Yes, currently omega
doesn't like decide.
Kim Morrison (Feb 23 2024 at 21:40):
It does limited propositional reasoning, but the goals have to be expressed in Prop, not Bool.
Kim Morrison (Feb 23 2024 at 21:41):
I'm not intending to change this until (hopefully soon) we have sat
available, after which we will make it work properly.
Kim Morrison (Feb 23 2024 at 21:42):
I would like to have good simp sets for "working in the opposite direction". E.g simp only [bool_to_prop]
and simp only [prop_to_bool]
.
Kim Morrison (Feb 23 2024 at 21:43):
We've made a small start on the direction with the bv_toNat
simp set in core for "converting BitVec goals to Nat goals, and pushing BitVec.toNat inwards", which is essentially the preprocessor for bv_omega
.
Last updated: May 02 2025 at 03:31 UTC