Skip to content

Conversation

@Taneb
Copy link
Member

@Taneb Taneb commented Sep 26, 2025

Closes #2831

Copy link
Contributor

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

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

Two comments, two requests for change.

Massively surprised this wasn't here already!

@jamesmckinna
Copy link
Contributor

So... I think that all of these things are already covered by Relation.Nullary.Negation (including even @JacquesCarette 's observations about curry etc.)? Or not!?

@JacquesCarette
Copy link
Contributor

I think you are correct @jamesmckinna . But there must also be something very slightly different about them? Perhaps some subtlety about irrelevance?

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Sep 29, 2025

The differences, AFAICT, are that the lemmas in Relation.Nullary.Negation only concern the Universal (explicitly quantified) cases, whereas this PR also covers the IUniversal (implicitly quantified) ones as well. But, FTR, using the suggested import:

open import Relation.Nullary.Negation using (¬_; ∃⟶¬∀¬; ∀⟶¬∃¬; ¬∃⟶∀¬; ∀¬⟶¬∃; ∃¬⟶¬∀)
module _ {P : Pred A ℓ} where

  ¬∃⟨P⟩⇒Π[∁P] : ¬ ∃⟨ P ⟩  Π[ ∁ P ]
  ¬∃⟨P⟩⇒Π[∁P] = ¬∃⟶∀¬

  ¬∃⟨P⟩⇒∀[∁P] : ¬ ∃⟨ P ⟩  ∀[ ∁ P ]
  ¬∃⟨P⟩⇒∀[∁P] ¬sat = ¬∃⟶∀¬ ¬sat _

  ∃⟨∁P⟩⇒¬Π[P] : ∃⟨ ∁ P ⟩  ¬ Π[ P ]
  ∃⟨∁P⟩⇒¬Π[P] = ∃¬⟶¬∀

  ∃⟨∁P⟩⇒¬∀[P] : ∃⟨ ∁ P ⟩  ¬ ∀[ P ]
  ∃⟨∁P⟩⇒¬∀[P] ∃CP ∀P = ∃¬⟶¬∀ ∃CP λ _  ∀P

  Π[∁P]⇒¬∃[P] : Π[ ∁ P ]  ¬ ∃⟨ P ⟩
  Π[∁P]⇒¬∃[P] = ∀¬⟶¬∃

  ∀[∁P]⇒¬∃[P] : ∀[ ∁ P ]  ¬ ∃⟨ P ⟩
  ∀[∁P]⇒¬∃[P] ∀∁P = ∀¬⟶¬∃ λ _  ∀∁P

So... I think this is worth badging as status:duplicate or even status:invalid?

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Oct 1, 2025

Do we want to merge this, or close, and follow up with a rename+deprecate as discussed in #2831 ?

I'm (largely) agnostic/uncommitted on this issue (apart from the redundancy involved), but proofs which differ at all from those versions offered above would be... redundancy too far, IMNSVHO ;-)

@JacquesCarette
Copy link
Contributor

I think you're right about all of this being redundant. I think the main remaining point is around findability and naming:

  1. Neither @Taneb nor Sergei were able to find these
  2. Relation.Nullary is a hideous prefix. Are there such things as non-trivial nullary relations? This feels like a horrible hack from ages ago that 3.0 should get rid of.

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Oct 11, 2025

I broadly agree:

But it's a testament to Stockholm Syndrome that I have come to internalise the Nullary/Unary/Binary taxonomy ;-)

@jamesmckinna
Copy link
Contributor

@Taneb suggest merging your commits here, or my suggestions above, to #2838 so that we can knock this off, at least for v2.4?

@Taneb
Copy link
Member Author

Taneb commented Oct 14, 2025

Why don't we merge both PRs separately? fwiw I'm (very slightly) against your suggestions: they add a new import to the dependency graph to turn a bunch of one line definitions to a bunch of slightly more abbreviated one line definitions

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Oct 14, 2025

Why don't we merge both PRs separately? fwiw I'm (very slightly) against your suggestions: they add a new import to the dependency graph to turn a bunch of one line definitions to a bunch of slightly more abbreviated one line definitions

Fair enough, but, pace the discoverability problem (not trying to discount it), I'm not sure the duplication in Unary makes (better?) sense... but for the sake of v2.4 (and the opportunity for a breaking redesign in v3.0), happy to merge this too.

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.

Happy to merge this, but I'd push a bit harder on @JacquesCarette 's suggestion to use curry/uncurry where possible... (eg by inlining the definitions given above?)

@Taneb Taneb requested a review from jamesmckinna October 27, 2025 12:38
@jamesmckinna jamesmckinna added addition discoverability How easy/hard will it be for users to find, within the context of their application? labels Oct 27, 2025
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.

I won't stand in the way of what's here already, but I do think the suggestions I make improve things, but without adding the extra node to the dependency graph, while emphasising the generic/delegation aspects of all these proofs.

module Relation.Unary.Properties where

open import Data.Product.Base as Product using (_×_; _,_; swap; proj₁; zip′)
open import Data.Product.Base as Product using (_×_; _,_; -,_; swap; proj₁; zip′; curry)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
open import Data.Product.Base as Product using (_×_; _,_; -,_; swap; proj₁; zip′; curry)
open import Data.Product.Base as Product using (_×_; _,_; -,_; swap; proj₁; zip′; curry; uncurry)

As before, I'd rather use the generic operations where possible.

¬∃⟨P⟩⇒Π[∁P] ¬sat = curry ¬sat

¬∃⟨P⟩⇒∀[∁P] : {P : Pred A ℓ} ¬ ∃⟨ P ⟩ ∀[ ∁ P ]
¬∃⟨P⟩⇒∀[∁P] ¬sat = curry ¬sat _
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe coupling is considered harmful, but given the amount of duplication/repetition/redundancy here, I would prefer to emphasise it by delegation:

Suggested change
¬∃⟨P⟩⇒∀[∁P] ¬sat = curry ¬sat _
¬∃⟨P⟩⇒∀[∁P] ¬sat = ¬∃⟨P⟩⇒Π[∁P] ¬sat _

¬∃⟨P⟩⇒∀[∁P] ¬sat = curry ¬sat _

∃⟨∁P⟩⇒¬Π[P] : {P : Pred A ℓ} ∃⟨ ∁ P ⟩ ¬ Π[ P ]
∃⟨∁P⟩⇒¬Π[P] (x , ¬Px) ΠP = ¬Px (ΠP x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
∃⟨∁P⟩⇒¬Π[P] (x , ¬Px) ΠP = ¬Px (ΠP x)
∃⟨∁P⟩⇒¬Π[P] (_ , ¬Px) ΠP = ¬Px (ΠP _)

using the underscores here:

  • is more robust (debatable?)
  • formally mirrors the subsequent lemma

∃⟨∁P⟩⇒¬∀[P] (_ , ¬Px) ∀P = ¬Px ∀P

Π[∁P]⇒¬∃[P] : {P : Pred A ℓ} Π[ ∁ P ] ¬ ∃⟨ P ⟩
Π[∁P]⇒¬∃[P] Π∁P (x , Px) = Π∁P x Px
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Π[∁P]⇒¬∃[P] Π∁P (x , Px) = Π∁P x Px
Π[∁P]⇒¬∃[P] = uncurry

suffices!

Π[∁P]⇒¬∃[P] Π∁P (x , Px) = Π∁P x Px

∀[∁P]⇒¬∃[P] : {P : Pred A ℓ} ∀[ ∁ P ] ¬ ∃⟨ P ⟩
∀[∁P]⇒¬∃[P] ∀∁P (_ , Px) = ∀∁P Px
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
∀[∁P]⇒¬∃[P] ∀∁P (_ , Px) = ∀∁P Px
∀[∁P]⇒¬∃[P] = Π[∁P]⇒¬∃[P] (λ _ ∀∁P)

again, emphasise the delegation to the explicit version.

@jamesmckinna
Copy link
Contributor

There are (lots of!?) potential library-design issues raised by this PR:

  • navigability/discoverability, as already noted
  • redundant recoding as a side effect of the above
  • finessing implicit vs. explicit function spaces (I find Function.Base.{_$-|λ-} too fiddly in practice to use, but maybe they could be deployed here?)
  • the Relation.*ary hierarchy, and 'opportunities' to refactor it
  • ...

so perhaps worth lifting out as a new issue?

@jamesmckinna jamesmckinna added this to the v2.4 milestone Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition discoverability How easy/hard will it be for users to find, within the context of their application?

Projects

None yet

Development

Successfully merging this pull request may close these issues.

¬∃⇒∀¬

4 participants