Skip to content

Commit 8f6987f

Browse files
committed
knock-on, plus proof of UIP from agda#2149
1 parent 50a89f4 commit 8f6987f

File tree

5 files changed

+25
-27
lines changed

5 files changed

+25
-27
lines changed

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ Additions to existing modules
409409

410410
* Added new proof in `Relation.Nullary.Decidable.Core`:
411411
```agda
412-
recompute-irr : (a? : Dec A) (p q : A) → recompute a? p ≡ recompute a? q
412+
recompute-constant : (a? : Dec A) (p q : A) → recompute a? p ≡ recompute a? q
413413
```
414414

415415
* Added new proof in `Relation.Nullary.Decidable`:
@@ -424,8 +424,8 @@ Additions to existing modules
424424

425425
* Added new definitions in `Relation.Nullary.Reflects`:
426426
```agda
427-
recompute : Reflects A b → Recomputable A
428-
recompute-irr : (r : Reflects A b) (p q : A) → recompute r p ≡ recompute r q
427+
recompute : Reflects A b → Recomputable A
428+
recompute-constant : (r : Reflects A b) (p q : A) → recompute r p ≡ recompute r q
429429
```
430430

431431
* Added new definitions in `Relation.Unary`

src/Axiom/UniquenessOfIdentityProofs.agda

+17-19
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,27 @@
88

99
module Axiom.UniquenessOfIdentityProofs where
1010

11-
open import Data.Bool.Base using (true; false)
12-
open import Data.Empty
13-
open import Relation.Nullary.Reflects using (invert)
14-
open import Relation.Nullary hiding (Irrelevant)
11+
open import Level using (Level)
12+
open import Relation.Nullary.Decidable.Core using (recompute; recompute-irr)
1513
open import Relation.Binary.Core
1614
open import Relation.Binary.Definitions
1715
open import Relation.Binary.PropositionalEquality.Core
1816
open import Relation.Binary.PropositionalEquality.Properties
1917

18+
private
19+
variable
20+
a : Level
21+
A : Set a
22+
x y : A
23+
2024
------------------------------------------------------------------------
2125
-- Definition
2226
--
2327
-- Uniqueness of Identity Proofs (UIP) states that all proofs of
2428
-- equality are themselves equal. In other words, the equality relation
2529
-- is irrelevant. Here we define UIP relative to a given type.
2630

27-
UIP : {a} (A : Set a) Set a
31+
UIP : (A : Set a) Set a
2832
UIP A = Irrelevant {A = A} _≡_
2933

3034
------------------------------------------------------------------------
@@ -39,11 +43,11 @@ UIP A = Irrelevant {A = A} _≡_
3943
-- the image of any other proof.
4044

4145
module Constant⇒UIP
42-
{a} {A : Set a} (f : _≡_ {A = A} ⇒ _≡_)
43-
(f-constant : {a b} (p q : ab) f p ≡ f q)
46+
(f : _≡_ {A = A} ⇒ _≡_)
47+
(f-constant : {x y} (p q : xy) f p ≡ f q)
4448
where
4549

46-
≡-canonical : {a b} (p : ab) trans (sym (f refl)) (f p) ≡ p
50+
≡-canonical : (p : xy) trans (sym (f refl)) (f p) ≡ p
4751
≡-canonical refl = trans-symˡ (f refl)
4852

4953
≡-irrelevant : UIP A
@@ -59,19 +63,13 @@ module Constant⇒UIP
5963
-- function over proofs of equality which is constant: it returns the
6064
-- proof produced by the decision procedure.
6165

62-
module Decidable⇒UIP
63-
{a} {A : Set a} (_≟_ : Decidable {A = A} _≡_)
64-
where
66+
module Decidable⇒UIP (_≟_ : Decidable {A = A} _≡_) where
6567

6668
≡-normalise : _≡_ {A = A} ⇒ _≡_
67-
≡-normalise {a} {b} a≡b with a ≟ b
68-
... | true because [p] = invert [p]
69-
... | false because [¬p] = ⊥-elim (invert [¬p] a≡b)
70-
71-
≡-normalise-constant : {a b} (p q : a ≡ b) ≡-normalise p ≡ ≡-normalise q
72-
≡-normalise-constant {a} {b} p q with a ≟ b
73-
... | true because _ = refl
74-
... | false because [¬p] = ⊥-elim (invert [¬p] p)
69+
≡-normalise {x} {y} x≡y = recompute (x ≟ y) x≡y
70+
71+
≡-normalise-constant : (p q : x ≡ y) ≡-normalise p ≡ ≡-normalise q
72+
≡-normalise-constant {x = x} {y = y} = recompute-irr (x ≟ y)
7573

7674
≡-irrelevant : UIP A
7775
≡-irrelevant = Constant⇒UIP.≡-irrelevant ≡-normalise ≡-normalise-constant

src/Relation/Nullary.agda

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private
2525

2626
open import Relation.Nullary.Recomputable public using (Recomputable)
2727
open import Relation.Nullary.Negation.Core public
28-
open import Relation.Nullary.Reflects public hiding (recompute)
28+
open import Relation.Nullary.Reflects public hiding (recompute; recompute-irr)
2929
open import Relation.Nullary.Decidable.Core public
3030

3131
------------------------------------------------------------------------

src/Relation/Nullary/Decidable/Core.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ module _ {A : Set a} where
7474
recompute : Dec A Recomputable A
7575
recompute = Reflects.recompute ∘ proof
7676

77-
recompute-irr : (a? : Dec A) (p q : A) recompute a? p ≡ recompute a? q
78-
recompute-irr = Reflects.recompute-irr ∘ proof
77+
recompute-constant : (a? : Dec A) (p q : A) recompute a? p ≡ recompute a? q
78+
recompute-constant = Reflects.recompute-constant ∘ proof
7979

8080
------------------------------------------------------------------------
8181
-- Interaction with negation, sum, product etc.

src/Relation/Nullary/Reflects.agda

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ recompute : ∀ {b} → Reflects A b → Recomputable A
6161
recompute (ofʸ a) _ = a
6262
recompute (ofⁿ ¬a) a = contradiction-irr a ¬a
6363

64-
recompute-irr : {b} (r : Reflects A b) (p q : A) recompute r p ≡ recompute r q
65-
recompute-irr r p q = refl
64+
recompute-constant : {b} (r : Reflects A b) (p q : A) recompute r p ≡ recompute r q
65+
recompute-constant r p q = refl
6666

6767
------------------------------------------------------------------------
6868
-- Interaction with negation, product, sums etc.

0 commit comments

Comments
 (0)