Zulip Chat Archive
Stream: new members
Topic: rw with hypotheses
Jordi Saludes Closa (Jul 18 2024 at 15:07):
I wonder how can Irw
taking into account an hypothesis.
For instance: there is min_cases
:
∀ {α : Type u} [inst : LinearOrder α] (a b : α), min a b = a ∧ a ≤ b ∨ min a b = b ∧ b < a
and I want to make the following work.
example (h: a ≤ b) : min a b = a := by
rw [min_cases]
Should I somehow split min_cases
first?
Notification Bot (Jul 18 2024 at 15:08):
A message was moved here from #new members > multiplication in EReal, least upper bounds over Real, ENNRe by Ruben Van de Velde.
Julian Berman (Jul 18 2024 at 15:14):
Can you make that a #mwe?
Julian Berman (Jul 18 2024 at 15:15):
(deleted)
Ruben Van de Velde (Jul 18 2024 at 15:17):
And what do you mean by "work" :)
Michal Wallace (tangentstorm) (Jul 18 2024 at 15:40):
@Jordi Saludes Closa rw
applies rules that use =
or ↔
or →
as the top-level operator. In min_cases
, the top level is ∨
, so it isn't the right tool for the job.
But if you try this:
example {a b:Nat} (h: a ≤ b) : min a b = a := by rw?
Lean will suggest a proof that does use rw with the hypothesis:
example {a b:Nat} (h: a ≤ b) : min a b = a := by rw [Nat.min_eq_left h]
Jordi Saludes Closa (Jul 18 2024 at 16:44):
I see. Thanks!
Last updated: May 02 2025 at 03:31 UTC