File size: 8,854 Bytes
f0f05de | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | import Mathlib
import OAI.Combinatorics.BalancedRyser.Construction.Construction
namespace OAI
namespace Balanced
open scoped _root_.Balanced
namespace ConfigurationStructure
variable {F : Type*} [Field F] [Fintype F] [DecidableEq F]
variable (C : Configuration F)
omit [Field F] in
theorem choice_line_mem_split (s : Slot F) : (C.choice s).line ∈ C.splitLines := by
exact Finset.mem_image.mpr ⟨s, Finset.mem_univ _, rfl⟩
theorem choice_designated_subset (hV : C.Valid) (s : Slot F) :
designated C.merged (C.choice s) ⊆ linePoints (C.choice s).line := by
intro p hp
obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hp
have hOn := (hV.2 s).2.2.2.2.2.1 i
simpa only [linePoints, Finset.mem_filter, Finset.mem_univ, true_and] using hOn
theorem choice_designated_card (hV : C.Valid) (s : Slot F) :
(designated C.merged (C.choice s)).card = 4 := by
rw [designated, Finset.card_image_of_injective _ (hV.2 s).2.2.2.2.1]
simp
theorem choice_designated_disjoint (hV : C.Valid) (hC : C.Compatible)
{i j : Slot F} (hij : i ≠ j) :
Disjoint (designated C.merged (C.choice i)) (designated C.merged (C.choice j)) := by
apply Finset.disjoint_left.mpr
intro p hpi hpj
have hpOn : OnLine p (C.choice i).line := by
simpa only [linePoints, Finset.mem_filter, Finset.mem_univ, true_and]
using choice_designated_subset C hV i hpi
exact hC.1 i j hij p hpj hpOn
theorem designated_slot_unique (hC : C.Compatible) {i j : Slot F} {p : Point F}
(hpi : p ∈ designated C.merged (C.choice i)) (hpj : OnLine p (C.choice j).line) :
i = j := by
by_contra hij
exact hC.1 j i (Ne.symm hij) p hpi hpj
theorem choice_line_injective (hV : C.Valid) (hC : C.Compatible) :
Function.Injective (fun s => (C.choice s).line) := by
intro i j hij
change (C.choice i).line = (C.choice j).line at hij
apply designated_slot_unique C hC (p := tuplePoint C.merged (C.choice i).tuple 0)
· exact Finset.mem_image.mpr ⟨0, Finset.mem_univ _, rfl⟩
· rw [← hij]
exact (hV.2 i).2.2.2.2.2.1 0
theorem retained_subset_points : C.retained ⊆ C.points := Finset.subset_union_left
theorem core_subset_retained : C.core ⊆ C.retained := by
intro p hp
simp only [Configuration.core, Finset.mem_filter, Finset.mem_univ, true_and] at hp
simp only [Configuration.retained, Finset.mem_filter, Finset.mem_univ, true_and]
intro l hl
exact hp l (Finset.mem_union_left _ hl)
theorem core_subset_points : C.core ⊆ C.points :=
(core_subset_retained C).trans (retained_subset_points C)
theorem designated_subset_points (s : Slot F) :
designated C.merged (C.choice s) ⊆ C.points := by
intro p hp
exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr ⟨s, Finset.mem_univ _, hp⟩)
theorem split_inter_points (hV : C.Valid) (hC : C.Compatible) (s : Slot F) :
linePoints (C.choice s).line ∩ C.points = designated C.merged (C.choice s) := by
ext p
constructor
· intro hp
obtain ⟨hpLine, hpX⟩ := Finset.mem_inter.mp hp
have hpOn : OnLine p (C.choice s).line := by
simpa only [linePoints, Finset.mem_filter, Finset.mem_univ, true_and] using hpLine
rcases Finset.mem_union.mp hpX with hpR | hpF
· have hpAvoid := (Finset.mem_filter.mp hpR).2
exact False.elim (hpAvoid _ (choice_line_mem_split C s) hpOn)
· obtain ⟨t, _, hpt⟩ := Finset.mem_biUnion.mp hpF
have hts := designated_slot_unique C hC hpt hpOn
simpa only [hts] using hpt
· intro hp
exact Finset.mem_inter.mpr
⟨choice_designated_subset C hV s hp, designated_subset_points C s hp⟩
theorem split_lines_card (hV : C.Valid) (hC : C.Compatible) :
C.splitLines.card = 2 * (Fintype.card F + 1) := by
rw [Configuration.splitLines, Finset.card_image_of_injective _ (choice_line_injective C hV hC)]
simp [Slot, Direction, Nat.mul_comm]
theorem split_multiplicity_eq_slots (hV : C.Valid) (hC : C.Compatible) (p : Point F) :
C.splitMultiplicity p =
(Finset.univ.filter (fun s : Slot F => OnLine p (C.choice s).line)).card := by
unfold Configuration.splitMultiplicity Configuration.splitLinesAt Configuration.splitLines
rw [Finset.filter_image, Finset.card_image_of_injective _ (choice_line_injective C hV hC)]
theorem designated_at_card (hV : C.Valid) (hC : C.Compatible) (p : Point F) :
(C.designatedAt p).card = 4 * C.splitMultiplicity p := by
unfold Configuration.designatedAt
rw [Finset.card_biUnion]
· rw [Finset.sum_congr rfl (fun s _ => choice_designated_card C hV s)]
simp only [Finset.sum_const, smul_eq_mul]
rw [split_multiplicity_eq_slots C hV hC p]
omega
· intro i _ j _ hij
exact choice_designated_disjoint C hV hC hij
theorem split_multiplicity_le_one_of_designated (hC : C.Compatible)
{s : Slot F} {p : Point F} (hp : p ∈ designated C.merged (C.choice s)) :
C.splitMultiplicity p ≤ 1 := by
have hsub : C.splitLinesAt p ⊆ {(C.choice s).line} := by
intro l hl
obtain ⟨hlS, hpl⟩ := Finset.mem_filter.mp hl
obtain ⟨t, _, rfl⟩ := Finset.mem_image.mp hlS
have hst := designated_slot_unique C hC hp hpl
simp only [Finset.mem_singleton]
rw [hst]
have hc := Finset.card_le_card hsub
simpa only [Finset.card_singleton, Configuration.splitMultiplicity] using hc
theorem center_not_designated (hC : C.Compatible) {p : Point F}
(hb : 2 ≤ C.splitMultiplicity p) (s : Slot F) :
p ∉ designated C.merged (C.choice s) := by
intro hp
have hle := split_multiplicity_le_one_of_designated C hC hp
omega
theorem split_lines_in_direction (hV : C.Valid) (g : Direction F) :
C.splitLines.filter (fun l => l.1 = g) =
{(C.choice (g, false)).line, (C.choice (g, true)).line} := by
ext l
constructor
· intro hl
obtain ⟨hlS, hdir⟩ := Finset.mem_filter.mp hl
obtain ⟨s, _, rfl⟩ := Finset.mem_image.mp hlS
have hs : s.1 = g := (hV.2 s).1.symm.trans hdir
rcases s with ⟨d, b⟩
dsimp at hs
subst d
cases b <;> simp
· intro hl
rcases Finset.mem_insert.mp hl with rfl | hl
· exact Finset.mem_filter.mpr
⟨choice_line_mem_split C (g, false), (hV.2 (g, false)).1⟩
· have heq := Finset.mem_singleton.mp hl
subst l
exact Finset.mem_filter.mpr
⟨choice_line_mem_split C (g, true), (hV.2 (g, true)).1⟩
theorem split_pair_ne (hV : C.Valid) (hC : C.Compatible) (g : Direction F) :
(C.choice (g, false)).line ≠ (C.choice (g, true)).line := by
intro h
have hslots := choice_line_injective C hV hC h
have hb := congrArg Prod.snd hslots
cases hb
theorem split_lines_in_direction_card (hV : C.Valid) (hC : C.Compatible)
(g : Direction F) : (C.splitLines.filter (fun l => l.1 = g)).card = 2 := by
rw [split_lines_in_direction C hV g]
simp [split_pair_ne C hV hC g]
theorem choice_line_ne_constituent (hV : C.Valid) (s : Slot F)
(d : Direction F) (b : Bool) :
(C.choice s).line ≠ constituent C.merged d b := by
intro h
apply (hV.2 s).2.1
exact Finset.mem_image.mpr ⟨(d, b), Finset.mem_univ _, h.symm⟩
theorem deleted_lines_in_direction (hV : C.Valid) (g : Direction F) :
C.deletedLines.filter (fun l => l.1 = g) =
{(C.choice (g, false)).line, (C.choice (g, true)).line,
constituent C.merged g true} := by
ext l
constructor
· intro hl
obtain ⟨hlD, hdir⟩ := Finset.mem_filter.mp hl
rcases Finset.mem_union.mp hlD with hlS | hlM
· have hp : l ∈ C.splitLines.filter (fun L => L.1 = g) :=
Finset.mem_filter.mpr ⟨hlS, hdir⟩
rw [split_lines_in_direction C hV g] at hp
rcases Finset.mem_insert.mp hp with h | h
· simp only [Finset.mem_insert, Finset.mem_singleton]
exact Or.inl h
· simp only [Finset.mem_singleton] at h
simp only [Finset.mem_insert, Finset.mem_singleton]
exact Or.inr (Or.inl h)
· obtain ⟨d, _, rfl⟩ := Finset.mem_image.mp hlM
change d = g at hdir
subst d
simp
· intro hl
simp only [Finset.mem_insert, Finset.mem_singleton] at hl
rcases hl with rfl | rfl | rfl
· exact Finset.mem_filter.mpr
⟨Finset.mem_union_left _ (choice_line_mem_split C (g, false)),
(hV.2 (g, false)).1⟩
· exact Finset.mem_filter.mpr
⟨Finset.mem_union_left _ (choice_line_mem_split C (g, true)),
(hV.2 (g, true)).1⟩
· exact Finset.mem_filter.mpr
⟨Finset.mem_union_right _ (Finset.mem_image.mpr ⟨g, Finset.mem_univ _, rfl⟩), rfl⟩
theorem deleted_lines_in_direction_card (hV : C.Valid) (hC : C.Compatible)
(g : Direction F) : (C.deletedLines.filter (fun l => l.1 = g)).card = 3 := by
rw [deleted_lines_in_direction C hV g]
simp [split_pair_ne C hV hC g, choice_line_ne_constituent C hV (g, false) g true, choice_line_ne_constituent C hV (g, true) g true]
end ConfigurationStructure
end Balanced
end OAI
|