File size: 3,082 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | import OAI.Combinatorics.MatrixRemoval.AnchorPatternBridge
import OAI.Combinatorics.MatrixRemoval.AnchorProperties
namespace OAI
/-!
# Structural anchor bridges for the fixed pattern
The generic bridges are specialized to the explicit `anchor64` definition.
-/
universe uR uC
namespace Problem348.AnchorBridge
/-- The exact anchor realizes every five-bit word on the specified suffix. -/
theorem anchor64_word_block_complete (w : Fin 5 β Bool) :
β a : Fin 32, β b : Fin 5,
anchor64 (wordRow a) (wordCol b) = w b := by
obtain β¨a, haβ© := anchorWord_bijective.2 w
refine β¨a, fun b => ?_β©
have hb := congrFun ha b
simpa only [anchorWord, wordRow, wordCol, Nat.add_comm] using hb
/-- An exact anchor copy has at least 33 anchors on one of its two axes,
provided anchors form prefixes and non-anchor rows do not shatter five
non-anchor columns. -/
theorem anchor64_anchor_majority {R : Type uR} {C : Type uC}
(A : R β C β Bool) (row : Fin 64 β R) (col : Fin 64 β C)
(anchorR : R β Prop) (anchorC : C β Prop)
[DecidablePred anchorR] [DecidablePred anchorC]
(hcopy : β i j, A (row i) (col j) = anchor64 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))
(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) :
33 β€ (Finset.univ.filter (fun i => anchorR (row i))).card β¨
33 β€ (Finset.univ.filter (fun j => anchorC (col j))).card := by
rcases anchor_at_32_or_anchor_at_32 anchor64 A row col anchorR anchorC
hcopy hcol hprefixR hprefixC anchor64_word_block_complete hnoshatter with hr | hc
Β· exact Or.inl (prefix_card_lower_bound _ β¨32, by decideβ© hprefixR hr)
Β· exact Or.inr (prefix_card_lower_bound _ β¨32, by decideβ© hprefixC hc)
/-- A row class of equal host rows occurs at most once in an anchor copy. -/
theorem anchor64_row_class_single_use {R : Type uR} {C : Type uC}
(A : R β C β Bool) (row : Fin 64 β R) (col : Fin 64 β C)
(P : R β Prop) [DecidablePred P]
(hcopy : β i j, A (row i) (col j) = anchor64 i j)
(hclass : β r s, P r β P s β A r = A s) :
(Finset.univ.filter (fun i => P (row i))).card β€ 1 :=
card_selected_row_class_le_one anchor64 A row col P hcopy
anchor64_rows_injective hclass
/-- A column class of equal host columns occurs at most once in an anchor copy. -/
theorem anchor64_col_class_single_use {R : Type uR} {C : Type uC}
(A : R β C β Bool) (row : Fin 64 β R) (col : Fin 64 β C)
(P : C β Prop) [DecidablePred P]
(hcopy : β i j, A (row i) (col j) = anchor64 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 :=
card_selected_col_class_le_one anchor64 A row col P hcopy
anchor64_columns_injective hclass
end Problem348.AnchorBridge
end OAI
|