Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
eb79f1c
Import the Hopf problem formalization
Vilin97 Sep 4, 2026
bc6e898
Narrow Hopf problem tactic imports
Vilin97 Sep 4, 2026
12b4ab2
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 4, 2026
5630fb5
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 4, 2026
bce2a91
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 4, 2026
7069b00
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 4, 2026
401d0fb
Credit sources of the six-sphere formalization
Vilin97 Sep 4, 2026
b4a4801
Deduplicate six-sphere coordinates and arguments
Vilin97 Sep 4, 2026
ed74291
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 5, 2026
5ed205a
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 8, 2026
b8a021d
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 10, 2026
885d392
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 10, 2026
3760ac3
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 10, 2026
90b0663
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 10, 2026
b645bec
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
1983bf7
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
238bd1f
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
4cb21f4
HopfProblem: drop @[simp] from formalAssociatorHomotopy_simplex_succ
Vilin97 Sep 11, 2026
66b4e78
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
0933a19
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
9a2015c
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
482b63f
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 11, 2026
251f58e
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 12, 2026
979865d
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 13, 2026
7514dc0
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 13, 2026
f609e0d
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 13, 2026
a3e95db
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 14, 2026
2cee31b
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 16, 2026
38582aa
Add PentagonalNumberTheoremAnalytic
JonCYeh Sep 17, 2026
88d9a56
Address review: correct two overclaims, narrow imports, fix stale docs
JonCYeh Sep 17, 2026
393a157
Address remaining review findings: dead helper, namespace containment
JonCYeh Sep 17, 2026
b7ff3fb
Satisfy the pool-wide naming linter
JonCYeh Sep 17, 2026
165d8c7
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
4f1b097
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
c336c0f
Address maintainer review: module names, JTP assembly, doc claim
JonCYeh Sep 17, 2026
576ab60
Merge branch 'conrad/pentagonal-number-theorem' of https://github.com…
Sep 17, 2026
932556e
Reflow the formal Jacobi scope sentence in the project card
Sep 17, 2026
2545129
Merge remote-tracking branch 'origin/main' into conrad/pentagonal-num…
Sep 17, 2026
8195b46
Fix entry metadata: qualify Franklin names, add generated project card
Sep 17, 2026
c3eb0af
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
90ebf06
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
9732c45
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
bcaa4fe
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
c630747
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
f52cda2
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
07807e3
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
6c15871
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
ac4e3c5
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
9ba5071
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
bf84460
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
53eb7aa
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
7b1cba1
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
21c83a5
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
1c30173
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
7f67646
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
f8837dc
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 17, 2026
0570d1b
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 17, 2026
0412d84
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
4f28abb
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
9ebe12b
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
bf8261a
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
a7baa0f
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
304301c
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
4f646c0
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
62653ef
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
b66e62a
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
51e54a8
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
59dcaab
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
029a3fe
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
14599b8
Repair the build against Mathlib v4.34.0
Sep 18, 2026
b367954
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
3692e93
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
9dbde1d
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
806f140
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
0ab4a5e
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
13bce96
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
befcbe5
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
101bdd3
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
fe3c100
Port HopfProblem to Mathlib v4.34.0 stable
Vilin97 Sep 18, 2026
19e9796
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 18, 2026
3127eb9
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 18, 2026
b9d5053
feat: import centered maximal-operator bounds
Sep 19, 2026
d4e0ff5
chore: normalize imported Lean source permissions
Sep 19, 2026
8ef91db
docs: align lattice commentary with proved bounds
Sep 19, 2026
d7d81cd
style: wrap smearing description
Sep 19, 2026
6198bd2
feat: import and optimize the complete ACMAX conjecture proof
Sep 19, 2026
2d02fd7
perf: bound remaining ACMAX arithmetic contexts
Sep 19, 2026
1c56be3
style: normalize ACMAX mathematical comment symbols
Sep 19, 2026
7b5e794
style: wrap the degree-log Jensen documentation
Sep 19, 2026
eee4c34
Merge remote-tracking branch 'origin/main' into pr-458
github-actions[bot] Sep 19, 2026
d030c9e
Merge remote-tracking branch 'origin/main' into pr-455
github-actions[bot] Sep 19, 2026
8b56d70
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 19, 2026
70c83b8
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 19, 2026
af5fe0b
Merge remote-tracking branch 'origin/main' into HEAD
Sep 19, 2026
3ed43b5
refactor: share ACMAX hub-cross leakage estimates
Sep 19, 2026
053ea98
Merge remote-tracking branch 'origin/main' into HEAD
Sep 19, 2026
08d686c
fix(ACMax): wrap the completed girth-bound documentation
Sep 19, 2026
5b20fbe
Merge remote-tracking branch 'origin/main' into pr-458
github-actions[bot] Sep 19, 2026
9b0fc33
Merge remote-tracking branch 'origin/main' into pr-455
github-actions[bot] Sep 19, 2026
e5fbd7f
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 19, 2026
ddcd945
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 19, 2026
c1d4f8f
Share ACMAX census identities and mirrored path cuts
Sep 19, 2026
bb17e6d
Import Gaussian Moments Conjecture counterexamples
Sep 20, 2026
3cdc9ca
Import square-difference-free counterexamples to Naslund conjecture
Sep 20, 2026
8cd6626
Separate lift recovery and asymptotic estimates into reusable lemmas
Sep 20, 2026
4b01fc1
feat: import Kurosh and sharp Schreier subgroup theorems
Sep 20, 2026
8ad293b
refactor: reuse Mathlib orbit quotient and internalize Kurosh helpers
Sep 20, 2026
5d80071
build: record initial DilCat port for reproducible profiling
Sep 20, 2026
c137251
feat: import dilatations of categories and commutative rings
Sep 20, 2026
59bcd96
docs: clarify the corrected exponent-profile comparison
Sep 20, 2026
ba96507
refactor: simplify dilatation uniqueness and preserve base algebra
Sep 20, 2026
97a2cb9
Merge branch 'main' into conrad/pentagonal-number-theorem
JonCYeh Sep 20, 2026
e10a76a
Merge remote-tracking branch 'origin/main' into pr-463
github-actions[bot] Sep 20, 2026
caeb1e1
Merge remote-tracking branch 'origin/main' into pr-462
github-actions[bot] Sep 20, 2026
590aeb8
Merge remote-tracking branch 'origin/main' into pr-461
github-actions[bot] Sep 20, 2026
fb8c29e
Merge remote-tracking branch 'origin/main' into pr-460
github-actions[bot] Sep 20, 2026
c6d70b8
Merge remote-tracking branch 'origin/main' into pr-458
github-actions[bot] Sep 20, 2026
653cd75
Merge remote-tracking branch 'origin/main' into pr-455
github-actions[bot] Sep 20, 2026
644e0ef
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 20, 2026
ff7df9b
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 20, 2026
2fe8fe6
refactor: share Kurosh product and edge equivalences
Sep 20, 2026
c5c52fd
refactor: share localization faithfulness proofs
Sep 20, 2026
0bd80b4
Merge remote-tracking branch 'origin/main' into pr-463
github-actions[bot] Sep 21, 2026
946a309
Merge remote-tracking branch 'origin/main' into pr-462
github-actions[bot] Sep 21, 2026
497c75e
Merge remote-tracking branch 'origin/main' into pr-461
github-actions[bot] Sep 21, 2026
9575376
Merge remote-tracking branch 'origin/main' into pr-460
github-actions[bot] Sep 21, 2026
aace611
Merge remote-tracking branch 'origin/main' into pr-458
github-actions[bot] Sep 21, 2026
147c048
Merge remote-tracking branch 'origin/main' into pr-455
github-actions[bot] Sep 21, 2026
5b846a0
Merge remote-tracking branch 'origin/main' into pr-446
github-actions[bot] Sep 21, 2026
92f28f2
Merge remote-tracking branch 'origin/main' into pr-392
github-actions[bot] Sep 21, 2026
658cee4
Merge current main before final PR validation
Vilin97 Sep 21, 2026
6251f09
Merge remote-tracking branch 'origin/main' into HEAD
Vilin97 Sep 21, 2026
4c678f0
Clarify the topological six-sphere identification
Vilin97 Sep 21, 2026
c33c463
Merge reviewed PR #461 into integration batch
Vilin97 Sep 21, 2026
5aec104
Merge reviewed PR #462 into integration batch
Vilin97 Sep 21, 2026
c41f308
Merge reviewed PR #463 into integration batch
Vilin97 Sep 21, 2026
aabdd2a
Merge reviewed PR #460 into integration batch
Vilin97 Sep 21, 2026
42a854e
Merge reviewed PR #455 into integration batch
Vilin97 Sep 21, 2026
953cda5
Merge reviewed PR #446 into integration batch
Vilin97 Sep 21, 2026
1a5b29c
Merge reviewed PR #458 into integration batch
Vilin97 Sep 21, 2026
e3534f0
Merge reviewed PR #392 into integration batch
Vilin97 Sep 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
303 changes: 303 additions & 0 deletions LeanPool.lean

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions LeanPool/ACMax.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/-
Copyright (c) 2026 Zeru Zhu, Jinzheng Li, Yuanjie Ren. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Zeru Zhu, Jinzheng Li, Yuanjie Ren
-/

import LeanPool.ACMax.UpperBound
import LeanPool.ACMax.Reduction.GapReduction

/-!
# Kolokolnikov's ACMAX conjecture

Source: arxiv:1412.6147, doi:10.1016/j.laa.2014.12.023, url:https://github.com/MerLeanProver/ACMaxConjecture/tree/78736ca2f5c29a4d5ad7dfdee4ac715bbfcde770
Authors: Zeru Zhu, Jinzheng Li, Yuanjie Ren
Status: verified
Main declarations: `ACMax.acmax_conjecture`
Tags: spectral-graph-theory, extremal-graph-theory, laplacian, non-backtracking-walks
MSC: 05C50, 05C35
-/

/-!
# ACMAX conjecture (algebraic-connectivity maximizer for `m = 2(n-2)`)

For `n ≥ 4`, among all simple graphs on `n` vertices with exactly `2(n-2)` edges,
the algebraic connectivity is at most `2`, and this bound is attained by the complete
bipartite graph `K_{2,n-2}` (whose algebraic connectivity equals `2`).

The statement decomposes into the equality clause (`algConn_completeBipartite_two`)
and the universal upper-bound clause (`algConn_le_two_of_card`).
-/

namespace ACMax

open Classical in
/-- **ACMAX conjecture.** For `n ≥ 4`, the complete bipartite graph `K_{2,n-2}` has
algebraic connectivity `2`, and every simple graph on `n` vertices with exactly
`2(n-2)` edges has algebraic connectivity at most `2`. -/
theorem acmax_conjecture (n : ℕ) (hn : 4 ≤ n) [Nonempty (Fin n)] :
algConn (completeBipartiteGraph (Fin 2) (Fin (n - 2))) = 2 ∧
∀ G : SimpleGraph (Fin n), G.edgeFinset.card = 2 * (n - 2) → algConn G ≤ 2 :=
⟨algConn_completeBipartite_two n hn,
fun G hm => algConn_le_two_of_card n hn G hm⟩

end ACMax
396 changes: 396 additions & 0 deletions LeanPool/ACMax/AHL/AHLAmGm.lean

Large diffs are not rendered by default.

318 changes: 318 additions & 0 deletions LeanPool/ACMax/AHL/AHLMarginals.lean

Large diffs are not rendered by default.

242 changes: 242 additions & 0 deletions LeanPool/ACMax/AHL/AHLStationary.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
/-
Copyright (c) 2026 Zeru Zhu, Jinzheng Li, Yuanjie Ren. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Zeru Zhu, Jinzheng Li, Yuanjie Ren
-/
import LeanPool.ACMax.AHL.NBWeighted
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Basic.Real.Basic

/-!
# The AHL stationary-measure vocabulary — walk decomposition, weights, and marginal sums

This file lands nodes **W0–W2** of the Alon–Hoory–Linial irregular-Moore walk-count proof, i.e. the
*vocabulary* the weighted AM–GM assembly (W3–W9) consumes. Building on the non-backtracking
machinery of `AHL.NBWalkCount` / `AHL.NBWeighted` (`nbWalksFrom`, `nbExtend`, `nb_concat_iff`,
`card_nbWalksFrom`), it packages three layers.

## Contents

* **W0 — the reusable one-step decomposition.** `nbWalksFrom_succ_eq_biUnion` exhibits the
length-`(k+1)` non-backtracking walks from `x` as the disjoint `biUnion` of the one-edge
extensions of the length-`k` walks (`k ≥ 1`), with `pairwiseDisjoint_nbExtend`, the fiber
cardinality `card_nbExtend` (`= deg (prefix end) − 1`), and the endpoint/penultimate fiber facts
`adj_of_mem_nbExtend` / `penultimate_of_mem_nbExtend`. Both the cardinality (already landed) and
every weighted marginal below then reduce through `Finset.sum_biUnion`. No new mathematics —
this simply extracts the decomposition buried in `card_nbWalksFrom_succ`.
* **W1 — the AHL walk weight.** `nbWeight ⟨v, p⟩ = ∏_{1 ≤ j < len} (deg (getVert j) − 1)⁻¹`
(the product over the *intermediate* vertices only). It is positive under `δ ≥ 2`
(`nbWeight_pos`), is `1` on walks of length `≤ 1` (`nbWeight_one`), and multiplies by exactly
`(deg end − 1)⁻¹` under a one-edge extension (`nbWeight_concat`) — the mass-conservation identity
driving the exact degree-bias.
* **W2 — the marginal sums.** Over the global sigma finset `nbAll k` (all length-`k`
non-backtracking walks, tagged by start): the *last-edge* marginal `nbLastWeight k u v` (walks
ending at `v` with penultimate `u`), the *end* marginal `nbEndWeight k v` (walks ending at `v`),
and the total `nbWeightTotal k`. Their exact values (`= 1`, `= deg v`, `= D`) are AHL's
stationarity `xP = x`, proved in the follow-up node W3–W5, not here; this file lands the defs and
their membership rewrite `mem_nbAll`.

## Formalization note — directed edges as (penultimate, end) pairs, not `SimpleGraph.Dart`

AHL runs its stationary walk over the `D` *directed edges*; the `xP = x` identity is a statement
about the *last* directed edge of a walk. Mathlib offers `SimpleGraph.Dart`, but the landed
counting vocabulary already carries the whole walk, whose last directed edge `(penultimate, end)`
is recovered by `Walk.penultimate` and the endpoint tag `s.1`. We therefore formalize a directed
edge as that `(penultimate, end)` pair and phrase the last-edge marginal `nbLastWeight` as a filter
on those two fields — keeping the marginal identities as sums over the already-landed `nbWalksFrom`
finsets with **no** `Dart`-to-walk bridge. (`Walk.penultimate_concat` is already in Mathlib, so the
"penultimate of an extension" fiber fact needs no fresh lemma.)
-/

namespace ACMax

open SimpleGraph Finset

variable {V : Type*} [Fintype V] {G : SimpleGraph V} [DecidableEq V] [DecidableRel G.Adj]

/-! ### W0 — the reusable one-step decomposition -/

/-- **Disjointness of the extension fibers.** Over distinct prefix walks the one-edge
non-backtracking extension sets `nbExtend G x` are disjoint: a shared extension `p.concat _`
determines its prefix `p` via `Walk.concat_inj`. This is the disjointness the `biUnion`
decomposition and every weighted regrouping below rely on. -/
theorem pairwiseDisjoint_nbExtend (x : V) (k : ℕ) :
Set.PairwiseDisjoint (↑(nbWalksFrom G x k)) (nbExtend G x) := by
intro s _ s' _ hss'
refine Finset.disjoint_left.mpr fun y hy hy' => ?_
obtain ⟨u, p⟩ := s
obtain ⟨u', p'⟩ := s'
rw [nbExtend, Finset.mem_image] at hy hy'
obtain ⟨b, hb, hby⟩ := hy
obtain ⟨b', hb', hby'⟩ := hy'
rw [Finset.mem_sdiff, mem_neighborFinset] at hb hb'
simp only [dite_eq_left hb.1] at hby
simp only [dite_eq_left hb'.1] at hby'
rw [← hby'] at hby
simp only [Sigma.mk.injEq] at hby
obtain ⟨rfl, hheq⟩ := hby
obtain ⟨rfl, hcopy⟩ := Walk.concat_inj (eq_of_heq hheq)
rw [Walk.copy_rfl_rfl] at hcopy
exact hss' (by rw [hcopy])

/-- **Fiber cardinality.** A prefix walk `s` (non-nil, so its endpoint has a penultimate) has
exactly `deg s.1 − 1` non-backtracking extensions — one per neighbour of the endpoint other than
the arrived-from vertex. This is `nb_extension_count` transported across the image. -/
theorem card_nbExtend {x : V} {s : Σ v : V, G.Walk x v} (hnn : ¬ s.2.Nil) :
(nbExtend G x s).card = G.degree s.1 - 1 := by
have hadj : G.Adj s.1 s.2.penultimate := (s.2.adj_penultimate hnn).symm
rw [nbExtend, Finset.card_image_of_injOn, nb_extension_count G hadj]
intro b hb b' hb' hbb
rw [Finset.mem_coe, Finset.mem_sdiff, mem_neighborFinset] at hb hb'
simp only [dite_eq_left hb.1, dite_eq_left hb'.1] at hbb
exact congrArg Sigma.fst hbb

/-- **Penultimate of an extension.** Every extension of `s` has the prefix endpoint `s.1` as its
penultimate vertex: the old endpoint becomes the new intermediate vertex. (Immediate from
`Walk.penultimate_concat`.) -/
theorem penultimate_of_mem_nbExtend {x : V} {s s' : Σ v : V, G.Walk x v}
(hs' : s' ∈ nbExtend G x s) : s'.2.penultimate = s.1 := by
rw [nbExtend, Finset.mem_image] at hs'
obtain ⟨b, hb, hbs'⟩ := hs'
rw [Finset.mem_sdiff, mem_neighborFinset] at hb
simp only [dite_eq_left hb.1] at hbs'
rw [← hbs']
exact Walk.penultimate_concat s.2 hb.1

/-- **The one-step decomposition** (W0). For `k ≥ 1`, the length-`(k+1)` non-backtracking walks
from `x` are exactly the disjoint union of the one-edge non-backtracking extensions of the
length-`k` ones. Extracted from the proof of `card_nbWalksFrom_succ`; the cardinality and every
weighted marginal of the AHL assembly are read off this identity via `Finset.sum_biUnion`. -/
theorem nbWalksFrom_succ_eq_biUnion (x : V) {k : ℕ} (hk : 1 ≤ k) :
nbWalksFrom G x (k + 1) = (nbWalksFrom G x k).biUnion (nbExtend G x) := by
have ha : ∀ s ∈ nbWalksFrom G x k, nbExtend G x s ⊆ nbWalksFrom G x (k + 1) := by
intro s hs
obtain ⟨hlen, hnb⟩ := mem_nbWalksFrom.mp hs
have hnn : ¬ s.2.Nil := Walk.not_nil_iff_lt_length.mpr (by omega)
intro y hy
rw [nbExtend, Finset.mem_image] at hy
obtain ⟨b, hb, hby⟩ := hy
rw [Finset.mem_sdiff, mem_neighborFinset, Finset.mem_singleton] at hb
simp only [dite_eq_left hb.1] at hby
subst hby
refine mem_nbWalksFrom.mpr ⟨?_, ?_⟩
· change (s.2.concat hb.1).length = k + 1
rw [Walk.length_concat, hlen]
· change IsNonBacktracking (s.2.concat hb.1)
exact (nb_concat_iff s.2 hnn hb.1).mpr ⟨hnb, hb.2⟩
have hsub : nbWalksFrom G x (k + 1) ⊆ (nbWalksFrom G x k).biUnion (nbExtend G x) := by
intro s' hs'
obtain ⟨v, w⟩ := s'
obtain ⟨hlen, hnb⟩ := mem_nbWalksFrom.mp hs'
clear hs'
cases w with
| nil => rw [Walk.length_nil] at hlen; exact absurd hlen (by omega)
| cons h p =>
obtain ⟨u, q, h', hqc⟩ := Walk.exists_cons_eq_concat h p
rw [Walk.length_cons] at hlen
have hql : q.length = k := by
have hc := congrArg Walk.length hqc
rw [Walk.length_cons, Walk.length_concat] at hc
omega
have hqnn : ¬ q.Nil := Walk.not_nil_iff_lt_length.mpr (by omega)
rw [hqc] at hnb
obtain ⟨hqnb, hpen⟩ := (nb_concat_iff q hqnn h').mp hnb
rw [Finset.mem_biUnion]
refine ⟨⟨u, q⟩, mem_nbWalksFrom.mpr ⟨hql, hqnb⟩, ?_⟩
rw [hqc, nbExtend, Finset.mem_image]
refine ⟨v, ?_, ?_⟩
· rw [Finset.mem_sdiff, mem_neighborFinset, Finset.mem_singleton]
exact ⟨h', hpen⟩
· simp only [dite_eq_left h']
exact Finset.Subset.antisymm hsub (Finset.biUnion_subset.mpr ha)

/-! ### W1 — the AHL walk weight -/

/-- **The AHL walk weight.** For a length-`len` non-backtracking walk `s = ⟨v, p⟩` starting at `x`,
the weight is the product `∏_{1 ≤ j < len} (deg (p.getVert j) − 1)⁻¹` over the *intermediate*
vertices only (endpoints `0` and `len` excluded; the empty product is `1` when `len ≤ 1`). This is
AHL's non-returning-walk probability, cleared of the uniform starting mass. -/
noncomputable def nbWeight {x : V} (s : Σ v : V, G.Walk x v) : ℝ :=
∏ j ∈ Finset.Ico 1 s.2.length, ((G.degree (s.2.getVert j) : ℝ) - 1)⁻¹

omit [DecidableEq V] in
/-- Unfolding of `nbWeight` on an explicit sigma constructor. -/
theorem nbWeight_mk {x v : V} (p : G.Walk x v) :
nbWeight (⟨v, p⟩ : Σ w : V, G.Walk x w) =
∏ j ∈ Finset.Ico 1 p.length, ((G.degree (p.getVert j) : ℝ) - 1)⁻¹ := rfl

omit [DecidableEq V] in
/-- **The weight is `1` on short walks.** For a walk of length `≤ 1` the intermediate range
`Ico 1 len` is empty, so the weight is the empty product `1`. -/
theorem nbWeight_one {x : V} {s : Σ v : V, G.Walk x v} (h : s.2.length ≤ 1) : nbWeight s = 1 := by
rw [nbWeight, Finset.Ico_eq_empty_of_le h, Finset.prod_empty]

omit [DecidableEq V] in
/-- **Positivity.** Under `δ ≥ 2` every factor `(deg (getVert j) − 1)⁻¹` is positive, so the whole
weight is positive. -/
theorem nbWeight_pos (hδ2 : ∀ v, 2 ≤ G.degree v) {x : V} (s : Σ v : V, G.Walk x v) :
0 < nbWeight s := by
rw [nbWeight]
refine Finset.prod_pos fun j _ => ?_
rw [inv_pos, sub_pos]
have h1 : (1 : ℝ) < (G.degree (s.2.getVert j) : ℝ) := by exact_mod_cast hδ2 (s.2.getVert j)
exact h1

omit [DecidableEq V] in
/-- **Weight under a one-edge extension** (mass conservation). Extending a non-nil walk
`p : G.Walk x v` by an edge `h : G.Adj v t` multiplies the weight by exactly `(deg v − 1)⁻¹` — the
old endpoint `v` becomes the new intermediate vertex. This is the whole AHL trick: the weighted
end-count obeys an *exact* degree law (unlike the raw end-count). -/
theorem nbWeight_concat {x v t : V} (p : G.Walk x v) (hp : ¬ p.Nil) (h : G.Adj v t) :
nbWeight (⟨t, p.concat h⟩ : Σ w : V, G.Walk x w) =
nbWeight (⟨v, p⟩ : Σ w : V, G.Walk x w) * ((G.degree v : ℝ) - 1)⁻¹ := by
have hL : 1 ≤ p.length := Walk.not_nil_iff_lt_length.mp hp
have hgv : ∀ j, j < p.length → (p.concat h).getVert j = p.getVert j := by
intro j hj
rw [Walk.concat_eq_append, Walk.getVert_append]
exact ite_eq_left hj
have hlast : (p.concat h).getVert p.length = v := by
calc (p.concat h).getVert p.length
= (p.concat h).getVert ((p.concat h).length - 1) := by
rw [Walk.length_concat, Nat.add_sub_cancel]
_ = (p.concat h).penultimate := rfl
_ = v := Walk.penultimate_concat p h
rw [nbWeight_mk (p.concat h), nbWeight_mk p, Walk.length_concat, Finset.prod_Ico_succ_top hL]
congr 1
· refine Finset.prod_congr rfl fun j hj => ?_
rw [hgv j (Finset.mem_Ico.mp hj).2]
· rw [hlast]

/-! ### W2 — the marginal sums -/

/-- The global sigma finset of all length-`k` non-backtracking walks, tagged by their start: an
element `⟨x, ⟨v, p⟩⟩` is a length-`k` non-backtracking walk `p : G.Walk x v`. -/
def nbAll (k : ℕ) : Finset (Σ x : V, Σ v : V, G.Walk x v) :=
Finset.univ.sigma fun x => nbWalksFrom G x k

/-- Membership in `nbAll`: `⟨x, ⟨v, p⟩⟩` lies in `nbAll k` iff `p` has length `k` and is
non-backtracking (the start ranges over all of `V`). -/
theorem mem_nbAll {k : ℕ} {t : Σ x : V, Σ v : V, G.Walk x v} :
t ∈ nbAll (G := G) k ↔ t.2.2.length = k ∧ IsNonBacktracking t.2.2 := by
rw [nbAll, Finset.mem_sigma]
simp only [Finset.mem_univ, true_and]
exact mem_nbWalksFrom

/-- **The last-edge marginal** (AHL's `xP = x`, def only). The total weight of the length-`k`
non-backtracking walks whose last directed edge is `(u, v)` — i.e. ending at `v` with penultimate
`u`. Its value `1` (for `k ≥ 1`, `G.Adj u v`) is the stationarity identity proved in node W3. -/
noncomputable def nbLastWeight (k : ℕ) (u v : V) : ℝ :=
∑ t ∈ (nbAll (G := G) k).filter (fun t => t.2.1 = v ∧ t.2.2.penultimate = u), nbWeight t.2

/-- **The end marginal** (def only). The total weight of the length-`k` non-backtracking walks
ending at `v`; its value `deg v` (node W4) is the marginal of `nbLastWeight` over the neighbours of
`v`. -/
noncomputable def nbEndWeight (k : ℕ) (v : V) : ℝ :=
∑ t ∈ (nbAll (G := G) k).filter (fun t => t.2.1 = v), nbWeight t.2

/-- **The total weight** (def only). The total weight of all length-`k` non-backtracking walks;
its value `D = ∑ v, deg v` (node W5) is the normalization `∑_v nbEndWeight k v`. -/
noncomputable def nbWeightTotal (k : ℕ) : ℝ :=
∑ t ∈ nbAll (G := G) k, nbWeight t.2

end ACMax
Loading
Loading