Skip to content

Re-export numeric subclass instances #2122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Data/Integer/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Data.Integer.Base where
open import Algebra.Bundles.Raw
using (RawMagma; RawMonoid; RawGroup; RawNearSemiring; RawSemiring; RawRing)
open import Data.Bool.Base using (Bool; T; true; false)
open import Data.Nat.Base as ℕ using (ℕ; z≤n; s≤s)
open import Data.Nat.Base as ℕ using (ℕ; z≤n; s≤s) hiding (module ℕ)
open import Data.Sign.Base as Sign using (Sign)
open import Level using (0ℓ)
open import Relation.Binary.Core using (Rel)
Expand Down Expand Up @@ -140,6 +140,9 @@ record Negative (i : ℤ) : Set where

-- Instances

open ℕ public
using (nonZero)

instance
pos : ∀ {n} → Positive +[1+ n ]
pos = _
Expand Down
9 changes: 8 additions & 1 deletion src/Data/Rational/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module Data.Rational.Base where

open import Algebra.Bundles.Raw
open import Data.Bool.Base using (Bool; true; false; if_then_else_)
open import Data.Integer.Base as ℤ using (ℤ; +_; +0; +[1+_]; -[1+_])
open import Data.Integer.Base as ℤ
using (ℤ; +_; +0; +[1+_]; -[1+_])
hiding (module ℤ)
open import Data.Nat.GCD
open import Data.Nat.Coprimality as C
using (Coprime; Bézout-coprime; coprime-/gcd; coprime?; ¬0-coprimeTo-2+)
Expand Down Expand Up @@ -176,6 +178,11 @@ NonPositive p = ℚᵘ.NonPositive (toℚᵘ p)
NonNegative : Pred ℚ 0ℓ
NonNegative p = ℚᵘ.NonNegative (toℚᵘ p)

-- Instances

open ℤ public
using (nonZero; pos; nonNeg; nonPos0; nonPos; neg)

-- Constructors

≢-nonZero : ∀ {p} → p ≢ 0ℚ → NonZero p
Expand Down
6 changes: 6 additions & 0 deletions src/Data/Rational/Unnormalised/Base.agda
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ open import Algebra.Bundles.Raw
open import Data.Bool.Base using (Bool; true; false; if_then_else_)
open import Data.Integer.Base as ℤ
using (ℤ; +_; +0; +[1+_]; -[1+_]; +<+; +≤+)
hiding (module ℤ)
open import Data.Nat.Base as ℕ using (ℕ; zero; suc)
open import Level using (0ℓ)
open import Relation.Nullary.Negation.Core using (¬_; contradiction)
Expand Down Expand Up @@ -149,6 +150,11 @@ NonPositive p = ℤ.NonPositive (↥ p)
NonNegative : Pred ℚᵘ 0ℓ
NonNegative p = ℤ.NonNegative (↥ p)

-- Instances

open ℤ public
using (nonZero; pos; nonNeg; nonPos0; nonPos; neg)

-- Constructors and destructors

-- Note: these could be proved more elegantly using the constructors
Expand Down