Skip to content

(re-)Definition of Prime (and Irreducible) in Data.Nat.Primality #2180

Closed
@jamesmckinna

Description

@jamesmckinna

Reflecting on @Taneb 's PR #1969 , and wanting to add the definition of Irreducible to Data.Nat.Primality, with

IrreducibleAt : Pred ℕ _
IrreducibleAt n m = m ∣ n  m ≡ 1 ⊎ m ≡ n

Irreducible : Set
Irreducible n = ∀[ IrreducibleAt n ]

I found myself wanting to redefine Composite and Prime to eliminate the special cases for 0 and 1 which otherwise pollute the definitions and properties given there.

This leads to the following definitions [REVISED in PR #2181 but not updated here]:
[DELETED: please see #2181 for heavily revised/redacted versions]
with this last pattern synonym essentially permitting proofs formerly involving Prime to access the second functional component without difficulty, and moreover to enforce that the argument to Prime must be of the form suc (suc _), and thus eliminate some now-redundant pattern matching against patterns of that form. with a constructor prime introducing witnesses to Prime p imposing that p must be NonTrivial ie > 1 (and much else besides ;-))

I have a revised version of Data.Nat.Primality based on these re-definitions, towards a breaking PR. So I'm cheekily tagging this as v2.0 in order to try to sneak it into the upcoming release.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions