Skip to content

Commit e7f081e

Browse files
Merge pull request #374 from sergey-goncharov/master
added unique choice
2 parents d32f1c9 + 590dce4 commit e7f081e

File tree

1 file changed

+34
-1
lines changed
  • src/Categories/Category/Instance/Properties/Setoids

1 file changed

+34
-1
lines changed

src/Categories/Category/Instance/Properties/Setoids/Choice.agda

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module _ ℓ where
2929
open import Categories.Category.Instance.Properties.Setoids.Exact
3030
open import Categories.Object.InternalRelation using (Relation)
3131

32-
-- Presentation axiom, aka CoSHEP (http://nlab-pages.s3.us-east-2.amazonaws.com/nlab/show/presentation+axiom)
32+
-- Presentation axiom, aka CoSHEP (https://ncatlab.org/nlab/show/presentation+axiom)
3333
record CoSHEP (A : Setoid ℓ ℓ) : Set (Level.suc ℓ) where
3434
field
3535
{P} : Setoid ℓ ℓ
@@ -60,6 +60,10 @@ module _ ℓ where
6060
entire {A} R = (x : ∣ A ∣) Σ[ e ∈ ∣ dom ∣ ] [ A ][ p₁ ⟨$⟩ e ≈ x ]
6161
where open Relation R
6262

63+
functional : {A B : Setoid ℓ ℓ} (R : Relation S A B) Set
64+
functional {A}{B} R = (e₁ e₂ : ∣ dom ∣) [ A ][ p₁ ⟨$⟩ e₁ ≈ p₁ ⟨$⟩ e₂ ] [ B ][ p₂ ⟨$⟩ e₁ ≈ p₂ ⟨$⟩ e₂ ]
65+
where open Relation R
66+
6367
ℕ-Setoid : Setoid ℓ ℓ
6468
ℕ-Setoid = record { Carrier = Lift _ ℕ ; _≈_ = P._≡_ ; isEquivalence = record { refl = P.refl ; sym = P.sym ; trans = P.trans } }
6569

@@ -94,3 +98,32 @@ module _ ℓ where
9498
; cong = λ {n}{m} eq let x , _ = surj n; y , _ = surj m in P.subst (λ m [ A ][ proj₁ (surj n) ≈ proj₁ (surj m) ]) eq (refl A)
9599
}
96100
, λ {n}{m} n≡m let _ , eq = surj n in P.trans eq n≡m
101+
102+
-- principle of unique choice for setoids
103+
-- https://ncatlab.org/nlab/show/principle+of+unique+choice
104+
record UniqueChoice {A B : Setoid ℓ ℓ} (R : Relation S A B) (ent : entire R) (frel : functional R) : Setwhere
105+
open Relation R
106+
107+
field
108+
fun : A ⇒ B
109+
isfun : (e : ∣ dom ∣) [ B ][ fun ⟨$⟩ (p₁ ⟨$⟩ e) ≈ p₂ ⟨$⟩ e ]
110+
111+
Setoid-UniqueChoice : {A B : Setoid ℓ ℓ} (R : Relation S A B) (ent : entire R) (frel : functional R) UniqueChoice R ent frel
112+
_⟨$⟩_ (UniqueChoice.fun (Setoid-UniqueChoice R ent frel)) x = p₂ ⟨$⟩ proj₁ (ent x)
113+
where open Relation R
114+
115+
cong (UniqueChoice.fun (Setoid-UniqueChoice {A} {B} R ent frel)) {n} {m} n≈m =
116+
let (en , p₁en≈n) = ent n
117+
(em , p₁em≈m) = ent m in frel en em
118+
(begin
119+
p₁ ⟨$⟩ en ≈⟨ p₁en≈n ⟩
120+
n ≈⟨ n≈m ⟩
121+
m ≈˘⟨ p₁em≈m ⟩
122+
p₁ ⟨$⟩ em
123+
∎)
124+
where
125+
open Relation R
126+
open SR A
127+
128+
UniqueChoice.isfun (Setoid-UniqueChoice R ent frel) e = let (e' , p₁e'≈p₁e) = ent (p₁ ⟨$⟩ e) in frel e' e p₁e'≈p₁e
129+
where open Relation R

0 commit comments

Comments
 (0)