Skip to content

Commit 63c2907

Browse files
committed
sharp modality more mature
1 parent 39cc4bb commit 63c2907

1 file changed

Lines changed: 38 additions & 8 deletions

File tree

library/foundations/modal/sharp.anders

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,49 @@ import library/foundations/univalent/equiv
88

99
def ♯ (A : U) := ♭ 𝟏 → A
1010

11-
-- Introduction Rule
12-
def ♯-unit (A : U) := λ (a : A), λ (_ : ♭ 𝟏), a
11+
-- Introduction Rule (Unit)
12+
def ♯-unit (A : U) (a : A) : ♯ A := λ (_ : ♭ 𝟏), a
1313

1414
-- Elimination Rule (Counit)
15-
def ♯-counit (A : U) := λ (s : ♯ A), s (♭-unit ★)
15+
def ♯-counit (A : U) (s : ♯ A) : A := s (♭-unit ★)
1616

17-
-- Modal types: A type is codiscrete (♯-modal) if the unit is an equivalence.
18-
def is-♯-modal (A : U) := isEquiv A (♯ A) (♯-unit A)
17+
-- Path in ♭ 𝟏 from ♭-unit ★ to any x
18+
-- This holds because ♭ 𝟏 is a proposition.
19+
-- We use ind-♭ with a flat motive and then extract with ♭-counit.
20+
def ♭-unit-𝟏-prop (x : ♭ 𝟏) : Path (♭ 𝟏) (♭-unit ★) x
21+
:= ♭-counit (ind-♭ 𝟏 (λ (z : ♭ 𝟏), Path (♭ 𝟏) (♭-unit ★) z)
22+
(λ (a : 𝟏), ind-unit (λ (z : 𝟏), ♭ (Path (♭ 𝟏) (♭-unit ★) (♭-unit z)))
23+
(♭-unit (<_> ♭-unit ★)) a) x)
1924

2025
-- Uniqueness Rule (η)
2126
-- s ≡ λ x, s (♭-unit ★)
22-
def ♯-η (A : U) := λ (s : ♯ A), <p> λ (x : ♭ 𝟏), s (♭-η 𝟏 x @ p)
27+
def ♯-η (A : U) (s : ♯ A) : Path (♯ A) (♯-unit A (♯-counit A s)) s
28+
:= <p> λ (x : ♭ 𝟏), s (♭-unit-𝟏-prop x @ p)
29+
30+
-- Induction Rule (Derived)
31+
def ind-♯ (A : U) (C : ♯ A → U) (f : Π (x : A), C (♯-unit A x)) (z : ♯ A) : C z
32+
:= transp (<i> C (♯-η A z @ i)) 0 (f (♯-counit A z))
33+
34+
-- Modal types: A type is codiscrete (♯-modal) if the unit is an equivalence.
35+
def is-♯-modal (A : U) := isEquiv A (♯ A) (♯-unit A)
2336

2437
-- Monad structure
25-
def ♯-join (A : U) := λ (ss : ♯ (♯ A)), λ (x : ♭ 𝟏), ss x x
26-
def ♯-map (A B : U) := λ (f : A → B), λ (s : ♯ A), λ (x : ♭ 𝟏), f (s x)
38+
def ♯-join (A : U) (ss : ♯ (♯ A)) : ♯ A := λ (x : ♭ 𝟏), ss x x
39+
def ♯-map (A B : U) (f : A → B) (s : ♯ A) : ♯ B := λ (x : ♭ 𝟏), f (s x)
40+
41+
--- Uniqueness (η-rule)
42+
def ♯-η-eq (A : U) (x : ♯ A) : Path (♯ A) x (♯-unit A (ind-♯ A (λ (z : ♯ A), A) (λ (a : A), a) x))
43+
:= sym (♯ A) (♯-unit A (♯-counit A x)) x (♯-η A x)
44+
45+
--- Reality Check: Huber Equations (Transport)
46+
--- transpⁱ (♯ A) φ (♯-unit a) = ♯-unit (transpⁱ A φ a)
47+
def trans-♯-is-correct (A : I → U) (u0 : A 0) :
48+
Path (♯ (A 1)) (transp (<i> ♯ (A i)) 0 (♯-unit (A 0) u0)) (♯-unit (A 1) (transp (<i> A i) 0 u0))
49+
:= idp (♯ (A 1)) (♯-unit (A 1) (transp (<i> A i) 0 u0))
50+
51+
--- Reality Check: Huber Equations (Composition)
52+
--- hcompⁱ (♯ A) [φ ↦ ♯-unit u] (♯-unit u₀) = ♯-unit (hcompⁱ A [φ ↦ u] u₀)
53+
def hcomp-♯-is-correct (A : U) (phi : I) (u : I → A) :
54+
Path (♯ A) (hcomp (♯ A) phi (λ (j : I), [ (phi = 1) → ♯-unit A (u j) ]) (♯-unit A (u 0)))
55+
(♯-unit A (hcomp A phi (λ (j : I), [ (phi = 1) → u j ]) (u 0)))
56+
:= idp (♯ A) (♯-unit A (hcomp A phi (λ (j : I), [ (phi = 1) → u j ]) (u 0)))

0 commit comments

Comments
 (0)