Zulip Chat Archive
Stream: general
Topic: tactics to calculate inequality
ZHAO Jinxiang (Dec 23 2024 at 18:48):
example (a b : ℝ) (h1 : a = 2017) (h2: b ≤ 1): b < a := by
sorry
Is there any tactics to prove this?
Kevin Buzzard (Dec 23 2024 at 18:48):
linarith
ZHAO Jinxiang (Dec 23 2024 at 18:50):
Thanks. It works.
Also, how can I prove this?
example (a b : WithBot ℕ) (h1 : a = 2017) (h2: b ≤ 1): b < a := by
sorry -- linarith seems not working here
Kevin Buzzard (Dec 23 2024 at 18:58):
import Mathlib
example (a b : WithBot ℕ) (h1 : a = 2017) (h2: b ≤ 1): b < a := by
-- use the right lemma
refine lt_of_le_of_lt h2 ?_
-- now use a tactic
simp_all
ZHAO Jinxiang (Dec 23 2024 at 19:04):
Why linarith
not working here?
Kevin Buzzard (Dec 23 2024 at 19:11):
From the docstring:
In theory, linarith should prove any goal that is true in the theory of linear arithmetic over the rationals. While there is some special handling for non-dense orders like Nat and Int, this tactic is not complete for these theories and will not prove every true goal. It will solve goals over arbitrary types that instantiate LinearOrderedCommRing.
WithBot Nat is not covered by these examples.
ZHAO Jinxiang (Dec 23 2024 at 19:15):
Okay, I see.
ZHAO Jinxiang (Dec 23 2024 at 19:15):
Another question: Is there any tactics to auto prove this without using refine lt_of_le_of_lt h2 ?_
or apply h2.trans_lt
?
Kevin Buzzard (Dec 23 2024 at 21:22):
import Mathlib
attribute [aesop unsafe apply 50%] lt_of_le_of_lt
example (a b : WithBot ℕ) (h1 : a = 2017) (h2: b ≤ 1): b < a := by
aesop
Last updated: May 02 2025 at 03:31 UTC