diff --git a/doc/README/Design/Decidability.agda b/doc/README/Design/Decidability.agda index c6f086424f..d38bcfba4a 100644 --- a/doc/README/Design/Decidability.agda +++ b/doc/README/Design/Decidability.agda @@ -31,14 +31,14 @@ infix 4 _≟₀_ _≟₁_ _≟₂_ -- a proof of `Reflects P false` amounts to a refutation of `P`. ex₀ : (n : ℕ) → Reflects (n ≡ n) true -ex₀ n = ofʸ refl +ex₀ n = of refl ex₁ : (n : ℕ) → Reflects (zero ≡ suc n) false -ex₁ n = ofⁿ λ () +ex₁ n = of λ () ex₂ : (b : Bool) → Reflects (T b) b -ex₂ false = ofⁿ id -ex₂ true = ofʸ tt +ex₂ false = of id +ex₂ true = of tt ------------------------------------------------------------------------ -- Dec @@ -85,8 +85,8 @@ zero ≟₁ suc n = no λ () suc m ≟₁ zero = no λ () does (suc m ≟₁ suc n) = does (m ≟₁ n) proof (suc m ≟₁ suc n) with m ≟₁ n -... | yes p = ofʸ (cong suc p) -... | no ¬p = ofⁿ (¬p ∘ suc-injective) +... | yes p = of (cong suc p) +... | no ¬p = of (¬p ∘ suc-injective) -- We now get definitional equalities such as the following. diff --git a/src/Axiom/UniquenessOfIdentityProofs.agda b/src/Axiom/UniquenessOfIdentityProofs.agda index 1cefc1a6a1..6975481cdb 100644 --- a/src/Axiom/UniquenessOfIdentityProofs.agda +++ b/src/Axiom/UniquenessOfIdentityProofs.agda @@ -8,15 +8,19 @@ module Axiom.UniquenessOfIdentityProofs where -open import Data.Bool.Base using (true; false) -open import Data.Empty -open import Relation.Nullary.Reflects using (invert) -open import Relation.Nullary hiding (Irrelevant) +open import Function.Base using (id; const; flip) +open import Level using (Level) +open import Relation.Nullary.Decidable.Core using (recompute; recompute-irr) open import Relation.Binary.Core open import Relation.Binary.Definitions open import Relation.Binary.PropositionalEquality.Core open import Relation.Binary.PropositionalEquality.Properties +private + variable + a : Level + A : Set a + ------------------------------------------------------------------------ -- Definition -- @@ -24,7 +28,7 @@ open import Relation.Binary.PropositionalEquality.Properties -- equality are themselves equal. In other words, the equality relation -- is irrelevant. Here we define UIP relative to a given type. -UIP : ∀ {a} (A : Set a) → Set a +UIP : (A : Set a) → Set a UIP A = Irrelevant {A = A} _≡_ ------------------------------------------------------------------------ @@ -38,12 +42,11 @@ UIP A = Irrelevant {A = A} _≡_ -- proof to its image via this function which we then know is equal to -- the image of any other proof. -module Constant⇒UIP - {a} {A : Set a} (f : _≡_ {A = A} ⇒ _≡_) - (f-constant : ∀ {a b} (p q : a ≡ b) → f p ≡ f q) +module Constant⇒UIP (f : _≡_ {A = A} ⇒ _≡_) + (f-constant : ∀ {x y} (p q : x ≡ y) → f p ≡ f q) where - ≡-canonical : ∀ {a b} (p : a ≡ b) → trans (sym (f refl)) (f p) ≡ p + ≡-canonical : ∀ {x y} (p : x ≡ y) → trans (sym (f refl)) (f p) ≡ p ≡-canonical refl = trans-symˡ (f refl) ≡-irrelevant : UIP A @@ -59,19 +62,13 @@ module Constant⇒UIP -- function over proofs of equality which is constant: it returns the -- proof produced by the decision procedure. -module Decidable⇒UIP - {a} {A : Set a} (_≟_ : Decidable {A = A} _≡_) - where +module Decidable⇒UIP (_≟_ : Decidable {A = A} _≡_) where ≡-normalise : _≡_ {A = A} ⇒ _≡_ - ≡-normalise {a} {b} a≡b with a ≟ b - ... | true because [p] = invert [p] - ... | false because [¬p] = ⊥-elim (invert [¬p] a≡b) - - ≡-normalise-constant : ∀ {a b} (p q : a ≡ b) → ≡-normalise p ≡ ≡-normalise q - ≡-normalise-constant {a} {b} p q with a ≟ b - ... | true because _ = refl - ... | false because [¬p] = ⊥-elim (invert [¬p] p) + ≡-normalise {x} {y} x≡y = recompute (x ≟ y) x≡y + + ≡-normalise-constant : ∀ {x y} (p q : x ≡ y) → ≡-normalise p ≡ ≡-normalise q + ≡-normalise-constant {x} {y} = recompute-irr (x ≟ y) ≡-irrelevant : UIP A ≡-irrelevant = Constant⇒UIP.≡-irrelevant ≡-normalise ≡-normalise-constant diff --git a/src/Data/Nat/Properties.agda b/src/Data/Nat/Properties.agda index b09b46db7d..9499d5685b 100644 --- a/src/Data/Nat/Properties.agda +++ b/src/Data/Nat/Properties.agda @@ -20,7 +20,6 @@ import Algebra.Construct.NaturalChoice.MinMaxOp as MinMaxOp import Algebra.Lattice.Construct.NaturalChoice.MinMaxOp as LatticeMinMaxOp import Algebra.Properties.CommutativeSemigroup as CommSemigroupProperties open import Data.Bool.Base using (Bool; false; true; T) -open import Data.Bool.Properties using (T?) open import Data.Nat.Base open import Data.Product.Base using (∃; _×_; _,_) open import Data.Sum.Base as Sum @@ -35,10 +34,10 @@ open import Relation.Binary.Core open import Relation.Binary open import Relation.Binary.Consequences using (flip-Connex) open import Relation.Binary.PropositionalEquality -open import Relation.Nullary hiding (Irrelevant) -open import Relation.Nullary.Decidable using (True; via-injection; map′) +open import Relation.Nullary.Decidable + using (Dec; yes; no; T?; True; via-injection; map′) open import Relation.Nullary.Negation.Core using (¬_; contradiction) -open import Relation.Nullary.Reflects using (fromEquivalence) +open import Relation.Nullary.Reflects as Reflects using (Reflects) open import Algebra.Definitions {A = ℕ} _≡_ hiding (LeftCancellative; RightCancellative; Cancellative) @@ -135,7 +134,7 @@ m ≟ n = map′ (≡ᵇ⇒≡ m n) (≡⇒≡ᵇ m n) (T? (m ≡ᵇ n)) <⇒<ᵇ (s