Appendix B: Master List of Definitions & Theorems - Chapter 1
This appendix serves as a centralized, rigorous catalog of the foundational mathematical postulates, definitions, axioms, lemmas, and theorems introduced in Chapter 1 of the Quantum Braid Dynamics (QBD) monograph.
1.1.5 Axiom of Choice
If the debate over the parallel postulate marked the birth of a new view on axioms, the controversy surrounding the Axiom of Choice represents its full maturation. Here, the justification for adopting a foundational principle is almost entirely divorced from physical intuition or self-evidence, resting instead on the internal coherence and sheer utility of the mathematical system it enables.
Introducing the Axiom of Choice
First formulated by Ernst Zermelo in 1904, the Axiom of Choice states that for any collection of non-empty sets, there exists a function (a "choice function") that selects exactly one element from each set. For a finite collection, this is provable from more basic axioms. The power and controversy of AC arise when dealing with infinite collections. Bertrand Russell's famous analogy clarifies its nature:
- Given an infinite collection of pairs of shoes, one can define a choice function ("for each pair, choose the left shoe").
- But for an infinite collection of pairs of socks, where the two members of a pair are indistinguishable, no such defining rule exists.
AC asserts that a choice function nevertheless exists, even if it cannot be constructed or explicitly defined.
Controversy and Counterintuitive Consequences
This non-constructive character is the primary source of objection to AC, particularly from mathematicians of the constructivist and intuitionist schools, for whom "to exist" means "to be constructible". The axiom's acceptance leads to a number of deeply counterintuitive results that challenge physical understanding. The most famous of these is the Banach-Tarski paradox, which demonstrates that a solid sphere can be decomposed into a finite number of non-overlapping pieces, which can then be reassembled by rigid motions to form two solid spheres, each identical in size to the original. This result appears to violate the conservation of volume, but the paradox is resolved by noting that the "pieces" involved are so complex that they are non-measurable, as they cannot be assigned a well-defined volume.
Justification through Systemic Utility and Equivalence
Despite these paradoxes, the Axiom of Choice is a standard and indispensable component of modern mathematics, forming the C in ZFC (Zermelo-Fraenkel set theory with Choice), the most common foundation for the field. Its justification is almost entirely pragmatic, stemming from its immense power and the elegance of the theories it facilitates. Within the context of the other ZF axioms, AC is logically equivalent to several other powerful and widely used principles, most notably:
- Zorn's Lemma: This principle states that a partially ordered set in which every chain (totally ordered subset) has an upper bound must contain at least one maximal element.
- The Well-Ordering Principle: This principle asserts that any set can be "well-ordered," meaning its elements can be arranged in an order such that every non-empty subset has a least element. These equivalent forms, particularly Zorn's Lemma, are essential tools in numerous branches of mathematics. Their use is critical in proving fundamental theorems such as:
- Every vector space has a basis.
- Every commutative ring with a unit element contains a maximal ideal (Krull's Theorem).
- The product of any collection of compact topological spaces is compact (Tychonoff's Theorem).
The mathematical community has largely accepted AC because rejecting it would mean abandoning these and countless other foundational results, effectively crippling vast areas of modern algebra, analysis, and topology. The justification is not its intuitive plausibility, but its mathematical fertility. The matter was settled formally when Kurt Gödel (1938) and Paul Cohen (1963) proved that AC is independent of the other axioms of ZF set theory; it can be neither proved nor disproved from them. Its inclusion is a genuine choice, and that choice has been made in favor of systemic power over intuitive comfort.
In Plain English:
Section 1.1.5 formalizes the properties of the QBD axiom regarding axiom of choice.
1.1.6 Principle: Coherentist Justification
The historical evolution of axiomatic justification, epitomized by the independence of Euclid's parallel postulate and the pragmatic acceptance of the Axiom of Choice, demonstrates that when foundational postulates cannot be syntactically derived or intuitively verified as "self-evident," their legitimacy rests upon Coherentist Justification. Rather than seeking validation from an impossible chain of antecedent proofs, the axiomatic basis of a formal deductive system is justified holistically by the emergent properties of the global structure it generates.
The adoption of an Axiomatic Basis is governed exclusively by the satisfaction of four Coherence Criteria:
- Consistency: The absence of a derivation of contradiction from the axiomatic basis, expressed by .
- Independence: The minimality of the basis, such that for every , , ensuring no redundant assumptions are codified as axioms.
- Parsimony: The minimization of the cardinality and structural complexity of postulates relative to the explanatory scope of the system (Occam's razor).
- Fertility (Systemic Utility): The capacity of to generate a rich, non-trivial body of theorems () that unifies disparate structures, resolves foundational paradoxes, and, in the construction of a physical theory, maps isomorphically to observable phenomena.
Holistic Support vs. Linear Circularity
Coherentist justification replaces the classical foundationalist model, which envisions knowledge as a hierarchical tower resting upon "self-evident" bedrock, with a relational model (analogous to Otto Neurath's ship), wherein foundational postulates and derived theorems exist in a web of mutual support.
Crucially, this mode of justification does not commit the fallacy of circular reasoning (petitio principii). A circular argument operates linearly (), providing no new explanatory content. Coherentist validation operates non-linearly: the axiomatic basis is not proved by its consequences, but rather justified by the global stability, parsimony, and mathematical and empirical fertility of the complete deductive edifice.
| Dimension | Foundationalist View (Classical) | Coherentist View (Formalist / Constructive) |
|---|---|---|
| Nature of Axioms | Self-evident truths; direct descriptions of an absolute, pre-existing reality. | Foundational assumptions; formal rules defining a generative system. |
| Source of Justification | Direct intuition, self-evidence, or linear antecedent derivation. | Systemic properties: consistency (), parsimony (), and generative fertility. |
| Structure of Knowledge | Hierarchical pyramid resting on basic, unshakeable beliefs. | Holistic web of mutual logical and structural coherence. |
| Status of Alternatives | Categorically false if non-corresponding to intuitive reality. | Valid alternative formal systems; selection is adjudicated pragmatically by systemic fertility and coherence. |
In Plain English:
Section 1.1.6 formalizes the properties of the QBD principle regarding coherentist justification.
1.2.1 Definition: Directed Acyclic Graph (DAG)
A Directed Acyclic Graph (DAG) is a directed graph containing no directed cycles. Formally, there exists no sequence of vertices in of length such that and for all .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.1 Directed acyclic graph. -/
abbrev DirectedAcyclicGraph {V : Type u} (G : DiGraph V) := G.DAG
In Plain English:
A directed acyclic graph contains no directed cycles. Its nonempty reachability relation is a strict partial order.
1.2.2 Definition: Bipartite Graph
A Bipartite Graph is a directed graph whose vertex set can be partitioned into two disjoint sets, and (where and ), such that every directed edge connects a vertex in to a vertex in or vice versa. Formally, the edge set satisfies .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.2 Bipartite graph. -/
abbrev BipartiteGraph {V : Type u} (G : DiGraph V) := G.Bipartite
In Plain English:
Section 1.2.2 formalizes the properties of the QBD definition regarding bipartite graph.
1.2.3 Definition: Directed Path
A Directed Path in a directed graph is a sequence of vertices of length such that for all , the directed edge .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.3 Directed path, including paths of length zero. -/
abbrev DirectedPath {V : Type u} (G : DiGraph V) (a b : V) := Walk G a b
In Plain English:
Consecutive directed edges form a walk that may repeat vertices.
1.2.4 Definition: Simple Path
A Simple Path is a Directed Path containing no repeated vertices. Formally, for all .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.4 Directed path with no repeated vertex. -/
abbrev SimplePath {V : Type u} {G : DiGraph V} {a b : V} (path : DirectedPath G a b) :=
path.IsSimple
In Plain English:
Section 1.2.4 formalizes the properties of the QBD definition regarding simple path.
1.2.5 Definition: 2-Path
A 2-Path is a simple Directed Path of length exactly . Formally, it is denoted as an ordered triplet of distinct vertices such that and .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.5 Simple directed two-path. -/
abbrev TwoPath {V : Type u} (G : DiGraph V) (a b c : V) := G.TwoPath a b c
In Plain English:
A 2-path follows two directed edges through three distinct vertices.
1.2.6 Definition: Cycle
A Cycle (or directed cycle) is a non-trivial Directed Path of length such that . The vertices are pairwise distinct.
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.6 Positive-length closed path, simple before returning to its start. -/
abbrev Cycle {V : Type u} {G : DiGraph V} {a : V} (path : DirectedPath G a a) := path.IsCycle
In Plain English:
A cycle is a nonempty closed directed path with no repetition apart from its first and last vertex.
1.2.7 Definition: 2-Cycle
A 2-Cycle is a Cycle of length exactly . Formally, it consists of a pair of distinct vertices such that and .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.7 Directed two-cycle. -/
abbrev TwoCycle {V : Type u} (G : DiGraph V) (a b : V) := G.TwoCycle a b
In Plain English:
A 2-cycle consists of the two directed edges on the same unordered pair.
1.2.8 Definition: 3-Cycle
A 3-Cycle is a Cycle of length exactly . Formally, it consists of a triplet of distinct vertices such that , , and .
Lean 4 (QBD.Ch01.Defs):
/-- §1.2.8 Directed three-cycle. -/
abbrev ThreeCycle {V : Type u} (G : DiGraph V) (a b c : V) := G.ThreeCycle a b c
In Plain English:
A 3-cycle uses three distinct vertices and is shortest when self-edges and reciprocal pairs are excluded.
1.3.1 Postulate: Dual Time Architecture
The temporal structure of the physical theory constitutes a Dual Time Architecture given by the pair , separating emergent Physical Time () from fundamental Global Logical Time ().
In Plain English:
A sequence index supplies order. Measuring duration requires a separate clock assignment.
1.3.2 Definition: Emergent Physical Time
Let be a causal graph. For any directed causal path in representing an observer's trajectory, the Emergent Physical Time interval along the path is defined as:
where is the topological path length and is a scaling function mapping discrete edge creation timestamps to proper time, emerging as continuous physical time in the macroscopic limit.
Lean 4 (QBD.Ch01.Defs):
/-- §1.3.2 Proper duration from the path length and its edge heights in path order. -/
def emergentPhysicalTime {V : Type u} {Duration : Type v} {a b : V}
(G : TimestampedGraph V) (f : Nat → List Nat → Duration)
(path : DirectedPath G.toDiGraph a b) : Duration :=
f path.length (path.edges.map G.H)
In Plain English:
Assigned durations add along consecutive segments of a chain. Interpreting the sum as a physical clock reading requires calibration.
1.3.3 Definition: Global Logical Time
Let be the specified input of a forward trajectory of the Universal Evolution Operator . Global Logical Time indexes that trajectory by labeling the input zero and incrementing the index by one for every update.
The indices have their usual strict total order, including when distinct ticks have the same active configuration.
Lean 4 (QBD.Ch01.Defs):
/-- §1.3.3 Global logical time counts forward updates from zero. -/
abbrev LogicalTime := Nat
/-- §1.3.3 The forward trajectory from a fixed initial state. -/
def forwardTrajectory {State : Type u} (update : State → State) (initial : State) : LogicalTime → State
| 0 => initial
| tick + 1 => update (forwardTrajectory update initial tick)
In Plain English:
Logical time is the index of an entry in a specified sequence of configurations, including repetitions.
1.3.4 Theorem: Temporal Finitude
Let the histories distinguished at observation admit an injective encoding into possible present states. Their cardinality is at most , and the comb with distinct retained terminal alternatives and the full continuing binary prefix tree give, respectively,
In Plain English:
Finite present-state capacity bounds distinguishable histories. Under the stated graph-edit and homogeneous Markov hypotheses, a finite complete creation ledger and a nonempty active past coexist with probability zero.
1.3.5 Lemma: Finite Information Substrate
Let and count the trials in a frozen snapshot, with one binary addition trial per distinct candidate return chord of a simple two-path, at most one deletion trial per old triangle with at most four outcomes, and the successor determined by the snapshot and realized trial list. The conditional realization entropy is at most bits, and under fixed initialization, uniform degree, one trial per candidate edge and at most linear vertex growth, both the accumulated conditional choice entropy and induced graph trajectory entropy are through ticks.
In Plain English:
The number of possible trial outcomes bounds their entropy. Under the degree and growth hypotheses, both trial and graph histories have at most quadratic entropy growth.
1.3.5.1 Proof: Finite Information Substrate
I. Counting Realizations in a Frozen Snapshot
Fix the input and index the addition trials and old-triangle trials. If is the outcome set of the -th deletion trial, the realized list takes values in the product
Write and . Concavity of gives
II. Counting Supporting Paths
For a middle vertex the ordered pair of incident directed edges ranges over at most possibilities. Requiring three distinct vertices can only reduce this count (2-Path §1.2.5). Every admissible addition has a supporting two-path, and one path determines only the return chord . Every directed triangle also contains a two-path, and a given path belongs to at most one directed triangle, since its third edge must be . Consequently, for maximum degree ,
III. Entropy of the Choice Sequence
With fixed, each list determines . Applying the fixed-snapshot bound on each positive-probability prefix and averaging gives
The chain rule and the arithmetic sum yield
IV. Projection to the Graph Trajectory
Write and . As is determined by , , so
Thus both entropies satisfy the displayed quadratic bound (Finite Information Substrate §1.3.5).
Q.E.D.
In Plain English:
Section 1.3.5.1 formalizes the properties of the QBD proof regarding finite information substrate.
1.3.5.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the discrete counting and quadratic horizon bounds established in Finite Information Substrate §1.3.5 proceeds via the following verification strategy:
- Model: Finite directed Boolean graphs with bounded incoming and outgoing degrees, per-tick trial counts for binary additions and at-most-four-outcome triangle deletions, and cumulative horizon sums represent the discrete update support across ticks.
- Certified Claims: The module certifies the frozen-snapshot support product bound, the per-tick linear-growth trial exponent bound, and the quadratic horizon sum bound both for abstract bounded trial counts and for concrete candidate-chord and directed-triangle counts in Finite Information Substrate §1.3.5.1.
- Scope Boundary: Uniform degree bounds and at-most-linear vertex growth are supplied as discrete hypotheses. Real-valued Shannon entropy bounds and the entropy chain rule are certified separately in Type-Theoretic Validation via Lean 4 and Mathlib §1.3.5.3.
import QBD.Ch01.L1_5_5_RelationalVertexEmergence
namespace QBD.Ch01
-- Sum the quantities at ticks `0` through `T - 1`.
def tickSum (f : Nat → Nat) : Nat → Nat
| 0 => 0
| T + 1 => tickSum f T + f T
-- The product of all deletion-trial outcome counts.
def deletionOutcomeProduct {C : Nat} (d : Fin C → Nat) : Nat := (List.ofFn d).prod
-- Support of the list of realized trial outcomes in a frozen snapshot.
/-- Each deletion trial contributes at most `4 = 2 ^ 2` possible outcomes. The binary
addition outcomes contribute a factor of `2 ^ A` to the Cartesian product size. -/
theorem support_product_bound (A : Nat) {C : Nat} (d : Fin C → Nat) (bound : ∀ j, d j ≤ 4) :
2 ^ A * deletionOutcomeProduct d ≤ 2 ^ (A + 2 * C) := by
have productBound : ∀ {n : Nat} (f : Fin n → Nat), (∀ j, f j ≤ 4) →
deletionOutcomeProduct f ≤ 2 ^ (2 * n) := by
intro n
induction n with
| zero => intro f _; simp [deletionOutcomeProduct]
| succ n ih =>
intro f bounded
have rest := ih (fun j => f j.succ) (fun j => bounded j.succ)
change (List.ofFn f).prod ≤ 2 ^ (2 * (n + 1))
rw [List.ofFn_succ, List.prod_cons, Nat.mul_succ, Nat.pow_add, Nat.mul_comm (2 ^ (2 * n))]
exact Nat.mul_le_mul (bounded 0) rest
rw [Nat.pow_add]
exact Nat.mul_le_mul_left _ (productBound d bound)
-- Linear vertex growth gives the time-dependent bound on the snapshot exponent.
/-- Substitute the bound `N ≤ a + b * t` into the snapshot counting inequality. -/
theorem trial_exponent_linear_growth {N : Nat} (G : FinDiGraph N) (Δ A C a b t : Nat)
(degreeBound : ∀ w, d_in G w ≤ Δ ∧ d_out G w ≤ Δ)
(additions : A ≤ simpleTwoPathCount G) (deletions : C ≤ simpleTwoPathCount G)
(growth : N ≤ a + b * t) : A + 2 * C ≤ 3 * Δ ^ 2 * (a + b * t) :=
Nat.le_trans (trial_exponent_bound G Δ A C degreeBound additions deletions)
(Nat.mul_le_mul_left _ growth)
-- A pointwise comparison remains valid after summation over a horizon.
/-- The new tick at each induction step contributes its pointwise inequality. -/
private theorem tickSum_mono {f g : Nat → Nat} {T : Nat} (bound : ∀ t, t < T → f t ≤ g t) :
tickSum f T ≤ tickSum g T := by
induction T with
| zero => exact Nat.le_refl _
| succ T ih =>
exact Nat.add_le_add (ih (fun t ht => bound t (Nat.lt_trans ht (Nat.lt_succ_self T))))
(bound T (Nat.lt_succ_self T))
-- A constant factor can be taken out of a tick sum.
/-- Distributivity gives the factorization at every successor horizon. -/
private theorem tickSum_mul (c : Nat) (f : Nat → Nat) (T : Nat) :
tickSum (fun t => c * f t) T = c * tickSum f T := by
induction T with
| zero => simp [tickSum]
| succ T ih => simp only [tickSum, ih, Nat.mul_add]
-- Sum an affine bound by counting the constant term and summing the tick indices.
/-- Induction gives `a * T` for the constant term and `b` times the sum of tick indices. -/
private theorem tickSum_affine (a b T : Nat) :
tickSum (fun t => a + b * t) T = a * T + b * tickSum id T := by
induction T with
| zero => simp [tickSum]
| succ T ih =>
simp only [tickSum, ih, id, Nat.mul_succ a T, Nat.mul_add]
ac_rfl
-- Exact twice-triangular sum of the tick indices.
/-- Doubling the sum of tick indices below `T` gives the product `T * (T - 1)`. -/
theorem twice_tick_index_sum (T : Nat) : 2 * tickSum id T = T * (T - 1) := by
induction T with
| zero => rfl
| succ T ih =>
rw [tickSum, Nat.mul_add, ih]
cases T with
| zero => rfl
| succ k =>
simp only [id, Nat.succ_sub_one]
rw [Nat.succ_mul (k + 1) (k + 1), Nat.mul_succ (k + 1) k]
omega
-- Exact doubled horizon sum of the affine exponent bound.
/-- Factor out the degree coefficient and apply the twice-triangular identity to the linear term. -/
theorem twice_quadratic_horizon_sum (Δ a b T : Nat) :
2 * tickSum (fun t => 3 * Δ ^ 2 * (a + b * t)) T =
3 * Δ ^ 2 * (2 * a * T + b * T * (T - 1)) := by
rw [tickSum_mul, tickSum_affine]
calc
_ = 3 * Δ ^ 2 * (2 * a * T + b * (2 * tickSum id T)) := by
rw [Nat.mul_left_comm 2, Nat.mul_add]
congr 1 <;> ac_rfl
_ = _ := by rw [twice_tick_index_sum, Nat.mul_assoc b]
-- The sum of trial exponents is bounded by the quadratic horizon expression.
/-- Substitute the per-tick affine bounds and replace the index sum by its exact closed form.
The numerator of the division by two is even by the doubled index-sum identity. -/
theorem trial_exponent_horizon_bound (A C : Nat → Nat) (Δ a b T : Nat)
(pointwise : ∀ t, t < T → A t + 2 * C t ≤ 3 * Δ ^ 2 * (a + b * t)) :
tickSum (fun t => A t + 2 * C t) T ≤
3 * Δ ^ 2 * (a * T + b * T * (T - 1) / 2) := by
refine Nat.le_trans (tickSum_mono pointwise) ?_
rw [tickSum_mul, tickSum_affine, Nat.mul_assoc b, ← twice_tick_index_sum]
have exactDivision : b * (2 * tickSum id T) / 2 = b * tickSum id T := by
rw [Nat.mul_comm 2, ← Nat.mul_assoc, Nat.mul_div_cancel _ (by decide : 0 < 2)]
rw [exactDivision]
exact Nat.le_refl _
-- Apply the horizon bound to a family of snapshots with uniformly bounded degrees.
/-- The graph hypotheses at each tick give the pointwise trial bounds consumed by the horizon sum. -/
theorem substrate_horizon_bound (N A C : Nat → Nat) (G : (t : Nat) → FinDiGraph (N t)) (Δ a b T : Nat)
(degreeBound : ∀ t, t < T → ∀ w, d_in (G t) w ≤ Δ ∧ d_out (G t) w ≤ Δ)
(additions : ∀ t, t < T → A t ≤ simpleTwoPathCount (G t))
(deletions : ∀ t, t < T → C t ≤ simpleTwoPathCount (G t))
(growth : ∀ t, t < T → N t ≤ a + b * t) :
tickSum (fun t => A t + 2 * C t) T ≤ 3 * Δ ^ 2 * (a * T + b * T * (T - 1) / 2) :=
trial_exponent_horizon_bound A C Δ a b T (fun t ht =>
trial_exponent_linear_growth (G t) Δ (A t) (C t) a b t
(degreeBound t ht) (additions t ht) (deletions t ht) (growth t ht))
/-- The quadratic horizon bound with both trial counts derived from each input graph. -/
theorem graph_trial_exponent_horizon_bound (N : Nat → Nat) (G : (t : Nat) → FinDiGraph (N t))
(Δ a b T : Nat) (degreeBound : ∀ t, t < T → ∀ w, d_in (G t) w ≤ Δ ∧ d_out (G t) w ≤ Δ)
(growth : ∀ t, t < T → N t ≤ a + b * t) :
tickSum (fun t => candidateChordCount (G t) + 2 * directedTriangleCount (G t)) T ≤
3 * Δ ^ 2 * (a * T + b * T * (T - 1) / 2) :=
trial_exponent_horizon_bound (fun t => candidateChordCount (G t))
(fun t => directedTriangleCount (G t)) Δ a b T fun t within =>
Nat.le_trans (graph_trial_exponent_bound (G t) Δ (degreeBound t within))
(Nat.mul_le_mul_left _ (growth t within))
end QBD.Ch01
#print axioms QBD.Ch01.support_product_bound
#print axioms QBD.Ch01.substrate_horizon_bound
#print axioms QBD.Ch01.graph_trial_exponent_horizon_bound
Verification Summary:
The machine-checked proofs establish the frozen-snapshot support product bound and the quadratic horizon bound on accumulated trial exponents under uniform degree limits and linear vertex growth, including the concrete bound derived directly from candidate chords and directed triangles. Real-valued Shannon entropy inequalities and the entropy chain rule are established in the companion Mathlib validation. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the finitary counting claims of Finite Information Substrate §1.3.5.
In Plain English:
Machine-checked Lean 4 proofs certify the formal claims verified in Section 1.3.5.3.
1.3.5.3 Type-Theoretic Validation via Lean 4 and Mathlib
Type-theoretic certification of the real-valued Shannon entropy bounds and chain rule established in Finite Information Substrate §1.3.5 proceeds via the following verification strategy:
- Model: Finite real probability distributions, binary-logarithm Shannon entropy functionals, conditional fiber entropies, and bijection-preserving simple-path ensembles represent finite-support information content.
- Certified Claims: The module certifies nonnegativity and the support-size upper bound for real Shannon entropy in bits, bijection invariance, self-loop simple-path entropy invariance, the exact chain rule with zero-mass fiber vanishing, and subadditivity in Finite Information Substrate §1.3.5.1.
- Scope Boundary: Finite probability weights and conditional fiber distributions are supplied as discrete real inputs. Differential entropy on continuous state spaces remains outside this finite-support certificate.
import QBD.Ch01.L1_3_5_FiniteInformationSubstrate
import QBD.Ch02.L2_2_3_ThermodynamicNullity
import QBDMathlib.Ch04.L4_6_4_ThermodynamicArrow
open QBDMathlib.Ch04
namespace QBDMathlib.Ch01
noncomputable section
variable {X Y : Type*} [Fintype X] [Fintype Y]
/-- Shannon entropy in bits, using the convention that a zero mass contributes zero. -/
def shannonBits (p : X → ℝ) : ℝ := shannonEntropy p / Real.log 2
theorem shannonBits_eq_logb (p : X → ℝ) :
shannonBits p = ∑ x, -(p x * Real.logb 2 (p x)) := by
unfold shannonBits shannonEntropy
rw [Finset.sum_div]
exact Finset.sum_congr rfl fun i _ => by unfold Real.logb; ring
private theorem log_two_positive : 0 < Real.log (2 : ℝ) := Real.log_pos (by norm_num)
theorem shannon_bits_nonnegative (p : FiniteLaw X) : 0 ≤ shannonBits p.weight := by
apply div_nonneg _ log_two_positive.le
apply Finset.sum_nonneg
intro x _
have leOne : p.weight x ≤ 1 := by
rw [← p.total]
exact Finset.single_le_sum (fun y _ => p.nonneg y) (Finset.mem_univ x)
exact neg_nonneg.mpr (mul_nonpos_of_nonneg_of_nonpos (p.nonneg x)
(Real.log_nonpos (p.nonneg x) leOne))
/-- Comparison with a uniform reference on the positive support gives the entropy bound. -/
theorem shannon_bits_support_bound (p : FiniteLaw X) [DecidablePred (fun i => 0 < p.weight i)] :
shannonBits p.weight ≤ Real.logb 2
((Finset.univ.filter (fun i => 0 < p.weight i)).card : ℝ) := by
let S := Finset.univ.filter (fun i => 0 < p.weight i)
let q : X → ℝ := fun i => if 0 < p.weight i then 1 else 0
have qmass : mass q = (S.card : ℝ) := by
unfold mass q S
rw [← Finset.sum_filter]
simp
have cardPos : (0 : ℝ) < S.card := by
by_contra! no
have empty : S = ∅ := Finset.card_eq_zero.mp (by exact_mod_cast le_antisymm no (Nat.cast_nonneg _))
have allZero : ∀ i, p.weight i = 0 := by
intro i
apply le_antisymm _ (p.nonneg i)
by_contra! h
have mem : i ∈ S := Finset.mem_filter.mpr ⟨Finset.mem_univ i, h⟩
simp [empty] at mem
simpa [allZero] using p.total
have reference : finiteKL p.weight q = -shannonEntropy p.weight := by
unfold finiteKL shannonEntropy
rw [← Finset.sum_neg_distrib]
apply Finset.sum_congr rfl
intro i _
by_cases pos : 0 < p.weight i
· simp [q, pos]
· have zero := le_antisymm (le_of_not_gt pos) (p.nonneg i)
simp [zero]
have gibbs := finite_log_sum p.weight q p.nonneg
(fun i => by dsimp [q]; split <;> norm_num)
(fun i hi => by simp [q, hi])
rw [show mass p.weight = 1 from p.total, qmass, reference, one_mul, one_div, Real.log_inv] at gibbs
exact div_le_div_of_nonneg_right (by linarith) log_two_positive.le
theorem shannon_bits_bijection (e : X ≃ Y) (p : Y → ℝ) :
shannonBits (p ∘ e) = shannonBits p := by
unfold shannonBits shannonEntropy
congr 1
exact Equiv.sum_comp e (fun y => -(p y * Real.log (p y)))
/-- A self-loop gives a bijection on the selected simple paths and leaves every
transported path distribution's entropy unchanged. -/
theorem self_loop_shannon_entropy {V : Type*} (E : QBD.Edge V → Prop) (x a b : V)
(select : List (QBD.Edge V) → Prop)
(catalog : Finset (List (QBD.Edge V)))
[DecidablePred (fun path => select path ∧ QBD.IsSimple a path ∧ QBD.DirectedEdgePath E a b path)]
[DecidablePred (fun path => select path ∧ QBD.IsSimple a path ∧
QBD.DirectedEdgePath (fun e => E e ∨ e = (x, x)) a b path)]
(weights : List (QBD.Edge V) → ℝ) :
(∑ path ∈ catalog.filter (fun path => select path ∧ QBD.IsSimple a path ∧
QBD.DirectedEdgePath (fun e => E e ∨ e = (x, x)) a b path),
-(weights path * Real.logb 2 (weights path))) =
(∑ path ∈ catalog.filter (fun path => select path ∧ QBD.IsSimple a path ∧
QBD.DirectedEdgePath E a b path), -(weights path * Real.logb 2 (weights path))) := by
congr 1
ext path
simp only [Finset.mem_filter]
constructor
· rintro ⟨listed, selected, simple, directed⟩
exact ⟨listed, selected, simple,
(QBD.Ch02.self_loop_simple_path_equivalence E x a b path simple).mp directed⟩
· rintro ⟨listed, selected, simple, directed⟩
exact ⟨listed, selected, simple,
(QBD.Ch02.self_loop_simple_path_equivalence E x a b path simple).mpr directed⟩
def marginalLeft (p : FiniteLaw (X × Y)) : FiniteLaw X :=
⟨fun x => ∑ y, p.weight (x, y), fun x => Finset.sum_nonneg fun y _ => p.nonneg (x, y),
(Fintype.sum_prod_type p.weight).symm.trans p.total⟩
def marginalRight (p : FiniteLaw (X × Y)) : FiniteLaw Y :=
⟨fun y => ∑ x, p.weight (x, y), fun y => Finset.sum_nonneg fun x _ => p.nonneg (x, y),
Finset.sum_comm.trans (marginalLeft p).total⟩
/-- Conditional entropy on a zero-mass fiber contributes zero. -/
def conditionalShannonBits (p : FiniteLaw (X × Y)) : ℝ :=
∑ x, (marginalLeft p).weight x *
shannonBits (fun y => p.weight (x, y) / (marginalLeft p).weight x)
private theorem marginal_left_comparison (p : FiniteLaw (X × Y)) (x : X) (y : Y) :
p.weight (x, y) ≤ (marginalLeft p).weight x :=
Finset.single_le_sum (fun z _ => p.nonneg (x, z)) (Finset.mem_univ y)
private theorem marginal_right_comparison (p : FiniteLaw (X × Y)) (x : X) (y : Y) :
p.weight (x, y) ≤ (marginalRight p).weight y :=
Finset.single_le_sum (fun z _ => p.nonneg (z, y)) (Finset.mem_univ x)
theorem shannon_bits_chain_rule (p : FiniteLaw (X × Y)) :
shannonBits p.weight = shannonBits (marginalLeft p).weight + conditionalShannonBits p := by
classical
let a := marginalLeft p
have someY : Nonempty Y := by
by_contra! empty
have := p.total
rw [Fintype.sum_prod_type] at this
simp at this
letI : Nonempty Y := someY
let K (x : X) : FiniteLaw Y :=
if hx : a.weight x = 0 then
⟨fun _ => (Fintype.card Y : ℝ)⁻¹, fun _ => by positivity,
by simp [Fintype.card_ne_zero]⟩
else ⟨fun y => p.weight (x, y) / a.weight x, fun y => div_nonneg (p.nonneg _) (a.nonneg _),
by rw [← Finset.sum_div]; exact div_self hx⟩
have joint : (fun xy : X × Y => a.weight xy.1 * (K xy.1).weight xy.2) = p.weight := by
funext ⟨x,y⟩
by_cases zero : a.weight x = 0
· have px := marginal_left_comparison p x y
change p.weight (x,y) ≤ a.weight x at px
have alsoZero := le_antisymm (px.trans_eq zero) (p.nonneg _)
simp [zero, alsoZero]
· simp only [K, dif_neg zero]
rw [mul_div_left_comm, div_self zero, mul_one]
have chain := trajectory_entropy_chain_rule a K
rw [joint] at chain
unfold shannonBits conditionalShannonBits
rw [chain, add_div, Finset.sum_div]
congr 1
apply Finset.sum_congr rfl
intro x _
change a.weight x * shannonEntropy (K x).weight / Real.log 2 =
a.weight x * shannonBits (fun y => p.weight (x, y) / a.weight x)
by_cases zero : a.weight x = 0
· simp [zero]
· simp [K, zero, shannonBits, mul_div_assoc]
theorem shannon_bits_subadditive (p : FiniteLaw (X × Y)) :
shannonBits p.weight ≤ shannonBits (marginalLeft p).weight + shannonBits (marginalRight p).weight := by
let a := marginalLeft p
let b := marginalRight p
let q := fun xy : X × Y => a.weight xy.1 * b.weight xy.2
have massQ : mass q = 1 := by
unfold mass q
rw [Fintype.sum_prod_type]
simp_rw [← Finset.mul_sum, b.total, mul_one, a.total]
have q₀ (xy : X × Y) : 0 ≤ q xy := mul_nonneg (a.nonneg _) (b.nonneg _)
have support (xy : X × Y) (pos : 0 < p.weight xy) :
0 < a.weight xy.1 ∧ 0 < b.weight xy.2 := by
rcases xy with ⟨x,y⟩
exact ⟨pos.trans_le (marginal_left_comparison p x y),
pos.trans_le (marginal_right_comparison p x y)⟩
have kl := finite_log_sum p.weight q p.nonneg q₀ fun xy h =>
mul_pos (support xy h).1 (support xy h).2
rw [show mass p.weight = 1 from p.total, massQ, div_one, Real.log_one, mul_zero] at kl
have split (xy : X × Y) :
p.weight xy * Real.log (p.weight xy / q xy) =
p.weight xy * Real.log (p.weight xy) -
(p.weight xy * Real.log (a.weight xy.1) + p.weight xy * Real.log (b.weight xy.2)) := by
rcases (p.nonneg xy).eq_or_lt with zero | pos
· simp [← zero]
· have h := support xy pos
rw [Real.log_div pos.ne' (mul_pos h.1 h.2).ne', Real.log_mul h.1.ne' h.2.ne']
ring
have left : (∑ xy : X × Y, p.weight xy * Real.log (a.weight xy.1)) =
∑ x, a.weight x * Real.log (a.weight x) := by
rw [Fintype.sum_prod_type]
simp_rw [← Finset.sum_mul]
rfl
have right : (∑ xy : X × Y, p.weight xy * Real.log (b.weight xy.2)) =
∑ y, b.weight y * Real.log (b.weight y) := by
rw [Fintype.sum_prod_type, Finset.sum_comm]
simp_rw [← Finset.sum_mul]
rfl
simp_rw [finiteKL, split, Finset.sum_sub_distrib, Finset.sum_add_distrib, left, right] at kl
unfold shannonBits shannonEntropy
rw [← add_div]
apply div_le_div_of_nonneg_right _ log_two_positive.le
simp_rw [Finset.sum_neg_distrib] at *
exact (by linarith : -(∑ x, p.weight x * Real.log (p.weight x)) ≤
-(∑ x, a.weight x * Real.log (a.weight x)) + -(∑ x, b.weight x * Real.log (b.weight x)))
end
end QBDMathlib.Ch01
#print axioms QBDMathlib.Ch01.shannon_bits_nonnegative
#print axioms QBDMathlib.Ch01.shannon_bits_support_bound
#print axioms QBDMathlib.Ch01.self_loop_shannon_entropy
#print axioms QBDMathlib.Ch01.shannon_bits_chain_rule
#print axioms QBDMathlib.Ch01.shannon_bits_subadditive
Verification Summary:
The machine-checked proofs establish nonnegativity, the binary-logarithm support bound, bijection invariance, self-loop simple-path invariance, the exact chain rule, and subadditivity for finite-support real Shannon entropy in bits. Continuous differential entropy and infinite-alphabet coding limits remain outside this finite-distribution formalization. The Lean 4 and Mathlib kernel accepts all closed proof terms using only standard axioms, certifying the information-theoretic claims of Finite Information Substrate §1.3.5.
In Plain English:
Machine-checked Lean 4 proofs certify the formal claims verified in Section 1.3.5.4.
1.3.6 Lemma: Backward Accumulation
Let be the cumulative occurrence set through tick , initially finite. Across ticks each with a new record its cardinality increases by at least , and if the trajectory's finite conditional entropy at each counted tick is at least , its joint trajectory entropy increases by at least bits.
In Plain English:
An append-only ledger counts insertions. Edge balance then bounds the number of ticks with edits.
1.3.6.1 Proof: Backward Accumulation
I. Domain and Objects
Creation occurrences are retained in the historical record (Backward Accumulation §1.3.6) (Monotonicity of History §1.4.5).
II. Occurrence Counting
Put . For , and . Thus for an interval ,
For a fixed-vertex edit history, let and denote the numbers of insertions and deletions from tick to tick . Suppose deletions remove only preexisting pairs, insertions add only previously absent pairs, and consists of exactly one fresh record per insertion. These hypotheses yield
where . The active tick count counts a tick with both operations once. Since , it obeys
III. Entropy Summation
For trajectory variables and the specified set of ticks, nonnegativity of conditional entropy gives
Q.E.D.
In Plain English:
Section 1.3.6.1 formalizes the properties of the QBD proof regarding backward accumulation.
1.3.6.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the occurrence accumulation and active-tick bounds established in Backward Accumulation §1.3.6 proceeds via the following verification strategy:
- Model: Duplicate-free append-only occurrence ledgers, fixed-vertex asymmetric loop-free edit histories, per-tick insertion and deletion counts, and half-open window sums represent the cumulative historical record and edge-count balance.
- Certified Claims: The module certifies pairwise disjointness of per-tick increments, monotonic ledger inclusion, the occurrence growth lower bound, telescoping edge-count balance, and the uniform observation-ledger bound on active ticks in Backward Accumulation §1.3.6.1.
- Scope Boundary: One-to-one recording of insertions and exact per-tick edge balance on a fixed vertex set are supplied as discrete premises. Real-valued conditional Shannon entropy summation remains outside this combinatorial Core certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
universe u
-- A cumulative ledger extends by appending the fresh records at each tick.
structure OccurrenceLedger (Ω : Type u) where
occurrences : Nat → List Ω
increments : Nat → List Ω
nodup : ∀ t, (occurrences t).Nodup
append_tick : ∀ t, occurrences (t + 1) = occurrences t ++ increments t
-- A fixed-vertex edit history with one retained record per insertion.
structure TemporalEditHistory (Ω : Type u) (N : Nat) where
ledger : OccurrenceLedger Ω
adjacency : Nat → LoopFreeAdjacency N
asymmetric : ∀ t, AsymmetricAdjacency (adjacency t)
insertions : Nat → Nat
deletions : Nat → Nat
records_per_insertion : ∀ t, insertions t = (ledger.increments t).length
balance : ∀ t, edgeCount (adjacency (t + 1)) + deletions t = edgeCount (adjacency t) + insertions t
-- Sum a tick quantity over a finite window given its start and length.
def tickWindowSumFrom (f : Nat → Nat) (a : Nat) : Nat → Nat
| 0 => 0
| n + 1 => tickWindowSumFrom f a n + f (a + n)
-- Sum a tick quantity over the half-open interval `[a, b)`.
def tickWindowSum (f : Nat → Nat) (a b : Nat) : Nat := tickWindowSumFrom f a (b - a)
-- A natural indicator for a tick with at least one event of the specified kind.
def positiveTick (n : Nat) : Nat := if 0 < n then 1 else 0
-- Count ticks with an insertion or a deletion, counting a tick with both once.
def activeTickCount {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N) (a b : Nat) : Nat :=
tickWindowSum (fun t => positiveTick (history.insertions t + history.deletions t)) a b
-- Appending inserts precisely the disjoint increment at each step.
/-- The appended ledger is duplicate-free, so no occurrence in the new increment is already present. -/
theorem ledger_increment_fresh {Ω : Type u} (ledger : OccurrenceLedger Ω) (t : Nat) :
(ledger.increments t).Nodup ∧
∀ ω, ω ∈ ledger.increments t → ω ∉ ledger.occurrences t := by
have distinct := ledger.nodup (t + 1)
rw [ledger.append_tick] at distinct
obtain ⟨_, incrementDistinct, disjoint⟩ := List.nodup_append.1 distinct
exact ⟨incrementDistinct, fun ω fresh old => disjoint ω old ω fresh rfl⟩
-- Every earlier ledger is included in every later ledger.
/-- Induction across ticks preserves each member of the earlier ledger through the append steps. -/
theorem ledger_monotone {Ω : Type u} (ledger : OccurrenceLedger Ω) {a b : Nat} (ordered : a ≤ b)
{ω : Ω} (member : ω ∈ ledger.occurrences a) : ω ∈ ledger.occurrences b := by
have retain : ∀ n, ω ∈ ledger.occurrences (a + n) := by
intro n
induction n with
| zero => exact member
| succ n ih =>
change ω ∈ ledger.occurrences (a + n + 1)
rw [ledger.append_tick]
exact List.mem_append_left _ ih
rw [← Nat.add_sub_of_le ordered]
exact retain (b - a)
-- Increments at different ticks are disjoint.
/-- An occurrence added earlier is already present when the later fresh increment is appended. -/
theorem ledger_increments_disjoint {Ω : Type u} (ledger : OccurrenceLedger Ω) {s t : Nat}
(ordered : s < t) {ω : Ω} (member : ω ∈ ledger.increments s) : ω ∉ ledger.increments t := by
have recorded : ω ∈ ledger.occurrences (s + 1) := by
rw [ledger.append_tick]
exact List.mem_append_right _ member
exact fun later => (ledger_increment_fresh ledger t).2 ω later (ledger_monotone ledger ordered recorded)
-- Pointwise comparison of tick quantities gives comparison of their interval totals.
/-- At each induction step, add the inequality for the newly included tick. -/
private theorem tickWindowSum_mono {f g : Nat → Nat} (pointwise : ∀ t, f t ≤ g t) (a b : Nat) :
tickWindowSum f a b ≤ tickWindowSum g a b := by
unfold tickWindowSum
induction b - a with
| zero => exact Nat.le_refl _
| succ n ih => exact Nat.add_le_add ih (pointwise (a + n))
-- A tick sum distributes over addition of tick quantities.
/-- The sum of total insertions and total deletions counts the two edit kinds across the window. -/
private theorem tickWindowSum_add (f g : Nat → Nat) (a b : Nat) :
tickWindowSum (fun t => f t + g t) a b = tickWindowSum f a b + tickWindowSum g a b := by
unfold tickWindowSum
induction b - a with
| zero => rfl
| succ n ih =>
simp only [tickWindowSumFrom, ih]
omega
-- The indicator for an active tick is bounded by its number of events.
/-- A positive natural is at least one, and the indicator is zero otherwise. -/
private theorem positiveTick_le (n : Nat) : positiveTick n ≤ n := by
unfold positiveTick
split <;> omega
-- The ledger size grows by the sum of the sizes of the increments.
/-- Induction sums the lengths of the disjoint appends over any ordered finite window. -/
theorem occurrence_growth {Ω : Type u} (ledger : OccurrenceLedger Ω) {a b : Nat} (ordered : a ≤ b) :
(ledger.occurrences b).length = (ledger.occurrences a).length +
tickWindowSum (fun t => (ledger.increments t).length) a b := by
have growth : ∀ n, (ledger.occurrences (a + n)).length = (ledger.occurrences a).length +
tickWindowSumFrom (fun t => (ledger.increments t).length) a n := by
intro n
induction n with
| zero => rfl
| succ n ih =>
change (ledger.occurrences (a + n + 1)).length = _
rw [ledger.append_tick, List.length_append, ih, tickWindowSumFrom, Nat.add_assoc]
calc
(ledger.occurrences b).length = (ledger.occurrences (a + (b - a))).length := by
rw [Nat.add_sub_of_le ordered]
_ = _ := growth (b - a)
-- At least one new record at each counted tick gives at least that much growth.
/-- The sum of the positive-increment indicators is bounded by the total size of the increments. -/
theorem occurrence_growth_lower_bound {Ω : Type u} (ledger : OccurrenceLedger Ω) {a b K : Nat}
(ordered : a ≤ b)
(counted : K ≤ tickWindowSum (fun t => positiveTick (ledger.increments t).length) a b) :
K ≤ (ledger.occurrences b).length - (ledger.occurrences a).length := by
rw [occurrence_growth ledger ordered, Nat.add_sub_cancel_left]
exact Nat.le_trans counted (tickWindowSum_mono (fun t => positiveTick_le (ledger.increments t).length) a b)
-- Total insertions equal the increase in the cumulative ledger size.
/-- One recorded occurrence per insertion identifies the insertion sum with occurrence growth. -/
theorem insertion_total_eq_growth {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N)
{a b : Nat} (ordered : a ≤ b) :
tickWindowSum history.insertions a b =
(history.ledger.occurrences b).length - (history.ledger.occurrences a).length := by
rw [occurrence_growth history.ledger ordered, Nat.add_sub_cancel_left]
have counts : history.insertions = fun t => (history.ledger.increments t).length :=
funext history.records_per_insertion
rw [counts]
-- The per-tick edge-count balance telescopes over the window.
/-- Add the next edit balance to the induction hypothesis and cancel the intermediate edge count. -/
theorem edge_count_telescopes {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N)
{a b : Nat} (ordered : a ≤ b) :
edgeCount (history.adjacency b) + tickWindowSum history.deletions a b =
edgeCount (history.adjacency a) + tickWindowSum history.insertions a b := by
have telescope : ∀ n,
edgeCount (history.adjacency (a + n)) + tickWindowSumFrom history.deletions a n =
edgeCount (history.adjacency a) + tickWindowSumFrom history.insertions a n := by
intro n
induction n with
| zero => rfl
| succ n ih =>
have step := history.balance (a + n)
change edgeCount (history.adjacency (a + n + 1)) + tickWindowSumFrom history.deletions a (n + 1) = _
simp only [tickWindowSumFrom]
omega
have total := telescope (b - a)
rwa [Nat.add_sub_of_le ordered] at total
-- Active ticks are bounded by the total number of edits.
/-- Counting at most one per tick is bounded by counting all insertions and deletions. -/
theorem active_ticks_le_edits {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N) (a b : Nat) :
activeTickCount history a b ≤ tickWindowSum history.insertions a b + tickWindowSum history.deletions a b := by
rw [← tickWindowSum_add]
exact tickWindowSum_mono (fun t => positiveTick_le (history.insertions t + history.deletions t)) a b
-- The active-tick bound retains the final edge count before weakening to ledger growth.
/-- Balance removes total deletions, leaving the start count and twice the number of insertions. -/
theorem active_tick_bound {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N)
{a b : Nat} (ordered : a ≤ b) :
(activeTickCount history a b + edgeCount (history.adjacency b) ≤
edgeCount (history.adjacency a) + 2 * tickWindowSum history.insertions a b) ∧
(activeTickCount history a b ≤ edgeCount (history.adjacency a) +
2 * ((history.ledger.occurrences b).length - (history.ledger.occurrences a).length)) := by
have edits := active_ticks_le_edits history a b
have balance := edge_count_telescopes history ordered
have growth := insertion_total_eq_growth history ordered
constructor <;> omega
-- The observation ledger gives a uniform bound on every finite preceding window.
/-- The initial adjacency occupies at most one direction per pair, and growth is at most
the size `B` of the complete observation ledger. -/
theorem observation_active_tick_bound {Ω : Type u} {N : Nat} (history : TemporalEditHistory Ω N)
{a b B : Nat} (ordered : a ≤ b) (observationSize : (history.ledger.occurrences b).length = B) :
activeTickCount history a b ≤ N * (N - 1) / 2 + 2 * B := by
have active := (active_tick_bound history ordered).2
have edges := (asymmetric_adjacency_edge_bound _ (history.asymmetric a)).2
omega
end QBD.Ch01
#print axioms QBD.Ch01.ledger_increments_disjoint
#print axioms QBD.Ch01.occurrence_growth_lower_bound
#print axioms QBD.Ch01.observation_active_tick_bound
Verification Summary:
The machine-checked proofs establish that append-only ledger increments at distinct ticks are disjoint, that counted active increments yield linear ledger growth, and that edge-count balance bounds active ticks across any preceding window by the asymmetric edge cap plus twice the observation ledger size. Conditional Shannon entropy lower bounds on stochastic trajectories remain outside this combinatorial formalization. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the ledger and edit-balance claims of Backward Accumulation §1.3.6.
In Plain English:
Machine-checked Lean 4 proofs certify disjointness of append-only ledger increments, linear occurrence growth, and the observation-ledger bound on active ticks.
1.3.7 Lemma: Finite State Recurrence
Let be a fixed finite vertex set of size and the loop-free directed adjacency. Among observations there are two with equal adjacency, and their cumulative occurrence sets differ if a record is added between the two snapshots.
In Plain English:
Section 1.3.7 formalizes the properties of the QBD lemma regarding finite state recurrence.
1.3.7.1 Proof: Finite State Recurrence
I. Coordinates of the Adjacency Projection
Fix a vertex set of size . For the directed pair domain , each of the source vertices admits target vertices. An active adjacency is determined by the vector of edge indicators (Causal Graph Substrate §1.4.1)
Two different edge sets differ on at least one pair, so this map is injective. The cardinality of the target is
II. Repeated Projection
For observation ticks , suppose all adjacencies were distinct. Injectivity would give
a contradiction. Hence for two distinct observation ticks .
III. Separation of the Occurrence Records
For a creation occurrence recorded after and by , the cumulative sets satisfy
In the record-level example, has initial occurrence . A deletion at tick one and fresh creation at tick two give
The birth coordinates distinguish from . Thus
The example separates recurrence of the adjacency projection from recurrence of the record (Finite State Recurrence §1.3.7).
Q.E.D.
In Plain English:
Section 1.3.7.1 formalizes the properties of the QBD proof regarding finite state recurrence.
1.3.7.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the adjacency recurrence and ledger separation claims established in Finite State Recurrence §1.3.7 proceeds via the following verification strategy:
- Model: Loop-free Boolean adjacencies on a fixed finite vertex set, injective binary encodings of off-diagonal pairs, snapshot-ledger pairs, and a concrete three-tick deletion-and-reinsertion sequence represent adjacency recurrence and occurrence identity.
- Certified Claims: The module certifies guaranteed adjacency repetition among observations, separation of full snapshot-ledger pairs whenever an intervening record is appended, and the explicit three-tick example separating recurrent adjacency from ledger identity in Finite State Recurrence §1.3.7.1.
- Scope Boundary: The vertex set cardinality is held fixed and recurrence applies strictly to the loop-free adjacency projection. Dynamical transition probabilities and variable-vertex state spaces remain outside this finite combinatorial certificate.
import QBD.Ch01.L1_3_6_BackwardAccumulation
namespace QBD.Ch01
universe u
/-- More observations than loop-free Boolean adjacencies force a recurrent adjacency. -/
theorem finite_state_recurrence (N : Nat)
(observations : Fin (2 ^ (N * (N - 1)) + 1) → LoopFreeAdjacency N) :
∃ i j, i < j ∧ observations i = observations j :=
finite_trajectory_recurrence _ (loopFreeAdjacencyCode N)
(@loopFreeAdjacencyCode_injective N) observations
-- A newly recorded occurrence distinguishes even snapshots with equal adjacency.
/-- Equality of the snapshot-ledger pairs would preserve membership in their second components. -/
theorem ledger_separates_recurrent_adjacency {Ω : Type u} {N : Nat} (earlier later : LoopFreeAdjacency N)
(oldLedger newLedger : List Ω) (ω : Ω) (recorded : ω ∈ newLedger) (fresh : ω ∉ oldLedger) :
(earlier, oldLedger) ≠ (later, newLedger) := by
intro equal
have sameLedger : oldLedger = newLedger := congrArg Prod.snd equal
exact fresh (sameLedger.symm ▸ recorded)
/-- An insertion anywhere between two observations distinguishes their full snapshot-ledger pairs. -/
theorem intervening_record_separates_observations {Ω : Type u} {N : Nat}
(history : TemporalEditHistory Ω N) {a t b : Nat} (started : a ≤ t) (finished : t < b)
{ω : Ω} (fresh : ω ∈ history.ledger.increments t) :
(history.adjacency a, history.ledger.occurrences a) ≠
(history.adjacency b, history.ledger.occurrences b) := by
have added : ω ∈ history.ledger.occurrences (t + 1) := by
rw [history.ledger.append_tick]
exact List.mem_append_right _ fresh
exact ledger_separates_recurrent_adjacency _ _ _ _ ω (ledger_monotone _ finished added)
(fun old => (ledger_increment_fresh _ t).2 ω fresh (ledger_monotone _ started old))
-- An occurrence in the two-vertex deletion and reinsertion example.
structure ThreeTickOccurrence where
edge : OffDiagonal 2
birth : Nat
height : Nat
-- The ordered edge used for both occurrences in the example.
def threeTickEdge : OffDiagonal 2 := ⟨0, 1, by decide⟩
-- The initial occurrence, with its initial height zero.
def threeTickInitial : ThreeTickOccurrence := ⟨threeTickEdge, 0, 0⟩
-- The fresh occurrence born when the edge is reinserted at tick two.
def threeTickRecreated : ThreeTickOccurrence := ⟨threeTickEdge, 2, 1⟩
-- The active edge is absent at the middle tick and present at both endpoints.
def threeTickAdjacency (tick : Fin 3) : LoopFreeAdjacency 2 := fun edge =>
if tick.val = 1 then false else decide (edge.source = threeTickEdge.source ∧ edge.target = threeTickEdge.target)
-- The deletion leaves the ledger intact, and the reinsertion appends its occurrence.
def threeTickLedger (tick : Fin 3) : List ThreeTickOccurrence :=
if tick.val = 2 then [threeTickInitial, threeTickRecreated] else [threeTickInitial]
-- The three-tick example has recurrent adjacency and distinct cumulative ledgers.
/-- Reinsertion restores the active pair at tick two, while the birth tick distinguishes the
new occurrence and its append distinguishes the endpoint snapshots with their ledgers. -/
theorem three_tick_ledger_example :
(∀ edge, threeTickAdjacency 0 edge =
decide (edge.source = threeTickEdge.source ∧ edge.target = threeTickEdge.target)) ∧
(∀ edge, threeTickAdjacency 1 edge = false) ∧
threeTickLedger 0 = [threeTickInitial] ∧ threeTickLedger 1 = [threeTickInitial] ∧
threeTickLedger 2 = [threeTickInitial, threeTickRecreated] ∧ threeTickInitial ≠ threeTickRecreated ∧
threeTickAdjacency 0 = threeTickAdjacency 2 ∧ threeTickLedger 0 ≠ threeTickLedger 2 ∧
(threeTickAdjacency 0, threeTickLedger 0) ≠ (threeTickAdjacency 2, threeTickLedger 2) := by
have different : threeTickInitial ≠ threeTickRecreated := by
intro equal
have birth := congrArg ThreeTickOccurrence.birth equal
cases birth
have fresh : threeTickRecreated ∉ threeTickLedger 0 := by
simp [threeTickLedger, Ne.symm different]
have recorded : threeTickRecreated ∈ threeTickLedger 2 := by simp [threeTickLedger]
have differentLedger : threeTickLedger 0 ≠ threeTickLedger 2 := by
intro equal
exact fresh (equal.symm ▸ recorded)
exact ⟨fun _ => rfl, fun _ => rfl, rfl, rfl, rfl, different, rfl, differentLedger,
ledger_separates_recurrent_adjacency _ _ _ _ _ recorded fresh⟩
end QBD.Ch01
#print axioms QBD.Ch01.finite_state_recurrence
#print axioms QBD.Ch01.intervening_record_separates_observations
#print axioms QBD.Ch01.three_tick_ledger_example
Verification Summary:
The machine-checked proofs establish that more than observations on a fixed finite vertex set force a repeated loop-free directed adjacency, while any intervening appended record distinguishes the corresponding snapshot-ledger pairs, as demonstrated explicitly by the three-tick deletion-and-reinsertion example. Recurrence applies solely to the fixed-vertex adjacency projection and does not constrain dynamical transition laws. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the logical claims of Finite State Recurrence §1.3.7.
In Plain English:
Machine-checked Lean 4 proofs certify adjacency recurrence on a fixed finite vertex set and separation of snapshot-ledger pairs by intervening records.
1.3.8 Lemma: Supertask Impossibility
Let sequential steps have nonoverlapping physical durations of at least . The number of complete steps in a physical interval of length is bounded by .
In Plain English:
A uniform positive lower bound on step length limits the number of nonoverlapping steps in a finite interval.
1.3.8.1 Proof: Supertask Impossibility
I. Interval Order
Let the physical observation interval be with . The complete steps correspond to ordered intervals
Logical indices count the steps, and the inequalities above concern the stipulated physical durations (Global Logical Time §1.3.3).
II. Adding Step Durations and Gaps
For , write the full length as
For the same inequality holds since .
III. Integer Bound and Exclusion of an Infinite List
Dividing by gives . Since is an integer,
An infinite family would contain distinct intervals. In increasing order of their left endpoints they still satisfy , for , and . The gaps in the duration sum are therefore nonnegative, and
The strict inequality follows from the floor bound and . The contradiction excludes an infinite list of steps (Supertask Impossibility §1.3.8).
Q.E.D.
In Plain English:
Section 1.3.8.1 formalizes the properties of the QBD proof regarding supertask impossibility.
1.3.8.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the sequential step bound and exclusion of unbounded step families established in Supertask Impossibility §1.3.8 proceeds via the following verification strategy:
- Model: Ordered, nonoverlapping natural-number step intervals bounded within a finite observation window and sharing a common positive minimum duration represent sequential physical execution.
- Certified Claims: The module certifies the accumulated duration inequality, the integer quotient upper bound on complete steps, and the impossibility of fitting one more step than that floor bound in Supertask Impossibility §1.3.8.1.
- Scope Boundary: Step endpoints and minimum durations are modeled in discrete natural-number duration units with a stipulated positive lower bound. Real-valued physical durations and dynamical links between logical ticks and elapsed duration remain outside this discrete Core certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
-- Ordered, nonoverlapping intervals with a common minimum duration.
structure OrderedStepIntervals (A B τ m : Nat) where
start : Fin m → Nat
finish : Fin m → Nat
first : ∀ j, j.val = 0 → A ≤ start j
last : ∀ j, j.val + 1 = m → finish j ≤ B
order : ∀ i j, i.val + 1 = j.val → finish i ≤ start j
duration : ∀ j, start j + τ ≤ finish j
-- All step durations fit within the available physical duration.
/-- Each interval end is at least the observation start plus the accumulated duration floors.
Applying the end bound at the last interval gives the result, with zero steps vacuous. -/
theorem supertask_duration_sum {A B τ m : Nat} (_observation : A ≤ B)
(steps : OrderedStepIntervals A B τ m) : m * τ ≤ B - A := by
have accumulated : ∀ (j : Nat) (inRange : j < m), A + (j + 1) * τ ≤ steps.finish ⟨j, inRange⟩ := by
intro j
induction j with
| zero =>
intro inRange
have first := steps.first ⟨0, inRange⟩ rfl
have duration := steps.duration ⟨0, inRange⟩
rw [Nat.one_mul]
omega
| succ j ih =>
intro inRange
let previous : Fin m := ⟨j, Nat.lt_trans (Nat.lt_succ_self j) inRange⟩
let current : Fin m := ⟨j + 1, inRange⟩
have earlier := ih previous.isLt
have gap := steps.order previous current rfl
have duration := steps.duration current
change A + (j + 1) * τ ≤ steps.finish previous at earlier
change A + (j + 1 + 1) * τ ≤ steps.finish current
rw [Nat.succ_mul]
omega
cases m with
| zero => simp
| succ m =>
have finish := steps.last ⟨m, Nat.lt_succ_self m⟩ rfl
have total := accumulated m (Nat.lt_succ_self m)
omega
-- A positive minimum duration bounds the number of sequential steps.
/-- Natural division takes the floor of the available duration divided by the minimum. -/
theorem supertask_step_bound {A B τ m : Nat} (observation : A ≤ B) (positive : 0 < τ)
(steps : OrderedStepIntervals A B τ m) : m ≤ (B - A) / τ :=
(Nat.le_div_iff_mul_le positive).2 (supertask_duration_sum observation steps)
-- One more than the finite step bound cannot fit.
/-- A family with `floor ((B - A) / τ) + 1` steps would violate the duration bound. -/
theorem supertask_impossibility {A B τ : Nat} (observation : A ≤ B) (positive : 0 < τ) :
OrderedStepIntervals A B τ ((B - A) / τ + 1) → False := by
intro steps
exact (Nat.not_succ_le_self _) (supertask_step_bound observation positive steps)
end QBD.Ch01
#print axioms QBD.Ch01.supertask_step_bound
#print axioms QBD.Ch01.supertask_impossibility
Verification Summary:
The machine-checked proofs confirm that sequential nonoverlapping intervals with a positive minimum duration fit at most the integer floor of the observation window divided by that minimum, excluding any family exceeding that bound. The formalization uses natural-number duration units and treats the positive duration floor as an explicit premise. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the discrete execution bounds of Supertask Impossibility §1.3.8.
In Plain English:
Machine-checked Lean 4 proofs certify the floor upper bound on nonoverlapping sequential steps and the impossibility of exceeding it.
1.3.9 Lemma: Finite Capacity of History Encodings
Let inject a family of distinguishable histories into a finite set of states, so . For a comb with its terminating alternatives and final continuing history included in , and for a binary continuing-prefix tree with all depth- histories included in , the respective bounds are
In Plain English:
Section 1.3.9 formalizes the properties of the QBD lemma regarding finite capacity of history encodings.
1.3.9.1 Proof: Finite Capacity of History Encodings
I. Encoding
The histories counted here are distinct records of occurrences (Finite Capacity of History Encodings §1.3.9) (Backward Accumulation §1.3.6).
The image is a subset of the state set, so .
II. Comb
Two alternatives that terminate at different branch points differ at the earlier point, where one continues and the other terminates. The final continuing history also differs from every terminated alternative at its branch point. Hence .
III. Full Continuing Branches
Let be the set of continuing prefixes of depth , with . The single root gives . For , every child has one parent. If counts the continuing children of , then
The induction hypothesis gives . In particular, . The depth- histories are included in , so .
Q.E.D.
In Plain English:
Section 1.3.9.1 formalizes the properties of the QBD proof regarding finite capacity of history encodings.
1.3.9.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the comb and binary-tree capacity bounds established in Finite Capacity of History Encodings §1.3.9 proceeds via the following verification strategy:
- Model: Boolean comb traces indexed by stop position, finite continuing-prefix trees with two distinct children per parent, and injective mappings into a finite state space represent distinguishable history families.
- Certified Claims: The module certifies pairwise distinctness of retained comb traces, exponential level growth of continuing binary prefix trees, and both the linear comb bound and logarithmic binary depth bound in Finite Capacity of History Encodings §1.3.9.1.
- Scope Boundary: Injectivity of the present-state encoding and retention of the specified comb or binary branch alternatives are supplied as explicit premises. Relating branch depth to elapsed logical ticks requires separate dynamical assumptions outside this combinatorial certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
-- A comb trace continues at branch `j` exactly when `j` precedes its stop index.
def combTrace {K : Nat} (stop : Fin (K + 1)) : Fin K → Bool :=
fun branch => decide (branch.val < stop.val)
-- A retained comb history is a trace of one of the possible stop indices.
def CombHistory (K : Nat) := {trace : Fin K → Bool // ∃ stop : Fin (K + 1), trace = combTrace stop}
-- The `K` stops and the final continuing trace are pairwise distinct.
/-- At the earlier of two distinct stop indices, that trace terminates and the other continues. -/
theorem comb_traces_distinct {K : Nat} {i j : Fin (K + 1)} (equal : combTrace i = combTrace j) : i = j := by
have disagree {p q : Fin (K + 1)} (before : p.val < q.val) (same : combTrace p = combTrace q) : False := by
let branch : Fin K := ⟨p.val, by have bound := q.isLt; omega⟩
have atBranch := congrFun same branch
change decide (p.val < p.val) = decide (p.val < q.val) at atBranch
simp [before] at atBranch
rcases Nat.lt_trichotomy i.val j.val with before | same | after
· exact False.elim (disagree before equal)
· exact Fin.ext same
· exact False.elim (disagree after equal.symm)
-- Encoding every retained comb trace requires at least `K + 1` states.
/-- Compose the distinct stop traces with the encoding, then apply finite capacity. -/
theorem comb_history_capacity {K M : Nat} (encode : CombHistory K → Fin M)
(injective : ∀ ⦃i j⦄, encode i = encode j → i = j) : K + 1 ≤ M ∧ K ≤ M - 1 := by
let history (stop : Fin (K + 1)) : CombHistory K := ⟨combTrace stop, ⟨stop, rfl⟩⟩
have states := injective_history_capacity (fun s => encode (history s)) (by
intro i j equal
exact comb_traces_distinct (congrArg Subtype.val (injective equal)))
exact ⟨states, by omega⟩
-- Finite levels of a continuing-prefix tree with two selected children per parent.
structure BinaryPrefixTree (K : Nat) where
levelSize : Nat → Nat
root : levelSize 0 = 1
parent : ∀ j, j < K → Fin (levelSize (j + 1)) → Fin (levelSize j)
children : ∀ j, j < K → Fin (levelSize j) → Fin 2 → Fin (levelSize (j + 1))
parent_of_child : ∀ j (within : j < K) p b, parent j within (children j within p b) = p
distinct_children : ∀ j (within : j < K) p {a b},
children j within p a = children j within p b → a = b
-- Distinct parents and branch choices contribute distinct children.
/-- The parent map recovers the parent index, and within that parent the two children differ. -/
theorem binary_prefix_level_doubles {K : Nat} (tree : BinaryPrefixTree K) {j : Nat} (within : j < K) :
2 * tree.levelSize j ≤ tree.levelSize (j + 1) := by
let parentIndex (i : Fin (2 * tree.levelSize j)) : Fin (tree.levelSize j) :=
⟨i.val / 2, by have bound := i.isLt; omega⟩
let branch (i : Fin (2 * tree.levelSize j)) : Fin 2 := ⟨i.val % 2, by omega⟩
refine injective_history_capacity (fun i => tree.children j within (parentIndex i) (branch i)) ?_
intro i l equal
have sameParent := congrArg (tree.parent j within) equal
rw [tree.parent_of_child, tree.parent_of_child] at sameParent
have sameBranch : branch i = branch l := by
rw [sameParent] at equal
exact tree.distinct_children j within (parentIndex l) equal
have rows : i.val / 2 = l.val / 2 := congrArg Fin.val sameParent
have columns : i.val % 2 = l.val % 2 := congrArg Fin.val sameBranch
exact Fin.ext (by omega)
-- Every level up to the depth has at least the corresponding power of two prefixes.
/-- Start with one root and multiply the lower bound by two at each continuing level. -/
theorem binary_prefix_level_bound {K : Nat} (tree : BinaryPrefixTree K) {j : Nat} (within : j ≤ K) :
2 ^ j ≤ tree.levelSize j := by
induction j with
| zero => rw [tree.root]; exact Nat.le_refl _
| succ j ih =>
rw [Nat.pow_succ, Nat.mul_comm (2 ^ j)]
exact Nat.le_trans (Nat.mul_le_mul_left 2 (ih (Nat.le_of_succ_le within)))
(binary_prefix_level_doubles tree (Nat.lt_of_succ_le within))
-- Encoding all depth-`K` prefixes requires at least `2 ^ K` states.
/-- Depth growth and injective capacity give the power bound, hence the floor-logarithm bound. -/
theorem binary_history_capacity {K M : Nat} (tree : BinaryPrefixTree K)
(encode : Fin (tree.levelSize K) → Fin M)
(injective : ∀ ⦃i j⦄, encode i = encode j → i = j) :
2 ^ K ≤ M ∧ (1 ≤ M → K ≤ Nat.log2 M) := by
have states := Nat.le_trans (binary_prefix_level_bound tree (Nat.le_refl K))
(injective_history_capacity encode injective)
exact ⟨states, fun positive => (Nat.le_log2 (Nat.ne_of_gt positive)).2 states⟩
end QBD.Ch01
#print axioms QBD.Ch01.comb_history_capacity
#print axioms QBD.Ch01.binary_history_capacity
Verification Summary:
The machine-checked proofs establish that encoding all retained comb traces requires at least states and that encoding all depth- prefixes of a continuing binary tree requires at least states, yielding the corresponding linear and logarithmic depth bounds. Relating branch depth to logical time and verifying retention of termination records remain outside this finite counting module. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the branching capacity claims of Finite Capacity of History Encodings §1.3.9.
In Plain English:
Machine-checked Lean 4 proofs certify the linear comb capacity bound and the logarithmic binary prefix-tree depth bound.
1.3.10 Lemma: Departure After an Infinite Hold
Let be a time-homogeneous Markov chain on a countable state space. Then the probability of a departure from a state occupied at every preceding tick is zero.
In Plain English:
A time-homogeneous Markov chain on a countable state space has zero probability of leaving a state it has occupied at every preceding tick.
1.3.10.1 Proof: Departure After an Infinite Hold
I. Probability of a Finite Hold and Departure
Let denote the countable state space and let denote the one-step transition kernel (Departure After an Infinite Hold §1.3.10). Let denote an arbitrary state in , and let denote an arbitrary integer serving as the last holding tick. The next tick is under unit-step indexing (Global Logical Time §1.3.3). Let denote the probability .
Let denote a positive integer. For , define as the event that each listed state equals .
For , let denote . The intersection through index yields
If , the inclusion implies . Conditioning on specifies the successive states from through . The reduction to conditioning on follows from the Markov property. Time homogeneity implies that the resulting conditional probability is . The successive equalities are
If , the inclusion implies . The two cases establish the recurrence for every .
At , the one-term intersection and the convention yield . For , the recurrence and the induction hypothesis yield
In particular, records a hold through tick , and records a hold through the next tick as well. Define as the event of a finite hold followed by departure, namely . The disjoint decomposition of into and and the two induction values yield
II. Probability of an Infinite Hold for a Fixed State and Tick
Define as the event that the chain occupies through every tick up to and departs at .
The intersection is countable. For every , the conditions defining include all holding conditions in and the departure condition at . These conditions imply . Consequently is bounded by in the chain
For and , the factor is zero. For , the factor is zero. The zero upper bound in each case implies .
For , define as . Then and . The binomial expansion yields
with the sum empty at . Taking reciprocals of the positive lower bound yields
For any , the choice of an integer implies . Dividing by this positive denominator yields a bound strictly less than . If were positive, would imply . This contradiction establishes also for .
III. Exhaustion by Finite Sets of States and Ticks
Let denote an injection from into . Its existence follows from countability of . For , define as the set of pairs satisfying both index bounds and define as the union of the corresponding events.
The index condition selects at most states, and the ticks are among , a list of integers. The number of pairs in is bounded by the product . Finite subadditivity and the fixed-pair result yield
The sets are increasing. For any pair , the integer satisfies both membership conditions, which implies . This establishes that every pair appears in the exhaustion.
IV. Probability of Departure at an Arbitrary Tick
Let denote the event of departure from a state held at every preceding tick. Every outcome in specifies a holding state and a last holding tick , which implies membership in and in some . Conversely, every outcome in a belongs to an and satisfies the defining conditions of . The two inclusions establish .
Define as and, for , define as . For , the inclusion implies . Every outcome in some belongs to at its least such index , and every lies in . These inclusions and the pairwise disjointness establish that is the disjoint union of the . The inequalities imply for each . Countable additivity yields
Q.E.D.
In Plain English:
Section 1.3.10.1 formalizes the properties of the QBD proof regarding departure after an infinite hold.
1.3.10.2 Type-Theoretic Validation via Lean 4 and Mathlib
Type-theoretic certification of the zero-probability departure result established in Departure After an Infinite Hold §1.3.10 proceeds via the following verification strategy:
- Model: A probability space with a two-sided integer-indexed process on a countable state space, holding-event intersections, a time-homogeneous holding recurrence, and countable unions over states and ticks represent infinite holds and departures.
- Certified Claims: The module certifies the geometric holding law, the finite-hold departure probability bound, fixed-state and fixed-tick nullity, and countable-union nullity of departure from any infinite hold in Departure After an Infinite Hold §1.3.10.1.
- Scope Boundary: The probability proof starts from the stated time-homogeneous holding recurrence on a countable state space. External schedule changes that violate time homogeneity remain outside this measure-theoretic certificate.
import Mathlib.MeasureTheory.Measure.Typeclasses.Probability
import Mathlib.MeasureTheory.Measure.Real
import Mathlib.Analysis.SpecificLimits.Basic
open MeasureTheory Filter Set
open scoped ENNReal Topology
namespace QBDMathlib.Ch01
variable {Ω S : Type*}
/-- The first `j + 1` observations in the window starting at `s - m`. -/
def holdPrefix (X : ℤ → Ω → S) (x : S) (s : ℤ) (m j : ℕ) : Set Ω :=
⋂ i : Fin (j + 1), {ω | X (s - (m : ℤ) + (i.val : ℤ)) ω = x}
def finiteHoldDeparture (X : ℤ → Ω → S) (x : S) (s : ℤ) (m : ℕ) : Set Ω :=
holdPrefix X x s m m \ holdPrefix X x s m (m + 1)
def infiniteHoldDeparture (X : ℤ → Ω → S) (x : S) (s : ℤ) : Set Ω :=
{ω | (∀ t ≤ s, X t ω = x) ∧ X (s + 1) ω ≠ x}
def someInfiniteHoldDeparture (X : ℤ → Ω → S) : Set Ω :=
{ω | ∃ x s, ω ∈ infiniteHoldDeparture X x s}
variable [MeasurableSpace Ω]
/-- The time-homogeneous Markov holding law on the finite prefixes, including null prefixes. -/
def HoldingRecurrence (μ : Measure Ω) (X : ℤ → Ω → S) (p : S → ℝ) : Prop :=
∀ x s m j, j ≤ m →
μ (holdPrefix X x s m (j + 1)) = ENNReal.ofReal (p x) * μ (holdPrefix X x s m j)
theorem holdPrefix_measure (μ : Measure Ω) {X : ℤ → Ω → S} {p : S → ℝ}
(law : HoldingRecurrence μ X p) (x : S) (s : ℤ) (m j : ℕ) (bound : j ≤ m + 1) :
μ (holdPrefix X x s m j) = ENNReal.ofReal (p x) ^ j * μ (holdPrefix X x s m 0) := by
induction j with
| zero => simp
| succ j ih =>
rw [law x s m j (Nat.le_of_succ_le_succ bound), ih (Nat.le_of_succ_le bound), pow_succ']
rw [mul_assoc]
omit [MeasurableSpace Ω] in
private theorem holdPrefix_succ_subset (X : ℤ → Ω → S) (x : S) (s : ℤ) (m j : ℕ) :
holdPrefix X x s m (j + 1) ⊆ holdPrefix X x s m j := by
intro ω member
refine Set.mem_iInter.mpr fun i => ?_
exact Set.mem_iInter.mp member i.castSucc
omit [MeasurableSpace Ω] in
private theorem infinite_subset_finite (X : ℤ → Ω → S) (x : S) (s : ℤ) (m : ℕ) :
infiniteHoldDeparture X x s ⊆ finiteHoldDeparture X x s m := by
rintro ω ⟨held, departed⟩
constructor
· refine Set.mem_iInter.mpr fun i => ?_
change X (s - (m : ℤ) + (i.val : ℤ)) ω = x
have hi := i.isLt
exact held _ (by omega)
· intro member
have last := Set.mem_iInter.mp member (Fin.last (m + 1))
change X (s - (m : ℤ) + ((m + 1 : ℕ) : ℤ)) ω = x at last
have tick : s - (m : ℤ) + ((m + 1 : ℕ) : ℤ) = s + 1 := by omega
exact departed (by simpa only [tick] using last)
variable [MeasurableSpace S] [MeasurableSingletonClass S]
theorem finite_hold_departure_measure_le (μ : Measure Ω) [IsProbabilityMeasure μ]
{X : ℤ → Ω → S} (measurableX : ∀ t, Measurable (X t)) {p : S → ℝ}
(law : HoldingRecurrence μ X p) (x : S) (s : ℤ) (m : ℕ) (p₀ : 0 ≤ p x) (p₁ : p x ≤ 1) :
μ (finiteHoldDeparture X x s m) ≤ ENNReal.ofReal (p x ^ m * (1 - p x)) := by
have prefixMeasurable (j : ℕ) : MeasurableSet (holdPrefix X x s m j) :=
MeasurableSet.iInter fun i => (measurableSet_singleton x).preimage (measurableX _)
have prefixReal (j : ℕ) (hj : j ≤ m + 1) :
μ.real (holdPrefix X x s m j) = (p x) ^ j * μ.real (holdPrefix X x s m 0) := by
simpa [measureReal_def, ENNReal.toReal_mul, ENNReal.toReal_pow, ENNReal.toReal_ofReal p₀] using
congrArg ENNReal.toReal (holdPrefix_measure μ law x s m j hj)
have nonneg : 0 ≤ p x ^ m * (1 - p x) := mul_nonneg (pow_nonneg p₀ _) (sub_nonneg.mpr p₁)
apply (ENNReal.le_ofReal_iff_toReal_le (measure_ne_top μ _) nonneg).2
change μ.real (finiteHoldDeparture X x s m) ≤ _
rw [finiteHoldDeparture, measureReal_sdiff (holdPrefix_succ_subset X x s m m) (prefixMeasurable _),
prefixReal m (Nat.le_succ _), prefixReal (m + 1) le_rfl]
calc
_ = (p x ^ m * (1 - p x)) * μ.real (holdPrefix X x s m 0) := by rw [pow_succ]; ring
_ ≤ _ := mul_le_of_le_one_right nonneg measureReal_le_one
theorem infinite_hold_departure_at_null (μ : Measure Ω) [IsProbabilityMeasure μ]
{X : ℤ → Ω → S} (measurableX : ∀ t, Measurable (X t)) {p : S → ℝ}
(law : HoldingRecurrence μ X p) (x : S) (s : ℤ) (p₀ : 0 ≤ p x) (p₁ : p x ≤ 1) :
μ (infiniteHoldDeparture X x s) = 0 := by
have bounded (m : ℕ) :
μ (infiniteHoldDeparture X x s) ≤ ENNReal.ofReal (p x ^ m * (1 - p x)) :=
(measure_mono (infinite_subset_finite X x s m)).trans
(finite_hold_departure_measure_le μ measurableX law x s m p₀ p₁)
rcases eq_or_lt_of_le p₀ with zero | positive
· exact nonpos_iff_eq_zero.mp (by simpa [← zero] using bounded 1)
rcases eq_or_lt_of_le p₁ with one | subunit
· exact nonpos_iff_eq_zero.mp (by simpa [one] using bounded 0)
have decay : Tendsto (fun m : ℕ => p x ^ m * (1 - p x)) atTop (𝓝 0) := by
simpa only [zero_mul] using (tendsto_pow_atTop_nhds_zero_of_lt_one positive.le subunit).mul_const (1 - p x)
have decayMeasure : Tendsto (fun m : ℕ => ENNReal.ofReal (p x ^ m * (1 - p x))) atTop (𝓝 0) := by
simpa only [Function.comp_def, ENNReal.ofReal_zero] using
(ENNReal.continuous_ofReal.tendsto 0).comp decay
exact nonpos_iff_eq_zero.mp (ge_of_tendsto decayMeasure (Eventually.of_forall bounded))
/-- A countable union over states and departure ticks exhausts the event. -/
theorem departure_after_infinite_hold [Countable S] (μ : Measure Ω) [IsProbabilityMeasure μ]
{X : ℤ → Ω → S} (measurableX : ∀ t, Measurable (X t)) {p : S → ℝ}
(law : HoldingRecurrence μ X p) (pBounds : ∀ x, 0 ≤ p x ∧ p x ≤ 1) :
μ (someInfiniteHoldDeparture X) = 0 := by
have exhaust : someInfiniteHoldDeparture X = ⋃ xs : S × ℤ, infiniteHoldDeparture X xs.1 xs.2 := by
ext ω
simp only [someInfiniteHoldDeparture, Set.mem_ofPred_eq, Set.mem_iUnion, Prod.exists]
rw [exhaust]
exact measure_iUnion_null fun ⟨x, s⟩ =>
infinite_hold_departure_at_null μ measurableX law x s (pBounds x).1 (pBounds x).2
end QBDMathlib.Ch01
#print axioms QBDMathlib.Ch01.holdPrefix_measure
#print axioms QBDMathlib.Ch01.finite_hold_departure_measure_le
#print axioms QBDMathlib.Ch01.infinite_hold_departure_at_null
#print axioms QBDMathlib.Ch01.departure_after_infinite_hold
Verification Summary:
The machine-checked proofs establish the geometric holding recurrence, prove that finite-hold departure probabilities vanish asymptotically for every state and tick, and apply countable subadditivity to certify measure zero for departure after any infinite hold. Time-inhomogeneous transition laws remain outside this formalization. The Lean 4 and Mathlib kernel accepts all closed proof terms using only standard axioms, certifying the measure-theoretic claims of Departure After an Infinite Hold §1.3.10.
In Plain English:
Section 1.3.10.2 formalizes the corresponding Chapter 1 statement.
1.3.11 Proof: Temporal Finitude
I. Identification of the Count
Let denote the histories distinguished at observation and the possible present states. The injective encoding implies
For one-tick extensions of a fixed past, let denote the distinct extensions from the frozen snapshot . Under the trial hypotheses of Finite Information Substrate §1.3.5, each trial list in determines one extension and . Thus
Under the hypotheses of Finite State Recurrence §1.3.7, let index a pair with . If a record is added between these observations, then . For histories distinguished by their occurrence sets, equality of their adjacency images therefore precludes an injective encoding by adjacency alone.
II. Branch Depth
The two counting cases give (Finite Capacity of History Encodings §1.3.9)
If unbounded candidate past length forces unbounded , the uniform bound on excludes unbounded candidate past length.
In the active-tick case, assume a two-sided time-homogeneous Markov chain of snapshots on fixed finite with irreflexive asymmetric adjacency, natural-number edge labels, insertions of absent pairs, deletions of present pairs, unchanged labels on surviving edges, and a complete append-only ledger recording exactly one fresh occurrence per insertion.
The active-tick case uses the occurrence bound in Backward Accumulation §1.3.6. On a fixed -vertex set with an asymmetric irreflexive adjacency, each unordered pair carries at most one edge. On a realization with a finite complete observation ledger of size , the ledger at the start of any preceding finite interval is a subset of the observation ledger. Thus every preceding finite interval ending at that observation satisfies
If the prior history contained more than active ticks, a finite interval beginning at the earliest of any of them and ending at observation would violate the bound. Thus the set of prior active ticks is finite. If it is nonempty, let denote its least tick.
For tick , let denote the inserted pairs and the deleted pairs. The edit hypotheses imply
For every , implies . The fixed vertex set and unchanged surviving labels establish . Chaining the equalities from up to gives for every . On tick , the update and disjointness conditions give
At least one of is nonempty, so and hence . There are finitely many possible edge sets on the fixed vertex set, and the height assignments for each edge set form a finite product of countable sets. The snapshot state space is therefore countable. The event of a finite complete ledger and a nonempty active past is contained in the event of departure after an infinite hold for this time-homogeneous chain. Its probability is zero (Departure After an Infinite Hold §1.3.10).
III. Physical Execution
For an execution of complete sequential steps in a finite physical interval the separate duration premise gives (Supertask Impossibility §1.3.8)
Q.E.D.
In Plain English:
Section 1.3.11 formalizes the properties of the QBD proof regarding temporal finitude.
1.3.11.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the finitary assembly and schedule contradiction established in Temporal Finitude §1.3.4 proceeds via the following verification strategy:
- Model: The assembly module imports the five certified Chapter 1 finiteness, ledger, recurrence, supertask, and branching-capacity modules alongside a zero-indexed consistency structure for the accumulating Grim Reaper schedule.
- Certified Claims: The module assembles the finite injective history bound, the linear comb depth bound, and the logarithmic binary prefix-tree depth bound of Temporal Finitude §1.3.4, and certifies the logical unsatisfiability of the Grim Reaper schedule in Temporal Finitude §1.3.11.
- Scope Boundary: Present-state encoding injectivity and the schedule consistency premises are supplied as discrete hypotheses. Real-analytic entropy concavity remains outside this Core module, while the measure-theoretic departure result of Departure After an Infinite Hold §1.3.10 is certified separately via Lean 4 and Mathlib in its companion validation.
import QBD.Ch01.L1_3_5_FiniteInformationSubstrate
import QBD.Ch01.L1_3_6_BackwardAccumulation
import QBD.Ch01.L1_3_7_FiniteStateRecurrence
import QBD.Ch01.L1_3_8_SupertaskImpossibility
import QBD.Ch01.L1_3_9_FiniteHistoryCapacity
namespace QBD.Ch01
-- The finite-capacity conclusions of Theorem 1.3.4 at a fixed state count.
structure TemporalFinitude (M : Nat) : Prop where
histories : ∀ {h : Nat} (encode : Fin h → Fin M),
(∀ ⦃i j⦄, encode i = encode j → i = j) → h ≤ M
comb : ∀ {K : Nat} (encode : CombHistory K → Fin M),
(∀ ⦃i j⦄, encode i = encode j → i = j) → K + 1 ≤ M ∧ K ≤ M - 1
binary : ∀ {K : Nat} (tree : BinaryPrefixTree K) (encode : Fin (tree.levelSize K) → Fin M),
(∀ ⦃i j⦄, encode i = encode j → i = j) → 2 ^ K ≤ M ∧ (1 ≤ M → K ≤ Nat.log2 M)
-- Theorem 1.3.4, assembled from finite capacity and the two branch counts.
/-- An injective present-state encoding bounds arbitrary histories, the comb depth, and the
full continuing binary depth by their respective capacity inequalities. -/
theorem temporal_finitude (M : Nat) : TemporalFinitude M :=
⟨injective_history_capacity, comb_history_capacity, binary_history_capacity⟩
-- The zero-indexed action rule for the accumulating Grim Reaper schedule.
structure GrimReaperConsistency (acts : Nat → Bool) : Prop where
none_forces_first : (∀ n, acts n = false) → acts 0 = true
action_rules : ∀ n, acts n = true →
(∀ m, n < m → acts m = false) ∧ ((∀ m, n + 1 < m → acts m = false) → acts (n + 1) = true)
-- No schedule satisfies the two action consistency conditions.
/-- Any action both forbids and forces the next indexed action. This makes all actions false,
which in turn forces the first action. -/
theorem grim_reaper_unsatisfiable : ¬ ∃ acts : Nat → Bool, GrimReaperConsistency acts := by
intro ⟨acts, consistent⟩
have none (n : Nat) : acts n = false := by
cases action : acts n with
| false => rfl
| true =>
obtain ⟨earlierNone, successorMustAct⟩ := consistent.action_rules n action
have forbidden := earlierNone (n + 1) (Nat.lt_succ_self n)
have forced := successorMustAct (fun m earlier => earlierNone m (Nat.lt_trans (Nat.lt_succ_self n) earlier))
rw [forbidden] at forced
contradiction
have forced := consistent.none_forces_first none
rw [none 0] at forced
contradiction
end QBD.Ch01
#print axioms QBD.Ch01.temporal_finitude
#print axioms QBD.Ch01.grim_reaper_unsatisfiable
Verification Summary:
The machine-checked proofs assemble the finite capacity inequalities for general, comb, and continuing binary history encodings directly from the per-lemma modules and establish that no zero-indexed action sequence satisfies the Grim Reaper consistency rules. Real-analytic entropy claims remain outside this discrete Core formalization, while the two-sided Markov departure result of Departure After an Infinite Hold §1.3.10 is certified separately via Lean 4 and Mathlib in its companion validation. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the assembled finitary claims of Temporal Finitude §1.3.11.
In Plain English:
Machine-checked Lean 4 proofs assemble the finitary capacity bounds of Temporal Finitude from per-lemma modules and certify Grim Reaper unsatisfiability.
1.4.1 Definition: Causal Graph Substrate
Let the Causal Graph Substrate at logical tick be the active spatial configuration , where is a fixed finite vertex set, is irreflexive and asymmetric, and records immutable causal heights of the active edge occurrences. Directed spatial cycles are permitted; the chronological order belongs to the distinct creation-event structure.
A creation occurrence is a record with birth tick and causal height . At most one occurrence of a given ordered pair is created per tick. The active-occurrence map identifies the current record and satisfies . The creation ledger retains past occurrences after active deletion (Historical Category §4.1.2).
Lean 4 (QBD.Ch01.Defs):
/-- An edge creation record, with separate birth tick and causal height. -/
structure CreationOccurrence (N : Nat) where
edge : Edge (AbstractEvent N)
birth : LogicalTime
height : Nat
deriving DecidableEq
/-- §1.4.1 The active graph, its birth coordinates, and the retained creation ledger. -/
structure CausalGraphSubstrate (N : Nat) where
tick : LogicalTime
snapshot : TimestampedGraph (AbstractEvent N)
activeBirth : Edge (AbstractEvent N) → LogicalTime
ledger : List (CreationOccurrence N)
In Plain English:
The snapshot stores active directed pairs and heights. A separate ledger retains the creation occurrences.
1.4.2 Definition: Abstract Event
Let be a finite set of vertices, where each element is an Abstract Event. An abstract event is a structureless vertex that persists across snapshots and represents the intersection of causal influences. It possesses no intrinsic coordinates, spatial volume, or physical attributes independent of its incidence relations within the edge set .
Lean 4 (QBD.Ch01.Defs):
/-- §1.4.2 A persistent abstract event in a fixed ambient vertex type. -/
abbrev AbstractEvent (N : Nat) := Fin N
In Plain English:
An abstract event is a vertex that identifies an incidence site across snapshots.
1.4.3 Definition: Causal Relation
Let be a set of directed edges, where each ordered pair is a Causal Relation. An edge represents a direct active link from source vertex to target vertex . The relation is strictly asymmetric, satisfying:
Lean 4 (QBD.Ch01.Defs):
/-- §1.4.3 A causal relation is an ordered pair present in the active graph. -/
abbrev CausalRelation {N : Nat} (G : CausalGraphSubstrate N) :=
{e : Edge (AbstractEvent N) // G.snapshot.E e = true}
In Plain English:
A causal relation is an oriented pair in the active graph. Historical precedence is defined on creation occurrences.
1.4.4 Definition: Creation Timestamp
Let the Creation Timestamp denote the causal height of the active occurrence of , distinct from its scheduler birth tick . For a new edge inserted during the transition from tick to tick , its height is
Existing occurrences retain their assigned heights. The initial substrate has . A deleted pair recreated later receives a new occurrence identifier even if its newly computed height equals an earlier height. The birth tick and height are both immutable coordinates of an occurrence; neither is a replacement for the other.
Lean 4 (QBD.Ch01.Defs):
/-- §1.4.4 The height of the active occurrence of a causal relation. -/
def creationTimestamp {N : Nat} (G : CausalGraphSubstrate N) (e : CausalRelation G) : Nat :=
G.snapshot.H e.val
/-- §1.4.4 Height assigned to a new edge from `source`, using the input snapshot. -/
def newCreationHeight {N : Nat} (G : TimestampedGraph (AbstractEvent N))
(source : AbstractEvent N) : Nat :=
1 + G.incomingMaximum source
In Plain English:
The creation timestamp is a height assigned from the incoming edges in the creation snapshot. The birth tick is recorded separately.
1.4.5 Theorem: Monotonicity of History
Let creation heights satisfy the source-side recurrence and let mean that the edge occurrence is an incoming edge of the source of in the snapshot used to create . Then is an irreflexive transitive relation on creation occurrences and every -chain has strictly increasing heights; active spatial walks need not have increasing heights (Creation Timestamp §1.4.4).
In Plain English:
Creation dependencies form a well-founded strict partial order. The recurrence gives the smallest admissible causal height at each occurrence.
1.4.6 Lemma: Irreflexivity of Timestamps
Let be a self-loop incident to a vertex in a graph . The recursive timestamp assignment is inconsistent and admits no stable timestamp assignment.
In Plain English:
A self-loop cannot satisfy a stable height equation in which its own height is an input to its assignment.
1.4.6.1 Proof: Irreflexivity of Timestamps
I. Fixed-Point Equation for a Self-Loop
Let and suppose a stable timestamp satisfies the stated recurrence (Irreflexivity of Timestamps §1.4.6). Put
with the timestamp rule fixed above (Creation Timestamp §1.4.4). The self-loop is incoming to , because its target is :
II. Maximum Bound and Contradiction
Membership in gives . Substituting from the recurrence gives
which is false. Equivalently,
The contradiction applies to every candidate finite value .
III. Pre-Insertion Value and Re-Evaluation
Let be the maximum on the incoming edges before insertion. A provisional assignment gives the new incoming maximum
because . Re-evaluation of the same recurrence then requires
The post-insertion update map is . Its increment satisfies
The iteration formula holds at . If it holds at , then
Thus no finite provisional value is a fixed point:
Q.E.D.
In Plain English:
Section 1.4.6.1 formalizes the properties of the QBD proof regarding irreflexivity of timestamps.
1.4.6.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the self-loop fixed-point obstruction and re-evaluation divergence established in Irreflexivity of Timestamps §1.4.6 proceeds via the following verification strategy:
- Model: Attained incoming height maxima on active edge predicates, the post-insertion re-evaluation map with fixed pre-insertion maximum, iterated re-evaluation sequences, and strict causal monotonicity over reachability represent self-loop timestamp instability.
- Certified Claims: The module certifies the absence of any stable incoming self-loop timestamp, the nonexistence of any finite fixed point for the post-insertion equation, the exact linear divergence of re-evaluation iterates, and irreflexivity of transitive dependency reachability in Irreflexivity of Timestamps §1.4.6.1.
- Scope Boundary: The attained incoming maximum and strict monotonicity relations are supplied as abstract premises. Enforcement of self-loop rejection by the concrete graph constructor remains outside this algebraic obstruction certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
universe u
variable {Ω : Type u}
-- Post-insertion re-evaluation with the pre-insertion maximum held fixed.
def Ψ (m₀ h : Nat) : Nat := 1 + max m₀ h
-- Repeated re-evaluation from the provisional height.
def reEvalHeight (m₀ : Nat) : Nat → Nat
| 0 => m₀ + 1
| j + 1 => Ψ m₀ (reEvalHeight m₀ j)
-- The fixed-point obstruction from the incoming-height bound.
/-- A self-loop's height is bounded by the incoming maximum and cannot equal its successor. -/
theorem no_stable_self_loop_timestamp (h m : Nat) : ¬ (h ≤ m ∧ h = 1 + m) := by
intro ⟨bound, recurrence⟩
rw [recurrence, Nat.add_comm 1 m] at bound
exact Nat.not_lt_of_ge bound (Nat.lt_succ_self m)
-- A self-loop contributes its own timestamp to the incoming maximum.
/-- When the active pair `(v, v)` belongs to the snapshot, its recursive incoming-maximum
timestamp equation has no solution at an attained maximum of that snapshot. -/
theorem no_stable_incoming_self_loop_timestamp {V : Type u}
(active : V × V → Prop) (height : V × V → Nat) (v : V) (m : Nat)
(loop : active (v, v))
(maximum : AttainedHeightMaximum (fun e => active e ∧ e.2 = v) height m) :
height (v, v) ≠ 1 + m := by
intro recurrence
exact no_stable_self_loop_timestamp (height (v, v)) m
⟨maximum.1 (v, v) ⟨loop, rfl⟩, recurrence⟩
-- At least one unit of increase on each re-evaluation.
/-- The post-insertion maximum includes the candidate height, so re-evaluation adds at least one. -/
theorem re_eval_strict_increase (m₀ h : Nat) : h + 1 ≤ Ψ m₀ h := by
unfold Ψ
rw [Nat.add_comm 1 (max m₀ h)]
exact Nat.succ_le_succ (Nat.le_max_right m₀ h)
-- Re-evaluation grows by at least one even when expressed as a difference.
/-- Subtracting the current height from the new height leaves at least one unit of increase. -/
theorem re_eval_increment (m₀ h : Nat) : 1 ≤ Ψ m₀ h - h := by
exact Nat.le_sub_of_add_le (by rw [Nat.add_comm]; exact re_eval_strict_increase m₀ h)
-- The post-insertion equation has no fixed point.
/-- For every pre-insertion maximum, no candidate satisfies `h = 1 + max m₀ h`. -/
theorem no_stable_post_insertion_timestamp (m₀ h : Nat) : Ψ m₀ h ≠ h := by
exact Nat.ne_of_gt (re_eval_strict_increase m₀ h)
-- No finite timestamp solves the explicit post-insertion equation.
/-- For every pre-insertion maximum `m₀`, the equation `h = 1 + max m₀ h` has no solution. -/
theorem no_post_insertion_solution (m₀ : Nat) : ¬ ∃ h : Nat, h = 1 + max m₀ h := by
intro ⟨h, equation⟩
exact no_stable_post_insertion_timestamp m₀ h equation.symm
-- Exact re-evaluation height after any number of steps.
/-- Starting at `m₀ + 1`, the iterate stays above `m₀` and grows by exactly one per step. -/
theorem re_eval_iterate_formula (m₀ j : Nat) : reEvalHeight m₀ j = m₀ + j + 1 := by
induction j with
| zero => rfl
| succ j ih =>
have bound : m₀ ≤ m₀ + j + 1 := Nat.le_trans (Nat.le_add_right m₀ j) (Nat.le_succ _)
rw [reEvalHeight, ih, Ψ, Nat.max_eq_right bound, Nat.add_comm 1]
exact congrArg (· + 1) (Nat.add_assoc m₀ j 1)
/-- Strict heights obstruct a return to the same occurrence. -/
theorem dependency_irreflexive {D : Ω → Ω → Prop} {h : Ω → Nat}
(strict : StrictCausalMonotonicity D h) (ω : Ω) : ¬ Reachable D ω ω :=
strict.dag ω
end QBD.Ch01
#print axioms QBD.Ch01.no_stable_incoming_self_loop_timestamp
#print axioms QBD.Ch01.no_post_insertion_solution
#print axioms QBD.Ch01.re_eval_iterate_formula
#print axioms QBD.Ch01.dependency_irreflexive
Verification Summary:
The machine-checked proofs establish that a self-loop cannot satisfy the recursive incoming-maximum timestamp equation, that post-insertion re-evaluation diverges linearly without a finite fixed point, and that strict causal monotonicity enforces irreflexivity of dependency reachability. Concrete constructor rejection mechanics remain outside this algebraic certificate. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the logical claims of Irreflexivity of Timestamps §1.4.6.
In Plain English:
Machine-checked Lean 4 proofs certify the self-loop timestamp fixed-point obstruction, linear re-evaluation divergence, and dependency irreflexivity.
1.4.7 Lemma: Transitive Causal Monotonicity
Let be a sequentially instantiated causal chain whose occurrence of remains incoming to the source when is created, for each . Then , and for the endpoint bound is (Creation Timestamp §1.4.4).
In Plain English:
Heights increase along chains whose earlier occurrences are active predecessors at the creation of the next occurrence.
1.4.7.1 Proof: Transitive Causal Monotonicity
I. Predecessor Membership at Creation
Let be the occurrence of and put . The sequential-chain hypothesis means that, when is created from a snapshot , its source is the target of and is still present there. Consequently
II. Consecutive Inequality
The source-side recurrence (Creation Timestamp §1.4.4) therefore gives
Here the set in the maximum ranges over the incoming edges of that source in the creation snapshot. Both the membership and the maximum refer to that same snapshot.
III. Induction on the Chain
For , . If , then
Induction proves for all . For , the consecutive increments telescope:
Thus for every ordered pair of distinct positions. This establishes the sequential-chain claim (Transitive Causal Monotonicity §1.4.7).
IV. Conclusion
Q.E.D.
In Plain English:
Section 1.4.7.1 formalizes the properties of the QBD proof regarding transitive causal monotonicity.
1.4.7.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the sequential chain bounds and transitive height increase established in Transitive Causal Monotonicity §1.4.7 proceeds via the following verification strategy:
- Model: Finite direct dependency chains, local creation-snapshot recurrence predicates, birth-ordered source-maximum heights, and admissible integer labelings over the nonempty transitive dependency closure represent chronological ordering along causal chains.
- Certified Claims: The module certifies the position-difference height lower bound, strict monotonicity between ordered chain positions, the end-to-end height increment bound for chains of length at least two, and strict height increase along nonempty transitive dependency paths in Transitive Causal Monotonicity §1.4.7.1.
- Scope Boundary: Direct predecessor membership in each creation snapshot and the source-maximum recurrence are supplied as structural premises. Spatial walks whose edges were created out of chronological sequence lie outside this dependency-order certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
universe u
variable {Ω : Type u}
-- The local creation recurrence for consecutive occurrences in a finite chain.
def ChainCreationRecurrence {k : Nat} (D : Ω → Ω → Prop) (chain : Fin k → Ω)
(h : Ω → Nat) : Prop :=
∀ (i : Nat) (next : i + 1 < k),
let predecessor := chain ⟨i, Nat.lt_trans (Nat.lt_succ_self i) next⟩
let successor := chain ⟨i + 1, next⟩
D predecessor successor ∧
∃ m : Nat, AttainedHeightMaximum (fun ω => D ω successor) h m ∧ h successor = 1 + m
-- Consecutive occurrences are direct dependencies in their creation snapshots.
def DirectDependencyChain {k : Nat} (D : Ω → Ω → Prop) (chain : Fin k → Ω) : Prop :=
∀ (i : Nat) (next : i + 1 < k),
D (chain ⟨i, Nat.lt_trans (Nat.lt_succ_self i) next⟩) (chain ⟨i + 1, next⟩)
-- A per-step increment accumulates between any two positions in a chain.
/-- Induction on the later index gives a lower bound equal to the distance between positions. -/
private theorem chain_height_distance_bound {k : Nat} {D : Ω → Ω → Prop}
{chain : Fin k → Ω} {h : Ω → Nat}
(creation : ChainCreationRecurrence D chain h) (i : Fin k) :
∀ (j : Nat) (inRange : j < k), i.val ≤ j →
h (chain i) + (j - i.val) ≤ h (chain ⟨j, inRange⟩) := by
intro j
induction j with
| zero =>
intro inRange order
have same : i = (⟨0, inRange⟩ : Fin k) := Fin.ext (Nat.eq_zero_of_le_zero order)
subst i
exact Nat.le_refl _
| succ j ih =>
intro inRange order
by_cases same : i.val = j + 1
· have sameIndex : i = (⟨j + 1, inRange⟩ : Fin k) := Fin.ext same
rw [sameIndex, Nat.sub_self, Nat.add_zero]
exact Nat.le_refl _
· have before : i.val ≤ j := Nat.le_of_lt_succ (Nat.lt_of_le_of_ne order same)
have earlier := ih (Nat.lt_trans (Nat.lt_succ_self j) inRange) before
obtain ⟨predecessor, m, maximum, recurrence⟩ := creation j inRange
have step : h (chain ⟨j, Nat.lt_trans (Nat.lt_succ_self j) inRange⟩) + 1 ≤
h (chain ⟨j + 1, inRange⟩) := by
rw [recurrence, Nat.add_comm 1 m]
exact Nat.succ_le_succ (maximum.1 _ predecessor)
rw [Nat.succ_sub before]
change h (chain i) + ((j - i.val) + 1) ≤ h (chain ⟨j + 1, inRange⟩)
rw [← Nat.add_assoc]
exact Nat.le_trans (Nat.succ_le_succ earlier) step
-- The lower bound at every position relative to the first occurrence.
/-- The height at position `j` is at least the initial chain height plus `j`. -/
theorem chain_height_lower_bound {k : Nat} {D : Ω → Ω → Prop} {chain : Fin k → Ω} {h : Ω → Nat}
(creation : ChainCreationRecurrence D chain h) (nonempty : 0 < k) (j : Fin k) :
h (chain ⟨0, nonempty⟩) + j.val ≤ h (chain j) :=
chain_height_distance_bound creation ⟨0, nonempty⟩ j.val j.isLt (Nat.zero_le _)
-- The distance bound and strict increase between distinct ordered positions.
/-- Positions `i < j` are separated by at least `j - i` height units. -/
theorem chain_height_strict_mono {k : Nat} {D : Ω → Ω → Prop} {chain : Fin k → Ω} {h : Ω → Nat}
(creation : ChainCreationRecurrence D chain h) {i j : Fin k} (order : i < j) :
h (chain i) + (j.val - i.val) ≤ h (chain j) ∧ h (chain i) < h (chain j) := by
have distance := chain_height_distance_bound creation i j.val j.isLt (Nat.le_of_lt order)
have positive : 0 < j.val - i.val := Nat.sub_pos_of_lt order
exact ⟨distance, Nat.lt_of_lt_of_le (Nat.lt_add_of_pos_right positive) distance⟩
-- The endpoint bound for a chain of at least two occurrences.
/-- A chain of `k` occurrences increases its height by at least `k - 1` from end to end. -/
theorem chain_height_endpoint_bound {k : Nat} {D : Ω → Ω → Prop} {chain : Fin k → Ω} {h : Ω → Nat}
(creation : ChainCreationRecurrence D chain h) (two : 2 ≤ k) :
let first : Fin k := ⟨0, Nat.lt_of_lt_of_le (by decide : 0 < 2) two⟩
let last : Fin k := ⟨k - 1, Nat.sub_lt (Nat.lt_of_lt_of_le (by decide : 0 < 2) two)
(Nat.zero_lt_succ 0)⟩
h (chain first) + k - 1 ≤ h (chain last) := by
dsimp
have positive := Nat.lt_of_lt_of_le (by decide : 0 < 2) two
rw [Nat.add_sub_assoc (Nat.succ_le_of_lt positive)]
exact chain_height_lower_bound creation positive
⟨k - 1, Nat.sub_lt positive (Nat.zero_lt_succ 0)⟩
-- The source-maximum specification supplies the recurrence along a direct dependency chain.
/-- Each successor with a direct predecessor is born at a positive tick, where the shifted
specification yields the attained incoming maximum used by the chain bounds. -/
theorem source_max_chain_creation {k : Nat} {birth : Ω → Nat} {D : Ω → Ω → Prop}
{chain : Fin k → Ω} {h : Ω → Nat} (birthRules : CausalBirthRules birth D)
(source : SourceMaximumHeight birth D h) (dependencies : DirectDependencyChain D chain) :
ChainCreationRecurrence D chain h := by
intro i next
have predecessor := dependencies i next
have later := Nat.lt_of_le_of_lt (Nat.zero_le _) (birthRules.predecessor_earlier predecessor)
exact ⟨predecessor, (source_max_shifted_iff D h _).2 (source.2 _ later)⟩
/-- Admissible heights increase along the nonempty transitive closure. -/
theorem dplus_height_strict_increase {birth : Ω → Nat} {D : Ω → Ω → Prop} {h : Ω → Nat}
(admissible : AdmissibleLabeling birth D h) {ω η : Ω} (path : Reachable D ω η) : h ω < h η :=
have strict : StrictCausalMonotonicity D h := fun _ _ step => admissible.2 _ _ step
strict.onReachable path
end QBD.Ch01
#print axioms QBD.Ch01.chain_height_strict_mono
#print axioms QBD.Ch01.chain_height_endpoint_bound
#print axioms QBD.Ch01.dplus_height_strict_increase
Verification Summary:
The machine-checked proofs confirm that heights along any sequentially instantiated dependency chain increase by at least one unit per step, yielding both strict monotonicity and the end-to-end length bound, and that every admissible labeling strictly increases along the nonempty transitive closure of dependencies. Non-chronological spatial walks remain outside this dependency-chain module. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the logical claims of Transitive Causal Monotonicity §1.4.7.
In Plain English:
Machine-checked Lean 4 proofs certify step-by-step and end-to-end height bounds along direct dependency chains and strict increase along transitive paths.
1.4.8 Lemma: Least Admissible Causal Height
Let an integer labeling of the creation occurrences be admissible if its values are at least zero on initial occurrences and at least one on later occurrences, and whenever . Then the source-maximum height with zero initialization is the pointwise least admissible labeling (Creation Timestamp §1.4.4).
In Plain English:
Every labeling that respects the birth-height bounds and increases by at least one across direct dependencies is at least as large as the source-maximum height at each occurrence.
1.4.8.1 Proof: Least Admissible Causal Height
I. Direct Predecessors and the Source-Maximum Formula
Let denote the set of direct predecessors of an occurrence . An initial occurrence has birth tick zero and height zero (Creation Timestamp §1.4.4). A direct predecessor must be present in the input snapshot of the transition creating its successor. The initial snapshot is stipulated, which implies that no transition creates its initial occurrences. The dependency definition then yields when .
For a later occurrence with , the transition creating it uses . Let denote the set of incoming pairs of its source in that snapshot. By the definition of , a predecessor of is precisely the active occurrence of one such pair. The active-occurrence map yields (Causal Graph Substrate §1.4.1)
The common second coordinate implies that distinct pairs in have distinct first coordinates. Projection onto the first coordinate is injective into the finite set . The image under has at most one entry per pair in , which implies . Activity of each at tick implies that it was born by that tick and yields
For every , the equality follows from the definition of the active height. Substitution into the source-maximum rule and use of the displayed description of yield
Let denote , and let denote . Finiteness of and membership of zero imply that belongs to . For every , implies . Membership of in implies membership of in the shifted set . The attained upper bound yields
The last equality uses the shift of to and the shift of each predecessor height to .
II. Verification of the Admissibility Conditions
At birth tick zero, and establish the initial floor . At every later tick, membership of in the set whose maximum equals implies .
If , then , and is a later occurrence. Membership of in the same set yields
The initial floor, the later floor, and the direct-dependency inequality establish admissibility of .
III. Pointwise Comparison by Strong Induction
Let denote an arbitrary admissible labeling. For each , the induction assertion is
At , initialization implies for every occurrence with . The initial floor for yields
Let denote a positive birth tick. Assume the assertion for every birth tick . Let denote an arbitrary occurrence with . The later floor for implies . For any , let denote . The comparison from Part I establishes . The induction hypothesis at yields . Adding one to both sides and using admissibility across yields
Every member of is bounded by from above. Its maximum belongs to the set and equals . The bound on that member establishes at tick . When there are no predecessors, the set is and the same bound yields .
If the assertion failed at any tick, its failing ticks would form a nonempty subset of with a least element. The base case excludes zero. At any positive least failing tick, the assertion holds at every smaller tick. The induction step then implies that the assertion holds at the supposed failing tick. This contradiction establishes the assertion at every birth tick.
IV. Least Admissible Labeling
Let denote the set of admissible labelings. Membership follows from Part II. Part III applies to each , and every occurrence has a birth tick in . These facts yield
These are the membership and comparison conditions for to be the pointwise least element of .
Q.E.D.
In Plain English:
Section 1.4.8.1 formalizes the properties of the QBD proof regarding least admissible causal height.
1.4.8.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the pointwise minimality and uniqueness claims established in Least Admissible Causal Height §1.4.8 proceeds via the following verification strategy:
- Model: Birth-ordered causal dependency relations, zero-initialized source-maximum height labelings, admissible integer labelings, and the concrete incoming-maximum insertion height on finite timestamped graphs represent minimal causal height assignment.
- Certified Claims: The module certifies that the source-maximum recurrence yields a pointwise least admissible labeling, that this least admissible labeling is unique, and that the concrete insertion height is the least positive height exceeding all active incoming heights at the source in Least Admissible Causal Height §1.4.8.1.
- Scope Boundary: Strict birth-tick precedence across direct dependencies and the source-maximum recurrence are supplied as explicit premises. Rescheduling protocols that alter snapshot membership lie outside this order-theoretic certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
universe u
variable {Ω : Type u}
-- The source-maximum height is bounded by every admissible labeling.
/-- Strong induction on birth tick compares the initialized height or its attaining
predecessor with the corresponding admissible lower bound. -/
theorem source_max_pointwise_least {birth : Ω → Nat} {D : Ω → Ω → Prop} {h c : Ω → Nat}
(birthRules : CausalBirthRules birth D) (source : SourceMaximumHeight birth D h)
(admissible : AdmissibleLabeling birth D c) (η : Ω) : h η ≤ c η := by
have compare : ∀ n, ∀ occurrence, birth occurrence = n → h occurrence ≤ c occurrence := by
intro n
induction n using Nat.strongRecOn with
| ind n ih =>
intro occurrence tick
rcases n with _ | n
· rw [source.1 occurrence tick]
exact Nat.zero_le _
· have later : 0 < birth occurrence := tick.symm ▸ Nat.zero_lt_succ n
rcases (source.2 occurrence later).2 with floor | ⟨ω, predecessor, attained⟩
· rw [floor]
exact admissible.1 occurrence later
· have earlier := birthRules.predecessor_earlier predecessor
rw [tick] at earlier
have smaller := ih (birth ω) earlier ω rfl
rw [attained]
exact Nat.le_trans (Nat.succ_le_succ smaller) (admissible.2 ω occurrence predecessor)
exact compare (birth η) η rfl
-- The recurrence determines a unique source-maximum height.
/-- Each of two source-maximum labelings is admissible and pointwise bounded by the other. -/
theorem source_max_unique_least {birth : Ω → Nat} {D : Ω → Ω → Prop} {h₁ h₂ : Ω → Nat}
(birthRules : CausalBirthRules birth D) (first : SourceMaximumHeight birth D h₁)
(second : SourceMaximumHeight birth D h₂) (η : Ω) : h₁ η = h₂ η :=
Nat.le_antisymm
(source_max_pointwise_least birthRules first (source_max_is_admissible birthRules second) η)
(source_max_pointwise_least birthRules second (source_max_is_admissible birthRules first) η)
/-- The recurrence supplies the pointwise least admissible height. -/
theorem source_max_least_admissible {birth : Ω → Nat} {D : Ω → Ω → Prop} {h : Ω → Nat}
(birthRules : CausalBirthRules birth D) (source : SourceMaximumHeight birth D h) :
PointwiseLeastAdmissible birth D h :=
⟨source_max_is_admissible birthRules source, fun _ candidate =>
source_max_pointwise_least birthRules source candidate⟩
/-- The concrete insertion height is the least height above zero and every incoming height. -/
theorem new_creation_height_least {N : Nat} (G : TimestampedGraph (AbstractEvent N))
(source : AbstractEvent N) :
(1 ≤ newCreationHeight G source ∧
∀ x, G.E (x, source) = true → G.H (x, source) < newCreationHeight G source) ∧
∀ c, 1 ≤ c → (∀ x, G.E (x, source) = true → G.H (x, source) < c) →
newCreationHeight G source ≤ c := by
obtain ⟨upper, attained⟩ := G.incomingMaximum_spec source
simp only [newCreationHeight, Nat.add_comm 1]
refine ⟨⟨Nat.succ_le_succ (Nat.zero_le _), fun x active => Nat.lt_succ_of_le (upper x active)⟩, ?_⟩
intro c positive exceeds
rcases attained with zero | ⟨x, active, height⟩
· simpa only [zero] using positive
· rw [height]
exact Nat.succ_le_of_lt (exceeds x active)
end QBD.Ch01
#print axioms QBD.Ch01.source_max_least_admissible
#print axioms QBD.Ch01.source_max_unique_least
#print axioms QBD.Ch01.new_creation_height_least
Verification Summary:
The machine-checked proofs establish by strong induction on birth tick that the zero-initialized source-maximum height is the unique pointwise least admissible labeling, and that the concrete insertion rule selects the least positive height strictly above all incoming heights at the source vertex. Scheduler policies that change predecessor availability remain outside this formalization. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the logical claims of Least Admissible Causal Height §1.4.8.
In Plain English:
Machine-checked Lean 4 proofs certify that the source-maximum recurrence yields the unique pointwise least admissible causal height.
1.4.9 Proof: Monotonicity of History
I. Direct Event Dependencies
Let be a dependency with the stipulated creation-snapshot meaning (Monotonicity of History §1.4.5). The preceding incoming occurrence belongs to the creation snapshot of . The source-side maximum therefore gives
Stable self-loop assignment also has the independent obstruction (Irreflexivity of Timestamps §1.4.6). Physical self-loops are excluded directly by the irreflexive edge constraint.
The source-maximum assignment is the pointwise least admissible labeling (Least Admissible Causal Height §1.4.8).
II. Finite Dependency Paths
A witness for is a chain with . The sequential inequality (Transitive Causal Monotonicity §1.4.7) gives
III. Irreflexivity and Transitivity
If , the endpoint inequality becomes , a contradiction. If and , concatenation of the two finite dependency chains is a nonempty dependency chain from to . Thus
IV. Well-Founded Height Descent
A reversed dependency chain satisfies . Induction gives . Taking contradicts nonnegativity. Therefore no infinite descending dependency chain exists, and is a well-founded strict partial order on creation occurrences.
Q.E.D.
In Plain English:
Section 1.4.9 formalizes the properties of the QBD proof regarding monotonicity of history.
1.4.9.1 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the causal order and least-labeling synthesis established in Monotonicity of History §1.4.5 proceeds via the following verification strategy:
- Model: The assembly module imports the three certified Chapter 1 timestamp-irreflexivity, transitive-monotonicity, and least-admissible-height modules to assemble the full order-theoretic structure on creation occurrences.
- Certified Claims: The module certifies strict monotonicity along direct dependency chains and nonempty transitive paths, irreflexivity, asymmetry, transitivity, well-foundedness of the transitive dependency relation, and unique pointwise minimality of the source-maximum height in Monotonicity of History §1.4.9.
- Scope Boundary: Causal birth rules and the source-maximum recurrence are supplied as abstract premises on an occurrence type. Concrete snapshot evolution and spatial cycle dynamics remain outside this order-theoretic assembly.
import QBD.Ch01.L1_4_6_TimestampIrreflexivity
import QBD.Ch01.L1_4_7_TransitiveCausalMonotonicity
import QBD.Ch01.L1_4_8_LeastAdmissibleHeight
namespace QBD.Ch01
universe u
variable {Ω : Type u}
-- The order and least-labeling conclusions of Monotonicity of History.
structure HistoryMonotonicity (birth : Ω → Nat) (D : Ω → Ω → Prop) (h : Ω → Nat) : Prop where
chain_height_increasing : ∀ {k : Nat} {chain : Fin k → Ω}, DirectDependencyChain D chain →
∀ {i j : Fin k}, i < j → h (chain i) + (j.val - i.val) ≤ h (chain j) ∧ h (chain i) < h (chain j)
height_increasing : ∀ {ω η}, Reachable D ω η → h ω < h η
irreflexive : ∀ ω, ¬ Reachable D ω ω
asymmetric : ∀ {ω η}, Reachable D ω η → ¬ Reachable D η ω
transitive : ∀ {ω η ζ}, Reachable D ω η → Reachable D η ζ → Reachable D ω ζ
well_founded : WellFounded (Reachable D)
least : PointwiseLeastAdmissible birth D h
unique_least : ∀ c, PointwiseLeastAdmissible birth D c → ∀ η, h η = c η
-- Theorem 1.4.5 and §1.4.9 on creation-occurrence dependencies.
/-- The closure is a well-founded strict order under the height measure, and the
source-maximum recurrence supplies the unique pointwise least admissible height. -/
theorem monotonicity_of_history {birth : Ω → Nat} {D : Ω → Ω → Prop} {h : Ω → Nat}
(birthRules : CausalBirthRules birth D) (source : SourceMaximumHeight birth D h) :
HistoryMonotonicity birth D h := by
have admissible := source_max_is_admissible birthRules source
have increases : ∀ {ω η}, Reachable D ω η → h ω < h η := dplus_height_strict_increase admissible
have least : PointwiseLeastAdmissible birth D h :=
source_max_least_admissible birthRules source
refine ⟨?_, @increases, ?_, ?_, @Reachable.trans Ω D, ?_, least, ?_⟩
· intro k chain dependencies i j order
exact chain_height_strict_mono (source_max_chain_creation birthRules source dependencies) order
· have strict : StrictCausalMonotonicity D h := fun _ _ step => admissible.2 _ _ step
exact dependency_irreflexive strict
· intro ω η forward backward
exact Nat.lt_asymm (increases forward) (increases backward)
· exact Subrelation.wf (fun path => increases path) (measure h).wf
· intro c candidate η
exact Nat.le_antisymm (least.2 c candidate.1 η) (candidate.2 h admissible η)
end QBD.Ch01
#print axioms QBD.Ch01.monotonicity_of_history
Verification Summary:
The machine-checked proof assembles the per-lemma irreflexivity, transitive monotonicity, and least-height certificates into a single closed theorem showing that the nonempty transitive dependency closure is a well-founded strict partial order whose unique pointwise least admissible height is the source-maximum recurrence. Concrete graph update scheduling remains outside this abstract order-theoretic module. The Lean 4 kernel accepts the closed proof term using only standard axioms, certifying the logical synthesis of Monotonicity of History §1.4.9.
In Plain English:
Machine-checked Lean 4 proofs assemble the well-founded strict partial order on creation occurrences and the unique least-height characterization.
1.5.1 Definition: Elementary Task Space
Let the Elementary Task Space consist of elementary additions and deletions on a fixed spatial vertex set . An addition inserts a directed pair between distinct vertices when both orientations are absent. It assigns the source-side causal height and records the new occurrence (Creation Timestamp §1.4.4). A deletion removes a present edge from the active graph and retains its historical occurrence.
Each primitive preserves , changes exactly one active edge, and leaves all surviving occurrence heights unchanged.
Lean 4 (QBD.Ch01.Defs):
/-- §1.5.1 Elementary tasks admissible at the input snapshot. -/
abbrev ElementaryTaskSpace {N : Nat} (G : CausalGraphSubstrate N) :=
{task : VacuumTask N // task.Legal G.snapshot.E}
In Plain English:
The elementary task space defines single-pair insertions and deletions on a fixed finite vertex set.
1.5.2 Definition: Edge Addition Task
Let the Edge Addition Task act on for an absent pair with and . The output snapshot has the following vertex set, active edge set, and causal-height map.
The creation ledger at tick is .
Lean 4 (QBD.Ch01.Defs):
/-- §1.5.2 Insert one edge with its source-side height and append its creation record. -/
def edgeAdditionTask {N : Nat} (G : CausalGraphSubstrate N) (u v : AbstractEvent N)
(_legal : (VacuumTask.add u v).Legal G.snapshot.E) : CausalGraphSubstrate N :=
let height := newCreationHeight G.snapshot u
let birth := G.tick + 1
{ tick := birth
snapshot := addRecordedEdge (u, v) height G.snapshot
activeBirth := updateAt G.activeBirth (u, v) birth
ledger := G.ledger ++ [⟨(u, v), birth, height⟩] }
In Plain English:
Insertion records a new occurrence whose height comes from the input snapshot.
1.5.3 Definition: Edge Deletion Task
Let the Edge Deletion Task act on for . The output snapshot has the following vertex set, active edge set, and causal-height map.
The creation ledger at tick is .
Lean 4 (QBD.Ch01.Defs):
/-- §1.5.3 Delete an active edge while retaining its record in the ledger. -/
def edgeDeletionTask {N : Nat} (G : CausalGraphSubstrate N) (u v : AbstractEvent N)
(_legal : (VacuumTask.del u v).Legal G.snapshot.E) : CausalGraphSubstrate N :=
{ tick := G.tick + 1
snapshot := (deleteRecordedEdge (u, v) G.snapshot).1
activeBirth := updateAt G.activeBirth (u, v) 0
ledger := G.ledger }
In Plain English:
Deletion removes an active edge and retains its creation record and the heights of all surviving edges.
1.5.4 Theorem: Vacuum Repertoire
Let be the space of tasks witnessed by finite sequences of elementary edge additions and deletions on a fixed vertex set . Each task is a finite composition of the primitives, with active incidence determined by the edge set and rollback of each active update specified by the edited pair and its previous height.
In Plain English:
Finite sequences preserve the ambient vertex set and admit recorded rollback of the active fields.
1.5.5 Lemma: Relational Vertex Emergence
Let be a causal graph, and let be the active vertex set. The creation or destruction of a vertex is strictly subordinate to edge operations, with no primitive task in directly mutating the vertex set .
In Plain English:
The Relational Vertex Emergence Lemma states that vertices cannot be directly created or destroyed by primitive tasks; they emerge and vanish solely as endpoints of active relations.
1.5.5.1 Proof: Relational Vertex Emergence
I. Primitive State Components
Let and with . The two primitive definitions give
(Edge Addition Task §1.5.2), (Edge Deletion Task §1.5.3). Hence in both cases.
II. Incidence Change Under Addition
Define and . For a legal addition, , so
Every previously positive degree remains positive. Each endpoint gains one, and every other degree is unchanged. Therefore
The formula allows either endpoint already to be active; set union adds no duplicate element.
III. Incidence Change Under Deletion
For a legal deletion, , so both endpoints have degree at least one. The corresponding equations are
Since , each endpoint loses exactly one. An endpoint leaves the active set exactly when its old total degree was one:
IV. Finite Primitive Sequences
For with , the base equality is . The single-step identity gives
Induction establishes for every finite . The active set is recalculated from the displayed incidence equations at each step, which proves the stated subordination (Relational Vertex Emergence §1.5.5).
Q.E.D.
In Plain English:
Section 1.5.5.1 formalizes the properties of the QBD proof regarding relational vertex emergence.
1.5.5.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the incidence dynamics and motif bounds established in Relational Vertex Emergence §1.5.5 proceeds via the following verification strategy:
- Model: Finite directed Boolean graphs on a fixed ambient vertex type, incoming and outgoing neighbor lists, total incidence degrees, active-vertex predicates, simple two-paths, deduplicated candidate chords, canonical directed triangles, and legal primitive task traces represent vertex subordination and local motif support.
- Certified Claims: The module certifies exact degree update identities, active-vertex add and delete membership formulas, ambient vertex invariance, and preservation of causal adjacency across legal primitive traces in Relational Vertex Emergence §1.5.5.1, alongside the candidate-chord, canonical-triangle, and snapshot trial-exponent bounds used by Finite Information Substrate §1.3.5.
- Scope Boundary: The ambient vertex cardinality is fixed and per-step legality is supplied as an explicit discrete premise. Variable-vertex state spaces and dynamical selection weights remain outside this kinematic Core certificate.
import QBD.Ch01.Defs
namespace QBD.Ch01
-- Ordered endpoint pairs of simple two-paths through a given middle vertex.
def simpleTwoPathsThrough {N : Nat} (G : FinDiGraph N) (w : Fin N) : List (Fin N × Fin N) :=
((inNeighbors G w).flatMap (fun v => (outNeighbors G w).map (fun u => (v, u)))).filter
(fun (v, u) => decide (v ≠ w ∧ w ≠ u ∧ v ≠ u))
-- Count simple directed two-paths by their unique middle vertex.
def simpleTwoPathCount {N : Nat} (G : FinDiGraph N) : Nat :=
finSum (fun w => (simpleTwoPathsThrough G w).length)
-- Project every simple two-path to its ordered return chord and deduplicate the result.
def candidateChords {N : Nat} (G : FinDiGraph N) : List (Fin N × Fin N) :=
((List.finRange N).flatMap (fun w => (simpleTwoPathsThrough G w).map Prod.swap)).eraseDups
-- Count the distinct ordered return chords supported by the graph's simple two-paths.
def candidateChordCount {N : Nat} (G : FinDiGraph N) : Nat := (candidateChords G).length
-- Keep exactly the simple two-paths that start at the least vertex and close into a directed cycle.
def canonicalTrianglesThrough {N : Nat} (G : FinDiGraph N) (w : Fin N) : List (Fin N × Fin N) :=
(simpleTwoPathsThrough G w).filter (fun (v, u) => decide (v < w ∧ v < u) && G (u, v))
-- Count each directed triangle by the middle vertex of its least-start rotation.
def directedTriangleCount {N : Nat} (G : FinDiGraph N) : Nat :=
finSum (fun w => (canonicalTrianglesThrough G w).length)
-- Pointwise bounds survive summation over a finite list.
/-- Adding the pointwise inequality at each list element bounds the sum. -/
private theorem sum_map_le {α : Type} {f g : α → Nat} (bound : ∀ x, f x ≤ g x) (xs : List α) :
(xs.map f).sum ≤ (xs.map g).sum := by
induction xs with
| nil => exact Nat.le_refl _
| cons x xs ih => exact Nat.add_le_add (bound x) ih
-- Summing a constant once per list element multiplies it by the length.
/-- Induction adds one copy of the constant for each element. -/
private theorem sum_map_const {α : Type} (xs : List α) (c : Nat) :
(xs.map (fun _ => c)).sum = xs.length * c := by
induction xs with
| nil => simp
| cons x xs ih => simp [ih, Nat.succ_mul, Nat.add_comm]
-- The endpoint list contains exactly the simple two-paths through its middle vertex.
/-- Membership requires the two directed edges and all three pairwise distinctness conditions. -/
theorem simple_two_path_membership {N : Nat} (G : FinDiGraph N) (v w u : Fin N) :
(v, u) ∈ simpleTwoPathsThrough G w ↔
G (v, w) = true ∧ G (w, u) = true ∧ v ≠ w ∧ w ≠ u ∧ v ≠ u := by
simp only [simpleTwoPathsThrough, List.mem_filter, List.mem_flatMap, List.mem_map,
inNeighbors, outNeighbors, List.mem_finRange, true_and, Prod.mk.injEq, decide_eq_true_eq]
constructor
· rintro ⟨⟨source, incoming, target, outgoing, rfl, rfl⟩, distinct⟩
exact ⟨incoming, outgoing, distinct⟩
· rintro ⟨incoming, outgoing, distinct⟩
exact ⟨⟨v, incoming, u, outgoing, rfl, rfl⟩, distinct⟩
-- Pairing distinct entries from two lists enumerates each ordered pair once.
/-- Each row is duplicate-free by distinct right entries, and different rows have different left entries. -/
private theorem paired_neighbors_nodup {α : Type} {xs ys : List α}
(left : xs.Nodup) (right : ys.Nodup) :
(xs.flatMap (fun x => ys.map (fun y => (x, y)))).Nodup := by
induction xs with
| nil => exact List.nodup_nil
| cons x xs ih =>
obtain ⟨fresh, rest⟩ := List.nodup_cons.1 left
rw [List.flatMap_cons, List.nodup_append]
refine ⟨?_, ih rest, ?_⟩
· exact List.Pairwise.map (fun y => (x, y)) (fun _ _ different eq => different (congrArg Prod.snd eq)) right
· intro first inRow second inRest equal
subst second
obtain ⟨y, _, firstPair⟩ := List.mem_map.1 inRow
obtain ⟨z, inOtherRow, inOtherMap⟩ := List.mem_flatMap.1 inRest
obtain ⟨q, _, otherPair⟩ := List.mem_map.1 inOtherMap
have same : x = z := congrArg Prod.fst (firstPair.trans otherPair.symm)
exact fresh (same.symm ▸ inOtherRow)
-- Each simple two-path is counted once in its middle-vertex list.
/-- Filtering the duplicate-free list of incoming and outgoing neighbor pairs preserves distinctness. -/
theorem simple_two_path_nodup {N : Nat} (G : FinDiGraph N) (w : Fin N) :
(simpleTwoPathsThrough G w).Nodup := by
unfold simpleTwoPathsThrough
exact (paired_neighbors_nodup ((List.nodup_finRange N).filter _) ((List.nodup_finRange N).filter _)).filter _
-- Deduplication preserves distinct entries and never increases length.
/-- Retain the head and remove all its copies from the tail before continuing. -/
private theorem eraseDups_distinct_and_shorter {α : Type} [BEq α] [LawfulBEq α] (xs : List α) :
xs.eraseDups.Nodup ∧ xs.eraseDups.length ≤ xs.length := by
induction size : xs.length using Nat.strongRecOn generalizing xs with
| ind n ih =>
rw [← size]
cases xs with
| nil => exact ⟨List.nodup_nil, Nat.le_refl _⟩
| cons x tail =>
let remaining := tail.filter (fun y => !y == x)
have lengthBound : remaining.length ≤ tail.length := List.length_filter_le _ _
have decreases : remaining.length < n := size ▸ Nat.lt_succ_of_le lengthBound
obtain ⟨distinct, shorter⟩ := ih remaining.length decreases remaining rfl
rw [List.eraseDups_cons, List.nodup_cons]
refine ⟨⟨?_, distinct⟩, Nat.succ_le_succ (Nat.le_trans shorter lengthBound)⟩
intro member
have kept := (List.mem_filter.1 (List.mem_eraseDups.1 member)).2
simp at kept
-- The candidate list contains every supported ordered return chord exactly once.
/-- Projection sends `(v, w, u)` to `(u, v)` and deduplication retains its membership. -/
theorem candidate_chords_spec {N : Nat} (G : FinDiGraph N) :
(candidateChords G).Nodup ∧ ∀ u v, (u, v) ∈ candidateChords G ↔
∃ w, (v, u) ∈ simpleTwoPathsThrough G w := by
refine ⟨(eraseDups_distinct_and_shorter _).1, ?_⟩
intro u v
simp only [candidateChords, List.mem_eraseDups, List.mem_flatMap, List.mem_finRange,
true_and, List.mem_map]
constructor
· rintro ⟨w, ⟨v', u'⟩, path, equal⟩
obtain ⟨rfl, rfl⟩ := Prod.mk.injEq .. |>.mp equal
exact ⟨w, path⟩
· rintro ⟨w, path⟩
exact ⟨w, (v, u), path, rfl⟩
-- The number of distinct supported chords is bounded by the simple two-path count.
/-- The projection produces one list entry per path, and deduplication can only reduce its length. -/
theorem candidate_chord_count_le_two_paths {N : Nat} (G : FinDiGraph N) :
candidateChordCount G ≤ simpleTwoPathCount G := by
unfold candidateChordCount candidateChords simpleTwoPathCount finSum
refine Nat.le_trans (eraseDups_distinct_and_shorter _).2 ?_
rw [List.length_flatMap]
simp only [List.length_map]
exact Nat.le_refl _
-- The triangle list at a middle vertex contains exactly the canonical directed cycles through it.
/-- Closing the path supplies the third edge. The strictly least start selects one rotation
per cycle, and each selected path occurs once in its middle-vertex list. -/
theorem canonical_triangles_spec {N : Nat} (G : FinDiGraph N) (w : Fin N) :
(canonicalTrianglesThrough G w).Nodup ∧ ∀ v u, (v, u) ∈ canonicalTrianglesThrough G w ↔
G (v, w) = true ∧ G (w, u) = true ∧ G (u, v) = true ∧ v < w ∧ v < u ∧ w ≠ u := by
refine ⟨(simple_two_path_nodup G w).filter _, ?_⟩
intro v u
simp only [canonicalTrianglesThrough, List.mem_filter, simple_two_path_membership,
Bool.and_eq_true, decide_eq_true_eq]
constructor
· rintro ⟨⟨first, second, _, middleNe, _⟩, ⟨least, closes⟩⟩
exact ⟨first, second, closes, least.1, least.2, middleNe⟩
· rintro ⟨first, second, closes, beforeMiddle, beforeLast, middleNe⟩
exact ⟨⟨first, second, fun eq => (Nat.ne_of_lt beforeMiddle) (congrArg Fin.val eq),
middleNe, fun eq => (Nat.ne_of_lt beforeLast) (congrArg Fin.val eq)⟩,
⟨⟨beforeMiddle, beforeLast⟩, closes⟩⟩
-- The number of canonical directed triangles is bounded by the simple two-path count.
/-- At each middle vertex, the triangle list is a filter of the simple two-path list. -/
theorem directed_triangle_count_le_two_paths {N : Nat} (G : FinDiGraph N) :
directedTriangleCount G ≤ simpleTwoPathCount G :=
sum_map_le (fun _ => List.length_filter_le _ _) _
-- Count the full neighbor-pair list for one middle vertex.
/-- Each incoming neighbor gives a row with exactly one pair per outgoing neighbor. -/
private theorem two_path_count_at_le_degree_product {N : Nat} (G : FinDiGraph N) (w : Fin N) :
(simpleTwoPathsThrough G w).length ≤ d_in G w * d_out G w := by
unfold simpleTwoPathsThrough
refine Nat.le_trans (List.length_filter_le _ _) ?_
rw [List.length_flatMap]
simpa only [List.length_map, d_in, d_out, sum_map_const] using
(Nat.le_refl ((inNeighbors G w).length * (outNeighbors G w).length))
-- Count simple two-paths by the degree product and the uniform degree bound.
/-- Each middle vertex contributes at most its incoming times outgoing degree, which is at most `Δ²`. -/
theorem two_path_count_bound {N : Nat} (G : FinDiGraph N) (Δ : Nat)
(degreeBound : ∀ w, d_in G w ≤ Δ ∧ d_out G w ≤ Δ) :
simpleTwoPathCount G ≤ finSum (fun w => d_in G w * d_out G w) ∧
finSum (fun w => d_in G w * d_out G w) ≤ N * Δ ^ 2 := by
refine ⟨sum_map_le (two_path_count_at_le_degree_product G) _, ?_⟩
have pointwise (w : Fin N) : d_in G w * d_out G w ≤ Δ ^ 2 := by
rw [Nat.pow_succ, Nat.pow_one]
exact Nat.mul_le_mul (degreeBound w).1 (degreeBound w).2
have total := sum_map_le pointwise (List.finRange N)
simpa only [finSum, sum_map_const, List.length_finRange] using total
-- The snapshot exponent is bounded by three times the uniform path-count bound.
/-- At most one return chord and at most one triangle per supporting path yield `A + 2C ≤ 3NΔ²`. -/
theorem trial_exponent_bound {N : Nat} (G : FinDiGraph N) (Δ A C : Nat)
(degreeBound : ∀ w, d_in G w ≤ Δ ∧ d_out G w ≤ Δ)
(additions : A ≤ simpleTwoPathCount G) (deletions : C ≤ simpleTwoPathCount G) :
A + 2 * C ≤ 3 * Δ ^ 2 * N := by
obtain ⟨paths, products⟩ := two_path_count_bound G Δ degreeBound
have count := Nat.le_trans paths products
rw [Nat.mul_assoc, Nat.mul_comm (Δ ^ 2) N]
omega
-- The concrete graph-derived trial exponent requires only the uniform degree bound.
/-- Distinct supported return chords and canonical directed triangles are both bounded by
the same simple two-path count, so the snapshot exponent bound applies directly. -/
theorem graph_trial_exponent_bound {N : Nat} (G : FinDiGraph N) (Δ : Nat)
(degreeBound : ∀ w, d_in G w ≤ Δ ∧ d_out G w ≤ Δ) :
candidateChordCount G + 2 * directedTriangleCount G ≤ 3 * Δ ^ 2 * N :=
trial_exponent_bound G Δ (candidateChordCount G) (directedTriangleCount G) degreeBound
(candidate_chord_count_le_two_paths G) (directed_triangle_count_le_two_paths G)
-- The ambient vertex set in its canonical order, including isolated vertices.
def ambientVertices {N : Nat} (_G : FinDiGraph N) : List (Fin N) := List.finRange N
-- All snapshots of a run, including the input and final snapshots.
def vacuumTrace {N : Nat} (G : FinDiGraph N) : List (VacuumTask N) → List (FinDiGraph N)
| [] => [G]
| task :: rest => G :: vacuumTrace (task.result G) rest
-- Every task in a sequence is checked against its own input snapshot.
def LegalVacuumSequence {N : Nat} (G : FinDiGraph N) : List (VacuumTask N) → Prop
| [] => True
| task :: rest => task.Legal G ∧ LegalVacuumSequence (task.result G) rest
-- Positive total degree is exactly edge incidence.
/-- A vertex is active precisely when it is the source or target of some present directed edge. -/
theorem active_vertex_iff_incident {N : Nat} (G : FinDiGraph N) (x : Fin N) :
V_act G x ↔ ∃ y, G (y, x) = true ∨ G (x, y) = true := by
have incoming : 0 < d_in G x ↔ ∃ y, G (y, x) = true := by
simp only [d_in, inNeighbors, ← List.countP_eq_length_filter,
List.countP_pos_iff, List.mem_finRange, true_and]
have outgoing : 0 < d_out G x ↔ ∃ y, G (x, y) = true := by
simp only [d_out, outNeighbors, ← List.countP_eq_length_filter,
List.countP_pos_iff, List.mem_finRange, true_and]
constructor
· intro active
have positive : 0 < d_in G x ∨ 0 < d_out G x := by
change 0 < d_in G x + d_out G x at active
omega
rcases positive with input | output
· obtain ⟨y, edge⟩ := incoming.1 input
exact ⟨y, Or.inl edge⟩
· obtain ⟨y, edge⟩ := outgoing.1 output
exact ⟨y, Or.inr edge⟩
· rintro ⟨y, edge | edge⟩
· have positive := incoming.2 ⟨y, edge⟩
change 0 < d_in G x + d_out G x
omega
· have positive := outgoing.2 ⟨y, edge⟩
change 0 < d_in G x + d_out G x
omega
-- A one-coordinate update replaces exactly one contribution to a duplicate-free count.
/-- The updated count plus the old bit equals the old count plus the new bit when the key
occurs. With the key absent, the old and new contributions are both zero. -/
private theorem countP_updateAt {α : Type} [DecidableEq α] (f : α → Bool) (key : α) (value : Bool)
(xs : List α) (distinct : xs.Nodup) :
xs.countP (updateAt f key value) + (if key ∈ xs then (f key).toNat else 0) =
xs.countP f + (if key ∈ xs then value.toNat else 0) := by
induction xs with
| nil => simp
| cons x tail ih =>
obtain ⟨fresh, rest⟩ := List.nodup_cons.1 distinct
by_cases here : x = key
· subst x
have unchanged : tail.countP (updateAt f key value) = tail.countP f := by
apply List.countP_congr
intro y member
have different : y ≠ key := fun equal => fresh (equal ▸ member)
simp [updateAt, different]
rw [List.countP_cons, List.countP_cons, unchanged]
simp only [List.mem_cons, true_or]
cases f key <;> cases value <;> simp [updateAt, Bool.toNat, Nat.add_comm, Nat.add_left_comm]
· have unchanged : updateAt f key value x = f x := by simp [updateAt, here]
rw [List.countP_cons, List.countP_cons, unchanged]
simp only [List.mem_cons, Ne.symm here, false_or]
have counts := ih rest
omega
-- Outgoing degree changes only in the row of the edited edge's source.
/-- Apply the one-coordinate count identity to the source row. All other rows are unchanged. -/
private theorem out_degree_update {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (value : Bool) :
d_out (updateAt G (u, v) value) x + (if x = u then (G (u, v)).toNat else 0) =
d_out G x + (if x = u then value.toNat else 0) := by
by_cases source : x = u
· subst x
have counts := countP_updateAt (fun y => G (u, y)) v value (List.finRange N) (List.nodup_finRange N)
unfold updateAt at counts
simpa [d_out, outNeighbors, ← List.countP_eq_length_filter, updateAt] using counts
· simp [d_out, outNeighbors, updateAt, source]
-- Incoming degree changes only in the column of the edited edge's target.
/-- Apply the one-coordinate count identity to the target column. All other columns are unchanged. -/
private theorem in_degree_update {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (value : Bool) :
d_in (updateAt G (u, v) value) x + (if x = v then (G (u, v)).toNat else 0) =
d_in G x + (if x = v then value.toNat else 0) := by
by_cases target : x = v
· subst x
have counts := countP_updateAt (fun y => G (y, v)) u value (List.finRange N) (List.nodup_finRange N)
unfold updateAt at counts
simpa [d_in, inNeighbors, ← List.countP_eq_length_filter, updateAt] using counts
· simp [d_in, inNeighbors, updateAt, target]
-- The outgoing degree change from inserting an absent pair.
/-- Only the source gains an outgoing edge. -/
theorem add_out_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (absent : G (u, v) = false) :
d_out (addAdjacency u v G) x = d_out G x + (if x = u then 1 else 0) := by
simpa [addAdjacency, absent, Bool.toNat] using out_degree_update G u v x true
-- The incoming degree change from inserting an absent pair.
/-- Only the target gains an incoming edge. -/
theorem add_in_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (absent : G (u, v) = false) :
d_in (addAdjacency u v G) x = d_in G x + (if x = v then 1 else 0) := by
simpa [addAdjacency, absent, Bool.toNat] using in_degree_update G u v x true
-- The total incidence change from inserting an absent pair.
/-- Sum the outgoing and incoming changes to add one contribution at each endpoint. -/
theorem add_total_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (absent : G (u, v) = false) :
d_tot (addAdjacency u v G) x = d_tot G x + (if x = u then 1 else 0) + (if x = v then 1 else 0) := by
unfold d_tot
rw [add_out_degree G u v x absent, add_in_degree G u v x absent]
ac_rfl
-- Addition activates both endpoints and retains all previously active vertices.
/-- The degree increments make each endpoint active and leave all other degrees unchanged. -/
theorem add_active_vertices {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (absent : G (u, v) = false) :
V_act (addAdjacency u v G) x ↔ V_act G x ∨ x = u ∨ x = v := by
unfold V_act
rw [add_total_degree G u v x absent]
by_cases source : x = u <;> by_cases target : x = v <;> simp [source, target] <;> omega
-- The outgoing degree change from deleting a present pair.
/-- The source loses one outgoing incidence. The additive form avoids truncated subtraction. -/
theorem del_out_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (present : G (u, v) = true) :
d_out (delAdjacency u v G) x + (if x = u then 1 else 0) = d_out G x := by
simpa [delAdjacency, present, Bool.toNat] using out_degree_update G u v x false
-- The incoming degree change from deleting a present pair.
/-- The target loses one incoming incidence. The additive form records the exact loss. -/
theorem del_in_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (present : G (u, v) = true) :
d_in (delAdjacency u v G) x + (if x = v then 1 else 0) = d_in G x := by
simpa [delAdjacency, present, Bool.toNat] using in_degree_update G u v x false
-- The total incidence change from deleting a present pair.
/-- Add the incoming and outgoing losses to the new degree to recover the old degree. -/
theorem del_total_degree {N : Nat} (G : FinDiGraph N) (u v x : Fin N) (present : G (u, v) = true) :
d_tot (delAdjacency u v G) x + (if x = u then 1 else 0) + (if x = v then 1 else 0) = d_tot G x := by
have output := del_out_degree G u v x present
have input := del_in_degree G u v x present
unfold d_tot
omega
-- Deletion removes an endpoint from the active set exactly at old degree one.
/-- Distinct endpoints lose one incidence each, and every other total degree is unchanged. -/
theorem del_active_vertices {N : Nat} (G : FinDiGraph N) (u v x : Fin N)
(distinct : u ≠ v) (present : G (u, v) = true) :
V_act (delAdjacency u v G) x ↔ V_act G x ∧ ¬ ((x = u ∨ x = v) ∧ d_tot G x = 1) := by
have oneLoss {old new : Nat} (loss : new + 1 = old) : 0 < new ↔ 0 < old ∧ old ≠ 1 := by
constructor
· intro positive
exact ⟨by omega, fun one => by omega⟩
· intro ⟨_, notOne⟩
exact Nat.pos_of_ne_zero (fun zero => notOne (by omega))
have balance := del_total_degree G u v x present
unfold V_act
by_cases source : x = u
· have target : x ≠ v := fun equal => distinct (source.symm.trans equal)
rw [ite_eq_left source, ite_eq_right target, Nat.add_zero] at balance
simp only [show x = u ∨ x = v from Or.inl source, true_and]
exact oneLoss balance
· by_cases target : x = v
· rw [ite_eq_right source, ite_eq_left target, Nat.add_zero] at balance
simp only [show x = u ∨ x = v from Or.inr target, true_and]
exact oneLoss balance
· simp only [ite_eq_right source, ite_eq_right target, Nat.add_zero] at balance
simp [source, target, balance]
-- Legal primitive tasks preserve irreflexivity and asymmetry.
/-- The diagonal is untouched. Insertion checks the reverse edge, and deletion only removes an edge. -/
theorem vacuum_task_preserves_causality {N : Nat} (G : FinDiGraph N) (task : VacuumTask N)
(causal : CausalAdjacency G) (legal : task.Legal G) : CausalAdjacency (task.result G) := by
have diagonalUnchanged (u v x : Fin N) (different : u ≠ v) (value : Bool) :
updateAt G (u, v) value (x, x) = false := by
have other : (x, x) ≠ (u, v) := by
intro equal
obtain ⟨source, target⟩ := Prod.mk.injEq .. |>.mp equal
exact different (source.symm.trans target)
simp [updateAt, other, causal.1 x]
cases task with
| add u v =>
obtain ⟨different, _, reverseAbsent⟩ := legal
refine ⟨fun x => diagonalUnchanged u v x different true, ?_⟩
intro x y present
change updateAt G (u, v) true (x, y) = true at present
change updateAt G (u, v) true (y, x) = false
by_cases edited : (x, y) = (u, v)
· obtain ⟨rfl, rfl⟩ := Prod.mk.injEq .. |>.mp edited
simp [updateAt, Ne.symm different, reverseAbsent]
· have wasPresent : G (x, y) = true := by simpa [updateAt, edited] using present
have reverseUnedited : (y, x) ≠ (u, v) := by
intro equal
obtain ⟨rfl, rfl⟩ := Prod.mk.injEq .. |>.mp equal
rw [reverseAbsent] at wasPresent
contradiction
simp [updateAt, reverseUnedited, causal.2 x y wasPresent]
| del u v =>
obtain ⟨different, _⟩ := legal
refine ⟨fun x => diagonalUnchanged u v x different false, ?_⟩
intro x y present
change updateAt G (u, v) false (x, y) = true at present
change updateAt G (u, v) false (y, x) = false
have wasPresent : G (x, y) = true := by
unfold updateAt at present
split at present
· contradiction
· exact present
unfold updateAt
split
· rfl
· exact causal.2 x y wasPresent
-- Ambient vertices and incidence throughout any finite primitive sequence.
/-- Every snapshot stays on the same `Fin N`. Its ambient enumeration is unchanged,
and its active vertices are precisely the endpoints of its present edges. -/
theorem ambient_vertex_set_invariant {N : Nat} (G : FinDiGraph N) (tasks : List (VacuumTask N)) :
∀ S ∈ vacuumTrace G tasks,
ambientVertices S = ambientVertices G ∧ (ambientVertices S).length = N ∧
(∀ x, V_act S x ↔ ∃ y, S (y, x) = true ∨ S (x, y) = true) := by
intro S _
exact ⟨rfl, List.length_finRange, active_vertex_iff_incident S⟩
-- Causal adjacency holds at every step of a finite legal sequence.
/-- Induction checks each legal edit against its input and propagates the causal adjacency conditions. -/
theorem vacuum_trace_preserves_causality {N : Nat} (G : FinDiGraph N) (tasks : List (VacuumTask N))
(causal : CausalAdjacency G) (legal : LegalVacuumSequence G tasks) :
∀ S ∈ vacuumTrace G tasks, CausalAdjacency S := by
induction tasks generalizing G with
| nil =>
intro S member
have same : S = G := by simpa [vacuumTrace] using member
exact same.symm ▸ causal
| cons task rest ih =>
intro S member
rcases List.mem_cons.1 member with same | later
· exact same.symm ▸ causal
· exact ih (task.result G) (vacuum_task_preserves_causality G task causal legal.1) legal.2 S later
end QBD.Ch01
#print axioms QBD.Ch01.graph_trial_exponent_bound
#print axioms QBD.Ch01.candidate_chords_spec
#print axioms QBD.Ch01.canonical_triangles_spec
#print axioms QBD.Ch01.ambient_vertex_set_invariant
#print axioms QBD.Ch01.vacuum_trace_preserves_causality
Verification Summary:
The machine-checked proofs confirm that elementary edge additions and deletions preserve the ambient vertex enumeration, update incoming, outgoing, and total degrees by exact unit increments, govern active-vertex membership solely through edge incidence, preserve irreflexive asymmetric adjacency across legal traces, and bound candidate chords and canonical triangles by the simple two-path count. Variable-vertex extensions and dynamical weighting remain outside this fixed-ambient kinematic module. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the logical claims of Relational Vertex Emergence §1.5.5.
In Plain English:
Machine-checked Lean 4 proofs certify exact degree updates, active-vertex membership formulas, ambient vertex invariance, causal adjacency preservation, and local motif bounds.
1.5.6 Lemma: Reversibility of Primitives
Let a snapshot have adjacency and height at every directed pair , with height zero when absent. Both fields are restored by adding an absent pair and then deleting it, or by deleting an active pair and then restoring it at its saved height.
In Plain English:
The two pointwise rollback operations restore adjacency and height under the stated premises.
1.5.6.1 Proof: Reversibility of Primitives
I. Update Maps on a Fixed Directed-Pair Domain
Write in the active-field representation (Creation Timestamp §1.4.4), with on absent pairs. Fix . If , the addition and deletion maps are defined pointwise by
II. Addition Followed by Deletion
Suppose . At the edited pair and away from it, respectively,
Both coordinates agree at every pair.
III. Deletion Followed by Recorded Restoration
Suppose and save . The two compositions at the edited pair and every other pair are
Extensional equality of the two active fields gives the partial inverses (Reversibility of Primitives §1.5.6)
Q.E.D.
In Plain English:
Section 1.5.6.1 formalizes the properties of the QBD proof regarding reversibility of primitives.
1.5.6.2 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the active-field rollback identities established in Reversibility of Primitives §1.5.6 proceeds via the following verification strategy:
- Model: Timestamped graphs pairing Boolean directed adjacency with natural-number height fields, recorded single-pair addition and height-saving deletion operators, and explicit rollback records represent elementary active-field inversion.
- Certified Claims: The module certifies pointwise restoration of both active adjacency and height under deletion followed by recorded addition, pointwise restoration under addition followed by deletion on an absent zero-height pair, and extensional snapshot restoration for any legal elementary task in Reversibility of Primitives §1.5.6.1.
- Scope Boundary: Restoration applies to the active adjacency and height fields under explicit presence, absence, and zero-height premises. Append-only ledger retention and dynamical transition probabilities remain outside this pointwise kinematic check.
import QBD.Ch01.Defs
namespace QBD.Ch01
universe u
theorem del_then_recorded_add_pointwise {V : Type u} [DecidableEq V]
(G : TimestampedGraph V) (e x : V × V) (h_act : G.E e = true) :
(addRecordedEdge e (deleteRecordedEdge e G).2 (deleteRecordedEdge e G).1).E x = G.E x ∧
(addRecordedEdge e (deleteRecordedEdge e G).2 (deleteRecordedEdge e G).1).H x = G.H x := by
dsimp [addRecordedEdge, deleteRecordedEdge, updateAt]
by_cases hx : x = e
· subst hx
constructor
· rw [ite_eq_left rfl]
exact h_act.symm
· rw [ite_eq_left rfl]
· constructor
· rw [ite_eq_right hx, ite_eq_right hx]
· rw [ite_eq_right hx, ite_eq_right hx]
theorem add_then_del_pointwise {V : Type u} [DecidableEq V]
(G : TimestampedGraph V) (e x : V × V) (h_rec : Nat)
(h_abs : G.E e = false) (h_zero : G.H e = 0) :
(deleteRecordedEdge e (addRecordedEdge e h_rec G)).1.E x = G.E x ∧
(deleteRecordedEdge e (addRecordedEdge e h_rec G)).1.H x = G.H x := by
dsimp [addRecordedEdge, deleteRecordedEdge, updateAt]
by_cases hx : x = e
· subst hx
constructor
· rw [ite_eq_left rfl]
exact h_abs.symm
· rw [ite_eq_left rfl]
exact h_zero.symm
· constructor
· rw [ite_eq_right hx, ite_eq_right hx]
· rw [ite_eq_right hx, ite_eq_right hx]
/-- A rollback record contains the edited pair and, for a deletion, its saved height. -/
inductive RecordedUndo (N : Nat) where
| remove (edge : Edge (AbstractEvent N))
| restore (edge : Edge (AbstractEvent N)) (height : Nat)
def RecordedUndo.apply {N : Nat} (undo : RecordedUndo N) (G : TimestampedGraph (AbstractEvent N)) :
TimestampedGraph (AbstractEvent N) :=
match undo with
| .remove edge => (deleteRecordedEdge edge G).1
| .restore edge height => addRecordedEdge edge height G
def ElementaryTaskSpace.recordUndo {N : Nat} {G : CausalGraphSubstrate N}
(task : ElementaryTaskSpace G) : RecordedUndo N :=
match task.val with
| .add u v => .remove (u, v)
| .del u v => .restore (u, v) (G.snapshot.H (u, v))
/-- The saved undo restores both active fields at every ordered pair. -/
theorem undo_elementary_task {N : Nat} {G : CausalGraphSubstrate N}
(zeroAbsent : ∀ e, G.snapshot.E e = false → G.snapshot.H e = 0)
(task : ElementaryTaskSpace G) : task.recordUndo.apply task.apply.snapshot = G.snapshot := by
have pointwise (x : Edge (AbstractEvent N)) :
(task.recordUndo.apply task.apply.snapshot).E x = G.snapshot.E x ∧
(task.recordUndo.apply task.apply.snapshot).H x = G.snapshot.H x := by
rcases task with ⟨task, legal⟩
cases task with
| add u v =>
exact add_then_del_pointwise G.snapshot (u, v) x _ legal.2.1 (zeroAbsent _ legal.2.1)
| del u v => exact del_then_recorded_add_pointwise G.snapshot (u, v) x legal.2
exact TimestampedGraph.ext (funext fun x => (pointwise x).1) (funext fun x => (pointwise x).2)
end QBD.Ch01
#print axioms QBD.Ch01.del_then_recorded_add_pointwise
#print axioms QBD.Ch01.add_then_del_pointwise
#print axioms QBD.Ch01.undo_elementary_task
Verification Summary:
The machine-checked proofs establish that recorded edge addition restores both active adjacency and causal height after deleting a present edge, that deletion restores both fields after adding an absent zero-height edge, and that the saved rollback record extensionally recovers the prior snapshot for every legal elementary task. Archival ledger growth and dynamical weighting remain outside this pointwise kinematic certificate. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the rollback identities of Reversibility of Primitives §1.5.6.
In Plain English:
Machine-checked Lean 4 proofs certify pointwise and extensional restoration of active adjacency and causal heights for elementary edge tasks.
1.5.7 Proof: Vacuum Repertoire
I. Domain and Objects
A task in the space specifies an admissible trajectory of active snapshots (Vacuum Repertoire §1.5.4) (Elementary Task Space §1.5.1).
II. Finite Task Composition
An admissible task has a witness sequence , with each an elementary edit defined on its input snapshot. Thus .
For an insertion of , the input conditions and imply that the sole new edge is neither a self-loop nor the reverse of an existing edge (Edge Addition Task §1.5.2). Every other pair retains its incidence and height. The new record enters the ledger by union. For a deletion, implies that any self-loop or reciprocal pair in already belongs to . Restriction preserves the height at each surviving edge, and (Edge Deletion Task §1.5.3).
Each step preserves the vertex set, leaves the active edge set irreflexive and asymmetric, and retains the causal heights of surviving edges. At index the active vertex set is (Relational Vertex Emergence §1.5.5).
III. Recorded Rollback
Let denote the active-field restoration determined by the edited pair and its previous height for step . The ledger is append-only along the forward sequence. The pointwise identities give (Reversibility of Primitives §1.5.6). Substitution from the last index to the first gives
Q.E.D.
In Plain English:
Section 1.5.7 formalizes the properties of the QBD proof regarding vacuum repertoire.
1.5.7.1 Type-Theoretic Validation via Lean 4 Core
Type-theoretic certification of the finite composition, ledger monotonicity, and recorded rollback claims established in Vacuum Repertoire §1.5.4 proceeds via the following verification strategy:
- Model: The assembly module imports the certified relational-vertex-emergence and primitive-reversibility modules and defines typed finite runs of legal elementary tasks on valid causal graph substrates together with their recorded rollback logs.
- Certified Claims: The module certifies preservation of substrate validity across every elementary task, preservation of ambient vertex invariance, active incidence, and causal adjacency across every snapshot of a finite run, append-only extension of the historical creation ledger, and exact active-snapshot restoration by folding the recorded rollback log in Vacuum Repertoire §1.5.7.
- Scope Boundary: Initial substrate validity and per-step legality are supplied as discrete structural hypotheses on a fixed ambient vertex set. Thermodynamic selection weights and variable-vertex extensions remain outside this kinematic Core certificate.
import QBD.Ch01.L1_5_5_RelationalVertexEmergence
import QBD.Ch01.L1_5_6_ReversibilityOfPrimitives
namespace QBD.Ch01
/-- A finite composition of elementary tasks, each checked on its own input. -/
inductive VacuumRun {N : Nat} : CausalGraphSubstrate N → CausalGraphSubstrate N → Type where
| nil (G : CausalGraphSubstrate N) : VacuumRun G G
| step {G H : CausalGraphSubstrate N} (task : ElementaryTaskSpace G) :
VacuumRun task.apply H → VacuumRun G H
def VacuumRun.tasks {N : Nat} : {G H : CausalGraphSubstrate N} → VacuumRun G H → List (VacuumTask N)
| _, _, .nil _ => []
| _, _, .step task rest => task.val :: rest.tasks
def VacuumRun.rollbackLog {N : Nat} :
{G H : CausalGraphSubstrate N} → VacuumRun G H → List (RecordedUndo N)
| _, _, .nil _ => []
| _, _, .step task rest => task.recordUndo :: rest.rollbackLog
private theorem task_adjacency {N : Nat} {G : CausalGraphSubstrate N} (task : ElementaryTaskSpace G) :
task.apply.snapshot.E = task.val.result G.snapshot.E := by
rcases task with ⟨task, legal⟩
cases task <;> rfl
theorem ElementaryTaskSpace.apply_valid {N : Nat} {G : CausalGraphSubstrate N}
(task : ElementaryTaskSpace G) (valid : G.Valid) : task.apply.Valid := by
obtain ⟨causal, normalized, active, unique, past, initial⟩ := valid
have causal' : CausalAdjacency task.apply.snapshot.E :=
task_adjacency task ▸ vacuum_task_preserves_causality G.snapshot.E task.val causal task.property
refine ⟨causal', ?_, ?_, ?_, ?_, ?_⟩
· rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩ <;> intro e absent
· simp only [ElementaryTaskSpace.apply, edgeAdditionTask, addRecordedEdge, updateAt] at absent ⊢
split at absent
· contradiction
· rw [ite_eq_right ‹e ≠ (u, v)›]
exact normalized e absent
· simp only [ElementaryTaskSpace.apply, edgeDeletionTask, deleteRecordedEdge, updateAt] at absent ⊢
split at absent <;> simp_all
· rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩ <;> intro ⟨e, present⟩
· by_cases edited : e = (u, v)
· simp [CausalGraphSubstrate.activeOccurrence, creationTimestamp, ElementaryTaskSpace.apply,
edgeAdditionTask, addRecordedEdge, updateAt, edited]
· have before : G.snapshot.E e = true := by
simpa [ElementaryTaskSpace.apply, edgeAdditionTask, addRecordedEdge, updateAt, edited] using present
simpa [CausalGraphSubstrate.activeOccurrence, creationTimestamp, ElementaryTaskSpace.apply,
edgeAdditionTask, addRecordedEdge, updateAt, edited] using
List.mem_append_left [⟨(u, v), G.tick + 1, newCreationHeight G.snapshot u⟩] (active ⟨e, before⟩)
· have edited : e ≠ (u, v) := by
intro equal
simp [ElementaryTaskSpace.apply, edgeDeletionTask, deleteRecordedEdge, updateAt, equal] at present
have before : G.snapshot.E e = true := by
simpa [ElementaryTaskSpace.apply, edgeDeletionTask, deleteRecordedEdge, updateAt, edited] using present
simpa [CausalGraphSubstrate.activeOccurrence, creationTimestamp, ElementaryTaskSpace.apply,
edgeDeletionTask, deleteRecordedEdge, updateAt, edited] using active ⟨e, before⟩
· rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩
· simp only [ElementaryTaskSpace.apply, edgeAdditionTask, List.map_append, List.map_cons, List.map_nil]
refine List.nodup_append.2 ⟨unique, by simp, ?_⟩
intro p member q new equal
obtain ⟨ω, inLedger, rfl⟩ := List.mem_map.1 member
obtain rfl := List.mem_singleton.1 new
have sameBirth := congrArg Prod.snd equal
have earlier := past ω inLedger
change ω.birth = G.tick + 1 at sameBirth
rw [sameBirth] at earlier
exact Nat.not_succ_le_self _ earlier
· exact unique
· rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩ <;> intro ω member
· change ω ∈ G.ledger ++ [_] at member
rcases List.mem_append.1 member with old | new
· exact Nat.le_trans (past ω old) (Nat.le_succ _)
· obtain rfl := List.mem_singleton.1 new
exact Nat.le_refl _
· exact Nat.le_trans (past ω member) (Nat.le_succ _)
· rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩ <;> intro ω member zero
· change ω ∈ G.ledger ++ [_] at member
rcases List.mem_append.1 member with old | new
· exact initial ω old zero
· obtain rfl := List.mem_singleton.1 new
exact False.elim (Nat.succ_ne_zero _ zero)
· exact initial ω member zero
theorem VacuumRun.legal_adjacency_trace {N : Nat} {G H : CausalGraphSubstrate N} (run : VacuumRun G H) :
LegalVacuumSequence G.snapshot.E run.tasks := by
induction run with
| nil => trivial
| step task rest ih =>
exact ⟨task.property, task_adjacency task ▸ ih⟩
theorem VacuumRun.final_valid_and_ledger_extension {N : Nat} {G H : CausalGraphSubstrate N}
(run : VacuumRun G H) (valid : G.Valid) : H.Valid ∧ ∃ added, H.ledger = G.ledger ++ added := by
induction run with
| nil => exact ⟨valid, [], (List.append_nil _).symm⟩
| step task rest ih =>
obtain ⟨finalValid, added, extension⟩ := ih (task.apply_valid valid)
refine ⟨finalValid, ?_⟩
rcases task with ⟨⟨u, v⟩ | ⟨u, v⟩, legal⟩
· exact ⟨_ :: added, extension.trans (List.append_assoc _ _ _)⟩
· exact ⟨added, extension⟩
/-- §1.5.4 Every legal finite composition preserves incidence and causal adjacency,
retains its input ledger, and admits rollback of the active adjacency and heights. -/
theorem vacuum_repertoire {N : Nat} {G H : CausalGraphSubstrate N} (run : VacuumRun G H)
(valid : G.Valid) :
(∀ S ∈ vacuumTrace G.snapshot.E run.tasks,
ambientVertices S = ambientVertices G.snapshot.E ∧ (ambientVertices S).length = N ∧
(∀ x, V_act S x ↔ ∃ y, S (y, x) = true ∨ S (x, y) = true) ∧ CausalAdjacency S) ∧
(H.Valid ∧ ∃ added, H.ledger = G.ledger ++ added) ∧
run.rollbackLog.foldr RecordedUndo.apply H.snapshot = G.snapshot := by
refine ⟨?_, run.final_valid_and_ledger_extension valid, ?_⟩
· intro S member
obtain ⟨same, count, incidence⟩ := ambient_vertex_set_invariant G.snapshot.E run.tasks S member
exact ⟨same, count, incidence,
vacuum_trace_preserves_causality G.snapshot.E run.tasks valid.1 run.legal_adjacency_trace S member⟩
· induction run with
| nil => rfl
| step task rest ih =>
change task.recordUndo.apply (rest.rollbackLog.foldr RecordedUndo.apply _) = _
rw [ih (task.apply_valid valid)]
exact undo_elementary_task valid.2.1 task
end QBD.Ch01
#print axioms QBD.Ch01.ElementaryTaskSpace.apply_valid
#print axioms QBD.Ch01.VacuumRun.final_valid_and_ledger_extension
#print axioms QBD.Ch01.vacuum_repertoire
Verification Summary:
The machine-checked proofs establish that every finite sequence of legal elementary edge additions and deletions preserves substrate validity, ambient vertex invariance, incidence-defined vertex activation, and causal adjacency at every step while extending the creation ledger append-only and admitting exact active-snapshot restoration via its recorded rollback log. Dynamical selection rules and variable-vertex constructions remain outside this kinematic assembly. The Lean 4 kernel accepts all closed proof terms using only standard axioms, certifying the assembled claims of Vacuum Repertoire §1.5.7.
In Plain English:
Machine-checked Lean 4 proofs certify validity preservation, append-only ledger extension, and recorded active-snapshot rollback for finite compositions of elementary tasks.