-
Notifications
You must be signed in to change notification settings - Fork 259
Description
Matthew wrote
The discussion for how this stage of the changes should be laid out should
really be continued in an issue on Github. If you'd like to open an issue there?
All right, I open it.
I think, standard library needs a generic divisibility notion _|_.
Currently there exists _|_ for Nat and ℤ.
I suggest to remove it, and to replace it with a generic divisibility defined for Magma:
First, the notion of a quotient is related to any _≈_, _∙_ :
module _ {α α=} (A : Setoid α α=) (_∙_ : Op₂ (Setoid.Carrier A))
where
open Setoid A using (_≈_) renaming (Carrier to C)
RightQuotient : C → C → Set (α ⊔ α=)
RightQuotient a b = ∃ (\q → (b ∙ q) ≈ a)
And the notion of divisibility is via RightQuotient:
module _ {α α=} (M : Magma α α=)
where
open Magma M using (_≈_; _∙_; ∙-cong; ∙-congˡ; setoid) renaming (Carrier to C)
_∣_ _∤_ : Rel C (α ⊔ α=)
x ∣ y = RightQuotient setoid _∙_ y x -- `x divides y'
_∤_ x = ¬_ ∘ _∣_ x
open EqR setoid
∣cong : _∣_ Respects2 _≈_
∣cond = ...
...
In particular, it will serve also for ℕ, ℤ, for pairs, for polynomials, and so on.
The existing divisibility for ℕ, ℤ to be replaced with _|_ imported from
Algebra.Properties.Magma (Nat.Properties *-magma) and from
Algebra.Properties.Magma (Integer.Properties *-magma).
The modules Algebra.Properties.Magma, Algebra.Properties.Monoid, ...
to be parametrized by Magma, Monoid, and so on. They contain theories related to Magma, Monoid, and so on. In particular, there are proved properties of _|_ related to these structures.
This notion of _|_ will serve the generic definition of GCD, etc.
How precisely is this all organized will be demonstrated in BFLib-0.01, which has to appear after the release of Agda-2.6.0.
But BFLib-0.01 will try to merge into standard so, that it modules to distribute their parts between the modules of standard library.