Lean / Reader
Lean readerAllRealCube.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports RealCubeSixteen, RealCubeDominant, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import RealCubeSixteenimport RealCubeDominantnamespace RealCubenoncomputable sectionopen scoped Classicalprivate theorem anchor_mem (d : ℕ) (h : ℝ) (a : Point d) : a ∈ vertices d h a := byinduction d with| zero => simp [vertices]| succ d ih => exact Finset.mem_product.mpr ⟨by simp,ih _⟩/-- A nonintegral side forces sixteen distinct residue classes, which arepaid for in addition to the fixed-scale cost minus one. -/theorem nonintegral_budget {S A : Host} {h k : ℝ} (hh : 0<h) (hk : 0<k)(step : ¬integralStep h k) (a : Point 4) (cov : expansion 4 h A ⊆ S)(other : vertices 4 k a ⊆ S) (many : 0<A.card) (few : A.card≤16) :15 + price 4 A.card ≤ S.card := bylet Z := S.image (residue 4 h)let n (z : Fin 4 → ℝ) := (cell A h z).cardhave self : integralStep h h := ⟨1,by simp [div_self hh.ne']⟩have anchors : A ⊆ S := fun x hx => cov (Finset.mem_biUnion.mpr ⟨x,hx,anchor_mem 4 h x⟩)have sumN : ∑ z∈Z,n z = A.card :=(Finset.card_eq_sum_card_fiberwise (f:=residue 4 h)(fun x hx => Finset.mem_image_of_mem _ (anchors hx))).symmhave sumS : ∑ z∈Z,(cell S h z).card = S.card :=(Finset.card_eq_sum_card_fiberwise (f:=residue 4 h)(fun x hx => Finset.mem_image_of_mem _ hx)).symmhave count : 16 ≤ Z.card := byhave sub := Finset.card_le_card (Finset.image_subset_image (f:=residue 4 h) other)rwa [residue_vertex_count 4 hk step a] at subhave localBound (z) (hz : z∈Z) : 1 + fee 2 (n z) ≤ (cell S h z).card := byhave live : 0 < (cell S h z).card := byobtain ⟨x,hx,eq⟩ := Finset.mem_image.mp hzexact Finset.card_pos.mpr ⟨x,Finset.mem_filter.mpr ⟨hx,eq⟩⟩by_cases empty : n z=0· simpa only [empty,fee,if_pos rfl,Nat.add_zero] using livehave sub : expansion 4 h (cell A h z) ⊆ cell S h z := byintro x hxobtain ⟨b,hb,v⟩ := Finset.mem_biUnion.mp hxobtain ⟨mem,eq⟩ := Finset.mem_filter.mp hbexact Finset.mem_filter.mpr ⟨cov (Finset.mem_biUnion.mpr ⟨b,mem,v⟩),(residue_constant 4 self v).trans eq⟩have bound := (fixed_scale_bound 4 (by decide) hh (cell A h z)((Finset.card_le_card (Finset.filter_subset _ _)).trans (by omega : A.card≤18))).trans(Finset.card_le_card sub)change price 4 (n z) ≤ _ at boundsimp only [fee,if_neg empty]; omegahave tot := Finset.sum_le_sum localBoundsimp only [Finset.sum_add_distrib,Finset.sum_const,nsmul_eq_mul,Nat.mul_one,sumS] at totchange Z.card + (∑ z∈Z,fee 2 (n z)) ≤ S.card at tothave merged := sum_fee Z n (by decide : 2≤8) (sumN.trans_le few)rw [sumN,fee,if_neg (Nat.ne_of_gt many)] at mergedomegaprivate theorem price_rich : ∀ r : Fin 17, 11≤(r:ℕ) → 70 ≤ price 4 r := by decide +kernelprivate theorem beta_rich : ∀ r : Fin 17, 11≤(r:ℕ) → 7 ≤ beta r := by decide +kernel/-- Eleven cubes of side h force every cube on the host to have side h or 2h. -/theorem two_scales_of_eleven {S : Host} {C : Finset Cube} (sup : supported S C)(hs : S.card≤81) {h : ℝ} (hh : 0<h) (many : 11 ≤ (sideGroup C h).card){c : Cube} (hc : c∈C) : c.2=h ∨ c.2=2*h := bylet A := bases C hhave ha : A.card = (sideGroup C h).card := bases_card _ _have lo : 11 ≤ A.card := by omegahave hi : A.card ≤ 16 := ha.trans_le (at_most_sixteen_same_side sup hs hh)have price70 := price_rich ⟨A.card,by omega⟩ lochange 70≤price 4 A.card at price70have cov := anchor_expansion_inside sup hhave pos := (sup c hc).1have incl := (sup c hc).2by_cases step : integralStep h c.2· obtain ⟨n,hn⟩ := steprw [div_eq_iff hh.ne'] at hnhave hnpos : 0<n := byhave : 0<(n:ℝ) := (mul_pos_iff_of_pos_right hh).mp (hn ▸ pos)exact_mod_cast thishave ub : c.2≤2*h := byby_contra! gthave ub := (large_cube_restriction hh gt A S c.1 cov incl hs).1have lb := fixed_scale_bound 4 (by decide) hh A (by omega)omegahave hnle : n≤2 := byhave : (n:ℝ)≤2 := (mul_le_mul_iff_left₀ hh).mp (hn ▸ ub)exact_mod_cast thisrcases (show n=1 ∨ n=2 by omega) with e|e <;> subst n <;> simp_all· have cost := nonintegral_budget hh pos step c.1 cov incl (by change 0<A.card;omega) hichange 15 + price 4 A.card ≤ S.card at costomega/-- No side occurs more than ten times in a hypothetical eighteen-cube family. -/theorem counterexample_side_cap {S : Host} {C : Finset Cube} (sup : supported S C)(hs : S.card≤81) (hc : C.card=18) {h : ℝ} (hh : 0<h) : (sideGroup C h).card≤10 := byby_contra! midhave hi := at_most_sixteen_same_side sup hs hhhave sub : C ⊆ sideGroup C h ∪ sideGroup C (2*h) := byintro x hxrcases two_scales_of_eleven sup hs hh mid hx with e|e· exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨hx,e⟩)· exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨hx,e⟩)have totals := (Finset.card_le_card sub).trans (Finset.card_union_le _ _)have covSub (B : Host) (bs : B ⊆ bases C (2*h)) : expansion 4 (2*h) B ⊆ S := byintro p hpobtain ⟨b,hb,v⟩ := Finset.mem_biUnion.mp hpexact anchor_expansion_inside sup _ (Finset.mem_biUnion.mpr ⟨b,bs hb,v⟩)by_cases eq : (sideGroup C h).card=16· have bh : 2 ≤ (bases C (2*h)).card := by rw [bases_card]; omegaobtain ⟨B,bs,bc⟩ := Finset.exists_subset_card_eq bhexact sixteen_forbids_two S (bases C h) B hh (anchor_expansion_inside sup h) (covSub B bs)(by rwa [bases_card]) bc hs· have bh : 3 ≤ (bases C (2*h)).card := by rw [bases_card]; omegaobtain ⟨B,bs,bc⟩ := Finset.exists_subset_card_eq bhhave cost := parity_budget S (bases C h) B hh (anchor_expansion_inside sup h) (covSub B bs)(by rw [bases_card];omega) (by rwa [bases_card]) (by omega) (by omega)rw [bc,bases_card] at costhave β := beta_rich ⟨(sideGroup C h).card,by omega⟩ midchange 7≤beta (sideGroup C h).card at βchange 32+1+7*beta (sideGroup C h).card ≤ S.card at costomega/-- Every eighteen-cube counterexample has a group of seven to ten of one side,and every side occurs at most ten times. -/theorem counterexample_profile {S : Host} {C : Finset Cube} (sup : supported S C)(hs : S.card≤81) (hc : C.card=18) :(∃ h∈C.image Prod.snd, 7≤(sideGroup C h).card) ∧∀ h>0,(sideGroup C h).card≤10 :=⟨dominant_side sup hc hs,fun _ hh => counterexample_side_cap sup hs hc hh⟩#print axioms counterexample_profileendend RealCube