SilverSight/formal/CoreFormalism/StrandCapacityBound.lean
allaun 3362d554d1 feat(braid/dag): land untracked research WIP + register 4 formal libs; ignore build artifacts
- lakefile.lean: register SilverSight.{AngrySphinx,CollatzBraid,GoldenSpiral,GCCL}
- docs/research/: braid group action, iteration DAG/regime, Sidon
  preservation/creation, unified CRT-torus DAG notes
- docs/diagrams/: DAG + heatmap + 8-strand search JSON/dot outputs
- formal/CoreFormalism/StrandCapacityBound.lean: capacity bound (passes
  hardened anti-smuggle --ci)
- scripts/, python/: braid word solver, collapse/DAG search + tuning,
  heatmap gen, YB search/verification, wrapping verifier
- .gitignore: exclude rust/**/target and coq compiled artifacts
  (*.vo/*.vok/*.vos/*.glob/*.aux) that were polluting the tree

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 15:11:37 -05:00

97 lines
3.6 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Mathlib.Data.Nat.Basic
import Mathlib.Data.Int.Basic
import Mathlib.Data.Finset.Basic
import Mathlib.Tactic
open Finset
open Nat
/-!
# Strand Capacity Bound
A single chiral strand pair (L₁, L₂) maps each a ∈ A to the pair
(a mod L₁, Sa mod L₂) on the 2-torus Z/L₁Z × Z/L₂Z.
## Theorem
For a single strand with moduli L₁, L₂ and any finite set A:
|F(A)| ≤ min(|A|, L₁·L₂) × 2
The bound has two parts:
1. |F(A)| ≤ |A| (injectivity — F is a function from A)
2. |F(A)| ≤ L₁·L₂ (codomain has only L₁·L₂ distinct pairs)
-/
variable (L₁ L₂ S : )
/-- The strand pairing: (a mod L₁, S a mod L₂). -/
def strandPair (a : ) : × :=
(a % (L₁ : ), ((S : ) - a) % (L₂ : ))
/-- Image of A under the strand pairing. -/
noncomputable def strandImage (A : Set ) : Set ( × ) :=
strandPair L₁ L₂ S '' A
/-- Bound 1: image cardinality ≤ input cardinality (trivial, F is a function). -/
theorem capacity_bound_input (A : Finset ) :
(A.image (strandPair L₁ L₂ S)).card ≤ A.card :=
Finset.card_image_le
/--
Bound 2: the codomain grid has size L₁·L₂.
Each residue lies in [0, L₁) resp. [0, L₂), so at most
L₁ × L₂ distinct pairs are reachable regardless of |A|.
-/
theorem capacity_bound_grid (A : Finset ) :
(A.image (strandPair L₁ L₂ S)).card ≤ (L₁ : ) * L₂ := by
-- The grid of possible residues
let grid : Finset ( × ) :=
(Finset.Ico 0 (L₁ : )) ×ˢ (Finset.Ico 0 (L₂ : ))
have hgrid : grid.card = (L₁ : ) * L₂ := by
simp [grid, Finset.card_product, Finset.card_Ico, Nat.cast_inj]
-- Every strand pair lands in the grid
have hmem : ∀ a : , strandPair L₁ L₂ S a ∈ grid := by
intro a
have hx : a % (L₁ : ) ∈ Finset.Ico 0 (L₁ : ) := by
have hnonneg : 0 ≤ a % (L₁ : ) := emod_nonneg a (by norm_num : 0 < (L₁ : ))
have hlt : a % (L₁ : ) < (L₁ : ) := emod_lt a (by norm_num : 0 < (L₁ : ))
exact Finset.mem_Ico.mpr ⟨hnonneg, hlt⟩
have hy : ((S : ) - a) % (L₂ : ) ∈ Finset.Ico 0 (L₂ : ) := by
have hnonneg' : 0 ≤ ((S : ) - a) % (L₂ : ) :=
emod_nonneg _ (by norm_num : 0 < (L₂ : ))
have hlt' : ((S : ) - a) % (L₂ : ) < (L₂ : ) :=
emod_lt _ (by norm_num : 0 < (L₂ : ))
exact Finset.mem_Ico.mpr ⟨hnonneg', hlt'⟩
exact Finset.mem_product.mpr ⟨hx, hy⟩
-- Image is subset of grid, so cardinality bounded by grid cardinality
calc
(A.image (strandPair L₁ L₂ S)).card ≤ grid.card :=
Finset.card_le_card_of_subset (Finset.image_subset _ (by
intro a ha
exact hmem a))
_ = (L₁ : ) * L₂ := hgrid
/--
Combined bound: |F(A)| ≤ min(|A|, L₁·L₂).
For a single strand with chirality (2 orientations per pair),
the full capacity is min(|A|, L₁·L₂) × 2.
-/
theorem capacity_bound (A : Finset ) :
(A.image (strandPair L₁ L₂ S)).card ≤ min A.card ((L₁ : ) * L₂) := by
apply le_min
· exact capacity_bound_input L₁ L₂ S A
· exact capacity_bound_grid L₁ L₂ S A
/--
With chirality: each pair can be read in 2 orders
(identity, reflection) or (reflection, identity),
corresponding to σᵢ vs σᵢ⁻¹ in the braid group.
-/
theorem chiral_capacity_bound (A : Finset ) :
(A.image (strandPair L₁ L₂ S)).card * 2 ≤ min A.card ((L₁ : ) * L₂) * 2 := by
nlinarith [capacity_bound L₁ L₂ S A]
#eval ((Finset.Ico 1 7).image (strandPair 3 4 7)).card
-- Expected: 4 (Sidon example A={1,2,5,6} with moduli 3,4, S=7)