Zulip Chat Archive

Stream: maths

Topic: Dedekind-MacNeille completion


Violeta Hernández (Jul 10 2025 at 05:33):

Has there been any progress on this?

Violeta Hernández (Jul 10 2025 at 05:52):

@Wrenna Robson Is it ok if I adapt your code for Mathlib 4 and PR it?

Wrenna Robson (Jul 10 2025 at 06:01):

Crack on, I'm not going to. Let me know and I'll have a look at the PR though.

Wrenna Robson (Jul 10 2025 at 08:33):

https://leanprover-community.github.io/mathlib4_docs/Mathlib/Order/Concept.html

Wrenna Robson (Jul 10 2025 at 08:33):

I think this is the rest of the Concept stuff, which iirc this basically is.

Wrenna Robson (Jul 10 2025 at 08:35):

(So you may not want to entirely duplicate it.)

Wrenna Robson (Jul 10 2025 at 08:35):

@Yaël Dillies what exactly did you end up doing with this?

Wrenna Robson (Jul 10 2025 at 08:53):

It looks to me like we are missing 3.7-3.9 from Davey & Priestley

Wrenna Robson (Jul 10 2025 at 08:58):

#general > conditional lattice refactor

@Violeta Hernández you may want to see this thread if you haven't already which was from a little later in 2022.

Violeta Hernández (Jul 10 2025 at 10:29):

Wrenna Robson said:

I think this is the rest of the Concept stuff, which iirc this basically is.

Oh oops. Would've done me good to read this two hours ago.

Wrenna Robson (Jul 10 2025 at 10:30):

;_;

Wrenna Robson (Jul 10 2025 at 10:30):

sorry, I realised it as soon as I got into work

Wrenna Robson (Jul 10 2025 at 10:30):

there is still work to do (which I am now noodling at...)

Wrenna Robson (Jul 10 2025 at 10:31):

I'm refactoring Yael's work somewhat to taste and aiming for the fundamental theorem. Then we just need the <= special case :)

Violeta Hernández (Jul 10 2025 at 10:32):

So, just to make sure I understand, the Dedekind-MacNeille completion is just the concept lattice of the relation of an order?

Wrenna Robson (Jul 10 2025 at 10:32):

Yes.

Violeta Hernández (Jul 10 2025 at 10:32):

huh

Wrenna Robson (Jul 10 2025 at 10:33):

Which stated kind of another way, is: any complete lattice is the concept lattice of ≤ (so all complete lattices are isomorphic to a concept lattice).

Violeta Hernández (Jul 10 2025 at 10:34):

What does the fundamental theorem of concept lattices say?

Violeta Hernández (Jul 10 2025 at 10:34):

My PR had a proof that every embedding into a complete lattice factored through the Dedekind completion; does that have a concept lattice analog?

Wrenna Robson (Jul 10 2025 at 10:35):

Yes: "The concepts of a given context form a complete lattice into which the original objects and attributes embed."

Violeta Hernández (Jul 10 2025 at 10:38):

Well, what I'm saying is a bit stronger, isn't it? The Dedekind completion of α is a complete lattice β with an order embedding α ↪o β, but it also has the property that for any other complete lattice γ with an embedding α ↪o γ, you can construct the embedding β ↪o γ such that the triangle commutes.

Wrenna Robson (Jul 10 2025 at 10:39):

I think this does have an analogue but I'm not yet sure we have it in the Concept stuff (which is certainly incomplete), and it might not be in the book.

Violeta Hernández (Jul 10 2025 at 10:40):

(I'm trying to read up on concept theory, but the Wikipedia article is genuinely incomprehensible...)

Wrenna Robson (Jul 10 2025 at 10:40):

see your DMs :)

Violeta Hernández (Jul 10 2025 at 10:46):

I feel like at the very least we should add some sort of docstring somewhere in the file containing the substring "Dedekind-MacNeille".

Wrenna Robson (Jul 10 2025 at 10:46):

Yes.

Wrenna Robson (Jul 10 2025 at 10:47):

I don't think it would be BAD to have a separate file which essentially contains the Dedekind-MacNeille completion, even if it's ultimately defined in terms of concepts.

Violeta Hernández (Jul 10 2025 at 10:49):

Maybe we can define DedekindCut α as an abbreviation for Concept α α (· ≤ ·), and add the theorems linking the intent/extent closure to the lower/upper bounds of a set?

Wrenna Robson (Jul 10 2025 at 10:50):

Yes, though they are near immediate:

theorem upperBounds_eq_upperPolar [LE α] : upperBounds s = upperPolar (·  ·) s := rfl
theorem lowerBounds_eq_lowerPolar [LE β] : lowerBounds t = lowerPolar (·  ·) t := rfl

(I've renamed the closures but you can see the point.)

Violeta Hernández (Jul 10 2025 at 10:50):

Hmm, that's a bit too immediate for my taste if I'm being honest

Violeta Hernández (Jul 10 2025 at 10:50):

Maybe we can add the abbreviation and keep it at that?

Wrenna Robson (Jul 10 2025 at 10:50):

In what sense?

Wrenna Robson (Jul 10 2025 at 10:51):

Oh as in it is Just There

Wrenna Robson (Jul 10 2025 at 10:51):

yes, I did think this.

Wrenna Robson (Jul 10 2025 at 10:51):

I am going to keep noodling at this refactor and extension for enrichment, thanks for reminding me of it, I'll let you know when I have something. I think we're both keen to get this in in some form.

Violeta Hernández (Jul 10 2025 at 10:54):

Violeta Hernández said:

Maybe we can add the abbreviation and keep it at that?

Actually, on second thought. What do you think about having a file that defines the abbreviation, but also proves the minimality theorem I mentioned?

Wrenna Robson (Jul 10 2025 at 10:54):

I think that would be great (though the minimality theorem might apply for concepts in which case we should have it).

Wrenna Robson (Jul 10 2025 at 10:55):

But basically I think we should have a file that requires people to know NOTHING about concepts that gives the Dedekind-MacNeille completion.

Wrenna Robson (Jul 10 2025 at 10:55):

Even if, ohoho, it is a simple thin layer over a different file that is the Concept one.

Violeta Hernández (Jul 10 2025 at 11:39):

@Wrenna Robson Opened a new PR defining DedekindCut α = Concept α α (· ≤ ·). I'm pleasantly surprised at how little work it took to port the minimality theorem.

#26966

Wrenna Robson (Jul 10 2025 at 11:40):

Oh very nice

Violeta Hernández (Jul 10 2025 at 11:57):

I imagine we also want to show the Dedekind completion of a complete lattice is isomorphic to itself, surely this theorem doesn't have a concept analog either?

Wrenna Robson (Jul 10 2025 at 11:58):

Uh that is sort of one end of the fundamental theorem.

Violeta Hernández (Jul 10 2025 at 11:58):

Oh, nice!

Violeta Hernández (Jul 10 2025 at 11:58):

Then it's a good thing I haven't done that yet

Violeta Hernández (Jul 10 2025 at 11:58):

I'll go read the paper you sent me

Wrenna Robson (Jul 10 2025 at 11:59):

Like in the sense that any complete lattice is isomorphic to the concept lattice of its <=, which IS the completion, essentially.

Violeta Hernández (Jul 10 2025 at 12:00):

Hmm... I mean, surely we can just state this in terms of DedekindCut?

Wrenna Robson (Jul 10 2025 at 12:00):

Quite probably!

Wrenna Robson (Jul 10 2025 at 12:00):

Certainly I think it's a good reason to have DedekindCut as a name.

Violeta Hernández (Jul 10 2025 at 12:02):

DedekindCut.ofElement would provide one half of the isomorphism, the other half should simply be sSup x.fst

Wrenna Robson (Jul 10 2025 at 12:02):

That sounds right to me!

Wrenna Robson (Jul 10 2025 at 12:02):

It's a really neat construction really.

Wrenna Robson (Jul 10 2025 at 12:02):

I am gonna finish what I am doing I think, but it's alright, I'm sure we can bring it all together.

Violeta Hernández (Jul 10 2025 at 12:36):

Just finished the proof! Put it in my own branch: https://github.com/vihdzp/mathlib4/blob/vi.ddk2/Mathlib/Order/Dedekind.lean

Wrenna Robson (Jul 10 2025 at 12:36):

Oh that's quite lovely :)

Violeta Hernández (Jul 10 2025 at 12:36):

Not sure if I should add this to my original PR, or if I should put this as a separate PR. What do you think?

Wrenna Robson (Jul 10 2025 at 12:37):

Hmm.

Wrenna Robson (Jul 10 2025 at 12:37):

Probably a separate dependent PR? Your first should ideally be as close to just adding the abbrev as possible I think (so possibly the factor theorem goes in the second one too).

Violeta Hernández (Jul 10 2025 at 12:39):

I'm not sure if I agree with that. The point of doing the factor theorem together with the abbrev is that it serves as battle-testing; specifically, it shows you don't have to go through any complicated Concept API to work with DedekindCut.

Yaël Dillies (Jul 10 2025 at 12:40):

Wrenna Robson said:

Yaël Dillies what exactly did you end up doing with this?

Everything I did is in mathlib

Wrenna Robson (Jul 10 2025 at 12:40):

Cool :)

Yaël Dillies (Jul 10 2025 at 12:42):

Note that somewhat recently @Laurent Bartholdi accidentally duplicated part of the concept file in Order.Rel.GaloisConnection. I reviewed his PR but failed to spot that it was a duplicate. If you are cleaning things up, then you could look at removing (most of) Order.Rel.GaloisConnection

Yaël Dillies (Jul 10 2025 at 12:43):

Violeta Hernández said:

Wrenna Robson said:

I think this is the rest of the Concept stuff, which iirc this basically is.

Oh oops. Would've done me good to read this two hours ago.

Please add "Dedekind-MacNeille completion" in the tags of Order.Concept so as to minimise the likelihood that this happens again

Wrenna Robson (Jul 10 2025 at 12:45):

Oops.

Violeta Hernández (Jul 10 2025 at 12:51):

Wrenna Robson said:

Probably a separate dependent PR? Your first should ideally be as close to just adding the abbrev as possible I think (so possibly the factor theorem goes in the second one too).

The way I see it, the factor theorem is proving that the definition of DedekindCut as a concept lattice is correct.

Violeta Hernández (Jul 10 2025 at 12:51):

I could just add the alias and the upperBounds_fst/lowerBounds_snd theorems, but then the PR would be five lines long and not very interesting.

Wrenna Robson (Jul 10 2025 at 12:52):

Hmm. I gotta dash to lunch and then I have a meeting but I will try to think more later.

Wrenna Robson (Jul 10 2025 at 15:12):

Is it just the one branch you have?

Violeta Hernández (Jul 10 2025 at 15:12):

The other branch is the one in the PR

Wrenna Robson (Jul 10 2025 at 15:20):

Right right

Violeta Hernández (Jul 10 2025 at 15:21):

I actually made a second PR, but that's just a few results on Concept itself I felt were missing

Wrenna Robson (Jul 10 2025 at 15:24):

Hmm, what is the definition of join-dense and meet-dense in Lean?

Violeta Hernández (Jul 10 2025 at 15:27):

I don't know. What is their definition in general? :sweat_smile:

Wrenna Robson (Jul 10 2025 at 15:28):

"a subset Q of an ordered set P is called join-
dense if every element of P is the join of a subset of Q."

Violeta Hernández (Jul 10 2025 at 15:30):

Haven't seen something like that

Wrenna Robson (Jul 10 2025 at 15:31):

Basically looking at this:
3.8 Theorem. Let (G, M, I) be a context and L = B(G, M, I) the
associated complete lattice of concepts. Then the mappings γ : G → L
and μ : M → L are such that the set γ(G) is join-dense in L,the set
μ(M ) is meet-dense in L,and gIm is equivalent to γ(g) <= μ(m) for
each g ∈ G and m ∈ M .

Violeta Hernández (Jul 10 2025 at 15:35):

Unless we have yet another tagging situation I don't think join-dense or meet-dense sets are in Mathlib

Wrenna Robson (Jul 10 2025 at 15:36):

Hmm!

Violeta Hernández (Jul 10 2025 at 15:36):

Are there any interesting results about them we could formalize?

Wrenna Robson (Jul 10 2025 at 15:37):

I think elsewhere in the same textbook the concepts are in, but in chapter 2. It would definitely be good to look at formalising them (possibly not in the same way the textbook does, as ever).

Wrenna Robson (Jul 10 2025 at 16:46):

https://github.com/linesthatinterlace/mathlib4/tree/concept_work

Wrenna Robson (Jul 10 2025 at 16:47):

So this is the branch I've been working on

Wrenna Robson (Jul 10 2025 at 16:47):

Bit different to yours!

Wrenna Robson (Jul 10 2025 at 16:47):

rel_iff_ofObject_le_ofAttribute is interesting to look at!

Wrenna Robson (Jul 10 2025 at 16:47):

I've been refactoring the existing file to make the API a bit better in terms of names etc.

Violeta Hernández (Jul 10 2025 at 16:49):

Are lowerPolar and upperPolar the names in the literature?

Wrenna Robson (Jul 10 2025 at 16:49):

They appear to be, or rather they are called "polars"

Wrenna Robson (Jul 10 2025 at 16:50):

And given lowerPolar is lowerBounds in the special case of <=, etc., that is why I chose those names.

Wrenna Robson (Jul 10 2025 at 16:51):

Similarly, "extent" and "intent" come from the literature.

Violeta Hernández (Jul 10 2025 at 16:51):

I like what you've done!

Wrenna Robson (Jul 10 2025 at 16:51):

Thanks! It would be good to work with you and bring our stuff together.

Violeta Hernández (Jul 10 2025 at 16:52):

I notice that ofObject and ofAttribute seem to be the generalizations of my single ofElement map

Wrenna Robson (Jul 10 2025 at 16:52):

That is correct.

Violeta Hernández (Jul 10 2025 at 16:52):

I can put my PR on draft. In a weird twist of events it turns out I don't even need it anymore!

Wrenna Robson (Jul 10 2025 at 16:53):

Isn't that always the way!

Violeta Hernández (Jul 10 2025 at 16:53):

(I wanted to define gaps of surreal numbers as Concept _ _ (· ≤ ·), but oddly enough it turns out the correct definition is Concept _ _ (· < ·) which is slightly different)

Wrenna Robson (Jul 10 2025 at 16:53):

But I will have time on and off to work on this and I think we could make some improvements by incorporating what I've done and then layering on top and around the DedkindCut stuff you've done, and the corresponding results.

Wrenna Robson (Jul 10 2025 at 16:54):

Aha! Good to have the concept language, isn't it?

Violeta Hernández (Jul 10 2025 at 16:54):

Truly is!

Wrenna Robson (Jul 10 2025 at 16:55):

There is an argument that you could define the set of sets which are IsExtent/IIsIntent (invariant under lowerPolar r (upperPolar r s) = s and vice vera`), as in give them a name, and then essentially both of those set of sets has a complete lattice structure on it that is isomorphic to the concept lattice.

Aaron Liu (Jul 10 2025 at 16:56):

This is similar happening with docs#LowerSet and docs#UpperSet right now and I don't like it (which one do I use?)

Wrenna Robson (Jul 10 2025 at 16:56):

(Notably the joins/meets are not quite the same as the ambient ones from Set - there is an interesting subtlety.)

Violeta Hernández (Jul 10 2025 at 16:57):

I opened #26968 with some results that are still useful for talking about surreal gaps. I've drafted the Dedekind cut PR in anticipation for the concept API to expand a bit first.

Wrenna Robson (Jul 10 2025 at 16:57):

LowerSet is different I think - lowerPolar is analgous to lowerBounds instead.

Wrenna Robson (Jul 10 2025 at 16:58):

Aaron Liu said:

This is similar happening with docs#LowerSet and docs#UpperSet right now and I don't like it (which one do I use?)

Ah but my putative thing above would be the corresponding thing... yeah.

Wrenna Robson (Jul 10 2025 at 16:58):

It's difficult because basically LowerSet is only special because it has <= associated with it.

Wrenna Robson (Jul 10 2025 at 16:58):

But that's just some particular relation.

Violeta Hernández (Jul 10 2025 at 16:59):

Wrenna Robson said:

There is an argument that you could define the set of sets which are IsExtent/IIsIntent (invariant under lowerPolar r (upperPolar r s) = s and vice vera`), as in give them a name, and then essentially both of those set of sets has a complete lattice structure on it that is isomorphic to the concept lattice.

I prefer defining both at once. Lower sets and upper sets often appear on their own, but surely intents and extents are something you only ever talk about together.

Wrenna Robson (Jul 10 2025 at 16:59):

I don't disagree, which ultimately is why Concept is right I think.

Wrenna Robson (Jul 10 2025 at 16:59):

It has a good symmetry to it.

Wrenna Robson (Jul 10 2025 at 16:59):

Right I gotta go home for now and then I will try not to fall down a concept hole tomorrow (but thanks Violeta for pushing me down one ;))

Violeta Hernández (Jul 10 2025 at 17:00):

Wrenna Robson said:

It has a good symmetry to it.

It also leads to better def-eqs!

Wrenna Robson (Jul 10 2025 at 17:00):

Yes!

Wrenna Robson (Jul 10 2025 at 17:01):

Basically the funny thing is that you generally have two choices of "correct" ext/injection style lemma in a proof - some constructions will want to use the extent and some will want to use the intent, and you need to move between them.

Wrenna Robson (Jul 10 2025 at 17:01):

That's why good API is really important here I think.

Violeta Hernández (Jul 10 2025 at 17:12):

I think it'd be nice to get the intentClosure → lowerPolar rename done quickly, or we'll end up with more and more theorems to rename.

Wrenna Robson (Jul 10 2025 at 17:14):

Agreed. Possibly the thing there is a rename PR that doesn't change anything else

Wrenna Robson (Jul 10 2025 at 17:15):

I.e. no new defs or theorems

Violeta Hernández (Jul 10 2025 at 17:15):

Agreed

Violeta Hernández (Jul 10 2025 at 17:15):

I can get that done rn if you want :slight_smile:

Violeta Hernández (Jul 10 2025 at 18:36):

Opened #26976 for the rename

Wrenna Robson (Jul 10 2025 at 18:37):

Thanks, sorry I'm still commuting home

Aaron Liu (Jul 10 2025 at 18:37):

I feel like extends Set α × Set β is really weird, it gives a Concept.toProd projection

Violeta Hernández (Jul 10 2025 at 18:37):

No worries!

Wrenna Robson (Jul 10 2025 at 18:38):

Yes I agree, I think we should also get rid of that as in my branch above. Think we could do that in the rename one

Violeta Hernández (Jul 10 2025 at 18:38):

I don't really see the issue, this projection is basically invisible.

Wrenna Robson (Jul 10 2025 at 18:40):

Basically I would rather have initialize_simps_projections Concept (fst -> extent, snd -> intent).

Violeta Hernández (Jul 10 2025 at 18:40):

Oh wait you're right, we can in fact choose better names for these fields

Wrenna Robson (Jul 10 2025 at 18:40):

I'm not sure the intent closure is what you say it is in the PR. I guess that's as good a name as any though.

Wrenna Robson (Jul 10 2025 at 18:40):

Yeah, look in my branch to see what I do :)

Violeta Hernández (Jul 10 2025 at 18:41):

The intent closure is just the smallest intent containing a set, isn't it?

Violeta Hernández (Jul 10 2025 at 18:41):

Wikipedia says as much

Wrenna Robson (Jul 10 2025 at 18:41):

Ah, yes.

Wrenna Robson (Jul 10 2025 at 18:41):

Yes indeed.

Wrenna Robson (Jul 10 2025 at 18:41):

Sorry, train maths.

Wrenna Robson (Jul 10 2025 at 18:42):

So that's another thing we should probably define.

Violeta Hernández (Jul 10 2025 at 18:42):

I don't think it needs a definition. Writing lowerPolar r (upperPolar r s) is straightforward enough.

Wrenna Robson (Jul 10 2025 at 18:42):

Yeah I don't disagree.

Violeta Hernández (Jul 10 2025 at 18:43):

We could add a theorem stating IsIntent t → s ⊆ t → lowerPolar r (upperPolar r s) ⊆ t. Can't be very dificult to prove.

Wrenna Robson (Jul 10 2025 at 18:44):

No that must be pretty obvious. But not in this PR!

Wrenna Robson (Jul 10 2025 at 18:44):

I would be happy with a notation for it by the way.

Wrenna Robson (Jul 10 2025 at 18:44):

But I can't think of one.

Violeta Hernández (Jul 10 2025 at 18:45):

It'd be nice if we could use A' notation, but I suspect the inherent ambiguity won't let us

Violeta Hernández (Jul 10 2025 at 18:46):

By the way, do I do the fst → intent rename in the intentClosure → lowerPolar PR? Or do I make a separate one?

Violeta Hernández (Jul 10 2025 at 18:46):

I feel like there's a case for both options

Wrenna Robson (Jul 10 2025 at 18:46):

Yeah, you need to specify the relation. And that's sufficient, technically, because you could instead of lowerPolar and upperPolar use swap r

Wrenna Robson (Jul 10 2025 at 18:46):

I think do that in the same PR. Let's try and capture all renames of existing things in one PR.

Violeta Hernández (Jul 10 2025 at 18:57):

oh whoops, the first set is actually the extent! glad i caught that

Wrenna Robson (Jul 10 2025 at 18:57):

Yeah!

Wrenna Robson (Jul 10 2025 at 18:58):

Somehow you expect it to be the other way round

Wrenna Robson (Jul 10 2025 at 18:59):

The first set is the objects, the extent of things to which the attributes apply. The second set is the intent, the attributes that are intended by the choice of objects

Wrenna Robson (Jul 10 2025 at 18:59):

That's how I remember

Violeta Hernández (Jul 10 2025 at 19:19):

Just updated the PR

Wrenna Robson (Jul 10 2025 at 19:33):

LGTM :)

Wrenna Robson (Jul 10 2025 at 19:34):

I think the instances might change a bit. And I'm not sure about those lemmas with "inf" in the name as I think we're now spelling that "min", etc.? But that can be a future piece of work.

Wrenna Robson (Jul 10 2025 at 19:35):

Do we perhaps want to make a thread in #PR Reviews for this work? It can stay here but people might not see it in maths.

Violeta Hernández (Jul 10 2025 at 19:36):

I thought we were still using inf and sup for lattices

Violeta Hernández (Jul 10 2025 at 19:37):

Sure, we can make a PR reviews thread

Wrenna Robson (Jul 10 2025 at 19:39):

I thought this but I'm not sure. It's certainly not what you get out of simps.

Violeta Hernández (Jul 10 2025 at 19:41):

We have docs#bot_inf_eq but no docs#bot_min_eq

Wrenna Robson (Jul 10 2025 at 19:48):

Fair enough then.

Wrenna Robson (Jul 10 2025 at 19:50):

Incidentally, the completion of the rationals under this gives the extended reals, right? Is there some similar construction that doesn't give you a bounded order if you already have it but otherwise suffices - i.e. gives a conditionally complete order?

Also - I think this follows from the order embedding stuff, but: if you have a linear order on the original type, the completed order is also linear, right?

Wrenna Robson (Jul 10 2025 at 19:50):

Might be a useful instance

Violeta Hernández (Jul 10 2025 at 19:52):

Wrenna Robson said:

Incidentally, the completion of the rationals under this gives the extended reals, right? Is there some similar construction that doesn't give you a bounded order if you already have it but otherwise suffices - i.e. gives a conditionally complete order?

Also - I think this follows from the order embedding stuff, but: if you have a linear order on the original type, the completed order is also linear, right?

You can just take out the top and bottom elements. That's what you generally do when you define real numbers as Dedekind cuts, you have to explicitly exclude the cases where either set is empty.

Wrenna Robson (Jul 10 2025 at 19:52):

Ahhhh

Violeta Hernández (Jul 10 2025 at 19:57):

And yeah, the completion of a linear order is linear.

Violeta Hernández (Jul 10 2025 at 19:59):

Not sure what the easiest way to prove this is

Aaron Liu (Jul 10 2025 at 20:07):

Violeta Hernández said:

Not sure what the easiest way to prove this is

try having an order embedding into LowerSet or UpperSet, and pull back le_total from there, is what I would do

Violeta Hernández (Jul 10 2025 at 20:23):

Oh of course, the linear order instance on LowerSet is basically exactly what you want

Violeta Hernández (Jul 10 2025 at 20:24):

instance {α : Type*} [LinearOrder α] : IsTotal (DedekindCut α) (·  ·) where
  total A B := @le_total (LowerSet α) _ ⟨_, A.isLowerSet_fst ⟨_, B.isLowerSet_fst

noncomputable instance {α : Type*} [LinearOrder α] : LinearOrder (DedekindCut α) := by
  classical exact Lattice.toLinearOrder _

noncomputable instance {α : Type*} [LinearOrder α] : CompleteLinearOrder (DedekindCut α) where
  __ := instCompleteLattice
  __ := instLinearOrder
  __ := LinearOrder.toBiheytingAlgebra

Wrenna Robson (Jul 10 2025 at 20:48):

Very nice.

Wrenna Robson (Jul 10 2025 at 20:48):

What does LowerSet correspond to in the concept lingo?

Wrenna Robson (Jul 10 2025 at 20:50):

(I have actually splurged and bought the Wille book on concept analysis so quite excited for that.)

Aaron Liu (Jul 10 2025 at 22:20):

Wrenna Robson said:

What does LowerSet correspond to in the concept lingo?

In a preorder α, a complementary pair of a lower set and an upper set corresponds to a Concept α α fun a b => ¬b ≤ a

Aaron Liu (Jul 10 2025 at 22:23):

Furthermore, this correspondence is an order isomorphism

Wrenna Robson (Jul 10 2025 at 23:36):

Right, so LowerSet is quite like an extent.

Wrenna Robson (Jul 10 2025 at 23:36):

Having looked into it, we also have ClosureOperator which is quite closely linked to some of these topics.

Aaron Liu (Jul 10 2025 at 23:37):

it's a galois connection, sometimes an insertion, sometimes a coinsertion

Wrenna Robson (Jul 11 2025 at 10:24):

Oh: Chapter 7 of "Introduction to Lattices and Order" actually has the discussion of the Dedekind–MacNeille completion.

Aaron Liu (Jul 12 2025 at 14:29):

Here's the order iso

import Mathlib

universe u

variable {α : Type u} [Preorder α]

example :
    {s : LowerSet α × UpperSet α // IsCompl (s.1 : Set α) (s.2 : Set α)} o
    Concept α α fun a b => ¬b  a where
  toFun s := {
    extent := s.1.1
    intent := s.1.2
    upperPolar_extent := by
      ext x
      constructor
      · intro hx
        rw [ s.prop.compl_eq, Set.mem_compl_iff]
        intro h
        exact hx h le_rfl
      · intro hx y hy hxy
        apply s.prop.disjoint.notMem_of_mem_left hy
        exact s.1.2.upper hxy hx
    lowerPolar_intent := by
      ext x
      constructor
      · intro hx
        rw [s.prop.eq_compl, Set.mem_compl_iff]
        intro h
        exact hx h le_rfl
      · intro hx y hy hxy
        apply s.prop.disjoint.notMem_of_mem_right hy
        exact s.1.1.lower hxy hx
  }
  invFun s := by
    refine (s.extent, ?_⟩, s.intent, ?_⟩), ?_, ?_⟩
    · intro x y hyx hx
      rw [ s.lowerPolar_intent] at hx 
      intro z hz hzy
      exact hx hz (hzy.trans hyx)
    · intro x y hxy hx
      rw [ s.upperPolar_extent] at hx 
      intro z hz hyz
      exact hx hz (hxy.trans hyz)
    · rw [Set.disjoint_iff]
      intro x hxl, hxr
      simp only [LowerSet.coe_mk, UpperSet.coe_mk] at hxl hxr
      rw [ s.upperPolar_extent] at hxr
      exact hxr hxl le_rfl
    · rw [codisjoint_iff_le_sup]
      intro x _
      simp only [LowerSet.coe_mk, UpperSet.coe_mk, Set.sup_eq_union, Set.mem_union]
      rw [or_iff_not_imp_left]
      intro hx
      rw [ s.lowerPolar_intent] at hx
      simp_rw [lowerPolar, Set.mem_setOf, not_forall, not_not] at hx
      obtain y, hy, hyx := hx
      rw [ s.upperPolar_extent] at hy 
      intro z hz hxz
      exact hy hz (hyx.trans hxz)
  left_inv _ := rfl
  right_inv _ := rfl
  map_rel_iff' := by
    intro a b
    simp only [Equiv.coe_fn_mk]
    apply and_self_iff.symm.trans
    conv_lhs =>
      congr
      · rw [ Concept.extent_subset_extent_iff]
      · rw [ Concept.intent_subset_intent_iff]
    simp [ Prod.le_def]

Wrenna Robson (Jul 15 2025 at 09:13):

Been doing some work on API improvements, started a different branch just to spread out the work a bit.

Wrenna Robson (Jul 15 2025 at 09:18):

Broadly some analogous types to LowerSet and UpperSet and that.

Wrenna Robson (Jul 15 2025 at 09:21):

Though I have managed to leave that branch on my home computer

Wrenna Robson (Jul 30 2025 at 11:30):

Wrenna Robson said:

(I have actually splurged and bought the Wille book on concept analysis so quite excited for that.)

My copy of the Wille book arrived. Gonna try touching concepts again soon.

Wrenna Robson (Jul 30 2025 at 11:30):

I do find myself wishing we a) had some concept of an order-reversing map, b) had a clear spelling for "Galois connection but it reverses the order".

Wrenna Robson (Jul 30 2025 at 11:31):

I know that you can use the dual, of course.

Wrenna Robson (Jul 30 2025 at 11:32):

But I don't like this as an option myself. For one thing - is the natural type of order-reversing maps Aᵒᵈ →o B or A →o Bᵒᵈ?

Wrenna Robson (Jul 30 2025 at 11:33):

Personally I would like to see a world where we have A →oᵒᵈ B to mean "order-reversing map from A to B", and then an appropriate equivalence between A →oᵒᵈ B and Aᵒᵈ →o B and A →o Bᵒᵈ.

Wrenna Robson (Jul 30 2025 at 11:34):

But I'm not sure if there's any appetite for this amongst contributors or maintainers.

Wrenna Robson (Jul 30 2025 at 13:14):

Might make this its own thread.

Yaël Dillies (Jul 30 2025 at 14:33):

The reason we don't have order-reversing maps, not contravariant functors, is https://xkcd.com/927/

Bryan Gin-ge Chen (Jul 30 2025 at 14:58):

Wrenna Robson said:

Might make this its own thread.

(linking for future reference: the new thread is at #maths > Order-reversing maps @ 💬)

Wrenna Robson (Jul 30 2025 at 16:59):

Yaël Dillies said:

The reason we don't have order-reversing maps, not contravariant functors, is https://xkcd.com/927/

The would feel true if we had any standard.

Antoine Chambert-Loir (Sep 25 2025 at 22:26):

What is the status of your project of constructing the Dedekind-MacNeille completion?

Wrenna Robson (Sep 25 2025 at 23:55):

God I can't even remember where we got to. I think I got lost down an order whole. I really need a better way of tracking my Mathlib and Lean projects.

Violeta Hernández (Sep 26 2025 at 04:47):

I completely forgot about this. Once I was able to use concepts to define surreal gaps i didn't really continue working on this.

Violeta Hernández (Sep 26 2025 at 04:47):

There should be an open PR of mine defining an alias for the DM completion, I'll see if I can resurrect it.

Violeta Hernández (Sep 26 2025 at 05:13):

Ah yes, #26966

Violeta Hernández (Sep 26 2025 at 05:14):

Note that if you want to work with the DM completion right now, you already can:

abbrev DedekindCut [Preorder α] := Concept α α (·  ·)

Violeta Hernández (Sep 26 2025 at 05:14):

I think what stopped me was @Wrenna Robson figuring out that some of my definitions could be generalized

Violeta Hernández (Sep 26 2025 at 05:19):

Ah! I'm glad I left a comment about this:

As a sidenote, the PR actually got drafted because it turns out this is not the most general definition! In any concept lattice, you can define two maps ofObject and ofAttribute; these just happen to give the same map in this special case.

Violeta Hernández (Sep 26 2025 at 05:23):

I'm not currently in the middle of any other major projects, so I think I can get this one over the finish line

Wrenna Robson (Sep 26 2025 at 05:46):

Happy to review it btw

Violeta Hernández (Sep 26 2025 at 05:54):

I notice your branch defines ofObjects and ofAttributes, for a set rather than a single element

Violeta Hernández (Sep 26 2025 at 05:55):

Do you think it's worth having both the set/element versions, or should we stick to one (or the other?)

Wrenna Robson (Sep 26 2025 at 05:57):

I think there was a reason I did that certainly! But I can't remember what it was.

Violeta Hernández (Sep 26 2025 at 05:59):

I probably need to read the document you sent me in full

Wrenna Robson (Sep 26 2025 at 06:01):

I'm sorry ;_;. I really got quite keen for this but then life happened.

Violeta Hernández (Sep 26 2025 at 06:01):

Ah, don't worry

Wrenna Robson (Sep 26 2025 at 06:01):

And I just kept finding stuff that I wanted to change

Violeta Hernández (Sep 26 2025 at 06:01):

I also am juggling like five Lean projects at any given point

Wrenna Robson (Sep 26 2025 at 06:25):

Mood

Wrenna Robson (Sep 26 2025 at 06:25):

I just tend to get bogged down in reviews or whatever

Wrenna Robson (Sep 26 2025 at 06:25):

And then never have time to get stuff finished

Violeta Hernández (Sep 26 2025 at 06:25):

yeah, I get you

Violeta Hernández (Sep 26 2025 at 06:26):

A lot of my work is kind of niche and so it often gets trapped in review hell

Violeta Hernández (Sep 26 2025 at 08:12):

Just opened #29995 and #29996. The former just adds a few lemmas I needed in the CGT repo, and the latter is just some small stylistic changes to the file.

Violeta Hernández (Sep 26 2025 at 08:35):

Ah nvm, I see that the work on your branch actually allows much simpler definitions for the instances! I think I'll replace #29996 with that.

Wrenna Robson (Sep 26 2025 at 08:36):

I'm glad that past me was smart and cool or whatever

Violeta Hernández (Sep 26 2025 at 08:37):

Specifically, I think I'll replace #29996 with a PR that defines IsIntent / IsExtent and uses them to golf the definitions of the lattice structure on concepts

Violeta Hernández (Sep 26 2025 at 08:37):

(You don't mind me opening the PR and adding you as a coauthor, do you?)

Wrenna Robson (Sep 26 2025 at 08:41):

I do not.

Wrenna Robson (Sep 26 2025 at 08:41):

I think you'll do good work here and I'm enthusiastic about contributing if I can, I just know I can't commit to it right now

Violeta Hernández (Sep 26 2025 at 09:01):

The new and improved #29996 is ready!

Violeta Hernández (Sep 26 2025 at 09:02):

Your usage of simps! was really clever, I was able to get rid of a huge block of lemmas which are now autogenerated

Wrenna Robson (Sep 26 2025 at 09:10):

Oh nice

Wrenna Robson (Sep 26 2025 at 09:12):

Should I look at #29995 first?

Violeta Hernández (Sep 26 2025 at 09:13):

It's quite smaller, so it might be easier to start there yeah

Violeta Hernández (Sep 26 2025 at 09:15):

Even smaller now that I realize I can use simps! there too

Wrenna Robson (Sep 26 2025 at 09:15):

Just made a commend to that extent! One sec while I finish

Wrenna Robson (Sep 26 2025 at 09:21):

Some comments added

Wrenna Robson (Sep 26 2025 at 09:25):

In general I would say that we do NOT here use the same approach that LowerSet and UpperSet use (where they have structure types that essentially correspond to upper and lower sets, which then use the predicate). I think that is fine - I just want to note the difference of approach.

Wrenna Robson (Sep 26 2025 at 09:26):

BUT having said this

Wrenna Robson (Sep 26 2025 at 09:26):

if you define an Extent and Intent type, the point is that they are order-isomorphic with the Concept lattice.

Wrenna Robson (Sep 26 2025 at 09:27):

i.e. I think it is true that a Concept is uniquely determined by its extent and its intent.

Wrenna Robson (Sep 26 2025 at 09:31):

Do we have a definition of the upper and lower closure? i.e. analogous to upperClosure and lowerClosure?

Wrenna Robson (Sep 26 2025 at 09:32):

I remember that I was playing around with this, and I am not sure I had found my favoured description.

Wrenna Robson (Sep 26 2025 at 09:32):

But all these concepts stuff is quite closely tied into closure operators and the like.

Violeta Hernández (Sep 26 2025 at 09:34):

I don't really think we should define an Extent/Intent type. In an ideal world, I don't believe we would have defined separate UpperSet/LowerSet types either.

Violeta Hernández (Sep 26 2025 at 09:34):

Wrenna Robson said:

Do we have a definition of the upper and lower closure? i.e. analogous to upperClosure and lowerClosure?

Isn't that just upperBounds and lowerBounds?

Wrenna Robson (Sep 26 2025 at 09:35):

So in this context I mean like "the smallest extent that contains a set" or whatever

Wrenna Robson (Sep 26 2025 at 09:35):

I guess these was the ofObjects or ofAttributes thing, right?

Wrenna Robson (Sep 26 2025 at 09:36):

Like if I have a set s, lowerPolar r (upperPolar r s) is the extent closure of it.

Wrenna Robson (Sep 26 2025 at 09:36):

That set is an extent.

Wrenna Robson (Sep 26 2025 at 09:36):

So a set whose extent closure is equal to itself is an extent

Wrenna Robson (Sep 26 2025 at 09:36):

same (dual) for intents

Violeta Hernández (Sep 26 2025 at 09:37):

Hm you're right, the upper closure would be upperBounds (lowerBounds s)

Violeta Hernández (Sep 26 2025 at 09:37):

No, I don't believe we have a definition for that

Wrenna Robson (Sep 26 2025 at 09:37):

https://en.wikipedia.org/wiki/Closure_operator

Violeta Hernández (Sep 26 2025 at 09:41):

Oh wait I'm sorry I completely misunderstood your question

Violeta Hernández (Sep 26 2025 at 09:41):

You're asking whether we should have upperClosure r s = upperPolar r (lowerPolar r s) as a definition?

Wrenna Robson (Sep 26 2025 at 09:42):

Yep!

Wrenna Robson (Sep 26 2025 at 09:42):

btw I agree about the separate types I think.

Wrenna Robson (Sep 26 2025 at 09:42):

Well you would call it the extentClosure probably.

Wrenna Robson (Sep 26 2025 at 09:43):

Obviously we had extentClosure previously, but the definition was not correct as we know

Wrenna Robson (Sep 26 2025 at 09:43):

Like if you look at the "formal contexts and concepts" heading here: https://en.wikipedia.org/wiki/Formal_concept_analysis

Violeta Hernández (Sep 26 2025 at 09:43):

hmm... it's a tough call. I feel like it might be too simple of an object to have, considering it's just the composition of two other functions with extensive API

Wrenna Robson (Sep 26 2025 at 09:43):

basically taking two primes is a closure

Wrenna Robson (Sep 26 2025 at 09:44):

Violeta Hernández said:

hmm... it's a tough call. I feel like it might be too simple of an object to have, considering it's just the composition of two other functions with extensive API

I somewhat suspect this. It should probably be an abbrev if it is defined.

Violeta Hernández (Sep 26 2025 at 09:44):

What about instead having extentClosure be a docs#ClosureOperator on Set α?

Wrenna Robson (Sep 26 2025 at 09:44):

I think that would make sense (and it... is that, I think?)

Wrenna Robson (Sep 26 2025 at 09:44):

(Yes.)

Wrenna Robson (Sep 26 2025 at 09:45):

We have the GaloisConnection between upperPolar and lowerPolar, right?

Violeta Hernández (Sep 26 2025 at 09:45):

that way it's not just the composition of these two functions

Violeta Hernández (Sep 26 2025 at 09:45):

We do, yes

Wrenna Robson (Sep 26 2025 at 09:45):

(Possibly you need to stickl some duals in there IDK).

Wrenna Robson (Sep 26 2025 at 09:45):

Because I think the closure operator will have a way of being made from the Galois Connection

Wrenna Robson (Sep 26 2025 at 09:46):

GaloisConnection.closureOperator

Violeta Hernández (Sep 26 2025 at 09:46):

It's probably easy enough to construct it directly with the API we already have

Violeta Hernández (Sep 26 2025 at 09:46):

Ah, nice

Wrenna Robson (Sep 26 2025 at 09:47):

If we're lucky that will even be nicely defeq when applied to the obvious thing.

Wrenna Robson (Sep 26 2025 at 09:48):

It's a really neat construction really - you go from this set with an arbitrary relation. and use that relation to construct this particular sublattice of the power set (the extents/the intents).

Wrenna Robson (Sep 26 2025 at 09:48):

which is complete!

Wrenna Robson (Sep 26 2025 at 09:50):

And then in particular if your original relation was <=... then when your original type embeds into this lattice, that is the completion and everything is respected.

Violeta Hernández (Sep 26 2025 at 09:53):

Wrenna Robson said:

Violeta Hernández said:

hmm... it's a tough call. I feel like it might be too simple of an object to have, considering it's just the composition of two other functions with extensive API

I somewhat suspect this. It should probably be an abbrev if it is defined.

I've learned the hard way that abbrev isn't nearly as nice as you'd want it to be

Wrenna Robson (Sep 26 2025 at 09:54):

It certainly isn't a catch-all solution.

Violeta Hernández (Sep 26 2025 at 10:41):

I just opened #30001 defining ofObjects and ofAttributes. This depends on #29996 for some lemmas, though.

Violeta Hernández (Sep 26 2025 at 10:43):

I think with that, everything on your branch has a PR now :slight_smile:

Wrenna Robson (Sep 26 2025 at 10:43):

I would change ofObjects_extent to ofObjects_apply_extent maybe (which lets you use simps?)

Wrenna Robson (Sep 26 2025 at 10:44):

Really though it feels like maybe simps should generate it as a prefix (extent_ofObjects)

Violeta Hernández (Sep 26 2025 at 10:44):

It's the eternal debate of dot notation

Wrenna Robson (Sep 26 2025 at 10:44):

Indeed

Wrenna Robson (Sep 26 2025 at 10:44):

Did you define that closure operator?

Violeta Hernández (Sep 26 2025 at 10:44):

I think the majority opinion is that foo.bar should be written down as bar_foo, but unfortunately simps disagrees with us

Violeta Hernández (Sep 26 2025 at 10:44):

I added the closure operator to #30001, though I don't really use it at all

Wrenna Robson (Sep 26 2025 at 10:44):

I note that (ofObjects r s).extent is a shorter spelling of it.

Wrenna Robson (Sep 26 2025 at 10:45):

I did have some comments on the other ones I can see you've not done? In particular I think it would be good to explictly have both sup and inf when defining the Lattice.

Wrenna Robson (Sep 26 2025 at 10:46):

i.e. as well as sup := (· ⊔ ·), also explictly give inf.

Violeta Hernández (Sep 26 2025 at 10:46):

Wrenna Robson said:

I did have some comments on the other ones I can see you've not done? In particular I think it would be good to explictly have both sup and inf when defining the Lattice.

I did respond to it, I mentioned that the SemilatticeInf instance already takes care of inf

Wrenna Robson (Sep 26 2025 at 10:46):

No I know.

Wrenna Robson (Sep 26 2025 at 10:47):

I'm saying you shouldn't leave it to that, it's often good in such cases to expressly define it.

Wrenna Robson (Sep 26 2025 at 10:47):

So that it is definitely defeq to the thing you want.

Violeta Hernández (Sep 26 2025 at 10:47):

you mean, add a field inf := (· ⊓ ·)?

Wrenna Robson (Sep 26 2025 at 10:47):

Ohh except - right

Wrenna Robson (Sep 26 2025 at 10:47):

Yes

Violeta Hernández (Sep 26 2025 at 10:47):

that feels a bit silly, since the inf instance that's inferred is in fact def-eq to the inf instance that's inferred

Wrenna Robson (Sep 26 2025 at 10:48):

Doesn't hurt to make it explict

Wrenna Robson (Sep 26 2025 at 10:48):

Arguably instSemilatticeInfConcept adds very little.

Violeta Hernández (Sep 26 2025 at 10:48):

It gets all three inf fields from the Lattice instance done at once

Violeta Hernández (Sep 26 2025 at 10:48):

As well as giving the PartialOrder instance

Wrenna Robson (Sep 26 2025 at 10:49):

Yes but you could just directly define the lattice. It isn't like it only exists under a certain constraint

Violeta Hernández (Sep 26 2025 at 10:49):

the Lattice instance uses some auxiliary theorems that we need the PartialOrder instance to even state

Wrenna Robson (Sep 26 2025 at 10:50):

also not quite sure about theorem ext' - again I just don't like primes! But extExtent and extIntent wouldn't be very ergonomic. It's just that I am not sure about breaking the symmetry

Wrenna Robson (Sep 26 2025 at 10:50):

Violeta Hernández said:

the Lattice instance uses some auxiliary theorems that we need the PartialOrder instance to even state

Ahhh fair

Violeta Hernández (Sep 26 2025 at 10:50):

Wrenna Robson said:

also not quite sure about theorem ext' - again I just don't like primes! But extExtent and extIntent wouldn't be very ergonomic. It's just that I am not sure about breaking the symmetry

Agree, that's why I instead added the docstrings

Wrenna Robson (Sep 26 2025 at 10:50):

I would probably use PartialOrder.lift to create the partial order

Violeta Hernández (Sep 26 2025 at 10:51):

Wrenna Robson said:

Doesn't hurt to make it explict

Making the inf field explicit makes it so that the other fields inf_le_left, inf_le_right, le_inf can no longer be inferred

Wrenna Robson (Sep 26 2025 at 10:51):

Alas.

Violeta Hernández (Sep 26 2025 at 10:51):

Wrenna Robson said:

I would probably use PartialOrder.lift to create the partial order

Well, but then we'd have to prove those three theorems instead of just getting them for free

Wrenna Robson (Sep 26 2025 at 10:51):

No, true...

Wrenna Robson (Sep 26 2025 at 10:52):

Btw do we have the theorem that c <= d (c d concepts) iff c.extent <= d.extent and iff d.intent <= c.intent?

Violeta Hernández (Sep 26 2025 at 10:52):

of course

Wrenna Robson (Sep 26 2025 at 10:52):

I can't see them

Wrenna Robson (Sep 26 2025 at 10:53):

but I thought we must do

Wrenna Robson (Sep 26 2025 at 10:53):

what are they called?

Violeta Hernández (Sep 26 2025 at 10:53):

docs#Concept.extent_subset_extent_iff

Wrenna Robson (Sep 26 2025 at 10:53):

That... doesn't seem to exist?

Wrenna Robson (Sep 26 2025 at 10:53):

In either file?

Violeta Hernández (Sep 26 2025 at 10:53):

edited

Wrenna Robson (Sep 26 2025 at 10:53):

aha!

Wrenna Robson (Sep 26 2025 at 10:54):

yes I always forget that we tend to use subset here

Wrenna Robson (Sep 26 2025 at 10:55):

How are Concept α β r and Concept α β (fun a b => ¬r a b) related btw? Are they at all?

Wrenna Robson (Sep 26 2025 at 11:00):

Oh also, where actually is the definition of the Dedekind-MacNeille completion in all this?

Violeta Hernández (Sep 26 2025 at 11:01):

Wrenna Robson said:

How are Concept α β r and Concept α β (fun a b => ¬r a b) related btw? Are they at all?

If s is an extent in the former, then I think sᶜ should be an extent in the latter? likewise with the intent.

Wrenna Robson (Sep 26 2025 at 11:01):

That feels right.

Violeta Hernández (Sep 26 2025 at 11:01):

Wrenna Robson said:

Oh also, where actually is the definition of the Dedekind-MacNeille completion in all this?

That's a completely different PR, which I want to remake using #30001

Wrenna Robson (Sep 26 2025 at 11:01):

Got it.

Wrenna Robson (Sep 26 2025 at 11:02):

Violeta Hernández said:

Wrenna Robson said:

How are Concept α β r and Concept α β (fun a b => ¬r a b) related btw? Are they at all?

If s is an extent in the former, then I think sᶜ should be an extent in the latter? likewise with the intent.

It basically just occured to me that the link between the Concept for < and the concept for <= might be a combination of this plus the swap one.

Violeta Hernández (Sep 26 2025 at 11:03):

In the linear order case, maybe

Wrenna Robson (Sep 26 2025 at 11:03):

Yes.

Violeta Hernández (Sep 26 2025 at 11:04):

I might be wrong about this, but I think that in any partial order, the <-concept lattice looks like the Dedekind completion, except that every element in the original order is associated to two elements that cover each other, instead of just one

Wrenna Robson (Sep 26 2025 at 11:05):

Hmm interesting.

Violeta Hernández (Sep 26 2025 at 11:05):

At least that happens in the linear order case

Violeta Hernández (Sep 26 2025 at 11:05):

I don't see a reason why it shouldn't happen in the partial order case too

Violeta Hernández (Sep 26 2025 at 11:08):

To be more specific, to embed an element of a poset into its Dedekind completion, you use the map fun x ↦ (Iic x, Ici x)

Violeta Hernández (Sep 26 2025 at 11:09):

but in the <-concept lattice, you can use either of fun x ↦ (Iio x, Ici x) or fun x ↦ (Iic x, Ioi x)

Wrenna Robson (Sep 26 2025 at 11:09):

Yeah that makes sense.

Wrenna Robson (Sep 26 2025 at 11:09):

Man that feels the wrong way round

Wrenna Robson (Sep 26 2025 at 11:09):

like it feels like it should be (Ici x, Iic x)

Wrenna Robson (Sep 26 2025 at 11:09):

But then you'd have to reverse intent and extent I guess

Aaron Liu (Sep 26 2025 at 11:16):

Violeta Hernández said:

I might be wrong about this, but I think that in any partial order, the <-concept lattice looks like the Dedekind completion, except that every element in the original order is associated to two elements that cover each other, instead of just one

Remember linear orders are automatically a lot of things

Aaron Liu (Sep 26 2025 at 11:20):

I have a four element poset whose <-concept lattice is a three element chain

Aaron Liu (Sep 26 2025 at 11:22):

and it's not always true for linear orders either since if it has a top or bot

Yijun Yuan (Sep 26 2025 at 11:26):

In my work on Hader-Narasimhan theory, I implemented the Dedekind-MacNeille completion DM(X) of any partially ordered set X (the minimal complete lattice containing a given partially ordered set), and showed that

  1. If the order on X is linear, then the order on DM(X) is also linear.
  2. The universal property of DM(X): any order embedding X→Y, with Y a complete lattice, factors through the canonical embedding X→DM(X).

What I do not formalize: The denseness of X in DM(X) (meet-dense, join-dense...)

I don't know if this is helpful

Code: https://github.com/YijunYuan/HarderNarasimhan/blob/master/HarderNarasimhan/OrderTheory/DedekindMacNeilleCompletion.lean

When working on this project, I'm not aware of this thread :rolling_on_the_floor_laughing:

Violeta Hernández (Sep 26 2025 at 11:27):

(deleted)

Violeta Hernández (Sep 26 2025 at 11:30):

Aaron Liu said:

I have a four element poset whose <-concept lattice is a three element chain

How come?

Aaron Liu (Sep 26 2025 at 11:30):

it just is

Aaron Liu (Sep 26 2025 at 11:30):

I calculated it

Aaron Liu (Sep 26 2025 at 11:31):

Everything is finite so

Violeta Hernández (Sep 26 2025 at 11:31):

Ok, let me rephrase, what's your example?

Aaron Liu (Sep 26 2025 at 11:32):

uhm

Aaron Liu (Sep 26 2025 at 11:32):

how do I describe this

Aaron Liu (Sep 26 2025 at 11:32):

it's the specialization order on the pseudocircle

Violeta Hernández (Sep 26 2025 at 11:32):

Hey, wait, stop, wait a second

Violeta Hernández (Sep 26 2025 at 11:33):

Isn't the Dedekind-MacNeille completion of α literally just LowerSet α?

Wrenna Robson (Sep 26 2025 at 11:34):

That seems like it would be isomorphic. But morally all that stuff is kinda a special case of the concept stuff.

Aaron Liu (Sep 26 2025 at 11:34):

no

Aaron Liu (Sep 26 2025 at 11:34):

it's not

Violeta Hernández (Sep 26 2025 at 11:35):

ok thank goodness

Wrenna Robson (Sep 26 2025 at 11:35):

Oh yeah the implication is the other way round.

Aaron Liu (Sep 26 2025 at 11:35):

counting argument the dedekind completion of singleton is singleton but lower sets is two-chain

Wrenna Robson (Sep 26 2025 at 11:36):

What is two-chain?

Aaron Liu (Sep 26 2025 at 11:36):

linear order with two elements

Wrenna Robson (Sep 26 2025 at 11:36):

Right.

Wrenna Robson (Sep 26 2025 at 11:37):

Yeah I think LowerSet is not minimal in that sense. You can presumably embed into it?

Aaron Liu (Sep 26 2025 at 11:37):

if the order is linear

Wrenna Robson (Sep 26 2025 at 11:37):

Right

Aaron Liu (Sep 26 2025 at 11:39):

Wrenna Robson said:

That seems like it would be isomorphic. But morally all that stuff is kinda a special case of the concept stuff.

It is a special case not just morally but literally

Wrenna Robson (Sep 26 2025 at 11:39):

Well it isn't in terms of how it is defined.

Aaron Liu (Sep 26 2025 at 11:39):

Aaron Liu said:

Here's the order iso

import Mathlib

universe u

variable {α : Type u} [Preorder α]

example :
    {s : LowerSet α × UpperSet α // IsCompl (s.1 : Set α) (s.2 : Set α)} o
    Concept α α fun a b => ¬b  a where
  toFun s := {
    extent := s.1.1
    intent := s.1.2
    upperPolar_extent := by
      ext x
      constructor
      · intro hx
        rw [ s.prop.compl_eq, Set.mem_compl_iff]
        intro h
        exact hx h le_rfl
      · intro hx y hy hxy
        apply s.prop.disjoint.notMem_of_mem_left hy
        exact s.1.2.upper hxy hx
    lowerPolar_intent := by
      ext x
      constructor
      · intro hx
        rw [s.prop.eq_compl, Set.mem_compl_iff]
        intro h
        exact hx h le_rfl
      · intro hx y hy hxy
        apply s.prop.disjoint.notMem_of_mem_right hy
        exact s.1.1.lower hxy hx
  }
  invFun s := by
    refine (s.extent, ?_⟩, s.intent, ?_⟩), ?_, ?_⟩
    · intro x y hyx hx
      rw [ s.lowerPolar_intent] at hx 
      intro z hz hzy
      exact hx hz (hzy.trans hyx)
    · intro x y hxy hx
      rw [ s.upperPolar_extent] at hx 
      intro z hz hyz
      exact hx hz (hxy.trans hyz)
    · rw [Set.disjoint_iff]
      intro x hxl, hxr
      simp only [LowerSet.coe_mk, UpperSet.coe_mk] at hxl hxr
      rw [ s.upperPolar_extent] at hxr
      exact hxr hxl le_rfl
    · rw [codisjoint_iff_le_sup]
      intro x _
      simp only [LowerSet.coe_mk, UpperSet.coe_mk, Set.sup_eq_union, Set.mem_union]
      rw [or_iff_not_imp_left]
      intro hx
      rw [ s.lowerPolar_intent] at hx
      simp_rw [lowerPolar, Set.mem_setOf, not_forall, not_not] at hx
      obtain y, hy, hyx := hx
      rw [ s.upperPolar_extent] at hy 
      intro z hz hxz
      exact hy hz (hyx.trans hxz)
  left_inv _ := rfl
  right_inv _ := rfl
  map_rel_iff' := by
    intro a b
    simp only [Equiv.coe_fn_mk]
    apply and_self_iff.symm.trans
    conv_lhs =>
      congr
      · rw [ Concept.extent_subset_extent_iff]
      · rw [ Concept.intent_subset_intent_iff]
    simp [ Prod.le_def]

Wrenna Robson (Sep 26 2025 at 11:39):

But yes.

Yijun Yuan (Sep 26 2025 at 11:41):

Sorry to interrupt, but what's the theme of the current discussion?

Violeta Hernández (Sep 26 2025 at 11:42):

@Yijun Yuan Just checked your branch. I think everything in there is covered by my PR (with much simpler proofs)

Yijun Yuan (Sep 26 2025 at 11:43):

Violeta Hernández said:

Yijun Yuan Just checked your branch. I think everything in there is covered by my PR (with much simpler proofs)

Great!

Yijun Yuan (Sep 26 2025 at 11:43):

Then maybe another remark is needed in my preprint :rolling_on_the_floor_laughing:

Violeta Hernández (Sep 26 2025 at 11:54):

Just updated #26966. This now contains a CompleteLinearOrder (DedekindCut α) instance.

Violeta Hernández (Sep 26 2025 at 11:56):

@Aaron Liu Ah, that explains it. So the modified Dedekind cut construction of surreals is really the -concept lattice, which happens to match the <-concept lattice in the linear order case.

Wrenna Robson (Sep 26 2025 at 11:57):

Have you got that DedekindCut.of is surjective on a Complete Lattice?

Aaron Liu (Sep 26 2025 at 11:58):

Violeta Hernández said:

Aaron Liu Ah, that explains it. So the modified Dedekind cut construction of surreals is really the -concept lattice, which happens to match the <-concept lattice in the linear order case.

that's what I said

Wrenna Robson (Sep 26 2025 at 11:58):

Or related things - like, if the underlying type is a CompleteSemilatticeSup, then the sSup operations are compatible (or whatever is true).

Aaron Liu (Sep 26 2025 at 11:58):

The <-concept lattice doesn't seem to be anything I know in the case of a non-linear order

Wrenna Robson (Sep 26 2025 at 12:00):

I guess of( sSup {s})

Wrenna Robson said:

Or related things - like, if the underlying type is a CompleteSemilatticeSup, then the sSup operations are compatible (or whatever is true).

Maybe this simply follows from it being an order embedding, IDK.

Violeta Hernández (Sep 26 2025 at 12:01):

Wrenna Robson said:

Have you got that DedekindCut.of is surjective on a Complete Lattice?

I can add that, it follows directly from the factor theorem

Aaron Liu (Sep 26 2025 at 12:01):

Surjective order embedding is order iso?

Wrenna Robson (Sep 26 2025 at 12:01):

Basically "if sup, inf, bot, top, sSup, sInf have sensible definitions, those definitions are compatible with the completion", that kind of thing.

Wrenna Robson (Sep 26 2025 at 12:03):

For me that is kind of the key final property - "if these things mean

Aaron Liu said:

Surjective order embedding is order iso?

Yeah I am not sure I can see "when it's a Complete Lattice already this is an order iso", though it surely follows!

Aaron Liu (Sep 26 2025 at 12:06):

I think of this as "adjoining" a sSup and sInf for every set in a way that makes it a complete lattice so if a set already has a sup or inf then it's "forced" to be the same as the existing one

Wrenna Robson (Sep 26 2025 at 12:06):

Aye

Aaron Liu (Sep 26 2025 at 12:07):

Probably translates to a statement involving docs#IsGLB and a statement involving docs#IsLUB

Wrenna Robson (Sep 26 2025 at 12:08):

You could define a map universal_sSup for instance (bad name) which is basically "take the sSup of a set into the Dedekind completion".

Wrenna Robson (Sep 26 2025 at 12:09):

And one could imagine some map on the Dedekind completion which is essentially the "go back to the original type if you can (because it is in the range of DedekindCut.of)".

Aaron Liu (Sep 26 2025 at 12:10):

I think this is something like "the map into the completion is bicontinuous"

Wrenna Robson (Sep 26 2025 at 12:10):

Which reminds me: I think DedekindCut.of should be protected.

Violeta Hernández (Sep 26 2025 at 12:12):

docs#FreeGroup.of and co. aren't protected so I think we should be fine

Wrenna Robson (Sep 26 2025 at 12:12):

Ah OK

Violeta Hernández (Sep 26 2025 at 12:15):

Just added of as an order isomorphism to the PR

Wrenna Robson (Sep 26 2025 at 12:15):

Nice.

Violeta Hernández (Sep 26 2025 at 12:18):

There's probably more stuff to be done, but I'd rather not be trapped in scope creep.

Wrenna Robson (Sep 26 2025 at 12:19):

Aye

Violeta Hernández (Sep 26 2025 at 12:21):

Question: does ofIso count as a proof of the fundamental theorem of concept lattices?

Aaron Liu (Sep 26 2025 at 12:21):

what's the fundamental theorem

Wrenna Robson (Sep 26 2025 at 12:22):

I feel like you would need a proof that if something is isomorphic to its Dedekind Cut, it is a complete lattice, but given the dedekind cut is a complete lattice that is surely a one-line proof.

Violeta Hernández (Sep 26 2025 at 12:22):

As I understand it, the fundamental theorem of concept lattices is "every concept lattice is a complete lattice, and every complete lattice is isomorphic to a concept lattice"

Violeta Hernández (Sep 26 2025 at 12:23):

we have in fact now proved both

Wrenna Robson (Sep 26 2025 at 12:24):

Depends on the statement I think but I would say it's basically there

Violeta Hernández (Sep 26 2025 at 12:25):

image.png
This seems to be what I'm saying

Wrenna Robson (Sep 26 2025 at 12:25):

Aye

Wrenna Robson (Sep 26 2025 at 12:26):

There is some stuff about infimum-dense and supremum-dense stuff that are in some statements of it I think

Violeta Hernández (Sep 26 2025 at 12:28):

Theorem 3.9 does seem to be a bit more detailed
image.png

Wrenna Robson (Sep 26 2025 at 12:28):

Yes I think you have the "in particular".

Wrenna Robson (Sep 26 2025 at 12:28):

I don't think mathlib contains concept of join-dense and meet-dense so that feels like a future PR

Violeta Hernández (Sep 26 2025 at 12:29):

Reading the statement from 3.10 I don't really get the impression that the entirety of 3.9 is part of the fundamental theorem

Violeta Hernández (Sep 26 2025 at 12:29):

It seems that the fundamental theorem is the characterization of concept lattices, rather

Violeta Hernández (Sep 26 2025 at 12:29):

Basically what I'm asking is whether I can get rid of the todo on the module docstring

Wrenna Robson (Sep 26 2025 at 12:30):

Right! I feel like morally yes but expect to justify that to reviewers so do make a note.

Violeta Hernández (Sep 26 2025 at 13:36):

@Aaron Liu Wait, isn't LowerSet Surreal the same as Cut?

Violeta Hernández (Sep 26 2025 at 13:36):

I think that's what your order iso proves

Aaron Liu (Sep 26 2025 at 13:53):

Violeta Hernández said:

Aaron Liu Wait, isn't LowerSet Surreal the same as Cut?

Yes???

Aaron Liu (Sep 26 2025 at 13:53):

What's the confusion here

Violeta Hernández (Sep 26 2025 at 13:53):

that I got into concepts for nothing

Aaron Liu (Sep 26 2025 at 13:58):

no it's for the defeqs

Violeta Hernández (Sep 26 2025 at 14:37):

oh yeah this is in the concept lattice PDF
image.png

Aaron Liu (Sep 26 2025 at 14:38):

neat


Last updated: Dec 20 2025 at 21:32 UTC