-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d18f57d
commit 9cf9e3f
Showing
10 changed files
with
125 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,5 @@ | ||
{-# OPTIONS --without-K #-} | ||
module hott.level.sets where | ||
|
||
open import level | ||
open import decidable | ||
open import sum | ||
open import equality.core | ||
open import equality.calculus | ||
open import equality.reasoning | ||
open import function.core | ||
open import function.extensionality.proof | ||
open import sets.empty | ||
open import sets.unit | ||
open import hott.level.core | ||
|
||
-- ⊤ is contractible | ||
⊤-contr : contr ⊤ | ||
⊤-contr = tt , λ { tt → refl } | ||
|
||
-- ⊥ is propositional | ||
⊥-prop : h 1 ⊥ | ||
⊥-prop x _ = ⊥-elim x | ||
|
||
⊥-initial : ∀ {i} {A : Set i} → contr (⊥ → A) | ||
⊥-initial = (λ ()) , (λ f → funext λ ()) | ||
|
||
-- Hedberg's theorem | ||
hedberg : ∀ {i} {A : Set i} | ||
→ ((x y : A) → Dec (x ≡ y)) | ||
→ h 2 A | ||
hedberg {A = A} dec x y = prop⇒h1 ≡-prop | ||
where | ||
open ≡-Reasoning | ||
|
||
canonical : {x y : A} → x ≡ y → x ≡ y | ||
canonical {x} {y} p with dec x y | ||
... | yes q = q | ||
... | no _ = p | ||
|
||
canonical-const : {x y : A} | ||
→ (p q : x ≡ y) | ||
→ canonical p ≡ canonical q | ||
canonical-const {x} {y} p q with dec x y | ||
... | yes _ = refl | ||
... | no f = ⊥-elim (f p) | ||
|
||
canonical-inv : {x y : A}(p : x ≡ y) | ||
→ canonical p · sym (canonical refl) ≡ p | ||
canonical-inv refl = left-inverse (canonical refl) | ||
|
||
≡-prop : {x y : A}(p q : x ≡ y) → p ≡ q | ||
≡-prop p q = begin | ||
p | ||
≡⟨ sym (canonical-inv p) ⟩ | ||
canonical p · sym (canonical refl) | ||
≡⟨ ap (λ z → z · sym (canonical refl)) | ||
(canonical-const p q) ⟩ | ||
canonical q · sym (canonical refl) | ||
≡⟨ canonical-inv q ⟩ | ||
q | ||
∎ | ||
|
||
-- Bool is a set | ||
private | ||
module BoolSet where | ||
open import sets.bool | ||
bool-set : h 2 Bool | ||
bool-set = hedberg _≟_ | ||
open BoolSet public | ||
|
||
-- Nat is a set | ||
private | ||
module NatSet where | ||
open import sets.nat.core | ||
nat-set : h 2 ℕ | ||
nat-set = hedberg _≟_ | ||
open NatSet public | ||
|
||
-- Fin is a set | ||
private | ||
module FinSet where | ||
open import sets.fin.core | ||
fin-set : ∀ n → h 2 (Fin n) | ||
fin-set n = hedberg _≟_ | ||
open FinSet public | ||
open import hott.level.sets.core public | ||
open import hott.level.sets.extra public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# OPTIONS --without-K #-} | ||
module hott.level.sets.core where | ||
|
||
open import sum | ||
open import equality.core | ||
open import sets.unit | ||
open import sets.empty | ||
open import hott.level.core | ||
|
||
⊤-contr : ∀ {i} → contr (⊤ {i}) | ||
⊤-contr = tt , λ { tt → refl } | ||
|
||
⊥-prop : h 1 ⊥ | ||
⊥-prop x _ = ⊥-elim x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{-# OPTIONS --without-K #-} | ||
module hott.level.sets.extra where | ||
|
||
open import level | ||
open import decidable | ||
open import sum | ||
open import equality.core | ||
open import equality.calculus | ||
open import equality.reasoning | ||
open import function.core | ||
open import function.extensionality.proof | ||
open import sets.empty | ||
open import sets.unit | ||
open import hott.level.core | ||
|
||
⊥-initial : ∀ {i} {A : Set i} → contr (⊥ → A) | ||
⊥-initial = (λ ()) , (λ f → funext λ ()) | ||
|
||
-- Hedberg's theorem | ||
hedberg : ∀ {i} {A : Set i} | ||
→ ((x y : A) → Dec (x ≡ y)) | ||
→ h 2 A | ||
hedberg {A = A} dec x y = prop⇒h1 ≡-prop | ||
where | ||
open ≡-Reasoning | ||
|
||
canonical : {x y : A} → x ≡ y → x ≡ y | ||
canonical {x} {y} p with dec x y | ||
... | yes q = q | ||
... | no _ = p | ||
|
||
canonical-const : {x y : A} | ||
→ (p q : x ≡ y) | ||
→ canonical p ≡ canonical q | ||
canonical-const {x} {y} p q with dec x y | ||
... | yes _ = refl | ||
... | no f = ⊥-elim (f p) | ||
|
||
canonical-inv : {x y : A}(p : x ≡ y) | ||
→ canonical p · sym (canonical refl) ≡ p | ||
canonical-inv refl = left-inverse (canonical refl) | ||
|
||
≡-prop : {x y : A}(p q : x ≡ y) → p ≡ q | ||
≡-prop p q = begin | ||
p | ||
≡⟨ sym (canonical-inv p) ⟩ | ||
canonical p · sym (canonical refl) | ||
≡⟨ ap (λ z → z · sym (canonical refl)) | ||
(canonical-const p q) ⟩ | ||
canonical q · sym (canonical refl) | ||
≡⟨ canonical-inv q ⟩ | ||
q | ||
∎ | ||
|
||
-- Bool is a set | ||
private | ||
module BoolSet where | ||
open import sets.bool | ||
bool-set : h 2 Bool | ||
bool-set = hedberg _≟_ | ||
open BoolSet public | ||
|
||
-- Nat is a set | ||
private | ||
module NatSet where | ||
open import sets.nat.core | ||
nat-set : h 2 ℕ | ||
nat-set = hedberg _≟_ | ||
open NatSet public | ||
|
||
-- Fin is a set | ||
private | ||
module FinSet where | ||
open import sets.fin.core | ||
fin-set : ∀ n → h 2 (Fin n) | ||
fin-set n = hedberg _≟_ | ||
open FinSet public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.