Mathematical Foundations

Appendix K

17 min read

Appendix K: Mathematical Foundations

This appendix does not prove new theorems. It identifies exactly which theorems from model theory, sheaf theory, and type theory underpin the Third Mode's guarantees—and states what each guarantee does not promise.

The discipline is new. The mathematics is not.

The Borrowed Machinery

Every formal result invoked in The Proofs is a known theorem, often with proofs dating to the mid-twentieth century:

GuaranteeUnderlying TheoremCanonical Source
Safe vocabulary extensionConservative extensionShoenfield, Mathematical Logic (1967), §4.6
Local-to-global coherenceSheaf gluing conditionMac Lane & Moerdijk, Sheaves in Geometry and Logic (1992), Ch. II
Substitution under equivalenceTransport along pathsHoTT Book (2013), §2.3
Verification cost scalingCover refinementStandard; see Bott & Tu (1982) for analogous arguments

The mathematical infrastructure exists. The engineering object does not.

What the Third Mode contributes is not a theorem but an architecture: a specification of exactly which verification steps must occur, exactly what artifacts must be emitted, and exactly how failures must be reported. Existing systems produce silence or exceptions where this architecture produces witnesses, receipts, and obstruction records.


What This Appendix Provides

For each load-bearing result, we state:

  1. The theorem — What the mathematics guarantees
  2. The operational consequence — What this means for system behavior
  3. The failure mode — What would constitute a violation
  4. The anchor — Where the main text invokes this machinery

For readers who want full proofs, the canonical sources are cited. For readers who want to understand how the proofs translate to system design, the operational consequences are the payload.


K.1 Conservative Extension Safety

Informal claim: Adding a new predicate to the vocabulary does not change the truth of existing statements.

Theorem(Conservative Extension)

Let (Σ,I,L)(\Sigma, I, L) be a theory (signature Σ\Sigma, constraints II, logic LL). Let Σ=Σ{q}\Sigma' = \Sigma \cup \{q\} be an extension adding predicate qq with constraints III' \supseteq I.

The extension is conservative over (Σ,I,L)(\Sigma, I, L) iff for every Σ\Sigma-sentence φ\varphi:

(Σ,I,L)φ(Σ,I,L)φ(\Sigma', I', L) \vdash \varphi \quad \Longleftrightarrow \quad (\Sigma, I, L) \vdash \varphi

That is: the new predicate does not create new theorems in the old language.

Proof

Proof sketch (model-theoretic):

  1. Let M(Σ,I)M \models (\Sigma, I) be a model of the original theory.

  2. Extension: We must show MM extends to M(Σ,I)M' \models (\Sigma', I'). Since qq is new (not in Σ\Sigma), we can interpret qMq^{M'} as any subset of the appropriate product of domains that satisfies the new constraints III' \setminus I. If such an interpretation exists, MM extends.

  3. Conservativity: Suppose (Σ,I,L)φ(\Sigma', I', L) \vdash \varphi for a Σ\Sigma-sentence φ\varphi. By completeness (for the relevant logic), φ\varphi holds in all models of (Σ,I)(\Sigma', I'). In particular, it holds in all extensions of models of (Σ,I)(\Sigma, I). Since φ\varphi is a Σ\Sigma-sentence, its truth depends only on the Σ\Sigma-reduct. Therefore φ\varphi holds in all models of (Σ,I)(\Sigma, I). By completeness, (Σ,I,L)φ(\Sigma, I, L) \vdash \varphi.

  4. The converse is immediate: if (Σ,I,L)φ(\Sigma, I, L) \vdash \varphi, then every model of (Σ,I)(\Sigma', I') is an extension of some model of (Σ,I)(\Sigma, I), so φ\varphi holds.

Failure mode: The extension fails to be conservative if the new constraints III' \setminus I entail Σ\Sigma-sentences not provable from II alone. Example: adding qq with constraint q(x)p(x)q(x) \to p(x) where pp is an existing predicate creates a conservative extension. Adding qq with constraint x.q(x)\forall x. q(x) and q(x)p(x)q(x) \to p(x) forces x.p(x)\forall x. p(x), which is non-conservative if x.p(x)\forall x. p(x) was not previously provable.

Operational consequence: When the Third Mode accepts a new predicate (A17/A29), it must verify that the extension is conservative. If verification fails, the predicate is rejected with a counterexample: a model of (Σ,I)(\Sigma, I) that cannot extend to a model of (Σ,I)(\Sigma', I') while preserving existing truths.

Anchor: A17b (Conservative Extension). This theorem and its proof are developed in full in Chapter 16.


K.1.1 Verification Strategies

Conservative extension is a semantic property. In general, checking it is undecidable. In practice, we deploy a hierarchy of verification strategies, each with known tradeoffs.

Modes

ModeCompletenessSoundnessArtifactsWhen to Use
Syntactic checkIncompleteSoundParse treeFast gate: reject obviously non-conservative extensions (e.g., constraint mentions Σ\Sigma-predicates with universal quantifiers)
SAT/SMTComplete for decidable fragmentsSoundUnsat core or countermodelDefault for propositional or linear arithmetic constraints
Model-theoretic samplingIncompleteUnsound (heuristic)Candidate countermodelsExploratory: find likely failures before expensive proofs
Proof assistantCompleteSoundFormal proof objectHigh-assurance: when the predicate will be load-bearing

Artifacts

A verification attempt produces one of:

  • ConservativityProof: A formal proof object (possibly machine-checked) establishing the extension is conservative.
  • Countermodel: A model M(Σ,I)M \models (\Sigma, I) and a Σ\Sigma-sentence φ\varphi such that (Σ,I)φ(\Sigma', I') \vdash \varphi but M⊭φM \not\models \varphi. This is a concrete witness of non-conservativity.
  • UnsatCore: The minimal subset of II' that, together with II, entails the problematic Σ\Sigma-sentence. Used for diagnosis and predicate revision.
  • Timeout: The verification budget was exhausted. The system treats this as "unknown" and may escalate to a higher mode or reject the predicate pending manual review.

Complexity and Limits

For fragments commonly used in data integration:

FragmentConservativity CheckComplexity
PropositionalDecidableNP-complete (reduces to SAT)
Equality constraintsDecidablePolynomial with union-find
Linear arithmetic (QF_LRA)DecidablePolynomial (linear programming)
Full first-orderUndecidableSemi-decidable (may not terminate)
Higher-order / dependent typesUndecidableRequires proof assistant

The Coherence Budget Forces Approximation

Real systems operate under time and resource constraints. The coherence budget (A21) specifies how much verification effort is permitted per operation. When the budget is tight:

  1. Approximate gates replace exact checks. A syntactic check may clear a predicate that a full SAT check would reject.
  2. Deferred verification queues expensive checks for batch processing. The predicate is admitted provisionally (lifecycle state: provisional) pending full verification.
  3. Risk-tiered modes apply stronger verification to predicates with wider scope or higher stakes (e.g., predicates used in financial reconciliation get proof-assistant level; catalog metadata gets SAT/SMT).

The system does not pretend these tradeoffs don't exist. Every verification attempt records the mode used, the budget consumed, and the confidence level of the result. An approximate clearance is not a guarantee—it is a bet, explicitly priced.


K.2 Gluing Correctness

Informal claim: If local claims agree on overlaps, the sheaf condition guarantees a unique global claim.

Theorem(Gluing Correctness)

Let F:CtxopSetF : \mathbf{Ctx}^{\mathrm{op}} \to \mathbf{Set} be a sheaf on the context site (Ctx,J)(\mathbf{Ctx}, J). Let {UiU}\{U_i \to U\} be a cover of UU.

If sections siF(Ui)s_i \in F(U_i) satisfy the matching condition:

siUi×UUj=sjUi×UUji,js_i|_{U_i \times_U U_j} = s_j|_{U_i \times_U U_j} \quad \forall i, j

then there exists a unique sF(U)s \in F(U) such that sUi=sis|_{U_i} = s_i for all ii.

Proof

Proof sketch (equalizer diagram):

  1. The sheaf condition states that F(U)F(U) is the equalizer of:

    iF(Ui)ρ2ρ1i,jF(Ui×UUj)\prod_i F(U_i) \xrightarrow[\rho_2]{\rho_1} \prod_{i,j} F(U_i \times_U U_j)

    where ρ1\rho_1 restricts the ii-th component to Ui×UUjU_i \times_U U_j, and ρ2\rho_2 restricts the jj-th component.

  2. A family (si)iF(Ui)(s_i) \in \prod_i F(U_i) is in the equalizer iff ρ1(si)=ρ2(si)\rho_1(s_i) = \rho_2(s_i), i.e., siUi×UUj=sjUi×UUjs_i|_{U_i \times_U U_j} = s_j|_{U_i \times_U U_j} for all i,ji, j.

  3. Existence: The matching condition says (si)(s_i) is in the equalizer. Therefore there exists sF(U)s \in F(U) that maps to (si)(s_i) under restriction.

  4. Uniqueness: The equalizer is a limit; the map F(U)iF(Ui)F(U) \to \prod_i F(U_i) is injective (this is the locality condition). Therefore ss is unique.

Failure mode: If the matching condition fails (some siUi×UUjsjUi×UUjs_i|_{U_i \times_U U_j} \neq s_j|_{U_i \times_U U_j}), the family is not in the equalizer, and no global section exists. The failure is localized to the specific overlap(s) where disagreement occurs.

Operational consequence: The glue operation (Appendix I) checks the matching condition. If satisfied, it returns the unique global claim. If not, it returns an ObstructionWitness identifying the disagreeing contexts and the specific claims that conflict.

Anchor: A13 (Sheaf Condition). This theorem and its proof are developed in full in Chapter 11.


K.3 Scoped Transport Safety

Informal claim: Transporting a property along a witnessed equivalence preserves truth within the declared scope.

Theorem(Scoped Transport Safety)

Let e:ASBe : A \simeq_S B be a witnessed equivalence with scope SS. Let P:EntityPropP : \mathbf{Entity} \to \mathbf{Prop} be a transportable property. Let USU \in S be a context in the equivalence's scope.

If P(A)P(A) holds in context UU, and transport is well-defined for PP along ee, then transporte(P)(B)\mathrm{transport}_e(P)(B) holds in context UU.

Conversely, if USU \notin S (context outside scope), transport is undefined and the operation fails with a ScopeViolation.

Proof

Proof sketch:

  1. Within scope: By definition of witnessed equivalence, ee provides a certificate that AA and BB are interchangeable for all transportable properties in contexts within SS. The transport map transporte:P(A)P(B)\mathrm{transport}_e : P(A) \to P(B) is part of the equivalence structure. If P(A)P(A) holds (has a proof/witness), then transporte\mathrm{transport}_e carries that witness to a witness of P(B)P(B).

  2. Preservation of truth: The transport is functorial: it preserves the structure of the proof. If P(A)P(A) was witnessed by π\pi, then P(B)P(B) is witnessed by transporte(π)\mathrm{transport}_e(\pi).

  3. Outside scope: The equivalence certificate is only valid in SS. If USU \notin S, the system has no warrant that AA and BB are interchangeable in UU. The transport operation checks USU \in S as a precondition. Failure produces a ScopeViolation artifact.

Failure mode: Attempting to use an equivalence outside its scope is a type error. The equivalence NYCpostalNew York City\texttt{NYC} \simeq_{\text{postal}} \texttt{New York City} does not justify substitution in a real estate context, even if both terms denote entities.

Operational consequence: The transport operation (Appendix I) enforces scope checking. Every successful transport produces a TransportReceipt that binds the original claim, the transported claim, and the certificate. The receipt is auditable: any consumer can verify that the transport was within scope.

Anchor: A10 (Witnessed Sameness), A16 (Transport Discipline), A30 (Scoped Equivalence). This theorem and its proof are developed in full in Chapter 14.


K.4 Coherence Budget Monotonicity

Informal claim: Checking coherence over a larger cover costs at least as much as checking over a smaller cover.

Theorem(Coherence Budget Monotonicity)

Let C={UiU}\mathcal{C} = \{U_i \to U\} be a cover of UU, and let C={UjU}\mathcal{C}' = \{U'_j \to U\} be a refinement of C\mathcal{C} (every UjU'_j factors through some UiU_i).

Let Cost(C)\mathrm{Cost}(\mathcal{C}) be the cost of verifying the matching condition over cover C\mathcal{C}. Then:

Cost(C)Cost(C)\mathrm{Cost}(\mathcal{C}') \geq \mathrm{Cost}(\mathcal{C})

Equality holds only if C\mathcal{C}' introduces no new overlaps.

Proof

Proof sketch:

  1. The cost of checking the matching condition is dominated by the number of pairwise overlap checks.

  2. For cover C\mathcal{C} with nn components, the number of overlaps is O(n2)O(n^2) in the worst case.

  3. A refinement C\mathcal{C}' with mnm \geq n components has O(m2)O(m^2) overlaps.

  4. Each overlap check has cost 1\geq 1 (at minimum, comparing values). Therefore Cost(C)Cost(C)\mathrm{Cost}(\mathcal{C}') \geq \mathrm{Cost}(\mathcal{C}).

  5. Equality case: If C\mathcal{C}' refines C\mathcal{C} by splitting components that have no overlaps with each other, no new overlap checks are introduced. But typically, refinement increases overlap complexity.

Operational consequence: There is no free lunch in coherence. Finer-grained verification (more contexts, more overlaps) costs more. The coherence budget (A21) must account for this: systems that demand higher coherence guarantees must pay with higher verification costs.

Anchor: A21 (Coherence Cost Model). This theorem and its proof are developed in full in Chapter 19.


K.5 What These Results Guarantee

Together, these four results provide the formal backbone of the Third Mode's promises:

ResultGuarantee
Conservative Extension SafetyNew predicates don't corrupt existing knowledge
Gluing CorrectnessLocal agreement implies unique global truth
Scoped Transport SafetyEquivalences are safely bounded
Coherence Budget MonotonicityVerification cost is predictable

What they do NOT guarantee:

  • Completeness: The Third Mode does not guarantee that every true statement can be proved. It guarantees that accepted statements are coherent with existing commitments.

  • Decidability: Checking the matching condition may be undecidable for some presheaves. The Third Mode specifies what must be checked, not that checking is always tractable.

  • Convergence: Multiple agents proposing predicates may not converge to a shared vocabulary. The Third Mode provides discipline, not consensus.


K.6 Formal Dependencies

The results depend on the following formal machinery:

ResultDependencies
Conservative ExtensionModel theory, completeness for the ambient logic
Gluing CorrectnessSheaf theory, equalizer definition
Scoped Transport SafetyEquivalence structure, transport maps
Coherence Budget MonotonicityCover refinement, overlap counting

For full proofs, consult:

  • Shoenfield (1967) for conservativity in classical logic
  • Mac Lane & Moerdijk (1992) for sheaf theory
  • HoTT Book (2013) for transport along equivalences
  • Grothendieck (SGA4) for site theory

The Third Mode's contribution is not inventing these results but applying them operationally: specifying the artifacts, failure modes, and audit trails that make the guarantees enforceable in software.


K.7 Formal Mini-Spine: The Obstruction Localization Theorem

This section gives one result with full rigor: complete definitions, a precise theorem statement, and a proof. The goal is to demonstrate that the claim "gluing failures are localized and structured" is not metaphor but mathematics.

K.7.1 Definitions

Context Category

A context category Ctx\mathbf{Ctx} is a category where:

  • Objects are contexts U,V,W,U, V, W, \ldots—each representing a view with a signature (vocabulary), constraints, and absence policy.
  • Morphisms f:UVf : U \to V are refinements: UU is a more specific context than VV (e.g., "FDA regulatory view" refines "US legal view").
  • Composition is associative; identities exist.
Grothendieck Topology

A Grothendieck topology JJ on Ctx\mathbf{Ctx} assigns to each object UU a collection J(U)J(U) of covering sieves. A sieve SS on UU is a subfunctor of Hom(,U)\mathrm{Hom}(-, U); it is covering if it is in J(U)J(U).

For our purposes, we use the simpler notion of a covering family: a collection {fi:UiU}iI\{f_i : U_i \to U\}_{i \in I} such that the sieve it generates is in J(U)J(U).

The pair (Ctx,J)(\mathbf{Ctx}, J) is a site.

Presheaf

A presheaf on (Ctx,J)(\mathbf{Ctx}, J) is a contravariant functor F:CtxopSetF : \mathbf{Ctx}^{\mathrm{op}} \to \mathbf{Set}.

  • For each context UU, F(U)F(U) is the set of local sections (claims that hold in UU).
  • For each morphism f:UVf : U \to V, F(f):F(V)F(U)F(f) : F(V) \to F(U) is the restriction map (how a claim in VV appears when viewed from the more specific context UU).
Matching Family

Let {fi:UiU}iI\{f_i : U_i \to U\}_{i \in I} be a covering family of UU. A matching family for a presheaf FF is a collection of sections {siF(Ui)}iI\{s_i \in F(U_i)\}_{i \in I} such that for all i,jIi, j \in I:

siUi×UUj=sjUi×UUjs_i|_{U_i \times_U U_j} = s_j|_{U_i \times_U U_j}

where Ui×UUjU_i \times_U U_j is the pullback (the "overlap" context where both UiU_i and UjU_j apply).

Sheaf

A presheaf FF is a sheaf if for every covering family {UiU}\{U_i \to U\} and every matching family {si}\{s_i\}, there exists a unique section sF(U)s \in F(U) such that sUi=sis|_{U_i} = s_i for all ii.

The unique ss is called the gluing of the family {si}\{s_i\}.

Obstruction

If {si}\{s_i\} is not a matching family (some siUi×UUjsjUi×UUjs_i|_{U_i \times_U U_j} \neq s_j|_{U_i \times_U U_j}), we say there is an obstruction to gluing. Define:

Obs({si}):={(i,j)siUi×UUjsjUi×UUj}\mathrm{Obs}(\{s_i\}) := \{(i, j) \mid s_i|_{U_i \times_U U_j} \neq s_j|_{U_i \times_U U_j}\}

This is the set of disagreeing pairs.

K.7.2 Theorem Statement

Theorem(Obstruction Localization)

Let FF be a presheaf on a site (Ctx,J)(\mathbf{Ctx}, J). Let {UiU}iI\{U_i \to U\}_{i \in I} be a covering family and {siF(Ui)}iI\{s_i \in F(U_i)\}_{i \in I} a collection of local sections.

Either:

  1. {si}\{s_i\} is a matching family, in which case there exists at most one sF(U)s \in F(U) with sUi=sis|_{U_i} = s_i for all ii, or

  2. {si}\{s_i\} is not a matching family, in which case Obs({si})\mathrm{Obs}(\{s_i\}) \neq \emptyset, and this set exactly identifies the pairs (i,j)(i, j) where the obstruction occurs.

Moreover, if FF is a sheaf, case (1) guarantees existence and uniqueness of the gluing.

K.7.3 Proof

Proof

We prove each part.

Part 1: Matching implies at-most-one gluing.

Suppose {si}\{s_i\} is a matching family and s,sF(U)s, s' \in F(U) both satisfy sUi=sis|_{U_i} = s_i and sUi=sis'|_{U_i} = s_i for all ii.

Consider the equalizer diagram:

F(U)eiIF(Ui)ρ2ρ1i,jIF(Ui×UUj)F(U) \xrightarrow{e} \prod_{i \in I} F(U_i) \xrightarrow[\rho_2]{\rho_1} \prod_{i,j \in I} F(U_i \times_U U_j)

where e(s)=(sUi)iIe(s) = (s|_{U_i})_{i \in I}, and ρ1,ρ2\rho_1, \rho_2 are the restriction maps to overlaps.

By assumption, e(s)=e(s)=(si)iIe(s) = e(s') = (s_i)_{i \in I}.

The map ee is injective for separated presheaves (and hence for sheaves). This separation property is precisely what distinguishes separated presheaves from arbitrary presheaves; for a sheaf, it holds by definition. Since we are proving uniqueness for sheaves, separation applies, and therefore s=ss = s'.

Part 2: Non-matching implies nonempty obstruction set.

Suppose {si}\{s_i\} is not a matching family. Then by definition, there exist i,ji, j such that siUi×UUjsjUi×UUjs_i|_{U_i \times_U U_j} \neq s_j|_{U_i \times_U U_j}. Hence (i,j)Obs({si})(i, j) \in \mathrm{Obs}(\{s_i\}), so Obs({si})\mathrm{Obs}(\{s_i\}) \neq \emptyset.

Part 3: Obstruction set exactly identifies disagreements.

By construction, (i,j)Obs({si})(i, j) \in \mathrm{Obs}(\{s_i\}) if and only if siUi×UUjsjUi×UUjs_i|_{U_i \times_U U_j} \neq s_j|_{U_i \times_U U_j}. The set contains no spurious pairs and omits no actual disagreements.

Part 4: Sheaf implies existence.

If FF is a sheaf and {si}\{s_i\} is a matching family, the sheaf condition guarantees existence of sF(U)s \in F(U) with sUi=sis|_{U_i} = s_i. Combined with Part 1, the gluing is unique.

K.7.4 Operational Consequence

The Obstruction Localization Theorem justifies the ObstructionWitness artifact:

ObstructionWitness {
  cover: [U_i],
  local_sections: {U_i: s_i},
  disagreeing_pairs: Obs({s_i}),
  specific_conflicts: [(i, j, s_i|_{overlap}, s_j|_{overlap})]
}

When a gluing attempt fails, the system does not return a generic "conflict" error. It returns a structured object that names:

  • Which contexts were involved
  • What claims each context made
  • Which pairs disagreed
  • What the disagreeing values were

This is not a design choice but what the mathematics requires: the obstruction is localized to specific overlaps, and the disagreement is a computable predicate.

This theorem is why the Third Mode can promise auditable failure. The failure is not "something went wrong." It is "contexts UiU_i and UjU_j disagree on the overlap Ui×UUjU_i \times_U U_j, with these specific values."

The Obstruction Localization theorem and its full proof are also developed in Chapter 11.

← Back to AppendicesBack to The Proofs →