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