Context Tower #
[Abu97] [AN04b] [Cum26] [Sch03]
A depth-indexed stack of context shifts unifying the codebase's context-manipulation mechanisms: Kaplanian indexicals (origin access), shifted indexicals (local access), De Bruijn temporal indexing (depth-relative access), situation introduction (mood), and domain expansion (branching time).
The tower is parametric over any context type C. KContext serves as the canonical
instantiation — it represents what a single context layer looks like. The tower wraps
it with a stack of shifts.
Key Operations #
.origin— the root context (speech-act context, Kaplan's c*).innermost— the most deeply embedded context (fold all shifts over origin).contextAt k— the context at depth k (fold first k shifts).push σ— embed deeper by adding a new shift.root c— trivial tower (no shifts, depth 0)
How FA Composes with Towers #
FA takes two meanings (function and argument). Both are parameterized by the same
tower. FA applies the function to the argument at that tower. The tower is threaded
as a reader parameter — ContextTower C →... is the enriched meaning type.
Classification of context shifts by their linguistic source.
- attitude : ShiftLabel
- temporal : ShiftLabel
- evidential : ShiftLabel
- mood : ShiftLabel
- perspective : ShiftLabel
- quotation : ShiftLabel
- clauseChain : ShiftLabel
- roleShift : ShiftLabel
- generic : ShiftLabel
Instances For
Equations
- Semantics.Context.instDecidableEqShiftLabel x✝ y✝ = if h : x✝.ctorIdx = y✝.ctorIdx then isTrue ⋯ else isFalse ⋯
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
A single context shift: a function transforming a context, tagged with its linguistic source.
- apply : C → C
The context transformation
- label : ShiftLabel
What kind of linguistic operation introduced this shift
Instances For
A context tower: an origin context with a stack of shifts.
The origin is the speech-act context (Kaplan's c*). Each shift corresponds to an embedding operator (attitude verb, temporal shift, mood operator). Contexts at each depth are computed by folding shifts over the origin — the path condition holds by construction.
- origin : C
The root context (speech-act context)
- shifts : List (ContextShift C)
Shifts from outermost to innermost.
shifts[0]is the first embedding (e.g., the matrix attitude verb); the last element is the deepest.
Instances For
Embedding depth (number of shifts).
Instances For
The context at depth k, computed by folding the first k shifts over
the origin. Saturates at tower depth: contextAt k for k ≥ depth
returns the innermost context.
Equations
- t.contextAt k = List.foldl (fun (c : C) (σ : Semantics.Context.ContextShift C) => σ.apply c) t.origin (List.take k t.shifts)
Instances For
The innermost (most deeply embedded) context: fold all shifts over origin.
Equations
- t.innermost = List.foldl (fun (c : C) (σ : Semantics.Context.ContextShift C) => σ.apply c) t.origin t.shifts
Instances For
Trivial tower with no shifts.
Equations
- Semantics.Context.ContextTower.root c = { origin := c, shifts := [] }
Instances For
Push a new shift onto the tower (embed one level deeper).
Instances For
Past the tower depth, contextAt saturates at the innermost context.
This is because List.take k on a list shorter than k returns the
whole list.
Pushing a shift updates the innermost context.
Equations
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.origin Semantics.Context.DepthSpec.origin = isTrue ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.origin Semantics.Context.DepthSpec.local = isFalse Semantics.Context.instDecidableEqDepthSpec.decEq._proof_1
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.origin (Semantics.Context.DepthSpec.relative k) = isFalse ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.local Semantics.Context.DepthSpec.origin = isFalse Semantics.Context.instDecidableEqDepthSpec.decEq._proof_3
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.local Semantics.Context.DepthSpec.local = isTrue ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq Semantics.Context.DepthSpec.local (Semantics.Context.DepthSpec.relative k) = isFalse ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq (Semantics.Context.DepthSpec.relative k) Semantics.Context.DepthSpec.origin = isFalse ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq (Semantics.Context.DepthSpec.relative k) Semantics.Context.DepthSpec.local = isFalse ⋯
- Semantics.Context.instDecidableEqDepthSpec.decEq (Semantics.Context.DepthSpec.relative a) (Semantics.Context.DepthSpec.relative b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Semantics.Context.instReprDepthSpec = { reprPrec := Semantics.Context.instReprDepthSpec.repr }
Equations
Resolve to a concrete depth index given the tower depth.
Equations
- Semantics.Context.DepthSpec.origin.resolve towerDepth = 0
- Semantics.Context.DepthSpec.local.resolve towerDepth = towerDepth
- (Semantics.Context.DepthSpec.relative a).resolve towerDepth = a
Instances For
An access pattern: a depth specification plus a projection from context to value.
This is how context-dependent expressions specify what they read:
English "I" = ⟨.origin, KContext.agent⟩
Amharic "I" = ⟨.local, KContext.agent⟩
English "now" = ⟨.origin, KContext.time⟩
- depth : DepthSpec
Which depth to read from
- project : C → R
Which coordinate to extract
Instances For
Resolve an access pattern against a tower.
Instances For
Map a function over the projected result.
Instances For
Origin access is invariant under push. This is the formal content of Kaplan's thesis: expressions reading from the speech-act context are unaffected by embedding operators.
Local access updates with push: the innermost projection tracks the new shift.
An access pattern is stable under a shift when pushing that shift onto any
tower leaves its resolution unchanged. This relation underlies both
Kaplan-compliance (Reference/Kaplan.lean: an expression stable under
every shift) and monsterhood (Reference/Monsters.lean: a shift that
destabilizes some expression) — the two are its ∀-over-shifts and
∃-over-expressions projections.
Equations
- ap.Stable σ = ∀ (t : Semantics.Context.ContextTower C), ap.resolve (t.push σ) = ap.resolve t
Instances For
Origin-depth access is stable under every shift — the access-pattern form
of origin_stable, and the sufficient condition for Kaplan-compliance.
The canonical innermost reader: returns the innermost context verbatim
(.local depth, identity projection). It is the universal witness for
instability — a shift destabilizes some access pattern iff it destabilizes
this one, because a push only ever changes the innermost context — so
monsterhood is defined as its instability (Reference/Monsters.lean).
Equations
- Semantics.Context.AccessPattern.innermostReader C = { depth := Semantics.Context.DepthSpec.local, project := id }
Instances For
Bridge to the substrate's Intension framework: an AccessPattern
IS an Intension (ContextTower C) R via its resolve method. The
substrate's Intension-based machinery (Intensional.Intension.IsRigid,
IsRigidOn, the functoriality lemmas in
Semantics/Intensional/Rigidity.lean) thereby applies to access
patterns. The push-invariance of origin-depth access (origin_stable
above) is the access-pattern analog of the substrate's IsRigidOn
on tower-shift orbits.
Equations
- ap.toIntension = ap.resolve
Instances For
In a root tower, origin and local access agree.