Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds unary disjoint relation #2595

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bsaul
Copy link
Contributor

@bsaul bsaul commented Feb 19, 2025

This PR adds the relation between two predicates expressing disjointness.

I am not at all wedded to the _#_ notation.

See the discussion on the Agda Zulip for more background.

@bsaul
Copy link
Contributor Author

bsaul commented Feb 19, 2025

Before I fix the build errors (due to overloaded # symbol), I'll wait till we've settled on notation.

@@ -207,7 +207,7 @@ infixr 8 _⇒_
infixr 7 _∩_
infixr 6 _∪_
infixr 6 _∖_
infix 4 _≬_
infix 4 _≬_ _#_ _#′_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about \perp/ instead? (not \bot BTW, but indistinguishable in many fonts, alas...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's Ok by me. That said, I already find some of the symbols used in Relation.Unary to be difficult to distinguish.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paging in @WolframKahl who might also have a suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because \bot and \perp are so hard to distinguish, I'm not pro. I think using the same symbol as apartness makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed a version using \perp, so folks can look at it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, at least in github, I find I can distinguish it from \bot.
FWIW, I think I'd rather have a distinct symbol than need to have hiding directives/qualified imports for the sake of reusing _#_...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to be more verbose as in _IsDisjointFrom_.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, 'ideally', use of a 'fat \perp' might be best, but I don't think we can shoehorn that into the agda-input-mode...?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be nice (fat perp)

@jamesmckinna
Copy link
Contributor

(in lieu of my (now deleted) comment, I took the liberty of adding the link myself to your OP... hope that's OK)

@bsaul
Copy link
Contributor Author

bsaul commented Feb 19, 2025

(I took the liberty of adding the link myself to your OP... hope that's OK)

Of course, thanks!

@jamesmckinna
Copy link
Contributor

cf. #2594 ... Can you also add some properties of these relations? Or other extensions, eg.:

  • prove Symmetric _⊥_, Symmetric _≬_
  • lift _⊥_ to Relation.Binary.Definitions (and even: Relation.Nullary?), and redefine Irreflexive using it?
  • redefine relational composition using _≬_? (there may be dependency issues in trying to do this; partly because of the Nullary/Unary/Binary distinction, and partly because neither of Unary nor Nullary split off distinct Definitions modules...)
  • ...

All of these strictly go outside the scope of what you have so far, but might also give life to the new definitions.

You also alluded to how they are part of your basic toolkit when developing in Agda, so what's a specimen client application/deployment context which might also be generally useful as an addition to the library?

@bsaul
Copy link
Contributor Author

bsaul commented Feb 20, 2025

Can you also add some properties of these relations?

Yes, will do. Those are good suggestions.

@bsaul
Copy link
Contributor Author

bsaul commented Feb 20, 2025

You also alluded to how they are part of your basic toolkit when developing in Agda, so what's a specimen client application/deployment context which might also be generally useful as an addition to the library?

I'm working on formalizing parts probability/statistics/causal inference wherein disjoint "events" or sets are sometimes a precondition in a theorem, e.g. Pearl's definition of d-separation.

@jamesmckinna
Copy link
Contributor

You also alluded to how they are part of your basic toolkit when developing in Agda, so what's a specimen client application/deployment context which might also be generally useful as an addition to the library?

I'm working on formalizing parts probability/statistics/causal inference wherein disjoint "events" or sets are sometimes a precondition in a theorem, e.g. Pearl's definition of d-separation.

Nice! But not sure quite how in scope (yet) that might be for stdlib. Still the two concepts introduced are familiar to me from constructive approaches to (the foundations of) probability, cf. eg. Jan van Plato's book from some years ago now...

@bsaul
Copy link
Contributor Author

bsaul commented Feb 21, 2025

Nice! But not sure quite how in scope (yet) that might be for stdlib.

I wouldn't expect most of what I'm noodling on to be in scope for stdlib -- I'm just trying to upstream things that might be.

@bsaul
Copy link
Contributor Author

bsaul commented Feb 21, 2025

cf. eg. Jan van Plato's book from some years ago now...

Thanks for the reference -- looks quite interesting.

@bsaul
Copy link
Contributor Author

bsaul commented Feb 21, 2025

  • prove Symmetric _⊥_, Symmetric _≬_

Done in f77d38b

@bsaul
Copy link
Contributor Author

bsaul commented Feb 21, 2025

  • lift _⊥_ to Relation.Binary.Definitions? and redefine Irreflexive using it?

Trying to import Relation.Unary into Relation.Binary.Defintions introduces a cyclic dependency, so I suspect there would be a bit of refactoring to make this happen.

Copy link
Contributor

@jamesmckinna jamesmckinna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for the PR, it looks in good shape for merging once the CHANGELOG is fixed.

I'm happy with \perp as the symbol, but I'll leave it to the other maintainers to rule on this.

@WolframKahl
Copy link
Member

WolframKahl commented Feb 26, 2025 via email

@jamesmckinna
Copy link
Contributor

In favour of \perp:

  • easy to type
  • mildly distinct visually from \bot
  • definitely distinct visually/lexically from _#_

In favour of _#_

  • semantically it is an apartness
  • ... what else?

Regarding @WolframKahl 's links to Unicode, I wonder if perhaps we should make every module preamble comment include the new (infix/mixfix) symbols introduced with their character encodings (emacs and Unicode?), as 'self-documentation', rather than trying to build a big lookup table in style-guide?

@JacquesCarette
Copy link
Contributor

I wonder if perhaps we should make every module preamble comment include the new (infix/mixfix) symbols introduced with their character encodings (emacs and Unicode?), as 'self-documentation', rather than trying to build a big lookup table in style-guide?

That seems like a good idea.

@bsaul
Copy link
Contributor Author

bsaul commented Feb 26, 2025

I wonder if perhaps we should make every module preamble comment include the new (infix/mixfix) symbols introduced with their character encodings (emacs and Unicode?), as 'self-documentation', rather than trying to build a big lookup table in style-guide?

That seems like a good idea.

Agreed.

Co-authored-by: jamesmckinna <[email protected]>
@WolframKahl
Copy link
Member

WolframKahl commented Feb 26, 2025 via email

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Feb 27, 2025

On Wed, Feb 26, 2025 at 03:58:22AM -0800, jamesmckinna wrote: In favour of \perp: * [...] * mildly distinct visually from \bot
With my current fonts, I can see that when they are side-by-side, but I wouldn't be able to distinguish individual occurrences. I'd therefore argue against using both symbols in Agda.

Hmm... that's a shame, I think. I'd maybe try to influence things further by adding

  • \perp as a definition is lifting/proxying for the underlying appeal to \bot, so 'it makes sense' (?) to use cognate symbols
  • plus any additional cognitive reinforcement arising from documenting the symbology sur place

But I'd better stop beating this particular donkey now.

@MatthewDaggitt
Copy link
Contributor

I have no strong opinions on the choice of symbol. We use quite a lot of close cognates in the library already, but I can understand the urge not to add more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants