Skip to content

Redefine ⊥ to make its proofs irrelevant? #645

Closed

Description

@gallais

@tomjack has this definition of ⊥. It comes with a big advantage: because all
the proofs of a given Prop are definitionally equal, we get for free that all
proofs of a negative statement are equal (cf. unique).

{-# OPTIONS --prop #-}

open import Agda.Builtin.Equality

record Truth (P : Prop) : Set where
  constructor [_]
  field
    truth : P
open Truth public

data ⊥' : Prop where

⊥ = Truth ⊥'

¬ : Set → Set
¬ A = A → ⊥

unique : {A : Set} (x y : ¬ A) → x ≡ y
unique x y = refl

This would in particular allow us to change ≢-≟-identity's type from the
cumbersome ∀ {b} → a ≢ b → ∃ λ ¬eq → a ≟ b ≡ no ¬eq to the nicer
∀ {b} (¬eq : a ≢ b) → a ≟ b ≡ no ¬eq

Activity

  1. MatthewDaggitt commented on Mar 7, 2019

    @MatthewDaggitt
    Collaborator

    Hmm interesting suggestion. The problem is that pattern matching on ⊥ is then results in [ () ] rather than () right?

    Regardless of whether we adopt it or not, I'd prefer to hold off introducing it for a while until Prop has been in use for a bit. I'm sure there's probably not, but if there is a bug in the implementation then using it for the empty set seems the best possible way of breaking as much as the standard library as possible!

  2. gallais commented on Mar 7, 2019

    @gallais
    MemberAuthor

    The problem is that pattern matching on ⊥ then results in [ () ] rather than () right?

    Splitting a value of type ⊥ indeed yields [ truth ] rather than (). However ()
    is accepted in 2.6.0 for a record with at least one absurd field so the change would
    be backwards compatible.

    Just like agda/agda#3533 improves case-splitting to take into account the fact that
    Agda is now more clever, we could probably also get it to generate the expected ()
    pattern.

  3. MatthewDaggitt commented on Mar 8, 2019

    @MatthewDaggitt
    Collaborator

    If you think we can make it entirely backwards compatible then it definitely sounds worthwhile.

  4. gallais commented on Mar 8, 2019

    @gallais
    MemberAuthor

    I am currently writing a patch to fix case splitting for this work. ;)

  5. nad commented on Mar 8, 2019

    @nad
    Contributor

    One thing to consider is that some people might not want to use all features that Agda has to offer. If someone wants to work in the fragment of Agda that does not include Prop, then this change would presumably make large parts of the standard library useless.

  6. MatthewDaggitt commented on Apr 19, 2019

    @MatthewDaggitt
    Collaborator

    I think @nad is probably right about this one. At the very least, let's see how @JacquesCarette gets on using it in the category theory portion of the library first...

    I'm going to close this for now but feel free to re-open in the future.

  7. 6 remaining items

  8. gallais commented on Feb 24, 2022

    @gallais
    MemberAuthor

    Sorry I should have been clearer given the title of the issue: I'm proposing to use irrelevance
    (that we now use widely for NonZero arguments), not Prop.

  9. changed the title [-]Redefine Bottom to make use of Prop?[/-] [+]Redefine Bottom to make its proofs irrelevant?[/+] on Feb 24, 2022
  10. changed the title [-]Redefine Bottom to make its proofs irrelevant?[/-] [+]Redefine ⊥ to make its proofs irrelevant?[/+] on Feb 24, 2022
  11. JacquesCarette commented on Feb 24, 2022

    @JacquesCarette
    Collaborator

    Ah. Well, my bias still holds, but I don't think I have active reasons to object. And it would be a coherent choice to make.

  12. MatthewDaggitt commented on Feb 25, 2022

    @MatthewDaggitt
    Collaborator

    Hmm so are you proposing a) to update the definition of ⊥ to a record with an irrelevant field or b) mark all arguments of type ⊥ to be irrelevant?

    I'd be more on board with b), as the number of such arguments is very low and it doesn't involve altering crucial definitions for reasons that would be non-obvious to users.

  13. added this to the v2.0 milestone on Feb 25, 2022
  14. gallais commented on Feb 25, 2022

    @gallais
    MemberAuthor

    mark all arguments of type ⊥ to be irrelevant?

    The use case is having proofs of negations be trivially equal to each other. In which case there is no
    "argument of type ⊥": ⊥ is the return type of the function.

  15. JacquesCarette commented on Feb 25, 2022

    @JacquesCarette
    Collaborator

    Note that I've been successfully nudged to the positive side of this by this code which is now smooth but used to need a postulate. [It goes all the way to Prop, but I think that irrelevance could have been enough.]

  16. jespercockx commented on Feb 25, 2022

    @jespercockx
    Member

    If all you want is a proof irrelevant empty type, then just a record type with an irrelevant field is indeed enough. (Though I am still a bit sad that Prop is hidden under a flag).

  17. MatthewDaggitt commented on Feb 26, 2022

    @MatthewDaggitt
    Collaborator

    As long as it's well documented why the definition is a little odd then I'm not averse to making the change.

  18. added 2 commits that reference this issue on Mar 4, 2022
    2b3eda5
    96d6887
  19. added a commit that references this issue on Mar 3, 2024
    367e3d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions