Skip to content

Commit 147eab6

Browse files
committed
fix flat modality
1 parent ca74e8b commit 147eab6

3 files changed

Lines changed: 59 additions & 2 deletions

File tree

doc/anders.tex

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ \section{Syntax}
101101
kan :=&$\textbf{transp}\ E\ E\ |\ \textbf{hcomp}\ E$ \\
102102
glue :=&$\textbf{Glue}\ E\ |\ \textbf{glue}\ E\ |\ \textbf{unglue}\ E\ E$ \\
103103
Im :=&$\textbf{Im}\ \mathrm{E}\ |\ \textbf{Inf}\ \mathrm{E}\ |\ \textbf{Join}\ \mathrm{E}\ |\ \textbf{ind$_{Im}$}\ \mathrm{E}\ \mathrm{E}$ \\
104+
Flat :=&$\flat\ \mathrm{E}\ |\ \flat-\textrm{unit}\ \mathrm{E}\ |\ \flat-\textrm{counit}\ \mathrm{E}\ |\ \textbf{ind}_{\flat}\ \mathrm{E}\ \mathrm{E}$ \\
104105
\end{tabular}
105106
\end{table}
106107

@@ -109,7 +110,7 @@ \section{Syntax}
109110
\begin{table}[ht!]
110111
\centering
111112
\begin{tabular}{rl}
112-
E :=&$\textrm{cosmos}\ |\ \textrm{var}\ |\ \textrm{MLTT}\ |\ \textrm{CCHM}\ |\ \textrm{Im}$ \\
113+
E :=&$\textrm{cosmos}\ |\ \textrm{var}\ |\ \textrm{MLTT}\ |\ \textrm{CCHM}\ |\ \textrm{Im}\ |\ \textrm{Flat}$ \\
113114
CCHM :=&$\textrm{path}\ |\ \textrm{I}\ |\ \textrm{part}\ |\ \textrm{sub}\ |\ \textrm{kan}\ |\ \textrm{glue}$ \\
114115
MLTT :=&$\textrm{pi}\ |\ \textrm{sigma}\ |\ \textrm{id}$ \\
115116
\end{tabular}
@@ -122,7 +123,8 @@ \section{Syntax}
122123
\texttt{V}, \texttt{$\bigvee$}, \texttt{$\bigwedge$}, \texttt{-}, \texttt{+}, \texttt{@}, \texttt{PathP},
123124
\texttt{transp}, \texttt{hcomp}, \texttt{zero}, \texttt{one}, \texttt{Partial}, \texttt{inc},
124125
\texttt{$\times$}, \texttt{$\rightarrow$}, \texttt{:}, \texttt{:=}, \texttt{$\mapsto$}, \texttt{U},
125-
\texttt{ouc}, \texttt{interval}, \texttt{inductive}, \texttt{Glue}, \texttt{glue}, \texttt{unglue}.
126+
\texttt{ouc}, \texttt{interval}, \texttt{inductive}, \texttt{Glue}, \texttt{glue}, \texttt{unglue},
127+
\texttt{$\flat$}, \texttt{$\flat$-unit}, \texttt{$\flat$-counit}, \texttt{ind-$\flat$}.
126128

127129
\textbf{Indentifiers}. Identifiers support UTF-8. Indentifiers couldn't
128130
start with $\texttt{:}$, $\texttt{-}$, $\rightarrow$. Sample identifiers:
@@ -651,6 +653,44 @@ \subsection{de Rham Stack}
651653
\textbf{def} T$^\infty$-map (X Y : U) (f : X → Y) ($\tau$ : T$^\infty$ X) : T$^\infty$ Y := (f $\tau$.1, d X Y f $\tau$.1 $\tau$.2) \\
652654
\end{tabular}
653655
\end{table}
656+
\newpage
657+
\subsection{Flat Modality}
658+
659+
The Flat modality $\flat$ (also known as the discrete modality) is a core primitive of Anders,
660+
providing a way to talk about discrete types. In a cohesive type theory, $\flat A$
661+
is the type $A$ equipped with the discrete topology. The Anders prover implements
662+
computational semantics for the Flat modality including its interaction with cubical primitives.
663+
664+
\begin{table}[ht!]
665+
\tabstyle
666+
\begin{tabular}{l}
667+
\textbf{def} Flat (A : U) := $\flat$ A \\
668+
\textbf{def} FlatUnit (A : U) (a : A) := $\flat$-unit a \\
669+
\textbf{def} FlatCounit (A : U) (x : $\flat$ A) := $\flat$-counit x \\
670+
\\
671+
\textbf{def} isDiscrete (A : U) : U := isEquiv A ($\flat$ A) (FlatUnit A) \\
672+
\textbf{def} ♭-$\eta$ (A : U) (x : $\flat$ A) : Path ($\flat$ A) x ($\flat$-unit ($\flat$-counit x)) := <p> x \\
673+
\textbf{def} FlatInd (A : U) (B : $\flat$ A $\rightarrow$ U) := ind-$\flat$ A B \\
674+
\end{tabular}
675+
\end{table}
676+
677+
The Flat modality satisfies several computational reduction rules for transport and
678+
homogeneous composition, which ensure that $\flat$ behaves correctly with respect to the
679+
cubical structure of the type theory.
680+
681+
\begin{table}[ht!]
682+
\tabstyle
683+
\begin{tabular}{l}
684+
transp$^{i}$ ($\flat$ A) $\varphi$ ($\flat$-unit a) = $\flat$-unit (transp$^i$ A $\varphi$ a) \\
685+
hcomp$^{i}$ ($\flat$ A) [$\phi$ $\mapsto$ $\flat$-unit u] ($\flat$-unit u$_0$) = $\flat$-unit (hcomp$^i$ A [$\phi$ $\mapsto$ u] u$_0$) \\
686+
\end{tabular}
687+
\end{table}
688+
689+
\begin{definition}[Discreteness]
690+
A type $A$ is called discrete if the unit map $\flat$-unit : $A \rightarrow \flat A$ is an equivalence.
691+
This corresponds to the intuition that a type is discrete if its points have no non-trivial paths between them
692+
that aren't captured by the discrete topology.
693+
\end{definition}
654694

655695
\newpage
656696
\subsection{Inductive Types}

library/foundations/modal/flat.anders

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,19 @@ def ♭-η (A : U) := λ (x : Flat A), <p> x
1818

1919
-- Discrete types: A type is discrete if ♭-unit is an equivalence.
2020
def isDiscrete (A : U) := isEquiv A (Flat A) (FlatUnit A)
21+
22+
-- Reality Check (Simon Huber Equations)
23+
24+
def trans-♭ (A : I → U) (a : A 0) : ♭ (A 1) := ♭-unit (transp (<i> A i) 0 a)
25+
def trans-♭′ (A : I → U) (a : A 0) : ♭ (A 1) := transp (<i> ♭ (A i)) 0 (♭-unit a)
26+
def trans-♭-is-correct (A : I → U) (a : A 0) : Path (♭ (A 1)) (trans-♭ A a) (trans-♭′ A a) := <_> trans-♭ A a
27+
28+
def hcomp-♭ (A : U) (r : I) (u : I → Partial A r) (u₀ : A[r ↦ u 0]) : ♭ A
29+
:= ♭-unit (hcomp A r u (ouc u₀))
30+
31+
def hcomp-♭′ (A : U) (r : I) (u : I → Partial A r) (u₀ : A[r ↦ u 0]) : ♭ A
32+
:= hcomp (Flat A) r (λ (i : I), [(r = 1) → ♭-unit (u i 1=1)]) (♭-unit (ouc u₀))
33+
34+
def hcomp-♭-is-correct (A : U) (r : I) (u : I → Partial A r) (u₀ : A[r ↦ u 0])
35+
: Path (Flat A) (hcomp-♭ A r u u₀) (hcomp-♭′ A r u u₀)
36+
:= <_> hcomp-♭ A r u u₀

src/ocaml/kernel/check.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ and conv_internal v1 v2 =
13211321
| VJoin u, VJoin v -> u == v || conv u v
13221322
| VIndIm (a1, b1), VIndIm (a2, b2) -> (a1 == a2 || conv a1 a2) && (b1 == b2 || conv b1 b2)
13231323
| VFla u, VFla v -> u == v || conv u v
1324+
| VFlaUnit u, VFlaUnit v -> u == v || conv u v
13241325
| VFlaCounit u, VFlaCounit v -> u == v || conv u v
13251326
| VIndFla (a1, b1), VIndFla (a2, b2) -> (a1 == a2 || conv a1 a2) && (b1 == b2 || conv b1 b2)
13261327
| VCoequ (a1, b1, f1, g1), VCoequ (a2, b2, f2, g2) -> (a1 == a2 || conv a1 a2) && (b1 == b2 || conv b1 b2) && (f1 == f2 || conv f1 f2) && (g1 == g2 || conv g1 g2)

0 commit comments

Comments
 (0)