Download data/lean/OAI/Combinatorics/MatrixRemoval/AnchorPatternBridge.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatrixRemoval/AnchorPatternBridge.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/MatrixRemoval/AnchorPatternBridge.lean
-
curl -L -o AnchorPatternBridge.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/MatrixRemoval/AnchorPatternBridge.lean
6 kB
| import Mathlib | |
| namespace OAI | |
| /-! | |
| # Structural bridges for anchor pinning | |
| Group uniqueness and no-shattering give pinning criteria independent of | |
| the host construction. | |
| -/ | |
| universe uI uJ uR uC uG | |
| namespace Problem348.AnchorBridge | |
| /-- Distinct pattern rows prevent a copy from repeating any host row class | |
| whose members have identical entries. -/ | |
| theorem row_labels_injective {I : Type uI} {J : Type uJ} {R : Type uR} {C : Type uC} {G : Type uG} | |
| (H : I β J β Bool) (A : R β C β Bool) | |
| (row : I β R) (col : J β C) (label : R β G) | |
| (hcopy : β i j, A (row i) (col j) = H i j) | |
| (hrows : Function.Injective H) | |
| (hlabel : β r s, label r = label s β A r = A s) : | |
| Function.Injective (fun i => label (row i)) := by | |
| intro i j hij | |
| apply hrows | |
| funext c | |
| rw [β hcopy, β hcopy] | |
| exact congrFun (hlabel (row i) (row j) hij) (col c) | |
| /-- The column version of `row_labels_injective`. -/ | |
| theorem col_labels_injective {I : Type uI} {J : Type uJ} {R : Type uR} {C : Type uC} {G : Type uG} | |
| (H : I β J β Bool) (A : R β C β Bool) | |
| (row : I β R) (col : J β C) (label : C β G) | |
| (hcopy : β i j, A (row i) (col j) = H i j) | |
| (hcols : Function.Injective (fun j => fun i => H i j)) | |
| (hlabel : β c d, label c = label d β β r, A r c = A r d) : | |
| Function.Injective (fun j => label (col j)) := by | |
| intro i j hij | |
| apply hcols | |
| funext r | |
| change H r i = H r j | |
| rw [β hcopy, β hcopy] | |
| exact hlabel (col i) (col j) hij (row r) | |
| /-- The 32 rows carrying all binary words in the fixed anchor. -/ | |
| def wordRow (a : Fin 32) : Fin 64 := β¨32 + a.val, by omegaβ© | |
| /-- The five columns carrying the word coordinates in the fixed anchor. -/ | |
| def wordCol (b : Fin 5) : Fin 64 := β¨59 + b.val, by omegaβ© | |
| @[simp] theorem wordCol_injective : Function.Injective wordCol := by | |
| intro a b hab | |
| apply Fin.ext | |
| have := congrArg Fin.val hab | |
| simp only [wordCol] at this | |
| omega | |
| /-- If both axes had at most 32 initial anchor positions, the complete-word | |
| submatrix would shatter five non-anchor columns. Thus the position at index | |
| 32 is an anchor on at least one axis. -/ | |
| theorem anchor_at_32_or_anchor_at_32 {R : Type uR} {C : Type uC} | |
| (H : Fin 64 β Fin 64 β Bool) (A : R β C β Bool) | |
| (row : Fin 64 β R) (col : Fin 64 β C) | |
| (anchorR : R β Prop) (anchorC : C β Prop) | |
| (hcopy : β i j, A (row i) (col j) = H i j) | |
| (hcol : Function.Injective col) | |
| (hprefixR : β i j, i β€ j β anchorR (row j) β anchorR (row i)) | |
| (hprefixC : β i j, i β€ j β anchorC (col j) β anchorC (col i)) | |
| (hwords : β w : Fin 5 β Bool, β a : Fin 32, | |
| β b : Fin 5, H (wordRow a) (wordCol b) = w b) | |
| (hnoshatter : β cs : Fin 5 β C, Function.Injective cs β | |
| (β b, Β¬ anchorC (cs b)) β β w : Fin 5 β Bool, | |
| β r, Β¬ anchorR r β β b, A r (cs b) β w b) : | |
| anchorR (row β¨32, by decideβ©) β¨ anchorC (col β¨32, by decideβ©) := by | |
| classical | |
| by_contra h | |
| push Not at h | |
| have hr : β a : Fin 32, Β¬ anchorR (row (wordRow a)) := by | |
| intro a ha | |
| apply h.1 | |
| exact hprefixR _ _ (by simp only [wordRow, Fin.le_iff_val_le_val]; omega) ha | |
| have hc : β b : Fin 5, Β¬ anchorC (col (wordCol b)) := by | |
| intro b hb | |
| apply h.2 | |
| exact hprefixC _ _ (by simp only [wordCol, Fin.le_iff_val_le_val]; omega) hb | |
| obtain β¨w, hwβ© := hnoshatter (fun b => col (wordCol b)) | |
| (hcol.comp wordCol_injective) hc | |
| obtain β¨a, haβ© := hwords w | |
| obtain β¨b, hbβ© := hw (row (wordRow a)) (hr a) | |
| exact hb ((hcopy _ _).trans (ha b)) | |
| /-- A downward-closed predicate holding at index `m` holds at at least | |
| `m+1` indices. -/ | |
| theorem prefix_card_lower_bound {n : β} (P : Fin n β Prop) [DecidablePred P] | |
| (m : Fin n) (hprefix : β i j, i β€ j β P j β P i) (hm : P m) : | |
| m.val + 1 β€ (Finset.univ.filter P).card := by | |
| classical | |
| calc | |
| m.val + 1 = (Finset.Iic m).card := by simp | |
| _ β€ (Finset.univ.filter P).card := by | |
| apply Finset.card_le_card | |
| intro i hi | |
| exact Finset.mem_filter.mpr β¨Finset.mem_univ i, | |
| hprefix i m (Finset.mem_Iic.mp hi) hmβ© | |
| /-- An increasing self-map of a finite ordered interval uses every label | |
| in the prescribed order. -/ | |
| theorem increasing_labels_eq_id {n : β} (f : Fin n β Fin n) | |
| (hf : StrictMono f) : f = id := by | |
| funext i | |
| exact le_antisymm (hf.le_id i) (hf.id_le i) | |
| /-- Any class of host rows with identical entries is used at most once | |
| in a copy with distinct pattern rows. In particular this applies to the | |
| dummy row class. -/ | |
| theorem card_selected_row_class_le_one {I : Type uI} {J : Type uJ} {R : Type uR} {C : Type uC} | |
| [Fintype I] (H : I β J β Bool) (A : R β C β Bool) | |
| (row : I β R) (col : J β C) (P : R β Prop) [DecidablePred P] | |
| (hcopy : β i j, A (row i) (col j) = H i j) | |
| (hrows : Function.Injective H) | |
| (hclass : β r s, P r β P s β A r = A s) : | |
| (Finset.univ.filter (fun i => P (row i))).card β€ 1 := by | |
| classical | |
| apply Finset.card_le_one.mpr | |
| intro i hi j hj | |
| apply hrows | |
| funext c | |
| rw [β hcopy, β hcopy] | |
| exact congrFun (hclass (row i) (row j) | |
| (Finset.mem_filter.mp hi).2 (Finset.mem_filter.mp hj).2) (col c) | |
| /-- Column version of the single-use class bound. -/ | |
| theorem card_selected_col_class_le_one {I : Type uI} {J : Type uJ} {R : Type uR} {C : Type uC} | |
| [Fintype J] (H : I β J β Bool) (A : R β C β Bool) | |
| (row : I β R) (col : J β C) (P : C β Prop) [DecidablePred P] | |
| (hcopy : β i j, A (row i) (col j) = H i j) | |
| (hcols : Function.Injective (fun j => fun i => H i j)) | |
| (hclass : β c d, P c β P d β β r, A r c = A r d) : | |
| (Finset.univ.filter (fun j => P (col j))).card β€ 1 := by | |
| classical | |
| apply Finset.card_le_one.mpr | |
| intro i hi j hj | |
| apply hcols | |
| funext r | |
| change H r i = H r j | |
| rw [β hcopy, β hcopy] | |
| exact hclass (col i) (col j) | |
| (Finset.mem_filter.mp hi).2 (Finset.mem_filter.mp hj).2 (row r) | |
| end Problem348.AnchorBridge | |
| end OAI | |