File size: 2,502 Bytes
ea76aac | 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 | import Mathlib
import OAI.Computability.MaxCut.Encoding.VerticesBits
import OAI.Computability.MaxCut.Estimates.VecEquivSymmVal
namespace OAI
noncomputable section
namespace OptimalMaxCut.RawGrid
open scoped BigOperators
open Finset MaxCutGames.Foundations.Target MaxCutGames.Foundations.Hastad
open LongCode LongCode.InstanceAdapter CounterMachine.Expr
attribute [local instance] Classical.propDecidable
theorem adjacency_bits {q : ℕ} (g : Instance q) (t : ℚ)
(ht : t ∈ Set.Icc (-1:ℚ) 1) (K L : ℕ)
(anchor : Fin (g.vertices*2^q))
(i j : Fin ((g.vertices*2^q)*(Unweighted.searchPrime (L*(g.vertices*2^q+1)^2))^6)) :
let w := (ofInstance g).gridWeights t ht (vertexEquiv g.vertices q) anchor K
let out := Unweighted.deterministicOutput L w (aggregate_symm _)
out.graph.adj i j = decide (adjacency q t ht K L (bits g) i.val j.val ≠ 0) := by
dsimp only
let p := Unweighted.searchPrime (L*(g.vertices*2^q+1)^2)
let : Fact p.Prime := ⟨(Unweighted.searchPrime_spec _).1⟩
have hparam : param q L (bits g) = p := by simp [param,p]
change decide (_ ∧ _ ∈ _) = _
apply Bool.decide_congr
rw [Unweighted.residue_membership]
rw [weights_bits]
have hf : ⌊(p:ℚ)*((weights q t ht K (bits g) (i.val/p^6) (j.val/p^6):ℕ):ℚ)/
(gridSize q K (bits g):ℚ)⌋₊ = p*weights q t ht K (bits g) (i.val/p^6) (j.val/p^6)/gridSize q K (bits g) := by
rw [← Nat.cast_mul,Nat.floor_div_natCast,Nat.floor_natCast]
have hd : (Unweighted.dot ((Unweighted.vertexEquiv (g.vertices*2^q)).symm i).2
((Unweighted.vertexEquiv (g.vertices*2^q)).symm j).2).val = pairing p i.val j.val := by
rw [Unweighted.dot_val]
simp only [Unweighted.vertexEquiv_symm_second,pairing]
rfl
simp only [mul_div_assoc, Unweighted.vertexEquiv_symm_first] at *
rw [hf,hd]
have hne : ((Unweighted.vertexEquiv (g.vertices*2^q)).symm i).1 ≠
((Unweighted.vertexEquiv (g.vertices*2^q)).symm j).1 ↔ i.val/p^6 ≠ j.val/p^6 := by
rw [ne_eq, Fin.ext_iff]
rfl
rw [hne]
unfold adjacency
rw [hparam]
change (_ ∧ _) ↔ ((if i.val/p^6=j.val/p^6 then 0 else _) ≠ 0)
by_cases hij : i.val/p^6=j.val/p^6
· simp [hij]
· simp only [ne_eq,hij,not_false_eq_true,true_and,ite_false]
simp only [sum_eq_zero_iff,mem_range,ite_eq_right_iff,one_ne_zero,imp_false,not_forall,not_not]
constructor
· rintro ⟨r,hr,he⟩; exact ⟨r,hr,he⟩
· rintro ⟨r,hr,he⟩; exact ⟨r,hr,he⟩
end OptimalMaxCut.RawGrid
end
end OAI
|