Zulip Chat Archive
Stream: Is there code for X?
Topic: biSup_inf_le
Patrick Massot (Feb 03 2026 at 17:14):
I can’t find.
lemma biSup_inf_le {α β : Type*} [CompleteLattice β] (f : α → β) (s : Set α) (b : β) :
⨆ a ∈ s, (f a ⊓ b) ≤ (⨆ a ∈ s, f a) ⊓ b :=
iSup₂_le fun _ ha ↦ inf_le_inf_right b (le_biSup f ha)
where is it hidden?
Bhavik Mehta (Feb 03 2026 at 17:56):
It looks to me like this is missing, the closest I can find is docs#iSup_inf_le_sSup_inf which is a less general version of your lemma and docs#iSup₂_inf_eq which has stronger typeclass assumptions.
Eric Wieser (Feb 03 2026 at 21:37):
@Jovan Gerbscheid, do you know why this doesn't work?
import Mathlib
-- we should have this lemma too
lemma iSup_inf_le {α : Sort*} {β : Type*} [CompleteLattice β] (f : α → β) (b : β) :
⨆ a, (f a ⊓ b) ≤ (⨆ a, f a) ⊓ b :=
iSup_le fun _ => inf_le_inf_right _ (le_iSup f _)
lemma biSup_inf_le {α β : Type*} [CompleteLattice β] (f : α → β) (s : Set α) (b : β) :
⨆ a ∈ s, (f a ⊓ b) ≤ (⨆ a ∈ s, f a) ⊓ b := by
-- extracted into a `have` to exonerate any elaboration issues
have := fun a : α => iSup_inf_le (f := fun h : a ∈ s => f a) (b := b)
-- doesn't match
grw [this]
which fails with
Tactic `grewrite` failed: did not find instance of the pattern in the target expression
⨆ (_ : ?a ∈ s), f ?a ⊓ b
α : Type u_1
β : Type u_2
inst✝ : CompleteLattice β
f : α → β
s : Set α
b : β
this : ∀ (a : α), ⨆ (_ : a ∈ s), f a ⊓ b ≤ (⨆ (_ : a ∈ s), f a) ⊓ b
⊢ ⨆ a ∈ s, f a ⊓ b ≤ (⨆ a ∈ s, f a) ⊓ b
(recall that ⨆ a ∈ s, f a is the delaboration of ⨆ a, ⨆ h : a ∈ s, f a)
Aaron Liu (Feb 03 2026 at 21:38):
bound variables
Aaron Liu (Feb 03 2026 at 21:40):
remember ⨆ a, ⨆ h : a ∈ s, f a is actually iSup fun a => ⨆ h : a ∈ s, f a
Eric Wieser (Feb 03 2026 at 21:41):
Does grw not support bound variables?
Aaron Liu (Feb 03 2026 at 21:41):
to match rw which also doesn't support bound variables
Eric Wieser (Feb 03 2026 at 21:43):
I guess
lemma biSup_inf_le {α β : Type*} [CompleteLattice β] (f : α → β) (s : Set α) (b : β) :
⨆ a ∈ s, (f a ⊓ b) ≤ (⨆ a ∈ s, f a) ⊓ b := by
grw [← iSup_inf_le]
gcongr
grw [← iSup_inf_le]
works
Aaron Liu (Feb 03 2026 at 21:47):
it says in the module docstring about this here
TODO:
The algorithm used to implement
grwuses the same method asrwto determine where to rewrite.
This means that we can get ill-typed results. Moreover, it doesn't detect which occurrences
can be rewritten bygcongrand which can't. It also means we cannot rewrite bound variables.A better algorithm would be similar to
simp only, where we recursively enter the subexpression
usinggcongrlemmas. This is tricky due to the many differentgcongrfor each pattern.With the current implementation, we can instead use
nth_grw.
Eric Wieser (Feb 03 2026 at 21:49):
I don't understand the last remark, nth_grw is of no help here as far as I can tell
Jovan Gerbscheid (Feb 03 2026 at 21:55):
nth_grw helps if grw doesn't find the right position.
Eric Wieser (Feb 03 2026 at 21:56):
But I guess doesn't help if the "right" position is under a binder?
Jovan Gerbscheid (Feb 03 2026 at 21:57):
Indeed
Patrick Massot (Feb 03 2026 at 22:46):
I created #34812 about those lemmas.
Last updated: Feb 28 2026 at 14:05 UTC