Zulip Chat Archive

Stream: Is there code for X?

Topic: ENat.iInf_eq_nat_iff


Iván Renison (Jan 18 2026 at 22:45):

Hi, do you know if there is a lemma saying something like this?

lemma ENat.iInf_eq_nat_iff {ι : Sort*} {f : ι  } {n : } :
     i, (f i : ) = n  ( i, f i = n)   i, n  f i := sorry

Jakub Nowak (Jan 18 2026 at 23:02):

Seems like we don't even have a generic version of this. iInf_eq_of_forall_ge_of_forall_gt_exists_lt seems to be the closest.
We might want to have

{α : Type u_1} {ι : Sort u_4} [CompleteLattice α] {f : ι  α} {b : α} : ( (i : ι), b  f i)  ( i, f i = b)   i, f i = b

Kevin Buzzard (Jan 18 2026 at 23:29):

(deleted)

Ruben Van de Velde (Jan 18 2026 at 23:30):

Not sure this helps, but too tired to solve the last sorry

import Mathlib
lemma ENat.iInf_eq_nat_iff {ι : Sort*} {f : ι  } {n : } :
     i, (f i : ) = n  ( i, f i = n)   i, n  f i := by
  by_cases!  : IsEmpty ι
  · simp
  rw [ ENat.coe_iInf]
  simp
  constructor
  · rintro rfl
    constructor
    · sorry
    · intro i
      apply ciInf_le
      simp
  · rintro ⟨⟨j, rfl, h
    apply le_antisymm
    · apply ciInf_le
      simp
    · apply le_ciInf h

Iván Renison (Jan 18 2026 at 23:34):

It helps, although that sorry seems difficult. I will try to probe it

Jakub Nowak (Jan 18 2026 at 23:48):

You can replace

  rw [ ENat.coe_iInf]
  simp

with

  norm_cast

Snir Broshi (Jan 18 2026 at 23:52):

The last sorry is exact ciInf_mem f

Jakub Nowak (Jan 18 2026 at 23:54):

Heh, you were just few seconds faster. I'm wondering why exact? couldn't find it?

Jakub Nowak (Jan 18 2026 at 23:56):

I'm guessing it can't see past Membership to know that it's just function application?

Snir Broshi (Jan 19 2026 at 00:02):

golf

import Mathlib
lemma ENat.iInf_eq_nat_iff {ι : Sort*} {f : ι  } {n : } :
     i, (f i : ) = n  ( i, f i = n)   i, n  f i := by
  cases isEmpty_or_nonempty ι
  · simp
  norm_cast
  refine (·  ciInf_mem f, fun _  ciInf_le (OrderBot.bddBelow ..) _⟩), fun ⟨⟨i, hi, h  ?_⟩
  exact le_antisymm (hi  ciInf_le (OrderBot.bddBelow ..) _) (le_ciInf h)

Jakub Nowak (Jan 19 2026 at 00:03):

Should we add ∃ i, f i = ⨅ i, f i to mathlib?

Snir Broshi (Jan 19 2026 at 00:03):

For which type/class? This isn't always true

Jakub Nowak (Jan 19 2026 at 00:04):

[ConditionallyCompleteLinearOrder α] [WellFoundedLT α]

Snir Broshi (Jan 19 2026 at 00:04):

(e.g. the infimum of all the negative integers is zero)

Snir Broshi (Jan 19 2026 at 00:07):

Jakub Nowak said:

[ConditionallyCompleteLinearOrder α] [WellFoundedLT α]

Do you mean as a simple rephrasing of docs#ciInf_mem ?

Jakub Nowak (Jan 19 2026 at 00:08):

Yes. Only for it to be found by exact?.

Snir Broshi (Jan 19 2026 at 00:15):

idk, just swapping the equality in that statement is enough to fool exact?, we should improve its algorithm rather than adding small translation lemmas

Aaron Liu (Jan 19 2026 at 00:57):

I believe the correct hypothesis for that one is not being a docs#Order.IsPredPrelimit

Violeta Hernández (Jan 19 2026 at 11:37):

Seems like you're describing docs#csInf_mem_of_not_isPredPrelimit

Iván Renison (Jan 19 2026 at 12:05):

And should we add ENat.iInf_eq_nat_iff to Mathlib?

Iván Renison (Jan 19 2026 at 15:07):

I opened #34144 adding ENat.iInf_eq_nat_iff

Jakub Nowak (Jan 19 2026 at 17:11):

Doesn't it trivially generalizes to any α instead of , and WithTop α instead of ℕ∞?

Iván Renison (Jan 19 2026 at 17:16):

Maybe with some assumptions on α, or you think that with out?

Jakub Nowak (Jan 19 2026 at 18:48):

Yeah, sorry, I just assumed implicitly "throw in all instances the proof requires". That would be [ConditionallyCompleteLinearOrder α] [WellFoundedLT α] I think?

Jakub Nowak (Jan 19 2026 at 18:48):

@Aaron Liu suggest we could do better assumptions, but that would be extra effort.

Iván Renison (Jan 19 2026 at 18:50):

Ok, yes


Last updated: Feb 28 2026 at 14:05 UTC