Skip to content

[ refactor ] Reconcile left/right congruence statements and proofs #2532

Open
@jamesmckinna

Description

@jamesmckinna

Have now added revised types for the new lemmas, and note the following:

  • ++⁺ʳ now has a type corresponding to the explicitly quantified version of Algebra.Definitions.LeftCongruent
  • ++⁺ˡ now has a type corresponding to the explicitly quantified version of Algebra.Definitions.RightCongruent
    (and explicit because "_++_ can't infer its arguments"... at least in the first case)

Which nomenclature/notation should be taken as canon? (Potential issue: I think that the use(s) of left/right superscript annotations in the Data.List.Relation* hierarchy are opposite to those of the Algebra.* congruence properties... sigh)

Barring the resolution of this question, I think this is (should be! ;-)) good to go now.

Originally posted by @jamesmckinna in #2426 (comment)

cf. #1436

Design decisions to be made:

  • It's very unfortunate (ahem) that I seem to be the one who introduced the left/right inversion relative to the existing conventions in Relation.Binary.Definitions and Algebra.Definitions, so I'll try to remedy that with a v3.0 PR, and I'm inclined to decide in favour of the Algebra.Definitions left/right convention, unless anyone strongly objects. NB this goes against @MatthewDaggitt 's original comments on Add left- and right- Pointwise congruence for _++_ on List #2426 ...
  • A separate issue is one regarding implicit/explicit quantification in the definition of Left/RightCongruent: when considering prefixing xs ++_ as a Pointwise-respecting (or any other Data.List.Relation.Binary.*), most, if not all of the uses of such properties do not require xs to be given explicitly (and as a suffixing operation, seemingly never, thanks to unification), and only a handful (typically those under Data.List.Relation.Unary.Any.Properties) actually do induction on xs to prove the relevant property, but again, never seem to use it in anger when applying those proofs. So I'm strongly tempted not to change the quantifiers in Algebra.Definitions, again unless anyone strongly objects, and to modify the quantification in Data.List.Relation.*.Properties. This goes slightly against the design advocated in Standardise implicit arguments of cancellation properties. #1436 and elsewhere (eg Associativity... which similarly almost never needs its arguments supplied explicitly), but is conformant with the abstract use of -congˡ and -congʳ derived forms in Algebra.Structures.IsMagma.

(Similar remarks apply to the corresponding lemmas under Data.Vec.Relation.* in the usual way)

Ahead of any review discussion (and consequent potential waste of bandwidth/effort) on a candidate PR, it would be useful to poll opinion on the wisdom of such choices, or otherwise!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions