Download data/lean/OAI/Combinatorics/BinaryEdit/FiniteVectorDetection.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.44 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BinaryEdit/FiniteVectorDetection.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/BinaryEdit/FiniteVectorDetection.lean
-
curl -L -o FiniteVectorDetection.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BinaryEdit/FiniteVectorDetection.lean
4.44 kB
| import OAI.Combinatorics.BinaryEdit.FiniteVectors | |
| import OAI.Combinatorics.BinaryEdit.SparseCharacterPeriod | |
| import OAI.Combinatorics.BinaryEdit.FiniteActivityBridge | |
| namespace OAI | |
| /-! | |
| # Actual sparse-node character tests | |
| Short-period detection holds for the finite-tree vectors in both the | |
| function-indexed and list-indexed presentations. | |
| -/ | |
| noncomputable section | |
| open scoped BigOperators | |
| open Classical | |
| namespace TreeEdit.BinaryLower.FiniteVectors | |
| /-- The actual finite-tree cheap vector detects any active distinguished | |
| vector whose children have support smaller than `k`. Exact orders and | |
| primality are unnecessary here: the proved annihilating periods suffice. -/ | |
| theorem sparse_node_detection {m k : β} | |
| (p : Fin k β Fin m β β) (hk : 1 β€ k) | |
| (hppos : β q i, 0 < p q i) (hp : β q i, p q i β€ k ^ 5) | |
| (j : β) (hj : j < k) (a : Leaf m k) (Ο : AddChar (State p) β) | |
| (hactive : Ο (w p j a) β 1) | |
| (hsparse : (Finset.univ.filter fun i : Fin m => | |
| Ο (w p (j + 1) (Function.update a β¨j, hjβ© i)) β 1).card < k) : | |
| ((4 * k ^ (10 * k) : β) : β) β€ | |
| β s : Fin (4 * k ^ (10 * k)), β1 - Ο ((s.val + 1) β’ u p j a)β ^ 2 := by | |
| let : Finite (State p) := state_finite p hppos | |
| let child : Fin m β State p := fun i => w p (j + 1) (Function.update a β¨j, hjβ© i) | |
| let S : Finset (Fin m) := Finset.univ.filter fun i => Ο (child i) β 1 | |
| have hsum : u p j a = β i, child i := u_eq_sum_child_w p j hj a | |
| have hroot : Ο (levelProduct p β¨j, hjβ© β’ β i, child i) β 1 := by | |
| rw [β hsum, β w_eq_level_nsmul_u p j hj a] | |
| exact hactive | |
| have hchild : β i β S, (prefixPeriod p j a * p β¨j, hjβ© i) β’ child i = 0 := by | |
| intro i _ | |
| dsimp [child] | |
| rw [β prefixPeriod_child p j hj a i] | |
| exact prefixPeriod_nsmul_w p (j + 1) (Function.update a β¨j, hjβ© i) | |
| have houtside : β i, i β S β Ο (child i) = 1 := by | |
| intro i hi | |
| simpa only [S, Finset.mem_filter, Finset.mem_univ, true_and, not_not] using hi | |
| have havg := FinitePeriod.sparse_character_detection Ο S child (p β¨j, hjβ©) | |
| hk hj hsparse (prefixPeriod_pos p hppos j a) (prefixPeriod_le p hp j hj.le a) | |
| (fun i _ => hppos _ i) (fun i _ => hp _ i) houtside hchild hroot | |
| have hJ : (0 : β) < ((4 * k ^ (10 * k) : β) : β) := by positivity | |
| have hraw := (le_div_iffβ hJ).mp havg | |
| rw [Fin.sum_univ_eq_sum_range (fun s : β => β1 - Ο ((s + 1) β’ u p j a)β ^ 2)] | |
| simpa only [one_mul, β hsum] using hraw | |
| end TreeEdit.BinaryLower.FiniteVectors | |
| namespace TreeEdit.BinaryLower.FiniteActivity | |
| /-- The exact unnormalized finite-sample detector required by | |
| `finite_tree_spectral_bound`, with the sparse predicate and child list | |
| indices unchanged. All hypotheses are local vector/period identities. -/ | |
| theorem characterSparse_detection {Ξ± A : Type*} | |
| [Fintype Ξ±] [AddCommGroup A] [Finite A] {k : β} | |
| (w : List Ξ± β A) (v : InternalNode Ξ± k) (u : A) | |
| (Q R : β) (p : Ξ± β β) (hk : 1 β€ k) | |
| (hQpos : 0 < Q) (hQ : Q β€ 2 * k ^ (5 * v.1.val)) | |
| (hppos : β i, 0 < p i) (hp : β i, p i β€ k ^ 5) | |
| (hroot : w (List.ofFn v.2) = R β’ u) | |
| (hsum : u = β i, w (List.ofFn v.2 ++ [i])) | |
| (hchild : β i, (Q * p i) β’ w (List.ofFn v.2 ++ [i]) = 0) | |
| (Ο : AddChar A β) (hsparse : characterSparse w k v Ο) : | |
| ((4 * k ^ (10 * k) : β) : β) β€ | |
| β s : Fin (4 * k ^ (10 * k)), β1 - Ο ((s.val + 1) β’ u)β ^ 2 := by | |
| let S : Finset Ξ± := Finset.univ.filter fun i => Ο (w (List.ofFn v.2 ++ [i])) β 1 | |
| have hcard : S.card < k := by | |
| simpa only [S, Branching.activeChildCount] using hsparse.2 | |
| have hactive : Ο (R β’ β i, w (List.ofFn v.2 ++ [i])) β 1 := by | |
| rw [β hsum, β hroot] | |
| exact hsparse.1 | |
| have houtside : β i, i β S β Ο (w (List.ofFn v.2 ++ [i])) = 1 := by | |
| intro i hi | |
| simpa only [S, Finset.mem_filter, Finset.mem_univ, true_and, not_not] using hi | |
| have havg := FinitePeriod.sparse_character_detection Ο S | |
| (fun i => w (List.ofFn v.2 ++ [i])) p hk v.1.isLt hcard hQpos hQ | |
| (fun i _ => hppos i) (fun i _ => hp i) houtside (fun i _ => hchild i) hactive | |
| have hJ : (0 : β) < ((4 * k ^ (10 * k) : β) : β) := by positivity | |
| have hraw := (le_div_iffβ hJ).mp havg | |
| rw [Fin.sum_univ_eq_sum_range (fun s : β => β1 - Ο ((s + 1) β’ u)β ^ 2)] | |
| simpa only [one_mul, β hsum] using hraw | |
| end TreeEdit.BinaryLower.FiniteActivity | |
| end | |
| end OAI | |