| | @@ -0,0 +1,78 @@ |
| 1 | +import ErdosSwarm.Erdos530Gap75.Data |
| 2 | + |
| 3 | +/-! |
| 4 | +# Paired shares for the 74/75 cover in Erdős #530 |
| 5 | + |
| 6 | +In the overlap numbering, the inverse incidence exchanges `(i, j)` with |
| 7 | +`(l - j, l - i)`. Both read the same signed displacement from the allocation table. |
| 8 | +At full overlap the share averages the two endpoint numberings. |
| 9 | +-/ |
| 10 | + |
| 11 | +namespace ErdosSwarm.Erdos530Gap75 |
| 12 | + |
| 13 | +open Finset |
| 14 | +open ErdosSwarm.Erdos530Gap103 (iso isoInv) |
| 15 | + |
| 16 | +private theorem shareNum_add_complement (P : Allocation) {l i j : ℤ} |
| 17 | + (hi : 0 ≤ i) (hj : j ≤ l) : |
| 18 | + shareNum P l i j + shareNum P l (l - j) (l - i) = 1 := by |
| 19 | + have hi' : l - i ≤ l := by omega |
| 20 | + simp only [shareNum, if_neg (not_lt.mpr hj), if_neg (not_lt.mpr hi'), |
| 21 | + show (l - i) - (l - j) = j - i by omega, sub_sub_cancel] |
| 22 | + ring |
| 23 | + |
| 24 | +/-- In a proper overlap, the forward and inverse numberings count a node from opposite ends. -/ |
| 25 | +private theorem num_in_overlap (g : Bool × ℤ) (hproper : overlap g ≠ 512) {z : ℤ} |
| 26 | + (hz : z ∈ Icc (0 : ℤ) 512) (hgz : iso g z ∈ Icc (0 : ℤ) 512) : |
| 27 | + 0 ≤ num g z ∧ num g z ≤ overlap g ∧ |
| 28 | + num (isoInv g) (iso g z) = overlap g - num g z := by |
| 29 | + rcases g with ⟨b, c⟩ |
| 30 | + cases b with |
| 31 | + | false => |
| 32 | + rcases lt_trichotomy c 0 with hc | rfl | hc |
| 33 | + · simp [iso, isoInv, overlap, num, flipped, hc, abs_of_neg hc, not_lt.mpr hc.le, |
| 34 | + mem_Icc] at * |
| 35 | + omega |
| 36 | + · simp [overlap] at hproper |
| 37 | + · simp [iso, isoInv, overlap, num, flipped, hc, abs_of_pos hc, not_lt.mpr hc.le, |
| 38 | + mem_Icc] at * |
| 39 | + omega |
| 40 | + | true => |
| 41 | + rcases le_or_gt c 512 with hc | hc |
| 42 | + · simp [iso, isoInv, overlap, num, flipped, hc, not_lt.mpr hc, mem_Icc] at * |
| 43 | + omega |
| 44 | + · simp [iso, isoInv, overlap, num, flipped, hc, not_le.mpr hc, mem_Icc] at * |
| 45 | + omega |
| 46 | + |
| 47 | +/-- At a repeated distance, the forward incidence and its inverse have total share one. -/ |
| 48 | +theorem share_add_share (P : Allocation) (g : Bool × ℤ) {i j : ℤ} |
| 49 | + (hi : i ∈ Icc (0 : ℤ) 512) (hj : j ∈ Icc (0 : ℤ) 512) |
| 50 | + (hgi : iso g i ∈ Icc (0 : ℤ) 512) (hgj : iso g j ∈ Icc (0 : ℤ) 512) : |
| 51 | + share P g i j + share P (isoInv g) (iso g j) (iso g i) = 1 := by |
| 52 | + have hinv : overlap (isoInv g) = overlap g := by |
| 53 | + rcases g with ⟨b, c⟩ |
| 54 | + cases b <;> simp [overlap, isoInv] |
| 55 | + by_cases hfull : overlap g = 512 |
| 56 | + · simp only [share, hinv, hfull, if_true] |
| 57 | + have hij := shareNum_add_complement P (mem_Icc.mp hi).1 (mem_Icc.mp hj).2 |
| 58 | + have hji := shareNum_add_complement P (mem_Icc.mp hj).1 (mem_Icc.mp hi).2 |
| 59 | + rcases g with ⟨b, c⟩ |
| 60 | + cases b with |
| 61 | + | false => |
| 62 | + have hc : c = 0 := by simpa [overlap] using hfull |
| 63 | + subst c |
| 64 | + simp only [iso, Bool.false_eq_true, if_false, add_zero] |
| 65 | + linear_combination (hij + hji) / 2 |
| 66 | + | true => |
| 67 | + have hc : c = 512 := by |
| 68 | + by_cases hc : c ≤ 512 <;> simp [overlap, hc] at hfull <;> omega |
| 69 | + subst c |
| 70 | + have hreflect (z : ℤ) : iso (true, 512) z = 512 - z := by simp [iso]; omega |
| 71 | + simp only [hreflect, sub_sub_cancel] |
| 72 | + linear_combination (hij + hji) / 2 |
| 73 | + · obtain ⟨hi₀, _, hinvi⟩ := num_in_overlap g hfull hi hgi |
| 74 | + obtain ⟨_, hjl, hinvj⟩ := num_in_overlap g hfull hj hgj |
| 75 | + simp only [share, hinv, if_neg hfull, hinvi, hinvj] |
| 76 | + exact shareNum_add_complement P hi₀ hjl |
| 77 | + |
| 78 | +end ErdosSwarm.Erdos530Gap75 |