-
Notifications
You must be signed in to change notification settings - Fork 257
Description
@Taneb 's recent work (#1744 , #1744) on permutations-as-transposition-lists has drawn attention to the (possible) need for a Parity type (rather than proxying via Data.Sign
), together with various properties: so far I have a branch with
UPDATED:
-
Parity
admits a commutative semiring structure (with0
=0ℙ
;1
=1ℙ
etc.) - a function
parity
fromNat
toParity
inData.Nat.Base
- a function
toSign
fromParity
toSign
- a function
fromSign
fromSign
toParity
- proofs that
(toSign, fromSign)
form an abelian group iso from(Parity, 0, _+_)
to(Sign, +, _*_)
- miscellaneous tidyings up of
Data.Sign
etc. to reflect new names for algebraic structures/bundles, cf. issueData.Integer.Properties.+-isAbelianGroup
should be called+-0-isAbelianGroup
#1844 and in line with review comments on current PR -
CHANGELOG
TODO in a subsequent PR:
- proof that
parity
is a commutative semiring homomorphism fromNat
toParity
- rationalise that proof; and in particular resolve where it belongs
Additionally, this might have the following as knock-on effects:
- rationalise the many instances in the library where the
0, 1, 2+ n
pattern analysis of aNat
argument takes place (esp. wrtN{-}ary
operations, as well as the obviousBinary
andNat
examples) see this branch and PR rationalise use ofsuc (suc n)
andsuc n@(suc _)
patterns throughout; remove2+ _
pattern #1870
EDITED:
It raised a question in my mind as well regarding where homomorphism-like properties belong in the library: under the source type, in moved discussion to issue #1871*.Properties
, or somewhere else? I currently have Parity
import Sign
in order to define the operations, but it strikes me that there's an asymmetry to that decision, which might better be reflected in having subdirectories of the Algebra.*
hierarchy which record concrete instances of (Semi)RingHomomorphism
s etc. suggestions welcome!