Zulip Chat Archive
Stream: mathlib4
Topic: Placing an order on a finite set
Connor Gordon (Feb 12 2024 at 20:05):
(For the full context of this question, you can check out this conversation.)
I currently have a function B : α → Set β
, and would like to create another function B' : α → Set β
such that the outputs of B'
are pairwise disjoint. Infrastructure to do this for functions of the form ℕ → Set β
exists in Docs#Disjointed, but I have been unsuccessful in finding an implementation more generally.
For my intended use specifically, I only care about disjointedness within a single specific F : Finset α
rather than all of α
, but even this is eluding me. Part of me would like to use F.toList
and attempt to reason from there, but my attempts thus far have been unsuccessful. Any ideas on how I could do this?
Kevin Buzzard (Feb 12 2024 at 20:18):
Set
is a mathlib thing, not a core Lean 4 thing, so this question is in the wrong stream -- can someone move it to #mathlib4 ?
I'm assuming that you want the union over B'
to be equal to the union over B
? Either that or something else is missing from your question (the answer to the question right now is "let B' x
be the empty set for all x").
In general why not just well-order alpha and define to be the things which are in but not in for any ?
Connor Gordon (Feb 12 2024 at 20:36):
Ah, apologies for the wrong stream. I'm still somewhat new to messaging on Zulip, and I'll keep it in mind going forward.
And also allow me to clarify what I mean. I have a function that is really defined from F → Set β
, for a specific F : Finset α
, but was recommended to define the function from α → Set β
in its entirety and ignore the part outside of F
. Yes, I do want to preserve the union, but specifically with respect to the set F
(same with making things disjoint; I really only care about behavior on F
).
As for well-ordering, I would love to be able to do that, but I genuinely have no idea how (and again, really would need to specifically well-order F
).
Hopefully that addresses everything, apologies for the lack of specificity in my original post.
Kevin Buzzard (Feb 12 2024 at 20:39):
Oh OK. I should think this would work then:
import Mathlib
variable {α β : Type*} (B : α → Set β) (F : Finset α)
-- use axiom of choice to well-order α
noncomputable instance : LinearOrder α := IsWellOrder.linearOrder WellOrderingRel
-- B' is a function of B and F
def B' (a : α) : Set β := {x : β | x ∈ B a ∧ ∀ a' < a, a' ∈ F → x ∉ B a'}
Notification Bot (Feb 12 2024 at 20:43):
This topic was moved here from #lean4 > Placing an order on a finite set by Jireh Loreaux.
Kevin Buzzard (Feb 12 2024 at 20:44):
(thanks Jireh). This function B' B F
should (if I got the maths right) have the property that the union over a in F of B(a) equals the union over a in F of B'(a), and the B'(a) for a in F are disjoint. Is that what you're after?
Connor Gordon (Feb 12 2024 at 20:50):
Yes it is, thank you so much! I'll give it a go and see if it works for me!
Kevin Buzzard (Feb 12 2024 at 21:14):
My effort
Connor Gordon (Feb 15 2024 at 16:27):
This works, thanks!
Last updated: May 02 2025 at 03:31 UTC