Exact Lean source
WernerMultivariateConvolution
formalization/Cloning/WernerMultivariateConvolution.lean
Source hash: 7981ba3f24fa5d54405e65a92518f672bfa0aef718735a94b59d6132b8e2bc8b
Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.
The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.
Declarations in this module
1import Cloning.WernerNormalization
2import Cloning.WernerDimensionIdentity
3
4/-! The multivariate negative-binomial convolution supplying the exact
5partial-trace balance of the symmetric projector. -/
6namespace Cloning.Occupation
7open scoped BigOperators
8open Finset
9
10private theorem list_choose_convolution (s r : ℕ) (a : Fin (s + 1) → ℕ) :
11 ((List.Nat.antidiagonalTuple (s + 1) r).map
12 (fun b => ∏ i, (b i + a i).choose (a i))).sum =
13 (r + (∑ i, a i) + s).choose ((∑ i, a i) + s) := by
14 induction s generalizing r with
15 | zero => simp
16 | succ s ih =>
17 rw [List.Nat.antidiagonalTuple, List.map_flatMap, List.flatMap_def, List.sum_flatten]
18 simp only [List.map_map, Function.comp_def]
19 have hprod (t : ℕ) (b : Fin (s + 1) → ℕ) :
20 (∏ i : Fin (s + 1 + 1), ((Fin.cons t b : Fin (s + 1 + 1) → ℕ) i + a i).choose (a i)) =
21 (t + a 0).choose (a 0) * ∏ i, (b i + a i.succ).choose (a i.succ) := by
22 rw [Fin.prod_univ_succ]
23 rfl
24 simp_rw [hprod, List.sum_map_mul_left, ih]
25 simp only [List.Nat.antidiagonal, List.map_map, Function.comp_def]
26 rw [← List.sum_toFinset _ List.nodup_range]
27 simp only [List.toFinset_range]
28 convert choose_convolution (a 0) ((∑ i : Fin (s + 1), a i.succ) + s) r using 1 <;>
29 simp [Fin.sum_univ_succ, Nat.add_assoc, Nat.add_comm, Nat.add_left_comm]
30
31/-- Convolution over actual occupation vectors with a fixed total. -/
32theorem multivariate_choose_convolution (s r : ℕ) (a : Fin (s + 1) → ℕ) :
33 (∑ b ∈ Finset.Nat.antidiagonalTuple (s + 1) r,
34 ∏ i, (b i + a i).choose (a i)) =
35 (r + (∑ i, a i) + s).choose ((∑ i, a i) + s) := by
36 have heq : (∑ b ∈ Finset.Nat.antidiagonalTuple (s + 1) r,
37 ∏ i, (b i + a i).choose (a i)) =
38 ((List.Nat.antidiagonalTuple (s + 1) r).map
39 (fun b => ∏ i, (b i + a i).choose (a i))).sum := rfl
40 rw [heq]
41 exact list_choose_convolution s r a
42
43/-- The same convolution in the form used for added occupation numbers. -/
44theorem multivariate_choose_added (s r : ℕ) (a : Fin (s + 1) → ℕ) :
45 (∑ b ∈ Finset.Nat.antidiagonalTuple (s + 1) r,
46 ∏ i, (a i + b i).choose (b i)) =
47 ((∑ i, a i) + r + s).choose r := by
48 have he (b : Fin (s + 1) → ℕ) : (∏ i, (a i + b i).choose (b i)) =
49 ∏ i, (b i + a i).choose (a i) := by
50 apply prod_congr rfl
51 intro i hi
52 simpa [Nat.add_comm] using (Nat.choose_symm_add (a := a i) (b := b i)).symm
53 simp_rw [he]
54 rw [multivariate_choose_convolution]
55 simpa [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using
56 (Nat.choose_symm_add (a := (∑ i, a i) + s) (b := r))
57
58/-- The scalar balance factor is the ratio of the symmetric dimensions. -/
59theorem werner_balance_dimension_identity (n r s : ℕ) :
60 ((n + r + s).choose (n + s) : ℝ) / ((n + r).choose n : ℝ) =
61 ((n + r + s).choose s : ℝ) / ((n + s).choose s : ℝ) := by
62 have ha : ((n + s).choose s : ℝ) ≠ 0 := by
63 exact_mod_cast (Nat.choose_pos (Nat.le_add_left s n)).ne'
64 have hb : ((n + r).choose n : ℝ) ≠ 0 := by
65 exact_mod_cast (Nat.choose_pos (Nat.le_add_right n r)).ne'
66 have hid : ((n + r + s).choose (n + s) : ℝ) * ((n + s).choose s : ℝ) =
67 ((n + r + s).choose s : ℝ) * ((n + r).choose n : ℝ) := by
68 exact_mod_cast (by simpa using
69 (Nat.choose_mul (n := n + r + s) (k := n + s) (s := s) (Nat.le_add_left s n)))
70 exact (div_eq_div_iff hb ha).mpr hid
71
72end Cloning.Occupation