Skip to content

Commit 1eee6f6

Browse files
Basic Prototypes
1 parent b4b6547 commit 1eee6f6

26 files changed

Lines changed: 3371 additions & 0 deletions
80.4 KB
Binary file not shown.
80.4 KB
Binary file not shown.

essay/draft-01/essay.tex

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
\documentclass{article}
2+
\usepackage{amsmath}
3+
\usepackage{amsfonts}
4+
\usepackage{xcolor}
5+
\usepackage[utf8]{inputenc}
6+
7+
\begin{document}
8+
9+
\title{Spherepop Calculus: A Geometric and Probabilistic Extension of Lambda Calculus}
10+
\author{Flyxion}
11+
\date{September 28, 2025}
12+
\maketitle
13+
14+
\begin{abstract}
15+
Spherepop Calculus (SPC) is a novel computational formalism that extends the lambda calculus with geometric scope (via \texttt{Sphere} and \texttt{Pop}), concurrent composition (via \texttt{Merge}), and probabilistic branching (via \texttt{Choice}). This paper explores the design and rationale of SPC, with a particular focus on the \texttt{doomCoin p} construct as a canonical example illustrating its probabilistic and tensorial semantics. We compare SPC with traditional and probabilistic lambda calculi, highlighting its unique ability to internalize probability, concurrency, and geometric structure. Additionally, we provide a Haskell implementation and a Racket evaluator skeleton, demonstrating practical realizations of SPC’s core concepts.
16+
\end{abstract}
17+
18+
\section{Introduction}
19+
Spherepop Calculus (SPC) reimagines lambda calculus by introducing geometric scoping through \texttt{Sphere} and \texttt{Pop}, parallel composition via \texttt{Merge}, and probabilistic branching with \texttt{Choice}. Unlike traditional lambda calculus, SPC natively supports concurrent and probabilistic computations, with a type discipline extending the Calculus of Constructions and semantics grounded in a presheaf topos enriched with the distribution monad. This paper elucidates SPC’s design principles, focusing on the \texttt{doomCoin p} construct, which exemplifies its ability to internalize probability and concurrency. We provide a formal comparison with lambda calculus and probabilistic lambda calculus, alongside implementations in Haskell and a Racket evaluator skeleton.
20+
21+
\section{Core Constructs of Spherepop Calculus}
22+
SPC extends lambda calculus with the following primitives:
23+
24+
\begin{itemize}
25+
\item \textbf{Sphere/Pop}: Replaces lambda abstraction and application with geometric scoping, where \texttt{Sphere(x:A.t)} denotes a function and \texttt{Pop(f,u)} applies it, interpreted as nested spheres.
26+
\item \textbf{Merge}: Represents parallel or nondeterministic composition, with semantics as a tensor product in a symmetric monoidal category.
27+
\item \textbf{Choice}: Introduces probabilistic branching, either internally (returning type $A$) or monadically (returning $\Dist(A)$ via the Giry distribution monad).
28+
\item \textbf{Rotate}: A novel operation for cyclic rotation over homogeneous Boolean tensors, capturing structural symmetries absent in lambda calculus.
29+
\end{itemize}
30+
31+
The type system extends the Calculus of Constructions with $\Pi$- and $\Sigma$-types, ensuring type alignment for \texttt{Merge} and \texttt{Choice}. Operational semantics involve stochastic reduction for \texttt{Choice} and tensorial distribution for \texttt{Merge}, with denotational semantics in a presheaf topos.
32+
33+
\section{Canonical Example: \texttt{doomCoin p}}
34+
The \texttt{doomCoin p} construct is a pedagogical archetype that illustrates SPC’s distinctive features:
35+
36+
\begin{equation}
37+
\doomCoin{p} \;\equiv\; \Choice(p, \LitBool{\#t}, \LitBool{\#f}),
38+
\end{equation}
39+
where $\LitBool{\#t}$ represents a catastrophic outcome (``doom'') and $\LitBool{\#f}$ denotes survival.
40+
41+
\subsection{Syntax and Typing}
42+
The \texttt{Choice} construct is typed as:
43+
\[
44+
\frac{\Gamma \vdash t : A \quad \Gamma \vdash u : A \quad p \in [0,1]}{\Gamma \vdash \Choice(p, t, u) : A \text{ or } \Dist(A)}.
45+
\]
46+
For \texttt{doomCoin p}, this yields $\Bool$ (internal) or $\Dist(\Bool)$ (monadic).
47+
48+
\subsection{Operational Semantics}
49+
The operational semantics of \texttt{Choice} involve stochastic reduction:
50+
\[
51+
\Choice(p, t, u) \to \begin{cases} t & \text{with probability } p, \\ u & \text{with probability } 1-p. \end{cases}
52+
\]
53+
Thus, $\doomCoin{p} \to \LitBool{\#t}$ with probability $p$, and $\LitBool{\#f}$ with probability $1-p$.
54+
55+
\subsection{Denotational Semantics}
56+
In the presheaf topos with the distribution monad, the semantics of \texttt{doomCoin p} is:
57+
\[
58+
\llbracket \doomCoin{p} \rrbracket = p \cdot \delta_{\#t} + (1-p) \cdot \delta_{\#f}.
59+
\]
60+
For multiple independent coins, $\Merge(\doomCoin{p_1}, \ldots, \doomCoin{p_n})$, the observable $\anyDoom$ (a Boolean OR fold) yields:
61+
\[
62+
\Pr[\anyDoom(\Merge(\doomCoin{p_1}, \ldots, \doomCoin{p_n}))] = 1 - \prod_{i=1}^n (1-p_i),
63+
\]
64+
demonstrating the Independent Channels Lemma.
65+
66+
\subsection{Rationale for \texttt{doomCoin p}}
67+
The \texttt{doomCoin p} notation is chosen for its clarity and expressiveness:
68+
\begin{itemize}
69+
\item \textbf{Intrinsic Probability}: The probability $p$ is a syntactic parameter, not an external annotation, unlike in lambda calculus where randomness requires an oracle.
70+
\item \textbf{Bernoulli Base Case}: Doom is modeled as a Boolean, providing the simplest nontrivial probabilistic type.
71+
\item \textbf{Tensorial Independence}: The \texttt{Merge} operator ensures that independence laws emerge naturally from the calculus’s structure.
72+
\item \textbf{Pedagogical Clarity}: The syntax is intuitive, pairing the event (doom) with its probability in a memorable term.
73+
\end{itemize}
74+
75+
\section{Comparison with Lambda Calculi}
76+
We contrast SPC with traditional and probabilistic lambda calculi to highlight the uniqueness of \texttt{doomCoin p}:
77+
78+
\begin{itemize}
79+
\item \textbf{Lambda Calculus}: Lacks native probability. A Bernoulli trial requires an external oracle, e.g., $\lambda r.\ \texttt{if } r < p \texttt{ then \#t else \#f}$. Independence laws must be proven externally.
80+
\item \textbf{Probabilistic Lambda Calculus}: Introduces $\texttt{choice}(p, e_1, e_2)$, but lacks native concurrency or dependent types. Independence is a semantic property, not syntactic.
81+
\item \textbf{SPC}: Integrates probability (\texttt{Choice}), concurrency (\texttt{Merge}), and geometric scoping (\texttt{Sphere/Pop}). The \texttt{doomCoin p} construct ensures that probabilistic laws, such as the Independent Channels Lemma, arise syntactically.
82+
\end{itemize}
83+
84+
\begin{table}[h]
85+
\centering
86+
\begin{tabular}{|l|c|c|c|}
87+
\hline
88+
\textbf{Feature} & \textbf{λ-Calculus} & \textbf{Prob. λ-Calculus} & \textbf{SPC} \\
89+
\hline
90+
Probability & External oracle & Primitive \texttt{choice} & Intrinsic \texttt{Choice} \\
91+
Doom Coin & $\lambda r.\ \texttt{if } r<p \texttt{ then \#t else \#f}$ & \texttt{choice}(p, \#t, \#f) & \texttt{doomCoin p} \\
92+
Independence & External proof & Semantic, meta-level & Syntactic via \texttt{Merge} \\
93+
Scope Model & Parentheses & Parentheses & Geometric spheres \\
94+
Concurrency & None & None & Tensorial \texttt{Merge} \\
95+
\hline
96+
\end{tabular}
97+
\caption{Comparison of Probabilistic Constructs Across Calculi}
98+
\end{table}
99+
100+
\section{Implementation in Haskell}
101+
The Haskell implementation, provided in \texttt{spherepop.hs}, supports type checking and evaluation using a distribution monad. Key components include:
102+
103+
\begin{itemize}
104+
\item \textbf{Type Checking}: Ensures type alignment for \texttt{Merge}, \texttt{Choice}, and \texttt{Rotate}.
105+
\item \textbf{Evaluation}: Handles probabilistic outcomes via a distribution monad.
106+
\item \textbf{Observables}: \texttt{anyDoom} computes doom probabilities across tensors.
107+
\end{itemize}
108+
109+
For example, the \texttt{eval} function manages probabilistic evaluation:
110+
\lstset{language=Haskell, basicstyle=\small\ttfamily, breaklines=true}
111+
\begin{lstlisting}
112+
eval :: Env -> Term -> Either String (Dist Value)
113+
eval env t = case t of
114+
Var x -> delta <$> lookupVal env x
115+
Choice p t u -> do
116+
dt <- eval env t
117+
du <- eval env u
118+
Right $ normalize $ mix p dt du
119+
...
120+
\end{lstlisting}
121+
122+
Running \texttt{demoDoomTensor} yields:
123+
\begin{verbatim}
124+
> run demoDoomTensor
125+
Type:
126+
Bool ⊗ Bool
127+
Eval (distribution):
128+
10.0% ⟼ (true ⊗ true)
129+
40.0% ⟼ (true ⊗ false)
130+
10.0% ⟼ (false ⊗ true)
131+
40.0% ⟼ (false ⊗ false)
132+
\end{verbatim}
133+
134+
\section{Racket Evaluator}
135+
The Racket implementation, provided in \texttt{spherepop.rkt}, supports type checking and evaluation using a distribution monad, mirroring the Haskell implementation. Key components include:
136+
137+
\begin{itemize}
138+
\item \textbf{Type Checking}: Ensures type alignment for \texttt{Merge}, \texttt{Choice}, and \texttt{Rotate} constructs.
139+
\item \textbf{Evaluation}: Handles probabilistic outcomes using a \texttt{Dist} structure.
140+
\item \textbf{Observables}: \texttt{prob-any-doom} computes doom probabilities across tensors.
141+
\end{itemize}
142+
143+
For example, the \texttt{eval} function manages probabilistic evaluation:
144+
\lstset{language=Lisp, basicstyle=\small\ttfamily, breaklines=true}
145+
\begin{lstlisting}
146+
(define (eval env term)
147+
(match term
148+
[`(Var ,x) (delta (lookup-val env x))]
149+
[`(Choice ,p ,t ,u)
150+
(define dt (eval env t))
151+
(define du (eval env u))
152+
(normalize (mix p dt du))]
153+
...))
154+
\end{lstlisting}
155+
156+
Running \texttt{demo-doom-tensor} yields:
157+
\begin{verbatim}
158+
> (run demo-doom-tensor)
159+
Type:
160+
(TyTensor (TyBool) (TyBool))
161+
Eval (distribution):
162+
10.0% ⟼ (VPair (VBool #t) (VBool #t))
163+
40.0% ⟼ (VPair (VBool #t) (VBool #f))
164+
10.0% ⟼ (VPair (VBool #f) (VBool #t))
165+
40.0% ⟼ (VPair (VBool #f) (VBool #f))
166+
\end{verbatim}
167+
168+
\section{Conclusion}
169+
Spherepop Calculus advances lambda calculus by integrating geometric scoping, concurrent composition, and probabilistic branching. The \texttt{doomCoin p} construct serves as a canonical example, demonstrating how SPC internalizes probability and concurrency in a way that is both syntactically elegant and semantically robust. By contrasting SPC with lambda calculi and providing practical implementations, we showcase its potential for reasoning about probabilistic and concurrent systems.
170+
171+
\appendix
172+
173+
\section{Implementation Listings}
174+
\subsection{Haskell Implementation}
175+
\lstinputlisting[language=Haskell]{spherepop.hs}
176+
\subsection{Racket Implementation}
177+
\lstinputlisting[language=Lisp]{spherepop.rkt}
178+
179+
\end{document}

essay/draft-01/spherepop.rkt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#lang racket
2+
3+
;; Spherepop Calculus: Evaluator Skeleton with Macros
4+
(provide sphere pop merge choice rotate lit-unit lit-bool lit-nat if add choice-n bind fold-or fold-and)
5+
6+
;; Core Syntax (minimal)
7+
(define-syntax-rule (sphere (x t) body) (Sphere x t body))
8+
(define-syntax-rule (pop f u) (Pop f u))
9+
(define-syntax-rule (merge t u) (Merge t u))
10+
(define-syntax-rule (choice p t u) (Choice p t u))
11+
(define-syntax-rule (rotate k t) (Rotate k t))
12+
(define-syntax-rule (lit-unit) (LitUnit))
13+
(define-syntax-rule (lit-bool b) (LitBool b))
14+
(define-syntax-rule (lit-nat n) (LitNat n))
15+
(define-syntax-rule (if b t u) (If b t u))
16+
(define-syntax-rule (add t u) (Add t u))
17+
18+
;; Extended Syntax (macros)
19+
(define-syntax-rule (choice-n (p1 t1) (p2 t2) ...)
20+
(choice p1 t1 (choice-n (p2 t2) ...)))
21+
(define-syntax-rule (choice-n (p t)) t)
22+
23+
(define-syntax-rule (bind (x <- t) u)
24+
(pop (sphere (x Any) u) t))
25+
26+
(define-syntax (fold-or stx)
27+
(syntax-case stx ()
28+
[(_ (merge t1 t2)) #'(if t1 (lit-bool #t) (fold-or t2))]
29+
[(_ b) #'b]))
30+
31+
(define-syntax (fold-and stx)
32+
(syntax-case stx ()
33+
[(_ (merge t1 t2)) #'(if t1 (fold-and t2) (lit-bool #f))]
34+
[(_ b) #'b]))
35+
36+
;; Evaluator Skeleton (to be implemented)
37+
(define (eval term)
38+
(error "Evaluator not implemented"))
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
\documentclass{article}
2+
\usepackage{amsmath}
3+
\usepackage{amsfonts}
4+
\usepackage{xcolor}
5+
\usepackage[utf8]{inputenc}
6+
\usepackage{tikz}
7+
\usetikzlibrary{cd}
8+
\usepackage{listings}
9+
\usepackage{hyperref}
10+
\usepackage{natbib}
11+
12+
\begin{document}
13+
14+
\title{Spherepop Calculus: Internalizing Probability, Concurrency, and Geometry}
15+
\author{Flyxion}
16+
\date{September 28, 2025}
17+
\maketitle
18+
19+
\begin{abstract}
20+
Spherepop Calculus (SPC) is a novel computational formalism extending lambda calculus with geometric scope (\texttt{Sphere} and \texttt{Pop}), concurrent composition (\texttt{Merge}), probabilistic branching (\texttt{Choice}), and structural symmetries (\texttt{Rotate}). This paper explores SPC’s design, emphasizing the \texttt{doomCoin p} construct as a canonical example of its probabilistic and tensorial semantics. We compare SPC with traditional and probabilistic lambda calculi, highlighting its ability to internalize probability, concurrency, and geometric structure. Implementations in Haskell and a Racket evaluator skeleton demonstrate practical realizations of SPC’s concepts.
21+
% TODO: Add a sentence on applications (e.g., AI safety, risk analysis) to motivate practical relevance.
22+
\end{abstract}
23+
24+
\section{Introduction}
25+
% Expand with:
26+
% - Motivation: Why geometric scoping unifies functional, concurrent, probabilistic computation.
27+
% - Historical context: λ-calculus (Church), probabilistic λ-calculus (Kozen), π-calculus (Milner).
28+
% - SPC’s philosophy: Internalizing probability/concurrency as first-class constructs.
29+
Spherepop Calculus (SPC) reimagines lambda calculus by introducing geometric scoping through \texttt{Sphere} and \texttt{Pop}, parallel composition via \texttt{Merge}, probabilistic branching with \texttt{Choice}, and structural operations like \texttt{Rotate}. Unlike traditional lambda calculus, SPC natively supports concurrent and probabilistic computations within a type discipline extending the Calculus of Constructions, with semantics in a presheaf topos enriched with the distribution monad. This paper elucidates SPC’s design, focusing on \texttt{doomCoin p} as a pedagogical archetype, and provides practical implementations in Haskell and Racket.
30+
31+
\section{Core Constructs of Spherepop Calculus}
32+
SPC extends lambda calculus with the following primitives, each with distinct syntax, typing, and semantics:
33+
34+
\begin{itemize}
35+
\item \textbf{Sphere/Pop}: Replaces lambda abstraction/application with geometric scoping, where \texttt{Sphere(x:A.t)} denotes a function and \texttt{Pop(f,u)} applies it.
36+
\item \textbf{Merge}: Represents parallel/nondeterministic composition, interpreted as a tensor product.
37+
\item \textbf{Choice}: Introduces probabilistic branching, returning either type $A$ or $\Dist(A)$.
38+
\item \textbf{Rotate}: Cyclic rotation over homogeneous Boolean tensors, capturing structural symmetries.
39+
\end{itemize}
40+
41+
\subsection{Syntax and Typing}
42+
% TODO: Add formal grammar and typing rules for each construct.
43+
\[
44+
\begin{array}{rcl}
45+
t,u &::=& \Var{x} \mid \Sphere(x{:}A.\,t) \mid \Pop(t,u) \mid \Merge(t,u) \mid \Choice(p,t,u) \mid \Rotate(k,t) \\
46+
&& \mid \LitUnit \mid \LitBool{b} \mid \LitNat{n} \mid \If(b,t,u) \mid \Add(t,u)
47+
\end{array}
48+
\]
49+
\[
50+
\frac{\Gamma, x{:}A \vdash t : B}{\Gamma \vdash \Sphere(x{:}A.\,t) : A \to B} \quad
51+
\frac{\Gamma \vdash f : A \to B \quad \Gamma \vdash u : A}{\Gamma \vdash \Pop(f,u) : B}
52+
\]
53+
\[
54+
\frac{\Gamma \vdash t : A \quad \Gamma \vdash u : B}{\Gamma \vdash \Merge(t,u) : A \otimes B} \quad
55+
\frac{\Gamma \vdash t : A \quad \Gamma \vdash u : A \quad p \in [0,1]}{\Gamma \vdash \Choice(p,t,u) : A}
56+
\]
57+
\[
58+
\frac{\Gamma \vdash t : \Bool^{\otimes k}, k \ge 1}{\Gamma \vdash \Rotate(k,t) : \Bool^{\otimes k}}
59+
\]
60+
61+
\subsection{Operational Semantics}
62+
% TODO: Expand with full small-step rules (from prior messages), including probability-mass composition.
63+
\[
64+
\Pop(\Sphere(x{:}A.\,t), v) \longrightarrow t[v/x]
65+
\]
66+
\[
67+
\Choice(p,t,u) \LongRightarrow_p t \quad \Choice(p,t,u) \LongRightarrow_{1-p} u
68+
\]
69+
\[
70+
\Merge(v,w) \longrightarrow v \otimes w \quad \Rotate(k, v_1 \otimes \cdots \otimes v_n) \longrightarrow v_{1+k \mod n} \otimes \cdots \otimes v_{n+k \mod n}
71+
\]
72+
73+
\subsection{Categorical Semantics}
74+
% TODO: Detail presheaf topos, distribution monad, tensor product for Merge.
75+
\texttt{Sphere/Pop} are exponentials/evaluation morphisms, \texttt{Merge} is a tensor product, and \texttt{Choice} is a convex combination in the distribution monad.
76+
77+
\section{Canonical Example: \texttt{doomCoin p}}
78+
The \texttt{doomCoin p} construct exemplifies SPC’s probabilistic and tensorial semantics:
79+
\[
80+
\doomCoin{p} \;\equiv\; \Choice(p, \LitBool{\#t}, \LitBool{\#f}).
81+
\]
82+
83+
\subsection{Syntax and Typing}
84+
\[
85+
\frac{\Gamma \vdash \LitBool{\#t} : \Bool \quad \Gamma \vdash \LitBool{\#f} : \Bool \quad p \in [0,1]}{\Gamma \vdash \doomCoin{p} : \Bool \text{ or } \Dist(\Bool)}
86+
\]
87+
88+
\subsection{Operational Semantics}
89+
\[
90+
\doomCoin{p} \LongRightarrow_p \LitBool{\#t} \quad \doomCoin{p} \LongRightarrow_{1-p} \LitBool{\#f}
91+
\]
92+
Example reduction for $\Merge(\doomCoin{0.2}, \doomCoin{0.5})$:
93+
\[
94+
\Merge(\Choice(0.2, \#t, \#f), \Choice(0.5, \#t, \#f)) \LongRightarrow_{0.2 \cdot 0.5} \#t \otimes \#t \quad \text{(and other paths)}.
95+
\]
96+
97+
\subsection{Denotational Semantics}
98+
\[
99+
\llbracket \doomCoin{p} \rrbracket = p \cdot \delta_{\#t} + (1-p) \cdot \delta_{\#f}
100+
\]
101+
For $\Merge(\doomCoin{p_1}, \ldots, \doomCoin{p_n})$, the \texttt{anyDoom} observable yields:
102+
\[
103+
\Pr[\anyDoom(\Merge(\doomCoin{p_1}, \ldots, \doomCoin{p_n}))] = 1 - \prod_{i=1}^n (1-p_i).
104+
\]
105+
% TikZ diagram showing categorical flow
106+
\begin{figure}[h]
107+
\centering
108+
\begin{tikzcd}
109+
\doomCoin{p} \arrow[r, "\llbracket \cdot \rrbracket"] \arrow[d, "\text{Choice}"] & p \cdot \delta_{\#t} + (1-p) \cdot \delta_{\#f} \arrow[d, "\text{tensor}"] \\
110+
\Dist(\Bool) \arrow[r, "\Merge"] & \Dist(\Bool^{\otimes n}) \arrow[r, "\anyDoom"] & \Dist(\Bool)
111+
\end{tikzcd}
112+
\caption{Categorical flow: \texttt{doomCoin p} to \texttt{anyDoom} via tensor product.}
113+
\end{figure}
114+
115+
\subsection{Rationale}
116+
\texttt{doomCoin p} is canonical because:
117+
\begin{itemize}
118+
\item \textbf{Intrinsic Probability}: $p$ is syntactic, not an external oracle.
119+
\item \textbf{Bernoulli Base Case}: Models doom as a Boolean.
120+
\item \textbf{Tensorial Independence}: \texttt{Merge} ensures the Independent Channels Lemma.
121+
\item \textbf{Pedagogical Clarity}: Intuitive and memorable syntax.
122+
\end{itemize}
123+
124+
\section{Comparison with Lambda Calculi}
125+
\begin{itemize}
126+
\item \textbf{Lambda Calculus}: Uses external oracles, e.g., $\lambda r.\ \texttt{if } r < p \texttt{ then \#t else \#f}$. No concurrency or intrinsic probability.
127+
\item \textbf{Probabilistic Lambda Calculus}: Supports \texttt{choice(p,e1,e2)}, but lacks tensorial concurrency or geometric scoping.
128+
\item \textbf{SPC}: Unifies probability, concurrency, and geometry via \texttt{Choice}, \texttt{Merge}, and \texttt{Sphere/Pop}.
129+
\end{itemize}
130+
% TODO: Add theorem: SPC subsumes probabilistic λ-calculus via doomCoin p.
131+
132+
\section{Operational Semantics (Appendix)}
133+
% From prior messages, full small-step semantics
134+
\[
135+
\infer[\textsc{E-Beta}]{\Pop(\Sphere(x{:}A.\,t), v) \longrightarrow t[v/x]}{}
136+
\]
137+
\[
138+
\infer[\textsc{E-Choice-1}]{\Choice(p,t,u) \LongRightarrow_p t}{} \quad
139+
\infer[\textsc{E-Choice-2}]{\Choice(p,t,u) \LongRightarrow_{1-p} u}{}
140+
\]
141+
% TODO: Add Rotate, Merge, probability-mass composition, soundness lemma.
142+
143+
\section{Implementation in Haskell}
144+
The Haskell implementation (\texttt{spherepop.hs}) provides type checking and evaluation:
145+
\begin{itemize}
146+
\item \textbf{Type Checking}: Ensures type alignment for \texttt{Merge}, \texttt{Choice}, \texttt{Rotate}.
147+
\item \textbf{Evaluation}: Big-step semantics with distribution monad.
148+
\item \textbf{Observables}: \texttt{anyDoom} computes doom probabilities.
149+
\end{itemize}
150+
% TODO: Include code snippets, GHCI runs.
151+
152+
\section{Racket Evaluator Skeleton}
153+
The Racket skeleton (\texttt{spherepop.rkt}) uses macros to desugar extended constructs into the core:
154+
\begin{itemize}
155+
\item \texttt{Choice\_n}: Nested \texttt{Choice} calls.
156+
\item \texttt{Bind}: Monadic sequencing via \texttt{Sphere/Pop}.
157+
\item \texttt{FoldOr/FoldAnd}: Boolean folds over tensors.
158+
\end{itemize}
159+
% TODO: Show macro definitions, example runs.
160+
161+
\section{Conclusion}
162+
SPC advances lambda calculus by integrating geometric scoping, concurrency, and probability. The \texttt{doomCoin p} construct exemplifies its power, with implementations in Haskell and Racket demonstrating practical utility. Future work includes exploring probabilistic dependent types and applications in AI safety.
163+
% TODO: Add open problems, future directions.
164+
165+
\bibliographystyle{plain}
166+
\bibliography{spherepop}
167+
\end{document}

0 commit comments

Comments
 (0)