import Arithmetic namespace KKFiniteCoreProof open KKFiniteCoreDraft lemma phase_dvd_iff {p s a i : Nat} (h : Nat.ModEq p (s + a) 0) : Nat.ModEq p i a ↔ p ∣ s + i := by rw [← Nat.modEq_zero_iff_dvd] constructor · intro hi exact ((Nat.ModEq.refl s).add hi).trans h · intro hi exact Nat.ModEq.add_left_cancel' s (hi.trans h.symm) theorem fixed_phase_local_bridge : Target_fixed_phase_local_bridge := by classical intro S a s i hS hphase rw [survivor_local_iff S (s+i) hS] simp only [not_forall, not_and, not_not] change (∃ p ∈ S, Nat.ModEq p i (a p) ∨ Nat.ModEq p (i+2) (a p)) ↔ _ constructor · rintro ⟨p, hp, hi⟩ refine ⟨p, hp, ?_⟩ rcases hi with hi | hi · intro hn exact False.elim (hn ((phase_dvd_iff (hphase p hp)).mp hi)) · intro _ simpa [Nat.add_assoc] using (phase_dvd_iff (hphase p hp)).mp hi · rintro ⟨p, hp, hi⟩ refine ⟨p, hp, ?_⟩ by_cases hn : p ∣ s+i · exact Or.inl ((phase_dvd_iff (hphase p hp)).mpr hn) · exact Or.inr ((phase_dvd_iff (hphase p hp)).mpr (by simpa [Nat.add_assoc] using hi hn)) theorem fixed_phase_block_bridge : Target_fixed_phase_block_bridge := by intro S a s m hS hp unfold Cover ExcludedBlock exact forall₂_congr (fun i _ => fixed_phase_local_bridge S a s i hS hp) theorem exists_cover_iff_exists_block : Target_exists_cover_iff_exists_block := by intro S m hS constructor · rintro ⟨a, ha⟩ obtain ⟨s, hs, hp⟩ := crt_phase S a hS exact ⟨s, hs, (fixed_phase_block_bridge S a s m hS hp).mp ha⟩ · rintro ⟨s, _, hs⟩ obtain ⟨a, hp⟩ := assignment_for_phase S s hS exact ⟨a, (fixed_phase_block_bridge S a s m hS hp).mpr hs⟩ #print axioms fixed_phase_local_bridge #print axioms fixed_phase_block_bridge #print axioms exists_cover_iff_exists_block end KKFiniteCoreProof