Documentation

Linglib.Core.Context.Tower

Context Tower #

@cite{abusch-1997} @cite{anand-nevins-2004} @cite{cumming-2026} @cite{schlenker-2003}

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 #

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.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      structure Core.Context.ContextShift (C : Type u_1) :
      Type u_1

      A single context shift: a function transforming a context, tagged with its linguistic source.

      • apply : CC

        The context transformation

      • label : ShiftLabel

        What kind of linguistic operation introduced this shift

      Instances For
        structure Core.Context.ContextTower (C : Type u_1) :
        Type u_1

        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).

          Equations
          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
            Instances For

              The innermost (most deeply embedded) context: fold all shifts over origin.

              Equations
              Instances For

                Trivial tower with no shifts.

                Equations
                Instances For

                  Push a new shift onto the tower (embed one level deeper).

                  Equations
                  Instances For
                    @[simp]
                    theorem Core.Context.ContextTower.root_origin {C : Type u_1} (c : C) :
                    (root c).origin = c
                    @[simp]

                    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.

                    @[simp]
                    @[simp]
                    theorem Core.Context.ContextTower.root_depth {C : Type u_1} (c : C) :
                    (root c).depth = 0
                    @[simp]
                    theorem Core.Context.ContextTower.push_depth {C : Type u_1} (t : ContextTower C) (σ : ContextShift C) :
                    (t.push σ).depth = t.depth + 1
                    @[simp]
                    theorem Core.Context.ContextTower.root_contextAt {C : Type u_1} (c : C) (k : ) :
                    (root c).contextAt k = c
                    @[simp]

                    Pushing a shift updates the innermost context.

                    Which depth to read from in a tower.

                    • .origin: always read from depth 0 (speech-act context)
                    • .local: always read from the innermost context
                    • .relative k: read from depth k
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Resolve to a concrete depth index given the tower depth.

                        Equations
                        Instances For
                          structure Core.Context.AccessPattern (C : Type u_1) (R : Type u_2) :
                          Type (max u_1 u_2)

                          An access pattern: a depth specification plus a projection from context to value.

                          This is how context-dependent expressions specify what they read:

                          • depth says which tower layer to read from
                          • project says which coordinate to extract

                          English "I" = ⟨.origin, KContext.agent⟩ Amharic "I" = ⟨.local, KContext.agent⟩ English "now" = ⟨.origin, KContext.time⟩

                          • depth : DepthSpec

                            Which depth to read from

                          • project : CR

                            Which coordinate to extract

                          Instances For
                            def Core.Context.AccessPattern.resolve {C : Type u_1} {R : Type u_2} (ap : AccessPattern C R) (t : ContextTower C) :
                            R

                            Resolve an access pattern against a tower.

                            Equations
                            Instances For
                              def Core.Context.AccessPattern.map {C : Type u_1} {R : Type u_2} {S : Type u_3} (ap : AccessPattern C R) (f : RS) :

                              Map a function over the projected result.

                              Equations
                              Instances For
                                theorem Core.Context.AccessPattern.origin_stable {C : Type u_1} {R : Type u_2} (ap : AccessPattern C R) (hd : ap.depth = DepthSpec.origin) (t : ContextTower C) (σ : ContextShift C) :
                                ap.resolve (t.push σ) = ap.resolve t

                                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.

                                theorem Core.Context.AccessPattern.local_updates {C : Type u_1} {R : Type u_2} (ap : AccessPattern C R) (hd : ap.depth = DepthSpec.local) (t : ContextTower C) (σ : ContextShift C) :
                                ap.resolve (t.push σ) = ap.project (σ.apply t.innermost)

                                Local access updates with push: the innermost projection tracks the new shift.

                                theorem Core.Context.AccessPattern.root_origin_eq_local {C : Type u_1} {R : Type u_2} (ap₁ ap₂ : AccessPattern C R) (h₁ : ap₁.depth = DepthSpec.origin) (h₂ : ap₂.depth = DepthSpec.local) (hProj : ap₁.project = ap₂.project) (c : C) :

                                In a root tower, origin and local access agree.