Skip to content

Redefine Algebra.Consequences.Setoid.wlog #2626

Open
@jamesmckinna

Description

@jamesmckinna

The trouble with the definition:

------------------------------------------------------------------------
-- Without Loss of Generality

module _ {p} {P : Pred A p}
         (≈-subst : Substitutive _≈_ p)
         (∙-comm : Commutative _∙_)
         where

  subst∧comm⇒sym : Symmetric (λ a b  P (a ∙ b))
  subst∧comm⇒sym = ≈-subst P (∙-comm _ _)

  wlog :  {r} {_R_ : Rel _ r}  Total _R_ 
         ( a b  a R b  P (a ∙ b)) 
          a b  P (a ∙ b)
  wlog r-total = BinaryConsequences.wlog r-total subst∧comm⇒sym

is twofold:

  • the assumption ≈-subst : Substitutive _≈_ p is needlessly restrictive, when ≈-resp : P Respects _≈_ would suffice
  • moreover, as even pointed out in Relation.Binary.Definitions, a relation _≈_ only ever satisfies Substitutive _≈_ p when it is PropositionalEquality (or a derivative of it), so the Setoid version of wlog can only ever be deployed in the Propositional case!

Arguably this is bug, so should be fixed as non-backwards-compatible change in v2.3 ;-) but v3.0 is probably more reasonable, or at least, less unreasonable...

Accordingly, propose instead:

------------------------------------------------------------------------
-- Without Loss of Generality

module _ {p} {P : Pred A p}
         (≈-resp : P Respects _≈_)
         (∙-comm : Commutative _∙_)
         where

  resp∧comm⇒sym : Symmetric (λ a b  P (a ∙ b))
  resp∧comm⇒sym = ≈-resp (∙-comm _ _)

  wlog :  {r} {_R_ : Rel _ r}  Total _R_ 
         ( a b  a R b  P (a ∙ b)) 
          a b  P (a ∙ b)
  wlog r-total = BinaryConsequences.wlog r-total resp∧comm⇒sym

with marginal knock-on consequences for the Propositional case (resp P instead of subst)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions