Skip to content

[ add ] Relation.Binary.Properties.PartialSetoid #2678

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

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

Conversation

jamesmckinna
Copy link
Contributor

@jamesmckinna jamesmckinna commented Mar 17, 2025

This adds the properties of PERs discussed in #2677 .

Issues:

  • naming: p- prefix to signify 'partial'
  • where to add:
    • Properties (as here)
    • Consequences (contra: dependency on PropositionalEquality)
    • or as manifest fields of Relation.Binary.Structures.IsPartialEquivalence (contra: every IsEquivalence gets bloated by the addition)

Downstream:

  • potential refactoring of Relation.Binary.Properties.Setoid to inherit from this?

@jamesmckinna
Copy link
Contributor Author

@JacquesCarette any suggestions regarding the names?

@JacquesCarette
Copy link
Contributor

I'm actually fine with the names as they are.

p-refl : x ≈ y → x ≈ x × y ≈ y
p-refl p = p-reflˡ p , p-reflʳ p

p-reflexiveˡ : x ≈ y → x ≡ z → x ≈ z
Copy link
Contributor

Choose a reason for hiding this comment

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

This is Trans _≈_ _≡_ _≈_ (and similarly below), suggesting that reflexive may not be quite the right name? Similarly is this not just a variant of subst?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm... I see what you mean... Will ponder this for a bit!

Copy link
Contributor Author

@jamesmckinna jamesmckinna May 27, 2025

Choose a reason for hiding this comment

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

So... my reasoning (with a bit of post hoc rationalisation...) was as follows:

  • reflexive proofs are of the form x ≡ z → x ≈ z
  • these ones are 'partial', because preconditioned on having a proof of x ≈ y to licence them
  • the left/right designators then pick out which of x or y is being matched on

Possibly a bit convoluted, so I'm open to 'better' names!

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not Trans _≈_ _≡_ _≈_ because the second x would be a y in that case.

This is an extremely weird property which basically says: if x is related to something (anything) and we have evidence of that, and x and z are identical, then we can get evidence that x and z are related.

I'm at a loss for what to name it.

Copy link
Contributor Author

@jamesmckinna jamesmckinna May 28, 2025

Choose a reason for hiding this comment

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

I don't know about 'weird'... these properties are characteristic of being a PER rather than a full IsEquivalence!? Namely that the relation is reflexive only on its domain of definition, rather than on the whole type...

Copy link
Contributor Author

@jamesmckinna jamesmckinna May 29, 2025

Choose a reason for hiding this comment

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

As to names: I could call it (something like) conditional-reflexive, but then we would lose that the ≡.refl instantiation of such a lemma should be partial-refl... so those lemmas would also need to be renamed. And then... names are getting too long?

-- Proofs for partial equivalence relations

trans-reflˡ : LeftTrans _≡_ _≈_
trans-reflˡ ≡.refl p = p
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need to match on the proof here? Is this not just a variant of subst?

Copy link
Contributor Author

@jamesmckinna jamesmckinna May 27, 2025

Choose a reason for hiding this comment

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

Oh... yes, probably! er, no, actually, as the arguments are in the wrong order, and introducing a flip/≡.sym seemed like an indirection too far!?

@MatthewDaggitt
Copy link
Contributor

Properties seems the right place to me

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.

3 participants