Notes
Toy Project Dynamics (Lenses)
Companion notes unpacking the discrete brickwork toy model and the continuous slot-observation lens framing.
A project state records what is needed to determine its possible next steps. The outgoing action set is a useful discrete analogy to tangent directions, not a vector space. A deterministic policy selects an action; iterating the update generates a trajectory. Curing adds a timer to the state. Myers-style lenses separate state, readout and update, so the information shown to an observer is not confused with the full state used by the model.
1) Discrete toy model: cylindrical brickwork as a state-transition system
State space X (finite state set)
Fix:
- N: number of courses (height)
- M: bricks per course (discrete angular positions 0,…, M-1)
A minimal state can be:
x = (c, p, σ, s, κ) where
- c ∈ {0,…,N}: current course index
- p ∈ {0,…,M}: how many bricks in this course have been placed
- σ ∈ {+1,-1}: direction for this course (CW/CCW)
- s ∈ {0,…,M-1}: start-offset for this course
- κ ∈ ℕ: curing cooldown remaining (optional extension)
You can regard the “blueprint filled in” as the exposed variable (a readout)
expose(x), e.g. the set of completed cells in an N × M grid.
“Tangent fiber” TxX in the discrete sense
At each state x, define:
TxX := {admissible next actions}
Example admissible actions:
- place_next_brick if κ = 0 and p < M
- start_next_course(σ, s) if κ = 0 and p = M and c < N
- wait if κ > 0
A deterministic policy is a function selecting a unique action
v(x) ∈ TxX. If you want branching, switch to possibilistic/
stochastic dynamics (Myers explicitly packages those as lenses too).
Lens-shaped system data (Myers / dynamical systems convention)
A deterministic system S is: state set, input set, output set, with update/expose maps. In this toy:
- StateS = set of partial-blueprint states x
- InS = “builder choice” inputs (direction + start offset, or just a policy token)
- OutS = “what you can see”: current blueprint fill-map (or current course progress)
With update and expose maps, this matches the “state + parameter
gives next state; state gives output” interface described in Myers’ deterministic-system
definition.
Pseudocode (minimal)
State = (course c, progress p, dir σ, start s, cooldown κ, placed[N][M])
expose(State):
return placed // the blueprint-as-filled-in (or a compressed summary)
update(State, input):
if κ > 0:
κ := κ - 1
return State
if p < M:
pos := (s + σ*p) mod M
placed[c][pos] := true
p := p + 1
if p == M:
κ := curing_time(c) // optional doping constraint
return State
// p == M and κ == 0:
if c == N-1: return State_done
c := c + 1
(σ, s) := choose_direction_and_start(input, c)
p := 0
return State
2) Spivak vs Myers lens “flip” (and what I’m choosing)
- Spivak: a lens (A/A0) → (B/B0) is (f: A → B, f#: A × B0 → A0).
- Myers: a lens (A-/A+) ⇄ (B-/B+) has passforward f: A+ → B+ and passback f#: A+ × B- → A-.
They’re equivalent up to a systematic swap of what you put on top vs bottom (Spivak even flags this “flip” issue in his slides).
Choice: I’ll use Myers’ orientation here, because it makes expose the passforward map (state → output) and update the passback (state × input → next-state / tangent), matching his system-theory definitions.
3) Continuous toy model: rotation observed through a slot, as a lens + wiring diagram
Physical story (your spec)
- Object moves around a circle.
- Input: initial speed ω, start angle θ0, radius r (relative to viewing platform).
- Output: null in blackout; otherwise the positions and times while crossing the viewing arc.
A clean factorisation (lens-compositional)
It’s conceptually helpful to split into boxes (exactly what wiring diagrams are for; in Spivak’s slides, wiring diagrams induce lenses built from diagonals/projections, and in Myers you re-interface systems by composing with lenses).
Boxes:
- Init: (θ0, ω, r) ↦ s0
- Dynamics: closed differential system evolving s(t)
- Slot sensor: an observation function producing visible coordinates or null
- Observer: post-process stream into entry/exit intervals (events)
This is also where the “open system” intuition sits: you can distinguish closed dynamics, initial conditions and the observer's readout. A genuine open-system extension must specify how time-varying input changes the state.
Formal lens for the dynamics box (Myers style)
Myers remarks that differential systems look like deterministic systems in the cartesian category Euc, except that the right-hand ℝn in the update map is interpreted as a tangent space/vector field.
So we can model the Dynamics box as:
- StateS = ℝ4 with s = (θ, ω, r, τ)
- InS = ℝ0 (closed during the run)
- OutS = ℝ3 with (θ, r, τ)
exposeS(θ, ω, r, τ) = (θ, r, τ)
updateS((θ, ω, r, τ), *) = (ω, 0, 0, 1)
encoding: θ̇ = ω, ω̇ = 0, ṙ = 0, τ̇ = 1.
The observation is null outside the slot, and (x, y, τ) inside, with x = r cos θ and y = r sin θ. No hidden position is included in the null observation. The demo's full circle and faint trail are an omniscient teaching view, not the sensor's output. A hard gate is discontinuous, so it is not a smooth Euc map. Initialisation selects the starting state; it is not a lens that continually resets the dynamics.
4) Working demo: interactive HTML with visuals + analytics
I built a self-contained interactive HTML that:
- animates the brickwork blueprint filling course-by-course (CW/CCW, start-offsets, optional “doping/curing” delays),
- sketches a trajectory tree for the direction choices,
- simulates the rotating point + slot, plots visibility over time, and computes analytic enter/exit intervals from θ(t) = θ0 + ωt mod 2π,
- includes an SVG wiring-diagram sketch and prints the lens-formalism text (Myers orientation).
5) The next dynamical question
Which state distinctions must an interface expose to support valid future choices? A progress picture may hide a curing timer or occupied resource. The constructive experiment computes counterexamples, refines a summary and generates full-completion paths from the resulting dynamics.
Open-system composition requires explicit readout and update maps and a clear clock. A summary sufficient after one wiring may fail after resources change. That is a testable dynamics question, not a claim that category-theory vocabulary supplies physical laws.