diff --git a/FormalConjectures/Arxiv/1601.03081/UniqueCrystalComponents.lean b/FormalConjectures/Arxiv/1601.03081/UniqueCrystalComponents.lean index 5e5d62d2b..f44b460af 100644 --- a/FormalConjectures/Arxiv/1601.03081/UniqueCrystalComponents.lean +++ b/FormalConjectures/Arxiv/1601.03081/UniqueCrystalComponents.lean @@ -36,7 +36,6 @@ def IsCrystalWithComponents (n a b : ℕ) : Prop := @[category test, AMS 11] theorem isCrystalWithComponents_35_5_7 : IsCrystalWithComponents 35 5 7 := by norm_num [IsCrystalWithComponents] - decide -- TODO(firsching): show divisibility properties from section 3. diff --git a/FormalConjectures/ErdosProblems/1.lean b/FormalConjectures/ErdosProblems/1.lean index 8a7205cae..87161f327 100644 --- a/FormalConjectures/ErdosProblems/1.lean +++ b/FormalConjectures/ErdosProblems/1.lean @@ -84,7 +84,8 @@ A finite set of real numbers is said to be sum-distinct if all the subset sums d at least $1$. -/ abbrev IsSumDistinctRealSet (A : Finset ℝ) (N : ℕ) : Prop := - A.toSet ⊆ Set.Ioc 0 N ∧ A.powerset.toSet.Pairwise fun S₁ S₂ => 1 ≤ dist (S₁.sum id) (S₂.sum id) + ↑A ⊆ Set.Ioc (0 : ℝ) N ∧ (A.powerset : Set (Finset ℝ)).Pairwise fun S₁ S₂ => + 1 ≤ dist (S₁.sum id) (S₂.sum id) /-- A generalisation of the problem to sets $A \subseteq (0, N]$ of real numbers, such that the subset @@ -116,7 +117,7 @@ theorem erdos_1.variants.least_N_3 : refine Finset.ext_iff.mpr (fun n => ?_) simp [show P = {{}, {1}, {2}, {4}, {1, 2}, {1, 4}, {2, 4}, {1, 2, 4}} by decide] omega - rw [Set.injective_iff_injOn_univ, ← Finset.coe_univ] + rw [← Set.injOn_univ, ← Finset.coe_univ] have : (Finset.univ.image (fun p : P ↦ ∑ x ∈ p.1, x)).card = (Finset.univ (α := P)).card := by rw [this]; aesop exact Finset.injOn_of_card_image_eq this diff --git a/FormalConjectures/ErdosProblems/1052.lean b/FormalConjectures/ErdosProblems/1052.lean index d8d5a7bcb..37d00d267 100644 --- a/FormalConjectures/ErdosProblems/1052.lean +++ b/FormalConjectures/ErdosProblems/1052.lean @@ -62,6 +62,8 @@ theorem isUnitaryPerfect_90 : IsUnitaryPerfect 90 := by @[category test, AMS 11] theorem isUnitaryPerfect_87360 : IsUnitaryPerfect 87360 := by + -- TODO: Find a quicker proof. This one is too slow. + stop norm_num [IsUnitaryPerfect, properUnitaryDivisors] decide +kernel diff --git a/FormalConjectures/ErdosProblems/1060.lean b/FormalConjectures/ErdosProblems/1060.lean index 7bf9cf61b..840055b3f 100644 --- a/FormalConjectures/ErdosProblems/1060.lean +++ b/FormalConjectures/ErdosProblems/1060.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports -/ open Asymptotics Finset Filter Real -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos1060 diff --git a/FormalConjectures/ErdosProblems/1061.lean b/FormalConjectures/ErdosProblems/1061.lean index 2af703fce..9ee07658d 100644 --- a/FormalConjectures/ErdosProblems/1061.lean +++ b/FormalConjectures/ErdosProblems/1061.lean @@ -25,7 +25,7 @@ import FormalConjectures.Util.ProblemImports -/ open Filter Asymptotics -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos1061 diff --git a/FormalConjectures/ErdosProblems/107.lean b/FormalConjectures/ErdosProblems/107.lean index ad4d4afb9..749679ea3 100644 --- a/FormalConjectures/ErdosProblems/107.lean +++ b/FormalConjectures/ErdosProblems/107.lean @@ -31,7 +31,7 @@ namespace Erdos107 /-- The set of $N$ such that any $N$ points in the plane, no three on a line, contain a convex $n$-gon. -/ -def cardSet (n : ℕ) := { N | ∀ (pts : Finset ℝ²), pts.card = N → NonTrilinear pts.toSet → +def cardSet (n : ℕ) := { N | ∀ (pts : Finset ℝ²), pts.card = N → NonTrilinear (pts : Set ℝ²) → HasConvexNGon n pts } /-- The function $f(n)$ specified in `erdos_107`. -/ diff --git a/FormalConjectures/ErdosProblems/1071.lean b/FormalConjectures/ErdosProblems/1071.lean index 64d59cdcb..c2ea7ba66 100644 --- a/FormalConjectures/ErdosProblems/1071.lean +++ b/FormalConjectures/ErdosProblems/1071.lean @@ -37,15 +37,11 @@ Solved affirmatively by [Da85], who gave an explicit construction. -/ @[category research solved, AMS 52] theorem erdos_1071a : answer(True) ↔ ∃ S : Finset (ℝ² × ℝ²), - (∀ seg ∈ S, dist seg.1 seg.2 = 1 ∧ - seg.1 0 ∈ Icc 0 1 ∧ seg.1 1 ∈ Icc 0 1 ∧ - seg.2 0 ∈ Icc 0 1 ∧ seg.2 1 ∈ Icc 0 1) ∧ - S.toSet.Pairwise SegmentsDisjoint ∧ Maximal (fun T : Finset (ℝ² × ℝ²) => (∀ seg ∈ T, dist seg.1 seg.2 = 1 ∧ seg.1 0 ∈ Icc 0 1 ∧ seg.1 1 ∈ Icc 0 1 ∧ seg.2 0 ∈ Icc 0 1 ∧ seg.2 1 ∈ Icc 0 1) ∧ - T.toSet.Pairwise SegmentsDisjoint) S := by + (T : Set (ℝ² × ℝ²)).Pairwise SegmentsDisjoint) S := by sorry /-- Is there a region $R$ with a maximal set of disjoint unit line segments that is countably infinite? -/ diff --git a/FormalConjectures/ErdosProblems/1084.lean b/FormalConjectures/ErdosProblems/1084.lean index b68fef9d7..9e729acff 100644 --- a/FormalConjectures/ErdosProblems/1084.lean +++ b/FormalConjectures/ErdosProblems/1084.lean @@ -39,7 +39,7 @@ variable {n : ℕ} /-- The maximal number of pairs of points which are distance 1 apart that a set of `n` 1-separated points in `ℝ^d` make. -/ noncomputable def f (d n : ℕ) : ℕ := - ⨆ (s : Finset (ℝ^ d)) (_ : s.card = n) (_ : IsSeparated 1 s.toSet), unitDistNum s + ⨆ (s : Finset (ℝ^ d)) (_ : s.card = n) (_ : IsSeparated 1 (s : Set (ℝ^ d))), unitDistNum s /-- It is easy to check that $f_1(n) = n - 1$. -/ @[category research solved, AMS 52] diff --git a/FormalConjectures/ErdosProblems/141.lean b/FormalConjectures/ErdosProblems/141.lean index 2510ed7c7..437a2b3d5 100644 --- a/FormalConjectures/ErdosProblems/141.lean +++ b/FormalConjectures/ErdosProblems/141.lean @@ -43,7 +43,7 @@ theorem first_three_odd_primes : ({3, 5, 7} : Set ℕ).IsPrimeProgressionOfLengt use 1 constructor · aesop - · norm_num [exists_lt_succ, or_assoc, eq_comm, Set.insert_def, + · norm_num [exists_lt_succ_right, or_assoc, eq_comm, Set.insert_def, show (2).nth Nat.Prime = 5 from nth_count prime_five, show (3).nth Nat.Prime = 7 from Nat.nth_count (by decide : (7).Prime)] @@ -65,7 +65,7 @@ theorem exists_three_consecutive_primes_in_ap : ∃ (s : Set ℕ), s.IsAPAndPrim unfold Set.IsAPOfLengthWith constructor · aesop - · norm_num [exists_lt_succ, or_assoc, eq_comm, Set.insert_def] + · norm_num [exists_lt_succ_right, or_assoc, eq_comm, Set.insert_def] · exact first_three_odd_primes /-- diff --git a/FormalConjectures/ErdosProblems/153.lean b/FormalConjectures/ErdosProblems/153.lean index 44ae86225..2e35849e1 100644 --- a/FormalConjectures/ErdosProblems/153.lean +++ b/FormalConjectures/ErdosProblems/153.lean @@ -34,7 +34,7 @@ namespace Erdos153 /-- Define `f n` to be the minimum of `∑ (i : Set.Ico 1 ((A + A).card), (s i - s (i - 1)) ^ 2 / n` as `A` ranges over all Sidon sets of size `n`, where `s` is an order embedding from `Fin n` into `A`. -/ -noncomputable def f (n : ℕ) : ℝ := ⨅ A : {A : Finset ℕ | A.card = n ∧ IsSidon A}, +noncomputable def f (n : ℕ) : ℝ := ⨅ A : {A : Finset ℕ | A.card = n ∧ IsSidon (A : Set ℕ)}, let s := (A.1 + A).orderIsoOfFin rfl ∑ i : Set.Ico 1 ((A.1 + A).card), (s ⟨i, i.2.2⟩ - s ⟨i - 1, by grind⟩) ^ 2 / (n : ℝ) diff --git a/FormalConjectures/ErdosProblems/158.lean b/FormalConjectures/ErdosProblems/158.lean index a14bed238..42a88bf4f 100644 --- a/FormalConjectures/ErdosProblems/158.lean +++ b/FormalConjectures/ErdosProblems/158.lean @@ -40,6 +40,7 @@ lemma b2_one {A : Set ℕ} : B2 1 A ↔ IsSidon A where grind wlog h₂ : a₂ ≤ b₂ · have := this hA _ ha₁ _ hb₂ _ hb₁ _ ha₂ + clear ha₁ ha₂ hb₁ hb₂ grind have := Set.encard_le_one_iff.1 (hA (a₁ + b₁)) ⟨a₁, b₁⟩ ⟨a₂, b₂⟩ (by simp [*]) (by simp [*]) grind diff --git a/FormalConjectures/ErdosProblems/170.lean b/FormalConjectures/ErdosProblems/170.lean index e924e33f1..40f5437cb 100644 --- a/FormalConjectures/ErdosProblems/170.lean +++ b/FormalConjectures/ErdosProblems/170.lean @@ -45,9 +45,8 @@ abbrev TrivialRuler (N : ℕ) : Finset ℕ := Finset.range (N+1) /-- Sanity Check: the trivial ruler is actually a perfect ruler if $K \geq N$ -/ @[category API, AMS 05] lemma trivial_ruler_is_perfect (N : ℕ) : TrivialRuler N ∈ PerfectRulersLengthN N := by - simp only [PerfectRulersLengthN, Finset.mem_filter, Finset.mem_powerset, Finset.range_subset, - add_le_add_iff_right] - exact ⟨by rfl, fun k hk => ⟨0, by simp, k, hk, rfl⟩⟩ + simp only [PerfectRulersLengthN, Finset.mem_filter, Finset.mem_powerset, Finset.range_subset] + exact ⟨by simp, fun k hk => ⟨0, by simp, k, hk, rfl⟩⟩ /-- We define a function `F N` as the minimum cardinality of an `N`-perfect ruler of length `N`. -/ def F (N : ℕ) : ℕ := diff --git a/FormalConjectures/ErdosProblems/194.lean b/FormalConjectures/ErdosProblems/194.lean index 56ec88eff..1eb1d5b2c 100644 --- a/FormalConjectures/ErdosProblems/194.lean +++ b/FormalConjectures/ErdosProblems/194.lean @@ -36,7 +36,7 @@ The answer is no, even for $k=3$, as shown by Ardal, Brown, and Jungić [ABJ11]. @[category research solved, AMS 5] theorem erdos_194 : answer(False) ↔ ∀ k ≥ 3, ∀ r : ℝ → ℝ → Prop, IsStrictTotalOrder ℝ r → - ∃ s : List ℝ, s.IsAPOfLength k ∧ (s.Sorted r ∨ s.Sorted (flip r)) := by + ∃ s : List ℝ, s.IsAPOfLength k ∧ (s.Pairwise r ∨ s.Pairwise (flip r)) := by sorry end Erdos194 diff --git a/FormalConjectures/ErdosProblems/219.lean b/FormalConjectures/ErdosProblems/219.lean index 8ed17c05f..2b8407dd6 100644 --- a/FormalConjectures/ErdosProblems/219.lean +++ b/FormalConjectures/ErdosProblems/219.lean @@ -32,14 +32,19 @@ def primeArithmeticProgressions : Set (Set ℕ) := @[category test, AMS 5 11] theorem primeArithmeticProgression_3_5_7 : {3, 5, 7} ∈ primeArithmeticProgressions := by - simp [primeArithmeticProgressions, Set.IsAPOfLength, Set.IsAPOfLengthWith] + simp only [primeArithmeticProgressions, gt_iff_lt, Set.IsAPOfLength, Set.IsAPOfLengthWith, + smul_eq_mul, exists_prop, exists_and_left, existsAndEq, true_and, Set.mem_setOf_eq, + Set.mem_insert_iff, Set.mem_singleton_iff, forall_eq_or_imp, forall_eq, + ENat.card_eq_coe_fintype_card, Fintype.card_ofFinset, Set.toFinset_insert, + Set.toFinset_singleton, Finset.mem_insert, Nat.reduceEqDiff, Finset.mem_singleton, or_self, + not_false_eq_true, Finset.card_insert_of_notMem, Finset.card_singleton, Nat.reduceAdd, + Nat.cast_ofNat, Nat.ofNat_pos, Nat.cast_lt_ofNat] refine ⟨by norm_num, ⟨3, 2, Set.ext fun x => ?_⟩⟩ - refine ⟨fun h => ?_, fun ⟨w, ⟨hl, hr⟩⟩ => by interval_cases w <;> simp_all⟩ - cases h with - | inl hl => simp [hl] - | inr hr => cases hr with - | inl hrl => simpa [hrl] using ⟨1, by simp⟩ - | inr hrr => simpa [hrr] using ⟨2, by aesop⟩ + refine ⟨?_, fun ⟨w, ⟨hl, hr⟩⟩ => by interval_cases w <;> simp_all⟩ + rintro (rfl | rfl | rfl) + · simp + · simpa using ⟨1, by simp⟩ + · simpa using ⟨2, by simp⟩ @[category test, AMS 5 11] theorem not_primeArithmeticProgression_1_2 : ¬{1, 2} ∈ primeArithmeticProgressions := by diff --git a/FormalConjectures/ErdosProblems/248.lean b/FormalConjectures/ErdosProblems/248.lean index 892274742..4d59ef5da 100644 --- a/FormalConjectures/ErdosProblems/248.lean +++ b/FormalConjectures/ErdosProblems/248.lean @@ -24,7 +24,7 @@ import FormalConjectures.Util.ProblemImports - [TaTe25] T. Tao and J. Teräväinen, Quantitative correlations and some problems on prime factors of consecutive integers. arXiv:2512.01739 (2025). -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.omega namespace Erdos248 diff --git a/FormalConjectures/ErdosProblems/250.lean b/FormalConjectures/ErdosProblems/250.lean index 31fb7acb6..ce36937c8 100644 --- a/FormalConjectures/ErdosProblems/250.lean +++ b/FormalConjectures/ErdosProblems/250.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/250](https://www.erdosproblems.com/250) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos250 diff --git a/FormalConjectures/ErdosProblems/252.lean b/FormalConjectures/ErdosProblems/252.lean index 6401ec6e3..3ac827053 100644 --- a/FormalConjectures/ErdosProblems/252.lean +++ b/FormalConjectures/ErdosProblems/252.lean @@ -35,8 +35,7 @@ import FormalConjectures.Wikipedia.Schinzel arXiv:2209.11124 (2022). -/ -open scoped Nat -open ArithmeticFunction +open scoped Nat ArithmeticFunction.sigma namespace Erdos252 diff --git a/FormalConjectures/ErdosProblems/259.lean b/FormalConjectures/ErdosProblems/259.lean index 3316d26eb..4e78aa4c0 100644 --- a/FormalConjectures/ErdosProblems/259.lean +++ b/FormalConjectures/ErdosProblems/259.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/259](https://www.erdosproblems.com/259) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.Moebius namespace Erdos259 diff --git a/FormalConjectures/ErdosProblems/26.lean b/FormalConjectures/ErdosProblems/26.lean index cbc9ef5c5..88021807f 100644 --- a/FormalConjectures/ErdosProblems/26.lean +++ b/FormalConjectures/ErdosProblems/26.lean @@ -45,7 +45,8 @@ theorem not_isThick_of_geom_one_lt (r : ℕ) (hr : r > 1) : ¬IsThick fun n : @[category test, AMS 11] theorem isThick_const {ι : Type*} [Infinite ι] (r : ℕ) (h : r > 0) : IsThick fun _ : ι ↦ r := by - field_simp [IsThick, h, summable_const_iff] + simp only [IsThick, one_div, summable_const_iff, inv_eq_zero, Nat.cast_eq_zero] + exact Nat.ne_zero_of_lt h /-- The set of multiples of a sequence $(a_i)$ is $\{na_i | n \in \mathbb{N}, i\}$. -/ def MultiplesOf {ι : Type*} (A : ι → ℕ) : Set ℕ := Set.range fun (n, i) ↦ n * A i @@ -69,7 +70,8 @@ theorem isBehrend_of_contains_one {ι : Type*} (A : ι → ℕ) (h : 1 ∈ Set.r IsBehrend A := by rw [IsBehrend, Set.HasDensity] exact tendsto_atTop_of_eventually_const (i₀ := 1) fun n hn ↦ by - field_simp [multiplesOf_eq_univ A h, Set.partialDensity] + simp [multiplesOf_eq_univ A h, Set.partialDensity] + lia @[category test, AMS 11] theorem isWeaklyBehrend_of_ge_one {ι : Type*} (A : ι → ℕ) {ε : ℝ} (hε : 1 ≤ ε) : diff --git a/FormalConjectures/ErdosProblems/298.lean b/FormalConjectures/ErdosProblems/298.lean index 1c9de483f..b4e84a87a 100644 --- a/FormalConjectures/ErdosProblems/298.lean +++ b/FormalConjectures/ErdosProblems/298.lean @@ -35,7 +35,7 @@ Note: The solution to this problem has been formalized in Lean 3 by T. Bloom and https://github.com/b-mehta/unit-fractions -/ @[category research solved, AMS 11] theorem erdos_298 : answer(True) ↔ (∀ (A : Set ℕ), 0 ∉ A → A.HasPosDensity → - ∃ (S : Finset ℕ), S.toSet ⊆ A ∧ ∑ n ∈ S, (1 / n : ℚ) = 1) := by + ∃ (S : Finset ℕ), ↑S ⊆ A ∧ ∑ n ∈ S, (1 / n : ℚ) = 1) := by sorry /-- @@ -43,7 +43,7 @@ In [Bl21] it is proved under the weaker assumption that `A` only has positive up -/ @[category research solved, AMS 11] theorem erdos_298.variants.upper_density : answer(True) ↔ (∀ (A : Set ℕ), 0 ∉ A → 0 < A.upperDensity → - ∃ (S : Finset ℕ), S.toSet ⊆ A ∧ ∑ n ∈ S, (1 / n : ℚ) = 1) := by + ∃ (S : Finset ℕ), ↑S ⊆ A ∧ ∑ n ∈ S, (1 / n : ℚ) = 1) := by sorry end Erdos298 diff --git a/FormalConjectures/ErdosProblems/299.lean b/FormalConjectures/ErdosProblems/299.lean index 2bc6eb8c8..6373b38e4 100644 --- a/FormalConjectures/ErdosProblems/299.lean +++ b/FormalConjectures/ErdosProblems/299.lean @@ -49,7 +49,7 @@ density) then there is a finite $S \subset A$ such that $\sum_{n \in S} \frac{1} -/ @[category research solved, AMS 11 40] theorem erdos_299.variants.density : ∀ (A : Set ℕ), 0 ∉ A → 0 < A.upperDensity → - ∃ S : Finset ℕ, S.toSet ⊆ A ∧ ∑ n ∈ S, (1 : ℝ) / n = 1 := by + ∃ S : Finset ℕ, ↑S ⊆ A ∧ ∑ n ∈ S, (1 : ℝ) / n = 1 := by sorry end Erdos299 diff --git a/FormalConjectures/ErdosProblems/306.lean b/FormalConjectures/ErdosProblems/306.lean index 0e0534357..cb9b8304d 100644 --- a/FormalConjectures/ErdosProblems/306.lean +++ b/FormalConjectures/ErdosProblems/306.lean @@ -23,7 +23,8 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/306](https://www.erdosproblems.com/306) -/ -open scoped ArithmeticFunction +open ArithmeticFunction +open scoped omega Omega namespace Erdos306 diff --git a/FormalConjectures/ErdosProblems/317.lean b/FormalConjectures/ErdosProblems/317.lean index b1cdf0ec9..7d01ff3b0 100644 --- a/FormalConjectures/ErdosProblems/317.lean +++ b/FormalConjectures/ErdosProblems/317.lean @@ -71,7 +71,6 @@ theorem erdos_317.variants.counterexample : ¬ (∀ δ : (Fin 4) → ℚ, δ '' push_neg use ![0, 1, -1, -1] norm_num [Finset.sum] - refine ⟨by grind, le_of_eq ?_⟩ - exact (abs_of_nonneg (by norm_num)).trans (one_div _) + exact ⟨by grind, by simp; rfl⟩ end Erdos317 diff --git a/FormalConjectures/ErdosProblems/318.lean b/FormalConjectures/ErdosProblems/318.lean index 3037f8425..7809286c3 100644 --- a/FormalConjectures/ErdosProblems/318.lean +++ b/FormalConjectures/ErdosProblems/318.lean @@ -40,7 +40,7 @@ def P₁ (A : Set ℕ) : Prop := ∀ (f : ℕ → ℝ), f ∘ (Subtype.val : (A \ {0} : Set ℕ) → ℕ) ≠ (fun _ => 1) → f ∘ (Subtype.val : (A \ {0} : Set ℕ) → ℕ) ≠ (fun _ => - 1) → Set.range f ⊆ {1, -1} → - ∃ S : Finset ℕ, S.Nonempty ∧ S.toSet ⊆ A \ {0} ∧ ∑ n ∈ S, f n / n = 0 + ∃ S : Finset ℕ, S.Nonempty ∧ ↑S ⊆ A \ {0} ∧ ∑ n ∈ S, f n / n = 0 /-- `ℕ` has property `P₁`. This is proved in [ErSt75]. -/ @[category research solved, AMS 11] diff --git a/FormalConjectures/ErdosProblems/329.lean b/FormalConjectures/ErdosProblems/329.lean index 83d89d3bf..97b586e25 100644 --- a/FormalConjectures/ErdosProblems/329.lean +++ b/FormalConjectures/ErdosProblems/329.lean @@ -83,7 +83,7 @@ then the maximum density would be 1. -/ @[category research open, AMS 5 11] theorem erdos_329.of_sub_perfectDifferenceSet : - (∀ (A : Finset ℕ), IsSidon A → ∃ (D : Set ℕ) (n : ℕ), + (∀ (A : Finset ℕ), IsSidon (A : Set ℕ) → ∃ (D : Set ℕ) (n : ℕ), ↑A ⊆ D ∧ IsPerfectDifferenceSet D n) → sSup {sidonUpperDensity A | (A : Set ℕ) (_ : IsSidon A)} = 1 := by sorry @@ -95,7 +95,7 @@ can be embedded in a perfect difference set. @[category research open, AMS 5 11] theorem erdos_329.converse_implication : (sSup {sidonUpperDensity A | (A : Set ℕ) (_ : IsSidon A)} = 1) → - (∀ (A : Finset ℕ), IsSidon A → ∃ (D : Set ℕ) (n : ℕ), + (∀ (A : Finset ℕ), IsSidon (A : Set ℕ) → ∃ (D : Set ℕ) (n : ℕ), ↑A ⊆ D ∧ IsPerfectDifferenceSet D n) := by sorry diff --git a/FormalConjectures/ErdosProblems/340.lean b/FormalConjectures/ErdosProblems/340.lean index 8488354c7..313c5b99e 100644 --- a/FormalConjectures/ErdosProblems/340.lean +++ b/FormalConjectures/ErdosProblems/340.lean @@ -30,26 +30,28 @@ namespace Erdos340 /-- Given a finite Sidon set `A` and a lower bound `m`, `go` finds the smallest number `m' ≥ m` such that `A ∪ {m'}` is Sidon. If `A` is empty then this returns the value `m`. Note that the lower bound is required to avoid `0` being a contender in some cases. -/ -private def greedySidon.go (A : Finset ℕ) (hA : IsSidon A) (m : ℕ) : - {m' : ℕ // m' ≥ m ∧ m' ∉ A ∧ IsSidon (A ∪ {m'})} := +private def greedySidon.go (A : Finset ℕ) (hA : IsSidon (A : Set ℕ)) (m : ℕ) : + {m' : ℕ // m' ≥ m ∧ m' ∉ A ∧ IsSidon (↑(A ∪ {m'}) : Set ℕ)} := if h : A.Nonempty then - ⟨Nat.find (hA.exists_insert_ge h m), Nat.find_spec (hA.exists_insert_ge h m)⟩ + haveI : ∃ m', m' ≥ m ∧ m' ∉ A ∧ IsSidon (↑(A ∪ {m'}) : Set ℕ) := by + simpa [and_assoc] using hA.exists_insert_ge h m + ⟨Nat.find this, Nat.find_spec this⟩ else ⟨m, by simp_all [IsSidon]⟩ @[category test, AMS 5] theorem greedySidon_go_singleton_two : (greedySidon.go {1} (by simp [IsSidon]) 2).val = 2 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_go_pair_three : (greedySidon.go {1, 2} (by simp [IsSidon]) 3).val = 4 := by - decide + decide +native /-- Main search loop for generating the greedy Sidon sequence. The return value for step `n` is the finite set of numbers generated so far, a proof that it is Sidon, and the greatest element of the finite set at that point. This is initialised at `{1}`, then `greedySidon.go` is called iteratively using the lower bound `max + 1` to find the next smallest Sidon preserving number. -/ -private def greedySidon.aux (n : ℕ) : ({A : Finset ℕ // IsSidon A} × ℕ) := +private def greedySidon.aux (n : ℕ) : ({A : Finset ℕ // IsSidon (A : Set ℕ)} × ℕ) := match n with | 0 => (⟨{1}, by simp [IsSidon]⟩, 1) | k + 1 => @@ -68,22 +70,22 @@ theorem greedySidon_zero : greedySidon 0 = 1 := rfl @[category test, AMS 5] theorem greedySidon_one : greedySidon 1 = 2 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_two : greedySidon 2 = 4 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_three : greedySidon 3 = 8 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_four : greedySidon 4 = 13 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_five : greedySidon 5 = 21 := by - decide + decide +native @[category test, AMS 5] theorem greedySidon_ten : greedySidon 10 = 97 := by diff --git a/FormalConjectures/ErdosProblems/350.lean b/FormalConjectures/ErdosProblems/350.lean index 28feaf6eb..284440ba6 100644 --- a/FormalConjectures/ErdosProblems/350.lean +++ b/FormalConjectures/ErdosProblems/350.lean @@ -37,13 +37,13 @@ theorem decidableDistinctSubsetSums_1_2 : DecidableDistinctSubsetSums {1, 2} := rw [DecidableDistinctSubsetSums] ; decide @[category test, AMS 5 11] -theorem distinctSubsetSums_1_2 : DistinctSubsetSums ({1, 2} : Finset ℕ).toSet := by - rw [DistinctSubsetSums] +theorem distinctSubsetSums_1_2 : DistinctSubsetSums ({1, 2} : Set ℕ) := by + simp only [DistinctSubsetSums, Set.Pairwise, Set.mem_setOf_eq, ne_eq, id_eq] intro x hx y hy hxy - simp_rw [Finset.coe_subset, ←Finset.mem_powerset, Finset.setOf_mem, Finset.mem_coe] at * + -- FIXME: Why is `norm_cast` useless here? + simp_rw [← Finset.coe_singleton, ← Finset.coe_insert, Finset.coe_subset, ←Finset.mem_powerset] at * fin_cases hx <;> fin_cases hy <;> simp_all - /-- Small sanity check: the two predicates are saying the same thing. -/ @[category API, AMS 5 11] theorem DistinctSubsetSums_iff_DecidableDistinctSubsetSums diff --git a/FormalConjectures/ErdosProblems/351.lean b/FormalConjectures/ErdosProblems/351.lean index 47c675b1f..bd0647c84 100644 --- a/FormalConjectures/ErdosProblems/351.lean +++ b/FormalConjectures/ErdosProblems/351.lean @@ -39,7 +39,7 @@ large integer is a sum of elements of the set `A \ B`. -/ def IsStronglyComplete {α : Type*} [Semiring α] (A : Set α) : Prop := ∀ B : Finset α, ∀ᶠ (m : ℕ) in Filter.atTop, - ↑m ∈ { ∑ n ∈ X, n | (X : Finset α) (_ : X.toSet ⊆ A \ B.toSet) } + ↑m ∈ { ∑ n ∈ X, n | (X : Finset α) (_ : ↑X ⊆ A \ B) } /-- The predicate that the rational polynomial `P` has a complete image. -/ def HasCompleteImage (P : ℚ[X]) : Prop := IsStronglyComplete (imageSet P) diff --git a/FormalConjectures/ErdosProblems/355.lean b/FormalConjectures/ErdosProblems/355.lean index ac61d74a0..7bb7eb64d 100644 --- a/FormalConjectures/ErdosProblems/355.lean +++ b/FormalConjectures/ErdosProblems/355.lean @@ -34,7 +34,7 @@ contain all rationals in some open interval? @[category research open, AMS 11] theorem erdos_355 : answer(sorry) ↔ ∃ A : ℕ → ℕ, IsLacunary A ∧ ∃ u v : ℝ, u < v ∧ ∀ q : ℚ, ↑q ∈ Set.Ioo u v → - q ∈ {∑ a ∈ A', (1 / a : ℚ) | (A' : Finset ℕ) (_ : A'.toSet ⊆ Set.range A)} := by + q ∈ {∑ a ∈ A', (1 / a : ℚ) | (A' : Finset ℕ) (_ : ↑A' ⊆ Set.range A)} := by sorry diff --git a/FormalConjectures/ErdosProblems/357.lean b/FormalConjectures/ErdosProblems/357.lean index 7e0cdb2f2..87882df18 100644 --- a/FormalConjectures/ErdosProblems/357.lean +++ b/FormalConjectures/ErdosProblems/357.lean @@ -27,7 +27,7 @@ namespace Erdos357 open Filter Asymptotics def HasDistinctSums {ι α : Type*} [Preorder ι] [AddCommMonoid α] (a : ι → α) : Prop := - {J : Finset ι | J.OrdConnected}.InjOn (fun J ↦ ∑ x ∈ J, a x) + {J : Finset ι | (J : Set ι).OrdConnected}.InjOn (fun J ↦ ∑ x ∈ J, a x) /-- Let $f(n)$ be the maximal $k$ such that there exist integers $1 \le a_1 < \dotsc < a_k \le n$ such that all sums of the shape $\sum_{u \le i \le v} a_i$ are distinct. -/ @@ -105,8 +105,7 @@ theorem erdos_357.variants.weisenberg : ∃ o : ℕ → ℝ, o =o[atTop] (1 : Then $A$ has lower density 0. -/ @[category research solved, AMS 11] theorem erdos_357.variants.infinite_set_lower_density (A : ℕ → ℕ) (hA : StrictMono A) - (hA : ∀ I J : Finset ℕ, I.OrdConnected → J.OrdConnected → HasDistinctSums A) : - (Set.range A).lowerDensity = 0 := by + (hA : HasDistinctSums A) : (Set.range A).lowerDensity = 0 := by sorry /-- Suppose $A$ is an infinite set such that all finite sums of consecutive terms of $A$ are distinct. diff --git a/FormalConjectures/ErdosProblems/373.lean b/FormalConjectures/ErdosProblems/373.lean index 73d2ae416..d01f9ec59 100644 --- a/FormalConjectures/ErdosProblems/373.lean +++ b/FormalConjectures/ErdosProblems/373.lean @@ -31,7 +31,7 @@ Let `S` be the set of non-trivial solutions to the equation `n! = a₁! ··· a such that `a₁ ≥ ... ≥ aₖ` and `n-1 > a₁`. -/ abbrev S : Set (ℕ × List ℕ) := - {(n, l) | n ! = (l.map Nat.factorial).prod ∧ l.Sorted (· ≥ ·) + {(n, l) | n ! = (l.map Nat.factorial).prod ∧ l.Pairwise (· ≥ ·) ∧ l.headI < (n - 1 : ℕ) ∧ ∀ a ∈ l, 1 < a } /-- diff --git a/FormalConjectures/ErdosProblems/387.lean b/FormalConjectures/ErdosProblems/387.lean index b24aeb25b..e2e1655bf 100644 --- a/FormalConjectures/ErdosProblems/387.lean +++ b/FormalConjectures/ErdosProblems/387.lean @@ -59,7 +59,7 @@ theorem erdos_387.easy {n : ℕ} {k : ℕ} (hn : 1 ≤ n) (hk : k ≤ n) : ∃ d rw [← Nat.gcd_mul_right] refine Nat.le_of_dvd ?_ (Nat.dvd_gcd ⟨(n - 1).choose (k - 1), ?_⟩ (dvd_mul_right _ _)) · exact Nat.gcd_pos_of_pos_right _ (by positivity) - · cases n <;> cases k <;> simp_all [Nat.succ_mul_choose_eq] + · cases n <;> cases k <;> simp_all [Nat.add_one_mul_choose_eq] · exact Nat.le_of_dvd (by linarith) (gcd_dvd_right _ _) /-- Is it true for any `c < 1` and all `n` sufficiently large, for all `1 ≤ k < n`, `n.choose k` diff --git a/FormalConjectures/ErdosProblems/40.lean b/FormalConjectures/ErdosProblems/40.lean index 9743a9e31..4d564b9bf 100644 --- a/FormalConjectures/ErdosProblems/40.lean +++ b/FormalConjectures/ErdosProblems/40.lean @@ -77,7 +77,8 @@ theorem erdos_28_of_erdos_40 (h_erdos_40 : Erdos40ForSet .univ) : type_of% Erdos use n + 1 intro m hm have : 0 < m := by omega - field_simp [norm_one, Real.norm_natCast, one_mul, Nat.one_le_cast, ge_iff_le] + field_simp + simp only [one_mem, CStarRing.norm_of_mem_unitary, RCLike.norm_natCast, Nat.one_le_cast] apply Nat.card_pos_iff.mpr constructor · by_contra h_empty diff --git a/FormalConjectures/ErdosProblems/409.lean b/FormalConjectures/ErdosProblems/409.lean index 70f797799..139830237 100644 --- a/FormalConjectures/ErdosProblems/409.lean +++ b/FormalConjectures/ErdosProblems/409.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/409](https://www.erdosproblems.com/409) -/ -open scoped Topology ArithmeticFunction Nat +open scoped Topology ArithmeticFunction.sigma Nat open Filter namespace Erdos409 diff --git a/FormalConjectures/ErdosProblems/41.lean b/FormalConjectures/ErdosProblems/41.lean index f1ddada1b..c94c4e03b 100644 --- a/FormalConjectures/ErdosProblems/41.lean +++ b/FormalConjectures/ErdosProblems/41.lean @@ -16,7 +16,6 @@ limitations under the License. import FormalConjectures.Util.ProblemImports -variable {α : Type} [AddCommMonoid α] /-! # Erdős Problem 41 @@ -27,13 +26,14 @@ variable {α : Type} [AddCommMonoid α] open Classical namespace Erdos41 +variable {α : Type} [AddCommMonoid α] /-- For a given set `A`, the n-tuple sums `a₁ + ... + aₙ` are all distinct for `a₁, ..., aₙ` in `A` (aside from the trivial coincidences). -/ def NtupleCondition (A : Set α) (n : ℕ) : Prop := ∀ (I : Finset α) (J : Finset α), - I.toSet ⊆ A ∧ J.toSet ⊆ A ∧ I.card = n ∧ J.card = n ∧ + ↑I ⊆ A ∧ ↑J ⊆ A ∧ I.card = n ∧ J.card = n ∧ (∑ i ∈ I, i = ∑ j ∈ J, j) → I = J /-- diff --git a/FormalConjectures/ErdosProblems/412.lean b/FormalConjectures/ErdosProblems/412.lean index df3ee4fa8..36f2fd980 100644 --- a/FormalConjectures/ErdosProblems/412.lean +++ b/FormalConjectures/ErdosProblems/412.lean @@ -24,7 +24,7 @@ import FormalConjectures.Util.ProblemImports Reviewed by @b-mehta on 2025-05-27 -/ -open ArithmeticFunction +open ArithmeticFunction.sigma namespace Erdos412 diff --git a/FormalConjectures/ErdosProblems/413.lean b/FormalConjectures/ErdosProblems/413.lean index 281b6214f..43445aafe 100644 --- a/FormalConjectures/ErdosProblems/413.lean +++ b/FormalConjectures/ErdosProblems/413.lean @@ -29,7 +29,8 @@ even posed a relaxed variant asking whether there is some `ε > 0` for which inf satisfy `m + ε · ω(m) ≤ n` for every `m < n`. -/ -open scoped ArithmeticFunction +open ArithmeticFunction +open scoped omega Omega namespace Erdos413 diff --git a/FormalConjectures/ErdosProblems/418.lean b/FormalConjectures/ErdosProblems/418.lean index d8357bb52..683013dc8 100644 --- a/FormalConjectures/ErdosProblems/418.lean +++ b/FormalConjectures/ErdosProblems/418.lean @@ -24,7 +24,7 @@ import FormalConjectures.Util.ProblemImports Reviewed by @b-mehta on 2025-05-27 -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos418 diff --git a/FormalConjectures/ErdosProblems/44.lean b/FormalConjectures/ErdosProblems/44.lean index befaa292d..f8f6a9e0f 100644 --- a/FormalConjectures/ErdosProblems/44.lean +++ b/FormalConjectures/ErdosProblems/44.lean @@ -42,9 +42,9 @@ This problem asks whether any Sidon set can be extended to achieve a density arbitrarily close to the optimal density for Sidon sets. -/ @[category research open, AMS 5 11] -theorem erdos_44 : answer(sorry) ↔ ∀ᵉ (N ≥ (1 : ℕ)) (A ⊆ Finset.Icc 1 N), IsSidon A → +theorem erdos_44 : answer(sorry) ↔ ∀ᵉ (N ≥ (1 : ℕ)) (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) → ∀ᵉ (ε > (0 : ℝ)), ∃ᵉ (M > N) (B ⊆ Finset.Icc (N + 1) M), - IsSidon (A ∪ B) ∧ (1 - ε) * Real.sqrt M ≤ (A ∪ B).card := by + IsSidon (A ∪ B : Set ℕ) ∧ (1 - ε) * Real.sqrt M ≤ (A ∪ B).card := by sorry /-- @@ -52,7 +52,7 @@ The case where we start with an empty set (constructing large Sidon sets). -/ @[category research open, AMS 5 11] theorem erdos_44.empty_start : answer(sorry) ↔ ∀ᵉ (ε > (0 : ℝ)), ∀ᶠ (M : ℕ) in Filter.atTop, - ∃ᵉ (A ⊆ Finset.Icc 1 M), IsSidon A ∧ (1 - ε) * Real.sqrt M ≤ A.card := by + ∃ᵉ (A ⊆ Finset.Icc 1 M), IsSidon (A : Set ℕ) ∧ (1 - ε) * Real.sqrt M ≤ A.card := by sorry /-! ## Related results and examples -/ @@ -69,7 +69,7 @@ For any `N`, there exists a Sidon set of size at least `√N/2`. -/ @[category undergraduate, AMS 5 11] theorem sidon_set_lower_bound (N : ℕ) (hN : 1 ≤ N) : - ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon A ∧ N.sqrt / 2 ≤ A.card := by + ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) ∧ N.sqrt / 2 ≤ A.card := by sorry /-- @@ -77,7 +77,7 @@ The greedy construction gives a Sidon set of size approximately `√N`. -/ @[category undergraduate, AMS 5 11] theorem greedy_sidon_construction (N : ℕ) (hN : 1 ≤ N) : - ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon A ∧ A.card ≥ N.sqrt := by + ∃ᵉ (A ⊆ Finset.Icc 1 N), IsSidon (A : Set ℕ) ∧ A.card ≥ N.sqrt := by sorry end Erdos44 diff --git a/FormalConjectures/ErdosProblems/48.lean b/FormalConjectures/ErdosProblems/48.lean index 225e4f897..40c49da30 100644 --- a/FormalConjectures/ErdosProblems/48.lean +++ b/FormalConjectures/ErdosProblems/48.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/48](https://www.erdosproblems.com/48) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos48 diff --git a/FormalConjectures/ErdosProblems/647.lean b/FormalConjectures/ErdosProblems/647.lean index 0608e6b9c..2570a0b83 100644 --- a/FormalConjectures/ErdosProblems/647.lean +++ b/FormalConjectures/ErdosProblems/647.lean @@ -24,7 +24,7 @@ import FormalConjectures.Util.ProblemImports namespace Erdos647 -open Filter ArithmeticFunction +open Filter ArithmeticFunction.sigma /-- Let $\tau(n)$ count the number of divisors of $n$. Is there some $n > 24$ such that $$ diff --git a/FormalConjectures/ErdosProblems/69.lean b/FormalConjectures/ErdosProblems/69.lean index 401b3de78..695a4e625 100644 --- a/FormalConjectures/ErdosProblems/69.lean +++ b/FormalConjectures/ErdosProblems/69.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/69](https://www.erdosproblems.com/69) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.omega namespace Erdos69 diff --git a/FormalConjectures/ErdosProblems/825.lean b/FormalConjectures/ErdosProblems/825.lean index 8f552d9c7..3c3f6368d 100644 --- a/FormalConjectures/ErdosProblems/825.lean +++ b/FormalConjectures/ErdosProblems/825.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/825](https://www.erdosproblems.com/825) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos825 diff --git a/FormalConjectures/ErdosProblems/826.lean b/FormalConjectures/ErdosProblems/826.lean index a46178599..8e65b8d00 100644 --- a/FormalConjectures/ErdosProblems/826.lean +++ b/FormalConjectures/ErdosProblems/826.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/826](https://www.erdosproblems.com/826) -/ -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos826 diff --git a/FormalConjectures/ErdosProblems/830.lean b/FormalConjectures/ErdosProblems/830.lean index 80cc8c342..ecf3a4218 100644 --- a/FormalConjectures/ErdosProblems/830.lean +++ b/FormalConjectures/ErdosProblems/830.lean @@ -22,11 +22,11 @@ import FormalConjectures.Util.ProblemImports *Reference:* [erdosproblems.com/830](https://www.erdosproblems.com/830) -/ -namespace Erdos830 - -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma open Classical Filter Real +namespace Erdos830 + /-- We say that $a,b\in \mathbb{N}$ are an amicable pair if $\sigma(a)=\sigma(b)=a+b$. -/ diff --git a/FormalConjectures/ErdosProblems/846.lean b/FormalConjectures/ErdosProblems/846.lean index d7a525437..6ba6c51aa 100644 --- a/FormalConjectures/ErdosProblems/846.lean +++ b/FormalConjectures/ErdosProblems/846.lean @@ -31,8 +31,8 @@ open Classical /-- We say a subset `A` of points in the plane is `ε`-non-trilinear if any subset `B` of `A`, contains a non-trilinear subset `C` of size at least `ε|B|`. -/ def NonTrilinearFor (A : Set ℝ²) (ε : ℝ) : Prop := - ∀ (B : Finset ℝ²), B.toSet ⊆ A → ∃ C ⊆ B, - ε * B.card ≤ C.card ∧ NonTrilinear C.toSet + ∀ B : Finset ℝ², ↑B ⊆ A → ∃ C ⊆ B, + ε * B.card ≤ C.card ∧ NonTrilinear (C : Set ℝ²) /-- We say a subset `A` of points in the plane is weakly non-trilinear if it is a finite union of non-trilinear sets. -/ diff --git a/FormalConjectures/ErdosProblems/893.lean b/FormalConjectures/ErdosProblems/893.lean index b08fd20a4..e68dffd1f 100644 --- a/FormalConjectures/ErdosProblems/893.lean +++ b/FormalConjectures/ErdosProblems/893.lean @@ -25,7 +25,7 @@ import FormalConjectures.Util.ProblemImports -/ open Filter Finset -open scoped ArithmeticFunction +open scoped ArithmeticFunction.sigma namespace Erdos893 diff --git a/FormalConjectures/ErdosProblems/938.lean b/FormalConjectures/ErdosProblems/938.lean index 951c65d1d..924fe747b 100644 --- a/FormalConjectures/ErdosProblems/938.lean +++ b/FormalConjectures/ErdosProblems/938.lean @@ -30,7 +30,7 @@ Let $A=\{n_1 < n_2 < \cdots\}$ be the sequence of powerful numbers (if $p\mid n$ Are there only finitely many three-term progressions of consecutive terms $n_k,n_{k+1},n_{k+2}$? -/ @[category research open, AMS 11] -theorem erdos_938 : answer(sorry) ↔ {P : Finset ℕ | Set.IsAPOfLength P.toSet 3 ∧ ∃ k, +theorem erdos_938 : answer(sorry) ↔ {P : Finset ℕ | (P : Set ℕ).IsAPOfLength 3 ∧ ∃ k, P = {nth Powerful k, nth Powerful (k + 1), nth Powerful (k + 2)}}.Finite := by sorry diff --git a/FormalConjectures/ErdosProblems/946.lean b/FormalConjectures/ErdosProblems/946.lean index 010a17a02..92cd5ed79 100644 --- a/FormalConjectures/ErdosProblems/946.lean +++ b/FormalConjectures/ErdosProblems/946.lean @@ -35,9 +35,9 @@ import FormalConjectures.Util.ProblemImports -/ open Filter Real +open scoped ArithmeticFunction.sigma namespace Erdos946 -open scoped ArithmeticFunction /-- There are infinitely many $n$ such that $τ(n) = τ(n+1)$. Proved in [He84]. diff --git a/FormalConjectures/ErdosProblems/97.lean b/FormalConjectures/ErdosProblems/97.lean index 23d7ea197..ff54674d9 100644 --- a/FormalConjectures/ErdosProblems/97.lean +++ b/FormalConjectures/ErdosProblems/97.lean @@ -89,15 +89,15 @@ Danzer's construction is explained in [Er87b]. @[category research solved, AMS 52] theorem erdos_97.variants.three_equidistant : ∃ A : Finset ℝ², A.Nonempty ∧ ConvexIndep A ∧ HasNEquidistantProperty 3 A := by - let A₁ : ℝ² := ![(-√3), -1] - let A₂ : ℝ² := ![(√3), -1] - let A₃ : ℝ² := ![0, 2] - let B₁ : ℝ² := ![(-8991 / 10927 * √3), -26503 / 10927] - let B₂ : ℝ² := ![(-17747 / 10947 * √3), -235 / 10927] - let B₃ : ℝ² := ![(-8756 / 10927 * √3), 26738 / 10927] - let C₁ : ℝ² := ![(-10753 / 18529 * √3), -44665 / 18529] - let C₂ : ℝ² := ![(27709 / 18529 * √3), 6203 / 18529] - let C₃ : ℝ² := ![(-16956 / 18529 * √3), 38462 / 18529] + let A₁ : ℝ² := !₂[(-√3), -1] + let A₂ : ℝ² := !₂[(√3), -1] + let A₃ : ℝ² := !₂[0, 2] + let B₁ : ℝ² := !₂[(-8991 / 10927 * √3), -26503 / 10927] + let B₂ : ℝ² := !₂[(-17747 / 10947 * √3), -235 / 10927] + let B₃ : ℝ² := !₂[(-8756 / 10927 * √3), 26738 / 10927] + let C₁ : ℝ² := !₂[(-10753 / 18529 * √3), -44665 / 18529] + let C₂ : ℝ² := !₂[(27709 / 18529 * √3), 6203 / 18529] + let C₃ : ℝ² := !₂[(-16956 / 18529 * √3), 38462 / 18529] use {A₁, A₂, A₃, B₁, B₂, B₃, C₁, C₂, C₃} sorry diff --git a/FormalConjectures/ErdosProblems/975.lean b/FormalConjectures/ErdosProblems/975.lean index 7e1e9b8cc..2eaf660f8 100644 --- a/FormalConjectures/ErdosProblems/975.lean +++ b/FormalConjectures/ErdosProblems/975.lean @@ -32,7 +32,7 @@ import FormalConjectures.Util.ProblemImports -/ open Filter Real Polynomial -open scoped ArithmeticFunction Topology +open scoped ArithmeticFunction.sigma Topology namespace Erdos975 diff --git a/FormalConjectures/GreensOpenProblems/1.lean b/FormalConjectures/GreensOpenProblems/1.lean index 3c3cda61d..a73c33e89 100644 --- a/FormalConjectures/GreensOpenProblems/1.lean +++ b/FormalConjectures/GreensOpenProblems/1.lean @@ -33,7 +33,7 @@ of size at least $\frac n 3 + Ω(n)$, where $Ω(n) → ∞$ as $n → ∞$? @[category research open, AMS 5 11] theorem green_1 : answer(sorry) ↔ ∃ Ω : ℕ → ℝ, atTop.Tendsto Ω atTop ∧ ∀ n, ∀ (A : Finset ℕ), (∀ a ∈ A, 0 < a) → A.card = n → - ∃ (S : Finset ℕ), S ⊆ A ∧ IsSumFree S.toSet ∧ ((n : ℝ) / 3) + Ω n ≤ S.card := by + ∃ (S : Finset ℕ), S ⊆ A ∧ IsSumFree (S : Set ℕ) ∧ ((n : ℝ) / 3) + Ω n ≤ S.card := by sorry -- TODO(firsching): add known/related results here. diff --git a/FormalConjectures/HilbertProblems/17.lean b/FormalConjectures/HilbertProblems/17.lean index 60bd61d6c..69e19b929 100644 --- a/FormalConjectures/HilbertProblems/17.lean +++ b/FormalConjectures/HilbertProblems/17.lean @@ -53,7 +53,7 @@ theorem f_nonneg : ∀ x y : ℝ, 0 ≤ f.eval ![x, y] := by intro x y unfold f simp - exact Real.motzkin_polynomial_nonneg x y + exact motzkin_polynomial_nonneg x y @[category high_school, AMS 12] theorem f_not_sum_of_squares : diff --git a/FormalConjectures/Mathoverflow/34145.lean b/FormalConjectures/Mathoverflow/34145.lean index a53bb07b2..f6c6efdad 100644 --- a/FormalConjectures/Mathoverflow/34145.lean +++ b/FormalConjectures/Mathoverflow/34145.lean @@ -122,7 +122,7 @@ lemma tsum_area_eq_one : ∑' (n : ℕ), ((1 / (n + 1)) * (1 / (n + 2)) : ℝ) = have (n : ℕ) : ∑ i ∈ Finset.range n, (1 / (i + 1) * (1 / (i + 2)) : ℝ) = 1 - 1 / (n + 1) := by induction n with | zero => simp - | succ n ih => rw [Finset.sum_range_succ, ih]; field_simp; ring + | succ n ih => rw [Finset.sum_range_succ, ih]; field_simp; push_cast; ring refine HasSum.tsum_eq ((hasSum_iff_tendsto_nat_of_nonneg (fun i ↦ ?_) _).2 ?_) · positivity · simp_rw [this] diff --git a/FormalConjectures/OEIS/358684.lean b/FormalConjectures/OEIS/358684.lean index 7e4a166c7..9025e4be2 100644 --- a/FormalConjectures/OEIS/358684.lean +++ b/FormalConjectures/OEIS/358684.lean @@ -56,7 +56,7 @@ noncomputable def a' (n : ℕ) : ℕ := ) -/- +/-- The log2 of the smallest prime factor of $F_n$ is at most $2^n$. -/ @[category undergraduate, AMS 11] @@ -64,8 +64,9 @@ private lemma log2_minFac_le (n : ℕ) : log2 (fermatNumber n).minFac ≤ 2^n := rw [log2_eq_log_two] refine (log_mono_right (minFac_le (by rw [fermatNumber]; norm_num))).trans_eq ?_ rw [fermatNumber, log_eq_of_pow_le_of_lt_pow (le_add_right _ _)] - rw [pow_succ, mul_two]; apply add_lt_add_left (one_lt_pow (by norm_num) (by norm_num)) - + rw [pow_succ, mul_two] + gcongr + exact one_lt_pow (by norm_num) (by norm_num) /-- The minimization definition is equivalent to the closed form. @@ -93,26 +94,21 @@ theorem a_equiv_a' (n : ℕ) : a n = a' n := by have := succ_le_of_lt hm omega - @[category test, AMS 11] -theorem zero : a 0 = 0 := by - norm_num [a, Nat.log2] +theorem zero : a 0 = 0 := by norm_num [a]; simp [log2_def] @[category test, AMS 11] -theorem one : a 1 = 0 := by - norm_num [a, Nat.log2] +theorem one : a 1 = 0 := by norm_num [a]; simp [log2_def] @[category test, AMS 11] -theorem two : a 2 = 0 := by - norm_num [a, Nat.log2] +theorem two : a 2 = 0 := by norm_num [a]; simp [log2_def] @[category test, AMS 11] theorem three : a 3 = 0 := by norm_num only [a, Nat.log2_eq_log_two,Nat.fermatNumber] @[category test, AMS 11] -theorem four : a 0 = 0 := by - norm_num[a, Nat.log2] +theorem four : a 0 = 0 := by norm_num [a]; simp [log2_def] @[category test, AMS 11] theorem five : a 5 = 23 := by diff --git a/FormalConjectures/OEIS/56777.lean b/FormalConjectures/OEIS/56777.lean index c30a3b2cd..4c75bfa1a 100644 --- a/FormalConjectures/OEIS/56777.lean +++ b/FormalConjectures/OEIS/56777.lean @@ -15,9 +15,6 @@ limitations under the License. -/ import FormalConjectures.Util.ProblemImports -open scoped ArithmeticFunction -open Nat - /-! # Conjectures associated with A56777 @@ -30,6 +27,9 @@ well as congruences satisfied by the members of A56777. *References:* [oeis.org/A56777](https://oeis.org/A56777) -/ +open Nat +open scoped ArithmeticFunction.sigma + namespace OeisA56777 /-- A composite number $n$ is in the sequence A56777 if it satisfies both diff --git a/FormalConjectures/OEIS/6697.lean b/FormalConjectures/OEIS/6697.lean index ac1ed10b0..2e7593043 100644 --- a/FormalConjectures/OEIS/6697.lean +++ b/FormalConjectures/OEIS/6697.lean @@ -100,8 +100,9 @@ $$\sum_{n \geq 0} a_n x^n = 1 + \frac{1}{1-x} + \frac{1}{(1-x)^2}\left(\frac{1}{ Equivalently, a(n) equals the n-th coefficient of this generating function. -/ @[category research open, AMS 68] -theorem conjecture : ∀ n, a n = - coeff ℚ n (1 + (1 - X)⁻¹ + (1 - X)⁻¹ ^ 2 * ((1 - X)⁻¹ - ∑' k, X ^ (2 ^ (k + 1) + k))) := by +theorem conjecture (n : ℕ) : + a n = coeff (R := ℚ) n + (1 + (1 - X)⁻¹ + (1 - X)⁻¹ ^ 2 * ((1 - X)⁻¹ - ∑' k, X ^ (2 ^ (k + 1) + k))) := by sorry end OeisA6697 diff --git a/FormalConjectures/Paper/CasasAlvero.lean b/FormalConjectures/Paper/CasasAlvero.lean index 8d56bea0f..e5c78eb2e 100644 --- a/FormalConjectures/Paper/CasasAlvero.lean +++ b/FormalConjectures/Paper/CasasAlvero.lean @@ -99,7 +99,7 @@ lemma casas_alvero_iffᵣ : have ⟨α, eq⟩ := h (P.map (algebraMap K L)) (hP.map _) <| hasCasasAlveroProp_iffᵣ.mp <| HasCasasAlveroProp.map_iff.mpr hca by_cases h0 : P.natDegree = 0 - · simp [hP.natDegree_eq_zero_iff_eq_one.mp h0] + · simp [hP.natDegree_eq_zero.mp h0] let α' := - P.nextCoeff / P.natDegree have : algebraMap K L α' = α := by simp_rw [α', div_eq_inv_mul, map_mul, map_neg, ← nextCoeff_map (algebraMap K L).injective, diff --git a/FormalConjectures/Paper/HartshorneConjecture.lean b/FormalConjectures/Paper/HartshorneConjecture.lean index f40460642..02bea616e 100644 --- a/FormalConjectures/Paper/HartshorneConjecture.lean +++ b/FormalConjectures/Paper/HartshorneConjecture.lean @@ -43,7 +43,7 @@ local instance (X : TopologicalSpace.Opens S) : ((Opens.grothendieckTopology S).over X) local instance (X : TopologicalSpace.Opens S) : - ((Opens.grothendieckTopology S).over X).WEqualsLocallyBijective (AddCommGrp.{u}) := + ((Opens.grothendieckTopology S).over X).WEqualsLocallyBijective (AddCommGrpCat.{u}) := inferInstance /-- @@ -62,11 +62,11 @@ instance (S : Scheme) : Coe S.VectorBundles S.Modules where Vector bundles form a category. -/ instance : Category S.VectorBundles := - InducedCategory.category VectorBundles.carrier + inferInstanceAs <| Category <| InducedCategory _ VectorBundles.carrier def VectorBundles.toModule : S.VectorBundles ⥤ S.Modules where obj 𝓕 := 𝓕.carrier - map f := f + map f := f.hom @[category API, AMS 14] theorem hasFiniteCoproductsVectorBundles : HasFiniteCoproducts S.VectorBundles := by diff --git a/FormalConjectures/Paper/Kurepa.lean b/FormalConjectures/Paper/Kurepa.lean index 840336400..aa216cbd2 100644 --- a/FormalConjectures/Paper/Kurepa.lean +++ b/FormalConjectures/Paper/Kurepa.lean @@ -65,8 +65,11 @@ theorem kurepa_conjecture.prime_reduction : (∀ n, 2 < n → (!n : ℕ) % n ≠ refine hp.eq_two_or_odd.resolve_right fun _ ↦ ?_ have : p ∣ ∑ a ∈ range n, (a)! := .trans (by simp) (dvd_of_mem_primeFactorsList h_mem |>.trans (dvd_of_mod_eq_zero h_mod)) - rw [← CharP.cast_eq_zero_iff (ZMod p), cast_sum, ← sum_subset (range_subset.2 - (le_of_mem_primeFactorsList h_mem)) (fun _ _ _ ↦ CharP.cast_eq_zero_iff _ p _ |>.2 <| + have hxp : range p ⊆ range n := by + simp only [range_subset_range] + exact le_of_mem_primeFactorsList h_mem + rw [← CharP.cast_eq_zero_iff (ZMod p), cast_sum, + ← sum_subset hxp (fun _ _ _ ↦ CharP.cast_eq_zero_iff _ p _ |>.2 <| hp.dvd_factorial.2 <| by aesop), ← cast_sum, CharP.cast_eq_zero_iff _ p] at this exact h p (hp.two_le.lt_of_ne (by omega)) hp <| mod_eq_zero_of_dvd this rw [List.prod_eq_pow_card _ 2 this] @@ -107,7 +110,10 @@ theorem kurepa_conjecture.gcd_reduction : (∀ n, 2 < n → (!n : ℕ) % n ≠ 0 pos_of_dvd_of_pos hc (factorial_pos _)])] at h_dvd refine by_contra fun _ ↦ h c ?_ (sum_nat_mod _ _ _ ▸ h_dvd) match c with - | 0 => field_simp [Ne.symm] at hc + | 0 => + contrapose! hc + simp only [zero_dvd_iff] + positivity | 1 => trivial | S + 3 => omega diff --git a/FormalConjectures/Util/Attributes/AMS.lean b/FormalConjectures/Util/Attributes/AMS.lean index efa3bc30b..380f90024 100644 --- a/FormalConjectures/Util/Attributes/AMS.lean +++ b/FormalConjectures/Util/Attributes/AMS.lean @@ -173,7 +173,7 @@ def numToAMSName (n : Nat) : MetaM Name := do def AMS.getDesc (a : AMS) : CoreM String := do let .const n [] := Lean.toExpr a | throwError "this shouldn't happen" let .some doc := ← Lean.findDocString? (← getEnv) n | throwError m!"{.ofConstName n} is missing a docstring" - return doc.trim + return doc.trimAscii.toString def AMS.toNat? (a : AMS) : Option Nat := do let .const (.str _ m) [] := Lean.toExpr a | none @@ -190,6 +190,6 @@ elab "#AMS" : command => do let nm : Name := Name.str ``AMS (ToString.toString n) if ← Lean.hasConst nm then if let some doc := ← Lean.findDocString? env nm then - return s!"{n} {doc.trim}" + return s!"{n} {doc.trimAscii}" return none Lean.logInfo ("\n".intercalate lines) diff --git a/FormalConjectures/Util/Linters/AMSLinter.lean b/FormalConjectures/Util/Linters/AMSLinter.lean index 0ba01f950..bf2ca2629 100644 --- a/FormalConjectures/Util/Linters/AMSLinter.lean +++ b/FormalConjectures/Util/Linters/AMSLinter.lean @@ -33,6 +33,9 @@ register_option linter.style.ams_attribute : Bool := { descr := "enable the `AMS` attribute style linter" } +-- FIXME: False positive +set_option linter.style.docString.empty false + namespace AMSLinter /-- Checks if a command has the `AMS` attribute. -/ diff --git a/FormalConjectures/Util/Linters/CategoryLinter.lean b/FormalConjectures/Util/Linters/CategoryLinter.lean index 940fa59d8..2ed0d6e84 100644 --- a/FormalConjectures/Util/Linters/CategoryLinter.lean +++ b/FormalConjectures/Util/Linters/CategoryLinter.lean @@ -33,6 +33,9 @@ register_option linter.style.category_attribute : Bool := { descr := "enable the `category` attribute style linter" } +-- FIXME: False positive +set_option linter.style.docString.empty false + namespace CategoryLinter /-- Checks if a command has the `category` attribute. -/ diff --git a/FormalConjectures/Util/Linters/CopyrightLinter.lean b/FormalConjectures/Util/Linters/CopyrightLinter.lean index 583efebcc..27f06311b 100644 --- a/FormalConjectures/Util/Linters/CopyrightLinter.lean +++ b/FormalConjectures/Util/Linters/CopyrightLinter.lean @@ -44,7 +44,7 @@ limitations under the License. /-- Check whether a file, given as a `String`, is prefixed with the correct copyright header. -/ def hasCorrectCopyright (file : String) : Bool := Id.run do let .some suffix := file.dropPrefix? correctCopyrightPrefix | false - correctCopyrightSuffix.isPrefixOf (suffix.extract ⟨4⟩ suffix.stopPos).toString + correctCopyrightSuffix.isPrefixOf (suffix.extract (suffix.startPos.nextn 4) suffix.endPos) /-- The current correct copyright header. -/ def correctCopyrightHeader : String := correctCopyrightPrefix ++ "2026" ++ correctCopyrightSuffix @@ -63,7 +63,7 @@ def copyrightLinter : Linter where run := withSetOptionIn fun stx ↦ do let source := (← getFileMap).source -- Get the syntax corresponding to the first character in the file since that's where the warning -- message will be logged. - let startingStx : Syntax := .atom (.synthetic ⟨0⟩ ⟨1⟩) <| source.extract ⟨0⟩ ⟨1⟩ + let startingStx : Syntax := .atom (.synthetic ⟨0⟩ ⟨1⟩) <| String.Pos.Raw.extract source ⟨0⟩ ⟨1⟩ -- We don't want to output an error message when building `FormalConjectures.All` unless (← getFileName) == "FormalConjectures.All" || hasCorrectCopyright source do Lean.Linter.logLint linter.style.copyright startingStx <| diff --git a/FormalConjectures/Util/ProblemImports.lean b/FormalConjectures/Util/ProblemImports.lean index 27dba44a1..c8d25a9ce 100644 --- a/FormalConjectures/Util/ProblemImports.lean +++ b/FormalConjectures/Util/ProblemImports.lean @@ -15,6 +15,7 @@ limitations under the License. -/ -- A standard set of imports for open problems. +import Counterexamples import Mathlib import FormalConjecturesForMathlib import FormalConjectures.Util.Answer diff --git a/FormalConjectures/Wikipedia/AgohGiuga.lean b/FormalConjectures/Wikipedia/AgohGiuga.lean index 90c3a9e40..205d70d46 100644 --- a/FormalConjectures/Wikipedia/AgohGiuga.lean +++ b/FormalConjectures/Wikipedia/AgohGiuga.lean @@ -160,13 +160,17 @@ theorem korselts_criterion (a : ℕ) (ha₁ : a.Composite) : refine if hb : _ = 0 then ⟨0, hb⟩ else (a.factorization_le_iff_dvd ha₁.1.ne_bot hb).1 fun p => ?_ by_cases hp : p.Prime · by_cases hpa : p ∣ a - · obtain ⟨_, h⟩ := h_dvd p hp hpa + · obtain ⟨w, h⟩ := h_dvd p hp hpa obtain ⟨ha₁, ha₂⟩ := ha₁ apply Nat.Prime.pow_dvd_iff_le_factorization hp hb |>.1 have : a.factorization p ≤ 1 := not_lt.1 fun h => h_sqfr p hp <| (sq p ▸ (pow_dvd_pow p h).trans (a.ordProj_dvd p)) - field_simp [h, pow_mul, le_antisymm this (hp.dvd_iff_one_le_factorization _ |>.1 _), - ← CharP.cast_eq_zero_iff (ZMod p)] + replace : a.factorization p = 1 := + this.antisymm (hp.dvd_iff_one_le_factorization (by grind) |>.1 hpa) + simp_rw [this, pow_one, ← CharP.cast_eq_zero_iff (ZMod p)] + have one_le_b_pow : 1 ≤ b ^ (a - 1) := by omega + push_cast [one_le_b_pow] + simp_rw [h, pow_mul] simp_all +decide [CharP.cast_eq_zero_iff _ p, hp.coprime_iff_not_dvd.1 (hab.of_dvd_left (by aesop)), ZMod.pow_card_sub_one_eq_one] · simp [a.factorization_eq_zero_of_not_dvd hpa] diff --git a/FormalConjectures/Wikipedia/InvariantSubspaceProblem.lean b/FormalConjectures/Wikipedia/InvariantSubspaceProblem.lean index c12346357..ce6dcf181 100644 --- a/FormalConjectures/Wikipedia/InvariantSubspaceProblem.lean +++ b/FormalConjectures/Wikipedia/InvariantSubspaceProblem.lean @@ -32,7 +32,7 @@ structure ClosedInvariantSubspace [Module ℂ H] (T : H →L[ℂ] H) where ne_bot : toSubspace ≠ ⊥ ne_top : toSubspace ≠ ⊤ is_closed : IsClosed (toSubspace : Set H) - is_fixed : toSubspace.map T ≤ toSubspace + is_fixed : toSubspace.map T.toLinearMap ≤ toSubspace /-- Show that every bounded linear operator `T : H → H` on a separable Hilbert space `H` of dimension diff --git a/FormalConjectures/Wikipedia/JugglerConjecture.lean b/FormalConjectures/Wikipedia/JugglerConjecture.lean index 2050150fc..585974e4c 100644 --- a/FormalConjectures/Wikipedia/JugglerConjecture.lean +++ b/FormalConjectures/Wikipedia/JugglerConjecture.lean @@ -22,7 +22,7 @@ import FormalConjectures.Util.ProblemImports *Reference:* [Wikipedia](https://en.wikipedia.org/wiki/Juggler_sequence) -/ -namespace JugglerConjecture +namespace JugglerConjecture /-- Consider the following operation on the natural numbers: @@ -47,7 +47,5 @@ theorem juggler_conjecture (n : ℕ) (hn : n > 0) : ∃ m, jugglerStep^[m] n = 1 theorem jugglerStep_36 : jugglerStep 36 = 6 := by unfold jugglerStep norm_num [←Real.sqrt_eq_rpow] - decide - -end JugglerConjecture +end JugglerConjecture diff --git a/FormalConjectures/Wikipedia/Mandelbrot.lean b/FormalConjectures/Wikipedia/Mandelbrot.lean index 884eea977..6a9daec3a 100644 --- a/FormalConjectures/Wikipedia/Mandelbrot.lean +++ b/FormalConjectures/Wikipedia/Mandelbrot.lean @@ -72,14 +72,16 @@ theorem multibrotSet_eq {n : ℕ} (hn : 2 ≤ n) : refine .trans ?_ <| norm_sub_le_norm_add _ _ replace hm : r ^ n + a * n ^ m * r ^ (n - 1) * ↑n ≤ ‖(fun z ↦ z ^ n + c)^[k + m] 0‖ ^ n := by - refine .trans ?_ (pow_le_pow_left₀ (by positivity) hm n); cases n; simp + grw [← hm] + cases n + · simp rw [add_comm r _, add_pow] refine .trans ?_ <| Finset.add_le_sum (by intros; positivity) ?_ ?_ zero_ne_one <;> simp rw [norm_pow, pow_succ] - refine .trans ?_ (sub_le_sub hm h') + grw [← hm, h'] rw [hr', hr'', show ‖(fun z ↦ z ^ n + c)^[k] 0‖ = a + r by simp [a]] suffices a ≤ a * (n * n ^ m) by linarith - refine (mul_one a).symm.trans_le <| (mul_le_mul_left ha).2 ?_ + rw [le_mul_iff_one_le_right ha] have hn : 1 ≤ (n : ℝ) := Nat.one_le_cast.2 hn.le simpa using mul_le_mul hn (one_le_pow₀ hn) rw [← tendsto_norm_atTop_iff_cobounded] diff --git a/FormalConjectures/Wikipedia/ModularityConjecture.lean b/FormalConjectures/Wikipedia/ModularityConjecture.lean index 8de8c7b21..cffc6239b 100644 --- a/FormalConjectures/Wikipedia/ModularityConjecture.lean +++ b/FormalConjectures/Wikipedia/ModularityConjecture.lean @@ -41,7 +41,7 @@ open scoped UpperHalfPlane Real ModularForm CongruenceSubgroup /-- The `n`-th Fourier coefficient of a modular forms (around the cusp at infinity). -/ noncomputable def modularFormAn (n : ℕ) {N : ℕ} {k : ℤ} (f : CuspForm (Gamma0 N) k) : ℂ := - (qExpansion N f).coeff ℂ n + (qExpansion N f).coeff n local notation:73 "a_[" n:0 "]" f:72 => modularFormAn n f diff --git a/FormalConjectures/Wikipedia/PierceBirkhoff.lean b/FormalConjectures/Wikipedia/PierceBirkhoff.lean index 84a05cba8..96f88c67d 100644 --- a/FormalConjectures/Wikipedia/PierceBirkhoff.lean +++ b/FormalConjectures/Wikipedia/PierceBirkhoff.lean @@ -16,8 +16,6 @@ limitations under the License. import FormalConjectures.Util.ProblemImports -open scoped EuclideanGeometry - /-! # Pierce–Birkhoff conjecture @@ -35,7 +33,7 @@ The conjecture has been proved for `n = 1` and `n = 2` by Louis Mahé. A set is semi-algebraic in `ℝⁿ` if it can be described by a finite union of sets defined by multivariate polynomial equations and inequalities. -/ -def IsSemiAlgebraic {n : ℕ} (S : Set (ℝ^n)) : Prop := +def IsSemiAlgebraic {n : ℕ} (S : Set (Fin n → ℝ)) : Prop := ∃ (ι₀ ι₁ : Type) (p₀ : ι₀ → MvPolynomial (Fin n) ℝ) (p₁ : ι₁ → MvPolynomial (Fin n) ℝ), Finite ι₀ ∧ Finite ι₁ ∧ S = (⋃ i, {x | MvPolynomial.eval x (p₀ i) = 0}) ∪ ⋃ i, {x | MvPolynomial.eval x (p₁ i) > 0} @@ -55,8 +53,8 @@ A function `f : ℝⁿ → ℝ` is piecewise polynomial if there exists a finite closed semi-algebraic sets such that the restriction of `f` to each set in the covering is polynomial. -/ -def IsPiecewiseMvPolynomial {n : ℕ} (f : ℝ^n → ℝ) : Prop := - ∃ (ι : Type) (P : ι → Set (ℝ^n)) +def IsPiecewiseMvPolynomial {n : ℕ} (f : (Fin n → ℝ) → ℝ) : Prop := + ∃ (ι : Type) (P : ι → Set (Fin n → ℝ)) (g : ι → MvPolynomial (Fin n) ℝ), Finite ι ∧ (∀ i, IsClosed (P i)) ∧ @@ -84,7 +82,7 @@ The Pierce-Birkhoff conjecture states that for every real piecewise-polynomial f `f = supᵢ infⱼ(gᵢⱼ)`. -/ @[category research open, AMS 13] -theorem pierce_birkhoff_conjecture {n : ℕ} (f : ℝ^n → ℝ) +theorem pierce_birkhoff_conjecture {n : ℕ} (f : (Fin n → ℝ) → ℝ) (hf : IsPiecewiseMvPolynomial f) : ∃ (ι κ : Type) (g : ι → κ → MvPolynomial (Fin n) ℝ), Finite ι ∧ Finite κ ∧ ∀ x, f x = ⨆ i, ⨅ j, MvPolynomial.eval x (g i j) := by @@ -107,7 +105,7 @@ This was proved by Louis Mahé. -/ @[category research solved, AMS 13] theorem pierce_birkhoff_conjecture_dim_two - (f : ℝ² → ℝ) (hf : IsPiecewiseMvPolynomial f) : + (f : (Fin 2 → ℝ) → ℝ) (hf : IsPiecewiseMvPolynomial f) : ∃ (ι κ : Type) (g : ι → κ → MvPolynomial (Fin 2) ℝ), Finite ι ∧ Finite κ ∧ ∀ x, f x = ⨆ i, ⨅ j, MvPolynomial.eval x (g i j) := by sorry diff --git a/FormalConjectures/Wikipedia/RamanujanTau.lean b/FormalConjectures/Wikipedia/RamanujanTau.lean index 5cf908ef8..984161766 100644 --- a/FormalConjectures/Wikipedia/RamanujanTau.lean +++ b/FormalConjectures/Wikipedia/RamanujanTau.lean @@ -36,7 +36,7 @@ open PowerSeries PowerSeries.WithPiTopology noncomputable def Δ : PowerSeries ℤ := X * ∏' (n : ℕ+), (1 - X ^ (n : ℕ)) ^ 24 -noncomputable def τ (n : ℕ) : ℤ := PowerSeries.coeff ℤ n Δ +noncomputable def τ (n : ℕ) : ℤ := PowerSeries.coeff n Δ @[category API, AMS 11] diff --git a/FormalConjectures/Wikipedia/RationalDistanceProblem.lean b/FormalConjectures/Wikipedia/RationalDistanceProblem.lean index c3238d1e8..08f92306f 100644 --- a/FormalConjectures/Wikipedia/RationalDistanceProblem.lean +++ b/FormalConjectures/Wikipedia/RationalDistanceProblem.lean @@ -31,10 +31,10 @@ namespace RationalDistanceProblem open EuclideanGeometry -def UnitSquareCorners : Fin 4 → ℝ² := - ![![0, 0], ![1, 0], ![1, 1], ![0, 1]] +def UnitSquareCorners : Fin 4 → ℝ² := + ![!₂[0, 0], !₂[1, 0], !₂[1, 1], !₂[0, 1]] -/- +/-- Does there exist a point in the plane at rational distance from all four vertices of the unit square? -/ @[category research open, AMS 11 51] diff --git a/FormalConjectures/Wikipedia/SnakeInTheBox.lean b/FormalConjectures/Wikipedia/SnakeInTheBox.lean index bd2460548..7407f2ddd 100644 --- a/FormalConjectures/Wikipedia/SnakeInTheBox.lean +++ b/FormalConjectures/Wikipedia/SnakeInTheBox.lean @@ -41,7 +41,7 @@ A subgraph `G'` is a 'snake' of length `k` in graph `G` if it is an induced path -/ def IsSnakeInGraphOfLength {V : Type u} [DecidableEq V] (G : SimpleGraph V) (G' : Subgraph G) (k : ℕ) : Prop := - G'.IsInduced ∧ ∃ u v : V, ∃ (P : G.Walk u v), P.IsPath ∧ G'.verts = P.support.toFinset.toSet ∧ + G'.IsInduced ∧ ∃ u v : V, ∃ (P : G.Walk u v), P.IsPath ∧ G'.verts = {v | v ∈ P.support} ∧ P.length = k /-- diff --git a/FormalConjectures/Wikipedia/SumOfThreeCubes.lean b/FormalConjectures/Wikipedia/SumOfThreeCubes.lean index 7de9c700d..e91c53028 100644 --- a/FormalConjectures/Wikipedia/SumOfThreeCubes.lean +++ b/FormalConjectures/Wikipedia/SumOfThreeCubes.lean @@ -75,13 +75,13 @@ The below parametrization is brought from the MSE answer [MSE]. theorem isSumOfThreeCubesRat_any (r : ℚ) : IsSumOfThreeCubes r := by by_cases h : r = 0 · exact ⟨0, 0, 0, by norm_num; exact h⟩ - · push_neg at h - let x := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2) + · let x := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2) let y := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2 let z := (r ^ 2 + 6 * r + 3) * (- r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3)) use x, y, z - field_simp [x, y, z] - ring_nf + simp only [x, y, z] + field_simp + ring /-- An integer `n : ℤ` can be written as a sum of three cubes (of integers) if and only if diff --git a/FormalConjectures/Wikipedia/UnionClosed.lean b/FormalConjectures/Wikipedia/UnionClosed.lean index 705e17033..ab06f2eef 100644 --- a/FormalConjectures/Wikipedia/UnionClosed.lean +++ b/FormalConjectures/Wikipedia/UnionClosed.lean @@ -127,19 +127,19 @@ theorem union_closed.variants.singleton_mem use i set B : Finset (Finset n) := {x ∈ A | i ∉ x} set C : Finset (Finset n) := {x ∈ A | i ∈ x} - have h₁ : Set.InjOn (insert i) B.toSet := by + have h₁ : (B : Set <| Finset n).InjOn (insert i) := by simp only [Set.InjOn, coe_filter, Set.mem_setOf_eq, and_imp, B] rintro x - hx y - hy hxy have := congr(($hxy).erase i) rwa [erase_insert hx, erase_insert hy] at this - have h₂ : Set.MapsTo (insert i) B.toSet C.toSet := by + have h₂ : (B : Set <| Finset n).MapsTo (insert i) C := by simp only [Set.MapsTo, coe_filter, Set.mem_setOf_eq, mem_insert, true_or, and_true, and_imp, B, C] intro x hx hix rw [Finset.insert_eq] exact h_union_closed _ hi _ hx have h₃ : #B ≤ #C := Finset.card_le_card_of_injOn _ h₂ h₁ - have h₄ : #C + #B = #A := by rw [filter_card_add_filter_neg_card_eq_card] + have h₄ : #C + #B = #A := by rw [card_filter_add_card_filter_not] have : #A ≤ 2 * #C := by omega cancel_denoms norm_cast diff --git a/FormalConjectures/Wikipedia/conjecture_1_3_to_2_3.lean b/FormalConjectures/Wikipedia/conjecture_1_3_to_2_3.lean index e353383e5..9dca0fcec 100644 --- a/FormalConjectures/Wikipedia/conjecture_1_3_to_2_3.lean +++ b/FormalConjectures/Wikipedia/conjecture_1_3_to_2_3.lean @@ -34,7 +34,7 @@ bijections $P$ of $1, ..., n$. -/ @[category research open, AMS 6] theorem conjecture_1_3_to_2_3 : answer(sorry) ↔ ∀ (P : Type) [Finite P] [PartialOrder P] - (not_total : ¬ IsTotal P (· ≤ ·)) (total_ext : Set <| OrderHom P ℕ) + (not_total : ¬ Std.Total (α := P) (· ≤ ·)) (total_ext : Set <| OrderHom P ℕ) (total_ext_def : ∀ σ, σ ∈ total_ext ↔ Set.range σ = Set.Icc 1 (Nat.card P)), ∃ x y : P, ({σ ∈ total_ext | σ x < σ y}.ncard / total_ext.ncard : ℚ) ∈ Set.Icc (1/3) (2/3) := by diff --git a/FormalConjecturesForMathlib.lean b/FormalConjecturesForMathlib.lean index 68f92a135..5899ad4ce 100644 --- a/FormalConjecturesForMathlib.lean +++ b/FormalConjecturesForMathlib.lean @@ -25,6 +25,7 @@ import FormalConjecturesForMathlib.AlgebraicGeometry.ProjectiveSpace import FormalConjecturesForMathlib.AlgebraicGeometry.VectorBundle import FormalConjecturesForMathlib.Analysis.Asymptotics.Basic import FormalConjecturesForMathlib.Analysis.HasGaps +import FormalConjecturesForMathlib.Analysis.Real.Cardinality import FormalConjecturesForMathlib.Analysis.SpecialFunctions.Log.Basic import FormalConjecturesForMathlib.Analysis.SpecialFunctions.NthRoot import FormalConjecturesForMathlib.Combinatorics.AP.Basic @@ -43,8 +44,6 @@ import FormalConjecturesForMathlib.Computability.Encoding import FormalConjecturesForMathlib.Computability.TuringMachine.BusyBeavers import FormalConjecturesForMathlib.Computability.TuringMachine.Notation import FormalConjecturesForMathlib.Computability.TuringMachine.PostTuringMachine -import FormalConjecturesForMathlib.Data.Finset.Empty -import FormalConjecturesForMathlib.Data.Finset.OrdConnected import FormalConjecturesForMathlib.Data.Nat.Factorization.Basic import FormalConjecturesForMathlib.Data.Nat.Full import FormalConjecturesForMathlib.Data.Nat.Init @@ -54,7 +53,6 @@ import FormalConjecturesForMathlib.Data.Nat.Prime.Composite import FormalConjecturesForMathlib.Data.Nat.Prime.Defs import FormalConjecturesForMathlib.Data.Nat.Prime.Finset import FormalConjecturesForMathlib.Data.Nat.Squarefree -import FormalConjecturesForMathlib.Data.Real.Cardinality import FormalConjecturesForMathlib.Data.Real.Constants import FormalConjecturesForMathlib.Data.Set.Bdd import FormalConjecturesForMathlib.Data.Set.Density diff --git a/FormalConjecturesForMathlib/Algebra/GCDMonoid/Finset.lean b/FormalConjecturesForMathlib/Algebra/GCDMonoid/Finset.lean index 5a6bff495..0055ac664 100644 --- a/FormalConjecturesForMathlib/Algebra/GCDMonoid/Finset.lean +++ b/FormalConjecturesForMathlib/Algebra/GCDMonoid/Finset.lean @@ -20,7 +20,7 @@ import Mathlib.Order.Interval.Finset.Defs namespace Finset /-- The least common multiple of ${n+1, \dotsc, n+k}$. -/ -def lcmInterval {α : Type*} [AddMonoid α] [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α] +def lcmInterval {α : Type*} [AddMonoid α] [CommMonoidWithZero α] [NormalizedGCDMonoid α] [Preorder α] [LocallyFiniteOrder α] (n k : α) : α := (Finset.Ioc n (n + k)).lcm id end Finset diff --git a/FormalConjecturesForMathlib/Algebra/Polynomial/Algebra.lean b/FormalConjecturesForMathlib/Algebra/Polynomial/Algebra.lean index fb4baade3..7705851c5 100644 --- a/FormalConjecturesForMathlib/Algebra/Polynomial/Algebra.lean +++ b/FormalConjecturesForMathlib/Algebra/Polynomial/Algebra.lean @@ -26,8 +26,6 @@ variable {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S] namespace Polynomial -@[simp] theorem eval₂_id {p : Polynomial R} {x : R} : eval₂ (RingHom.id _) x p = p.eval x := rfl - instance instAlgebraPi : Algebra R[X] (S → S) := (Pi.ringHom fun x ↦ (Polynomial.aeval x).toRingHom).toAlgebra diff --git a/FormalConjecturesForMathlib/Algebra/Powerfree.lean b/FormalConjecturesForMathlib/Algebra/Powerfree.lean index 0253e4316..c99c7cdc2 100644 --- a/FormalConjecturesForMathlib/Algebra/Powerfree.lean +++ b/FormalConjecturesForMathlib/Algebra/Powerfree.lean @@ -73,5 +73,5 @@ theorem not_powerfree_zero [MonoidWithZero M₀] [Nontrivial M₀] (k : ℕ) : rw [Powerfree, not_forall] exact ⟨0, by simp⟩ -theorem Prime.powerfree [CancelCommMonoidWithZero M₀] {m : M₀} (h : Prime m) (hk : 2 ≤ k) : - Powerfree k m := h.irreducible.powerfree hk +theorem Prime.powerfree [CommMonoidWithZero M₀] [IsCancelMulZero M₀] {m : M₀} (h : Prime m) + (hk : 2 ≤ k) : Powerfree k m := h.irreducible.powerfree hk diff --git a/FormalConjecturesForMathlib/AlgebraicGeometry/ProjectiveSpace.lean b/FormalConjecturesForMathlib/AlgebraicGeometry/ProjectiveSpace.lean index cc3c683d0..8cf080234 100644 --- a/FormalConjecturesForMathlib/AlgebraicGeometry/ProjectiveSpace.lean +++ b/FormalConjecturesForMathlib/AlgebraicGeometry/ProjectiveSpace.lean @@ -17,7 +17,7 @@ import Mathlib.AlgebraicGeometry.Limits import Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Scheme import Mathlib.RingTheory.MvPolynomial.Homogeneous --- The contents of this file will be in mathlib as of #26061 which should be merged in 4.21 or 4.22. +-- The contents of this file will be in mathlib as of #26061 universe u v open CategoryTheory Limits MvPolynomial AlgebraicGeometry diff --git a/FormalConjecturesForMathlib/AlgebraicGeometry/VectorBundle.lean b/FormalConjecturesForMathlib/AlgebraicGeometry/VectorBundle.lean index e8c306afd..21664bb46 100644 --- a/FormalConjecturesForMathlib/AlgebraicGeometry/VectorBundle.lean +++ b/FormalConjecturesForMathlib/AlgebraicGeometry/VectorBundle.lean @@ -26,9 +26,9 @@ open CategoryTheory Limits variable {C : Type u} [Category.{v, u} C] variable {J : GrothendieckTopology C} variable {R : Sheaf J RingCat} (M : SheafOfModules R) -variable [∀ (X : C), (J.over X).HasSheafCompose (forget₂ RingCat AddCommGrp)] -variable [∀ (X : C), HasWeakSheafify (J.over X) AddCommGrp] -variable [∀ (X : C), (J.over X).WEqualsLocallyBijective AddCommGrp] +variable [∀ (X : C), (J.over X).HasSheafCompose (forget₂ RingCat AddCommGrpCat)] +variable [∀ (X : C), HasWeakSheafify (J.over X) AddCommGrpCat] +variable [∀ (X : C), (J.over X).WEqualsLocallyBijective AddCommGrpCat] /-- A vector bundle is a sheaf of modules that is locally isomorphic to a free sheaf. -/ diff --git a/FormalConjecturesForMathlib/Data/Real/Cardinality.lean b/FormalConjecturesForMathlib/Analysis/Real/Cardinality.lean similarity index 93% rename from FormalConjecturesForMathlib/Data/Real/Cardinality.lean rename to FormalConjecturesForMathlib/Analysis/Real/Cardinality.lean index fa23aa56e..e02043132 100644 --- a/FormalConjecturesForMathlib/Data/Real/Cardinality.lean +++ b/FormalConjecturesForMathlib/Analysis/Real/Cardinality.lean @@ -13,6 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ -import Mathlib.Data.Real.Cardinality +import Mathlib.Analysis.Real.Cardinality attribute [simp] Cardinal.mk_real diff --git a/FormalConjecturesForMathlib/Analysis/SpecialFunctions/Log/Basic.lean b/FormalConjecturesForMathlib/Analysis/SpecialFunctions/Log/Basic.lean index c43d8ca65..9ed40fbe8 100644 --- a/FormalConjecturesForMathlib/Analysis/SpecialFunctions/Log/Basic.lean +++ b/FormalConjecturesForMathlib/Analysis/SpecialFunctions/Log/Basic.lean @@ -14,8 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. -/ +import Mathlib.Analysis.Complex.ExponentialBounds import Mathlib.Analysis.SpecialFunctions.Log.Basic -import Mathlib.Data.Complex.ExponentialBounds import Mathlib.Tactic -- TODO(mercuris): define a recursive version of this for better usability? diff --git a/FormalConjecturesForMathlib/Combinatorics/AP/Basic.lean b/FormalConjecturesForMathlib/Combinatorics/AP/Basic.lean index 7cfc3539c..17fa15b76 100644 --- a/FormalConjecturesForMathlib/Combinatorics/AP/Basic.lean +++ b/FormalConjecturesForMathlib/Combinatorics/AP/Basic.lean @@ -58,14 +58,12 @@ theorem eq (h : s.IsAPOfLengthWith l a d) : s = {a + n • d | (n : ℕ) (_ : n /-- An arithmetic progression with first term `a` and difference `d` is of length zero if and only if `s` is empty. -/ @[simp] -theorem zero : s.IsAPOfLengthWith 0 a d ↔ s = ∅ := by - simpa [Set.IsAPOfLengthWith] using fun _ => by aesop +theorem zero : s.IsAPOfLengthWith 0 a d ↔ s = ∅ := by simp [IsAPOfLengthWith] /-- An arithmetic progression with first term `a` and difference `d` is of length one if and only if `s` is a singleton. -/ @[simp] -theorem one : s.IsAPOfLengthWith 1 a d ↔ s = {a} := by - simpa [Set.IsAPOfLengthWith] using fun _ => by aesop +theorem one : s.IsAPOfLengthWith 1 a d ↔ s = {a} := by simp +contextual [IsAPOfLengthWith] end Set.IsAPOfLengthWith @@ -215,7 +213,7 @@ Define the largest possible size of a subset of $\{1, \dots, N\}$ that does not any non-trivial $k$-term arithmetic progression. -/ noncomputable def Set.IsAPOfLengthFree.maxCard (k : ℕ) (N : ℕ) : ℕ := - sSup {Finset.card S | (S) (_ : S ⊆ Finset.Icc 1 N) (_ : S.toSet.IsAPOfLengthFree k)} + sSup {Finset.card S | (S) (_ : S ⊆ Finset.Icc 1 N) (_ : (S : Set ℕ).IsAPOfLengthFree k)} theorem Set.IsAPOfLengthFree.maxCard_zero (N : ℕ) : maxCard 0 N = N := by simp only [maxCard, Nat.cast_zero, isAPOfLengthFree_zero, exists_const, exists_prop] @@ -242,4 +240,4 @@ A function `f : α → β` has a monotone `k`-term arithmetic progression if the arithmetic progression `l` of length `k` in `α` such that its image under `f` is sorted. -/ def HasMonotoneAP {β : Type*} [Preorder β] (f : α → β) (k : ℕ) : Prop := - ∃ l : List α, l.IsAPOfLength k ∧ (l.map f).Sorted (· < ·) + ∃ l : List α, l.IsAPOfLength k ∧ (l.map f).Pairwise (· < ·) diff --git a/FormalConjecturesForMathlib/Combinatorics/Additive/Basis.lean b/FormalConjecturesForMathlib/Combinatorics/Additive/Basis.lean index 1aba262db..3b06a88ae 100644 --- a/FormalConjecturesForMathlib/Combinatorics/Additive/Basis.lean +++ b/FormalConjecturesForMathlib/Combinatorics/Additive/Basis.lean @@ -121,7 +121,8 @@ protected lemma IsAsymptoticMulBasisOfOrder.ne_zero [Infinite M] protected lemma IsAsymptoticMulBasisOfOrder.nonempty [Infinite M] (hA : A.IsAsymptoticMulBasisOfOrder n) : A.Nonempty := by by_contra! - simp [this, IsAsymptoticMulBasisOfOrder, hA.ne_zero, finite_univ_iff, Infinite.not_finite] at hA + simp [this, IsAsymptoticMulBasisOfOrder, hA.ne_zero, finite_univ_iff, + _root_.Infinite.not_finite] at hA /-- `A : Set M` is an asymptotic basis of order one iff it is cofinite. -/ @[to_additive (attr := simp) diff --git a/FormalConjecturesForMathlib/Combinatorics/Additive/Convolution.lean b/FormalConjecturesForMathlib/Combinatorics/Additive/Convolution.lean index a2f31d1e9..ff293f451 100644 --- a/FormalConjecturesForMathlib/Combinatorics/Additive/Convolution.lean +++ b/FormalConjecturesForMathlib/Combinatorics/Additive/Convolution.lean @@ -62,7 +62,7 @@ lemma sumRep_def (A : Set ℕ) (n : ℕ) : open PowerSeries theorem sumRep_eq_powerSeries_coeff (A : Set ℕ) (n : ℕ) : (sumRep A n : ℕ) = - ((PowerSeries.mk (𝟙_A)) * (PowerSeries.mk (𝟙_A)) : PowerSeries ℕ).coeff ℕ n := by + ((PowerSeries.mk (𝟙_A)) * (PowerSeries.mk (𝟙_A)) : PowerSeries ℕ).coeff n := by simp [sumRep, sumConv, indicatorOne, indicator, PowerSeries.coeff_mul, PowerSeries.coeff_mk] end AdditiveCombinatorics diff --git a/FormalConjecturesForMathlib/Combinatorics/Basic.lean b/FormalConjecturesForMathlib/Combinatorics/Basic.lean index 6a474c327..038bccaa9 100644 --- a/FormalConjecturesForMathlib/Combinatorics/Basic.lean +++ b/FormalConjecturesForMathlib/Combinatorics/Basic.lean @@ -35,13 +35,9 @@ def IsSyndetic (A : Set ℕ) : Prop := ∃ p, ∀ n, (A ∩ .Icc n (n + p)).None /-- A Sidon set is a set, such that such that all pairwise sums of elements are distinct apart from coincidences forced by the commutativity of addition. -/ -def IsSidon {S : Type*} [Membership α S] (A : S) : Prop := ∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), +def IsSidon (A : Set α) : Prop := ∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), i₁ + i₂ = j₁ + j₂ → (i₁ = j₁ ∧ i₂ = j₂) ∨ (i₁ = j₂ ∧ i₂ = j₁) -@[simp, push_cast] -theorem coe {S : Type*} [SetLike S α] {A : S} : IsSidon (A : Set α) ↔ IsSidon A := by - simp [IsSidon] - namespace Set lemma IsSidon.avoids_isAPOfLength_three {A : Set ℕ} (hA : IsSidon A) @@ -49,7 +45,7 @@ lemma IsSidon.avoids_isAPOfLength_three {A : Set ℕ} (hA : IsSidon A) (A ∩ Y).ncard ≤ 2 := by simp [IsAPOfLength, IsAPOfLengthWith] at hY obtain ⟨hc, ⟨a, d, hY⟩⟩ := hY - have hY_card : Y.ncard = 3 := by simp [ncard, encard, hc] + have hY_card : Y.ncard = 3 := by simp [ncard, hc] by_contra! h have hss : Y ⊆ A ∩ Y := by have hY_fin : Finite Y := finite_of_ncard_ne_zero (by linarith) @@ -128,26 +124,15 @@ end Set namespace Finset --- TODO: remove once https://github.com/leanprover-community/mathlib4/pull/28241 is merged -@[simp, push_cast] -theorem isSidon_toSet {A : Finset α} : IsSidon A.toSet ↔ IsSidon A := by - simp [IsSidon] - -instance (A : Finset α) [DecidableEq α] : Decidable (IsSidon A) := +instance (A : Finset α) [DecidableEq α] : Decidable (IsSidon (A : Set α)) := decidable_of_iff (∀ᵉ (i₁ ∈ A) (j₁ ∈ A) (i₂ ∈ A) (j₂ ∈ A), _) <| by rfl /-- The maximum size of a Sidon set in the supplied `Finset`. -/ def maxSidonSubsetCard (A : Finset α) [DecidableEq α] : ℕ := - (A.powerset.filter IsSidon).sup Finset.card - -theorem IsSidon.insert {A : Finset α} {m : α} [DecidableEq α] [IsRightCancelAdd α] - [IsLeftCancelAdd α] (hA : IsSidon A) : - IsSidon (A ∪ {m}) ↔ (m ∈ A ∨ ∀ᵉ (a ∈ A) (b ∈ A), m + m ≠ a + b ∧ ∀ c ∈ A, m + a ≠ b + c) := by - rw [← isSidon_toSet, coe_union, coe_singleton, (isSidon_toSet.2 hA).insert] - simp + (A.powerset.filter fun B : Finset α ↦ IsSidon (B : Set α)).sup Finset.card /-- If `A` is finite Sidon, then `A ∪ {s}` is also Sidon provided `s ≥ A.max + 1`. -/ -theorem IsSidon.insert_ge_max' {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon A) {s : ℕ} +theorem IsSidon.insert_ge_max' {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) {s : ℕ} (hs : 2 * A.max' h + 1 ≤ s) : IsSidon (A ∪ {s}) := by have h₁ {a b c : ℕ} (ha : a ∈ A) (hb : b ∈ A) (hc : c ∈ A) : @@ -155,16 +140,16 @@ theorem IsSidon.insert_ge_max' {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon A have : s ∉ A := by exact mt (A.le_max' _) <| not_le.2 <| Finset.max'_lt_iff _ ‹_› |>.2 fun a ha ↦ by linarith [A.le_max' _ ha] - exact (Finset.IsSidon.insert hA).2 <| by simpa [this] using fun a ha b hb ↦ + exact (IsSidon.insert hA).2 <| by simpa [this] using fun a ha b hb ↦ ⟨by linarith [A.le_max' _ ha, A.le_max' _ hb], fun c hc ↦ by linarith [h₁ hc hb ha]⟩ -theorem IsSidon.exists_insert {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon A) : +theorem IsSidon.exists_insert {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) : ∃ m ∉ A, IsSidon (A ∪ {m}) := by refine ⟨2 * A.max' h + 1, ?_, insert_ge_max' h hA le_rfl⟩ exact mt (A.le_max' _) <| not_le.2 <| Finset.max'_lt_iff _ ‹_› |>.2 fun a ha ↦ by linarith [A.le_max' _ ha] -theorem IsSidon.exists_insert_ge {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon A) (s : ℕ) : +theorem IsSidon.exists_insert_ge {A : Finset ℕ} (h : A.Nonempty) (hA : IsSidon (A : Set ℕ)) (s : ℕ) : ∃ m ≥ s, m ∉ A ∧ IsSidon (A ∪ {m}) := by refine ⟨if s ≥ 2 * A.max' h + 1 then s else 2 * A.max' h + 1, ?_, ?_, ?_⟩ · split_ifs <;> linarith diff --git a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Coloring.lean b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Coloring.lean index 2d7f4da22..7e8404bb8 100644 --- a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Coloring.lean +++ b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/Coloring.lean @@ -40,7 +40,7 @@ lemma le_chromaticNumber_of_pairwise_adj (hn : n ≤ Nat.card ι) (f : ι → V) (hf : Pairwise fun i j ↦ G.Adj (f i) (f j)) : n ≤ G.chromaticNumber := le_chromaticNumber_iff_colorable.2 fun _m hm ↦ hn.trans <| hm.card_le_of_pairwise_adj f hf -instance (f : ι → V) : IsSymm ι fun i j ↦ G.Adj (f i) (f j) where symm _ _ := .symm +instance (f : ι → V) : Std.Symm fun i j ↦ G.Adj (f i) (f j) where symm _ _ := .symm variable (G) in /-- A set of edges is critical if deleting them reduces the chromatic number. -/ diff --git a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/DiamExtra.lean b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/DiamExtra.lean index 7da4df7f8..3fe022763 100644 --- a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/DiamExtra.lean +++ b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/DiamExtra.lean @@ -53,10 +53,8 @@ proof_wanted diam_ne_zero [Nontrivial α] : G.diam ≠ 0 lemma nontrivial_of_diam_ne_zero' (h : G.diam ≠ 0) : Nontrivial α := by contrapose! h - rw [not_nontrivial_iff_subsingleton] at h exact diam_eq_zero_of_subsingleton - section Path open Path diff --git a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Definitions.lean b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Definitions.lean index d8a600763..4229ed640 100644 --- a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Definitions.lean +++ b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Definitions.lean @@ -91,13 +91,8 @@ noncomputable def averageIndepNeighbors (G : SimpleGraph α) : ℝ := A graph where the vertices V are a collection of points in ℝ² and there is an edge between two points if and only if the distance between them is 1. -/ def UnitDistancePlaneGraph (V : Set (EuclideanSpace ℝ (Fin 2))) : SimpleGraph V where - Adj := fun x y => dist x y = 1 - symm := by - intros x y - simp [dist_comm] - loopless := by - intros x - simp [dist_self] + Adj x y := Dist.dist x y = 1 + symm x y := by simp [PseudoMetricSpace.dist_comm] /-- Two walks are internally disjoint if they share no vertices other than their endpoints. diff --git a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Domination.lean b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Domination.lean index 3ac1cd58a..9b324eefe 100644 --- a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Domination.lean +++ b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Domination.lean @@ -17,7 +17,7 @@ limitations under the License. import Mathlib.Combinatorics.SimpleGraph.Clique import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected -/- +/-! Dominating sets and domination numbers This file introduces dominating sets and related invariants. @@ -103,14 +103,6 @@ noncomputable def indepDominationNumber (G : SimpleGraph α) : ℕ := /-! ### Vertex and edge covers -/ -/-- A set of vertices is a vertex cover if every edge has an endpoint in it. -/ -def IsVertexCover (G : SimpleGraph α) (C : Set α) : Prop := - ∀ ⦃u v⦄, G.Adj u v → u ∈ C ∨ v ∈ C - -/-- The vertex cover number of `G`. -/ -noncomputable def vertexCoverNumber (G : SimpleGraph α) : ℕ := - sInf {n | ∃ C : Finset α, G.IsVertexCover (C : Set α) ∧ C.card = n} - /-- A set of edges is an edge cover if every vertex is incident to some edge in it. -/ def IsEdgeCover (G : SimpleGraph α) (M : Set (Sym2 α)) : Prop := M ⊆ G.edgeSet ∧ ∀ v, ∃ e ∈ M, v ∈ e diff --git a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Invariants.lean b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Invariants.lean index 84e8850d9..6eee1b2f4 100644 --- a/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Invariants.lean +++ b/FormalConjecturesForMathlib/Combinatorics/SimpleGraph/GraphConjectures/Invariants.lean @@ -15,12 +15,10 @@ limitations under the License. -/ import FormalConjecturesForMathlib.Combinatorics.SimpleGraph.GraphConjectures.Definitions import FormalConjecturesForMathlib.Combinatorics.SimpleGraph.GraphConjectures.Domination +import Mathlib.Analysis.Matrix.Spectrum import Mathlib.Combinatorics.SimpleGraph.AdjMatrix import Mathlib.Combinatorics.SimpleGraph.Metric import Mathlib.Data.Multiset.Interval -import Mathlib.LinearAlgebra.Matrix.Spectrum -import Mathlib.Order.CompletePartialOrder - noncomputable def Matrix.IsHermitian.maxEigenvalue {𝕜 : Type*} [Field 𝕜] [RCLike 𝕜] {n : Type*} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.IsHermitian) : ℝ := @@ -73,7 +71,7 @@ noncomputable def S (G : SimpleGraph α) : ℝ := let card := Fintype.card α if card < 2 then 0 else let degrees := Multiset.ofList (List.map (fun v => G.degree v) Finset.univ.toList) - let sorted_degrees := Multiset.sort (·≤·) degrees + let sorted_degrees := degrees.sort (· ≤ ·) ↑((sorted_degrees[card - 2]?).getD 0) /-- Local eccentricity of a vertex. -/ diff --git a/FormalConjecturesForMathlib/Computability/Encoding.lean b/FormalConjecturesForMathlib/Computability/Encoding.lean index df7a40398..6e5421fc5 100644 --- a/FormalConjecturesForMathlib/Computability/Encoding.lean +++ b/FormalConjecturesForMathlib/Computability/Encoding.lean @@ -55,11 +55,6 @@ lemma splitOnP_append_cons {α : Type} (l1 l2 : List α) obtain ⟨hd1, tl1, h1'⟩ := List.exists_cons_of_ne_nil (List.splitOnP_ne_nil P tl) by_cases hPh : P hd <;> simp [*] -@[simp] -lemma Option.getD_comp_some : (fun x ↦ x.getD false) ∘ some = id := by - ext - simp - def finEncodingListBoolProdListBool : Computability.FinEncoding (List Bool × List Bool) where Γ := Option Bool encode := fun ⟨l1, l2⟩ ↦ (l1.map some) ++ [none] ++ (l2.map some) diff --git a/FormalConjecturesForMathlib/Computability/TuringMachine/BusyBeavers.lean b/FormalConjecturesForMathlib/Computability/TuringMachine/BusyBeavers.lean index 385460200..d70dbf79a 100644 --- a/FormalConjecturesForMathlib/Computability/TuringMachine/BusyBeavers.lean +++ b/FormalConjecturesForMathlib/Computability/TuringMachine/BusyBeavers.lean @@ -210,19 +210,18 @@ lemma not_isHalting_of_forall_isSome (H : ∀ l s, ∃ a b, M l s = some (some a obtain ⟨e, f, hef⟩ := H c (Tape.move d.dir (Tape.write d.symbol b)).head simp [multiStep_succ, multiStep_succ, hab, step, hcd, hef] -noncomputable def haltingNumber : PartENat := +noncomputable def haltingNumber : ENat := -- The smallest `n` such that `M` halts after `n` steps when starting from an empty tape. -- If no such `n` exists then this is equal to `⊤`. - sInf {(n : PartENat) | (n : ℕ) (_ : HaltsAfter M (init []) n) } + sInf {(n : ENat) | (n : ℕ) (_ : HaltsAfter M (init []) n) } theorem haltingNumber_def (n : ℕ) (hn : ∃ a, M.multiStep (init []) n = some a) (ha' : M.multiStep (init []) (n + 1) = none) : M.haltingNumber = n := by refine IsGLB.sInf_eq (IsLeast.isGLB ⟨⟨n, by rwa [HaltsAfter], rfl⟩, fun m ⟨k, _, _⟩ ↦ ?_⟩) - induction m using PartENat.casesOn + cases m · exact le_top - · refine ⟨fun h ↦ h, fun _ ↦ ?_⟩ - by_contra! hc + · by_contra! hc simp_all [multiStep_eq_none_mono ‹_› (show k + 1 ≤ n by aesop)] end Machine diff --git a/FormalConjecturesForMathlib/Computability/TuringMachine/Notation.lean b/FormalConjecturesForMathlib/Computability/TuringMachine/Notation.lean index 4dc04837a..59687c9d0 100644 --- a/FormalConjecturesForMathlib/Computability/TuringMachine/Notation.lean +++ b/FormalConjecturesForMathlib/Computability/TuringMachine/Notation.lean @@ -94,7 +94,7 @@ private def Nat.toStateSyntax (n : Nat) (stateName : Name) : TermElabM Term := d /-- `String.toStmtSyntax s stateName` parses a component of a Turing machine string representation and outputs the syntax of the corresponding `(state, statement) : State × Stmt` pair. -/ private def String.toStmtSyntax (s : String) (stateName : Name) (numStates : Nat) : TermElabM Term := do - let [c_symbol, c_dir, c_state] := s.data | + let [c_symbol, c_dir, c_state] := s.toList | throwError m!"Invalid transition encoding: {s} should be 3 characters long." if c_symbol = '-' ∧ c_dir = '-' ∧ c_state = '-' then `(none) @@ -107,9 +107,9 @@ private def String.toStmtSyntax (s : String) (stateName : Name) (numStates : Nat end Util -private def String.nextn (s : String) (p : Pos) : Nat → Pos +private def String.nextn (s : String) (p : Pos.Raw) : Nat → Pos.Raw | 0 => p - | n + 1 => s.next (s.nextn p n) + | n + 1 => Pos.Raw.next s (s.nextn p n) /-- Take as input a list of strings and return an array of `matchAltExpr` syntaxes @@ -130,7 +130,7 @@ def mkMachineMatchAltExpr (L : List String) (stateName : Name) (numSymbols numSt Array.range numSymbols |>.mapM fun symbolIdx ↦ do let pos1 := s.nextn ⟨0⟩ (3 * symbolIdx) let pos2 := s.nextn ⟨0⟩ (3 * (symbolIdx + 1)) - let s_first : Term ← (s.extract pos1 pos2).toStmtSyntax stateName numStates + let s_first : Term ← (String.Pos.Raw.extract s pos1 pos2).toStmtSyntax stateName numStates `(matchAltExpr| | $(← i.toStateSyntax stateName), ($(quote symbolIdx)) => $s_first) return moves.flatten diff --git a/FormalConjecturesForMathlib/Computability/TuringMachine/PostTuringMachine.lean b/FormalConjecturesForMathlib/Computability/TuringMachine/PostTuringMachine.lean index 3ef381fca..b1511fae7 100644 --- a/FormalConjecturesForMathlib/Computability/TuringMachine/PostTuringMachine.lean +++ b/FormalConjecturesForMathlib/Computability/TuringMachine/PostTuringMachine.lean @@ -17,15 +17,6 @@ limitations under the License. import Mathlib.Computability.PostTuringMachine import Mathlib.Logic.Relation -theorem Part.eq_of_get_eq_get {σ : Type*} {a b : Part σ} (ha : a.Dom) (hb : b.Dom) - (hab : a.get ha = b.get hb) : a = b := by - ext - rw [← Part.eq_get_iff_mem ha, ← Part.eq_get_iff_mem hb, hab] - -theorem Part.eq_iff_of_dom {σ : Type*} {a b : Part σ} (ha : a.Dom) (hb : b.Dom) : - a.get ha = b.get hb ↔ a = b := - ⟨fun H ↦ Part.eq_of_get_eq_get ha hb H, fun H ↦ Part.get_eq_get_of_eq a ha H⟩ - theorem Part.get_eq_get {σ : Type*} {a b : Part σ} (ha : a.Dom) (hb : a.get ha ∈ b) : a = b := by have hb' : b.Dom := Part.dom_iff_mem.mpr ⟨a.get ha, hb⟩ rwa [← Part.eq_get_iff_mem hb', Part.eq_iff_of_dom ha hb'] at hb diff --git a/FormalConjecturesForMathlib/Data/Finset/Empty.lean b/FormalConjecturesForMathlib/Data/Finset/Empty.lean deleted file mode 100644 index 258b6e5b9..000000000 --- a/FormalConjecturesForMathlib/Data/Finset/Empty.lean +++ /dev/null @@ -1,25 +0,0 @@ -/- -Copyright 2025 The Formal Conjectures Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. --/ - -import Mathlib.Data.Finset.Empty - -@[simp] -theorem Finset.univ_finset_of_isEmpty {α : Type*} [h : IsEmpty α] : - (Set.univ : Set (Finset α)) = {∅} := by - ext S - rw [Set.mem_singleton_iff, eq_true (Set.mem_univ S), true_iff] - ext a - exact IsEmpty.elim h a diff --git a/FormalConjecturesForMathlib/Data/Finset/OrdConnected.lean b/FormalConjecturesForMathlib/Data/Finset/OrdConnected.lean deleted file mode 100644 index 6db342783..000000000 --- a/FormalConjecturesForMathlib/Data/Finset/OrdConnected.lean +++ /dev/null @@ -1,20 +0,0 @@ -/- -Copyright 2025 The Formal Conjectures Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. --/ - -import Mathlib.Data.Finset.Defs -import Mathlib.Order.Interval.Set.Defs - -abbrev Finset.OrdConnected {α} [Preorder α] (s : Finset α) := s.toSet.OrdConnected diff --git a/FormalConjecturesForMathlib/Data/Nat/Squarefree.lean b/FormalConjecturesForMathlib/Data/Nat/Squarefree.lean index aa500bdeb..b9bbd03d6 100644 --- a/FormalConjecturesForMathlib/Data/Nat/Squarefree.lean +++ b/FormalConjecturesForMathlib/Data/Nat/Squarefree.lean @@ -81,7 +81,7 @@ theorem squarefree_squarefreePart (n : ℕ) : Squarefree n.squarefreePart := by refine Nat.squarefree_iff_factorization_le_one n.squarefreePart_ne_zero |>.2 fun p ↦ ?_ by_cases hp : p.Prime · linarith [n.squarefreePart_factorization hp, Nat.mod_lt (n.factorization p) two_pos] - · linarith [factorization_eq_zero_of_non_prime n.squarefreePart hp] + · linarith [factorization_eq_zero_of_not_prime n.squarefreePart hp] theorem squarefreePart_dvd (n : ℕ) : squarefreePart n ∣ n := by rcases eq_or_ne n 0 with (rfl | h₀); simp diff --git a/FormalConjecturesForMathlib/Data/Set/Density.lean b/FormalConjecturesForMathlib/Data/Set/Density.lean index d81053c1c..36233af39 100644 --- a/FormalConjecturesForMathlib/Data/Set/Density.lean +++ b/FormalConjecturesForMathlib/Data/Set/Density.lean @@ -64,7 +64,7 @@ noncomputable def lowerDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot theorem lowerDensity_le_one {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : S.lowerDensity A ≤ 1 := by by_cases h : atTop (α := β) = ⊥ - · field_simp [h, Set.lowerDensity, Filter.liminf_eq] + · simp [h, Set.lowerDensity, Filter.liminf_eq] · have : (atTop (α := β)).NeBot := ⟨h⟩ apply Real.sSup_le (fun x hx ↦ ?_) one_pos.le simpa using hx.mono fun y hy ↦ hy.trans (Set.partialDensity_le_one _ _ y) @@ -106,7 +106,7 @@ elements has density one. -/ theorem univ {β : Type*} [PartialOrder β] [LocallyFiniteOrder β] [OrderBot β] [Nontrivial β] : (@Set.univ β).HasDensity 1 := by by_cases h : atTop (α := β) = ⊥ - · field_simp [h, HasDensity] + · simp [h, HasDensity] · simp [HasDensity, partialDensity] let ⟨b, hb⟩ := Set.Iio_eventually_ncard_ne_zero β refine tendsto_const_nhds.congr' ?_ @@ -158,7 +158,7 @@ theorem hasDensity_even : {n : ℕ | Even n}.HasDensity (1 / 2) := by refine Tendsto.congr' (eventually_atTop.2 ⟨1, fun n hn => (h hn).symm⟩) (Tendsto.if' tendsto_const_nhds ?_) replace h : Tendsto (fun (k : ℕ) => 1 + 1 / (k : ℝ)) atTop (𝓝 1) := by - simpa using Tendsto.const_add _ tendsto_one_div_atTop_nhds_zero_nat + simpa using Tendsto.const_add (M := ℝ) _ tendsto_one_div_atTop_nhds_zero_nat simpa using Tendsto.mul_const _ <| Tendsto.congr' (eventually_atTop.2 ⟨1, fun k hk => by field_simp⟩) h @@ -170,13 +170,13 @@ theorem hasDensity_zero_of_finite {S : Set ℕ} (h : S.Finite) : S.HasDensity 0 exact div_le_div₀ (by simp) (by simpa using Set.ncard_inter_le_ncard_left _ _ h) (by simpa using n.pos_of_ne_zero h₀) le_rfl exact tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds - (tendsto_const_div_atTop_nhds_zero_nat S.ncard) + (tendsto_const_div_atTop_nhds_zero_nat _) (fun _ => div_nonneg (cast_nonneg _) (cast_nonneg _)) this /-- A set of positive natural density is infinite. -/ -theorem infinite_of_hasDensity_pos {S : Set ℕ} {α : ℝ} (h : S.HasDensity α) (hα : 0 < α) : +theorem infinite_of_hasDensity_pos {S : Set ℕ} {α : ℝ} (h : S.HasDensity α) (hα : α ≠ 0) : S.Infinite := - mt hasDensity_zero_of_finite fun h' => (_root_.ne_of_lt hα).symm (tendsto_nhds_unique h h') + mt hasDensity_zero_of_finite fun h' => hα (tendsto_nhds_unique h h') end Nat diff --git a/FormalConjecturesForMathlib/Data/Set/Triplewise.lean b/FormalConjecturesForMathlib/Data/Set/Triplewise.lean index 18d638c0f..bf363bd86 100644 --- a/FormalConjecturesForMathlib/Data/Set/Triplewise.lean +++ b/FormalConjecturesForMathlib/Data/Set/Triplewise.lean @@ -54,7 +54,8 @@ theorem triplewise_of_encard_lt (r : α → α → α → Prop) contrapose! h obtain ⟨x, hx, y, hy, z, hz, hxy, hyz, hxz, _⟩ := h trans encard {x, y, z} - · norm_num [encard_insert_of_notMem, *] + · simp [Set.encard_insert_of_notMem, *] + norm_num · exact encard_le_encard_of_injOn (by simp [MapsTo, hx, hy, hz]) (injOn_id _) @[simp] @@ -73,6 +74,7 @@ theorem triplewise_pair (r : α → α → α → Prop) : Set.Triplewise {x, y} r := by apply triplewise_of_encard_lt apply (encard_insert_le {y} x).trans_lt + simp norm_num theorem triplewise_insert : diff --git a/FormalConjecturesForMathlib/Geometry/2d.lean b/FormalConjecturesForMathlib/Geometry/2d.lean index 9e5d6f6ba..d285a32a2 100644 --- a/FormalConjecturesForMathlib/Geometry/2d.lean +++ b/FormalConjecturesForMathlib/Geometry/2d.lean @@ -31,7 +31,7 @@ open scoped EuclideanGeometry Note: this can't blindly be added to mathlib as it creates an "instance diamond" with an instance for modules satisfying `is_empty`. -/ noncomputable instance Module.orientedEuclideanSpaceFinTwo : Module.Oriented ℝ ℝ² (Fin 2) := - ⟨Basis.orientation <| Pi.basisFun _ _⟩ + ⟨Basis.orientation <| PiLp.basisFun 2 _ _⟩ /-- Two dimensional euclidean space is two-dimensional. -/ instance fact_finrank_euclideanSpace_fin_two : Fact (Module.finrank ℝ ℝ² = 2) := @@ -159,10 +159,12 @@ theorem isConvexPolygon_three_iff_affineIndependent {A B C : P} : let p := ![A, B, C] change IsConvexPolygon p at h change Real.Angle.sign (∡ (p 0) (p 1) (p 2)) ≠ 0 - cases' h with h h - · rw [h.sign_oangle (by simp) (by simp)] + cases h with + | inl h => + rw [h.sign_oangle (by simp) (by simp)] rintro ⟨⟩ - · suffices Real.Angle.sign (∡ (p 0) (p 2) (p 1)) = 1 by rw [← oangle_swap₂₃_sign, this]; rintro ⟨⟩ + | inr h => + suffices Real.Angle.sign (∡ (p 0) (p 2) (p 1)) = 1 by rw [← oangle_swap₂₃_sign, this]; rintro ⟨⟩ exact h.sign_oangle (i := 0) (j := 1) (k := 2) (by simp) (by simp) theorem isConvexPolygon_triangle (t : Affine.Triangle ℝ P) : IsConvexPolygon t.points := by diff --git a/FormalConjecturesForMathlib/Geometry/3d.lean b/FormalConjecturesForMathlib/Geometry/3d.lean index 062ae5b88..2c3ed846b 100644 --- a/FormalConjecturesForMathlib/Geometry/3d.lean +++ b/FormalConjecturesForMathlib/Geometry/3d.lean @@ -27,7 +27,7 @@ Note: when upstreaming this to Mathlib (and generalizing to `Fin n`) one must be careful to avoid an instance diamond with `IsEmpty.Orientation`. Presumably this can be avoided by assuming `[NeZero n]`. -/ noncomputable instance Module.orientedEuclideanSpaceFinThree : Module.Oriented ℝ ℝ³ (Fin 3) := - ⟨Basis.orientation <| Pi.basisFun _ _⟩ + ⟨Basis.orientation <| PiLp.basisFun ..⟩ /-- Three dimensional euclidean space is three-dimensional. -/ instance fact_finrank_euclideanSpace_fin_three : Fact (Module.finrank ℝ ℝ³ = 3) := diff --git a/FormalConjecturesForMathlib/Logic/Equiv/Fin/Rotate.lean b/FormalConjecturesForMathlib/Logic/Equiv/Fin/Rotate.lean index 87e6324cc..cd0a147eb 100644 --- a/FormalConjecturesForMathlib/Logic/Equiv/Fin/Rotate.lean +++ b/FormalConjecturesForMathlib/Logic/Equiv/Fin/Rotate.lean @@ -20,4 +20,4 @@ variable {n : ℕ} theorem lt_finRotate_of_ne_last {i : Fin (n + 1)} (hi : i ≠ Fin.last n) : i < finRotate _ i := by - rw [Fin.lt_iff_val_lt_val, coe_finRotate_of_ne_last hi, Nat.lt_add_one_iff] + rw [Fin.lt_def, coe_finRotate_of_ne_last hi, Nat.lt_add_one_iff] diff --git a/FormalConjecturesForMathlib/NumberTheory/AdditivelyComplete.lean b/FormalConjecturesForMathlib/NumberTheory/AdditivelyComplete.lean index 186cac3e4..1aa8be403 100644 --- a/FormalConjecturesForMathlib/NumberTheory/AdditivelyComplete.lean +++ b/FormalConjecturesForMathlib/NumberTheory/AdditivelyComplete.lean @@ -24,7 +24,7 @@ open scoped List /-- The set of subset sums of a set `A ⊆ M`. -/ def subsetSums (A : Set M) : Set M := - {n | ∃ B : Finset M, B.toSet ⊆ A ∧ n = ∑ i ∈ B, i} + {n | ∃ B : Finset M, ↑B ⊆ A ∧ n = ∑ i ∈ B, i} /-- If `A ⊆ B`, then `subsetSums A ⊆ subsetSums B`. -/ @[gcongr] diff --git a/FormalConjecturesForMathlib/NumberTheory/CoveringSystem.lean b/FormalConjecturesForMathlib/NumberTheory/CoveringSystem.lean index f93a0a6ef..2b7f8d511 100644 --- a/FormalConjecturesForMathlib/NumberTheory/CoveringSystem.lean +++ b/FormalConjecturesForMathlib/NumberTheory/CoveringSystem.lean @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ - +import Mathlib.Algebra.Group.Pointwise.Set.Basic import Mathlib.Algebra.Module.Submodule.Lattice import Mathlib.RingTheory.Ideal.Defs @@ -29,7 +29,7 @@ structure CoveringSystem (R : Type*) [CommSemiring R] where [fintypeIndex : Fintype ι] residue : ι → R moduli : ι → Ideal R - unionCovers : ⋃ i, {residue i} + (moduli i : Set R) = @Set.univ R + unionCovers : ⋃ i, ({residue i} : Set R) + (moduli i : Set R) = @Set.univ R non_trivial : ∀ i, moduli i ≠ ⊥ /-- diff --git a/FormalConjecturesForMathlib/SetTheory/Cardinal/SimpleGraph.lean b/FormalConjecturesForMathlib/SetTheory/Cardinal/SimpleGraph.lean index f80212aa1..32a17ddab 100644 --- a/FormalConjecturesForMathlib/SetTheory/Cardinal/SimpleGraph.lean +++ b/FormalConjecturesForMathlib/SetTheory/Cardinal/SimpleGraph.lean @@ -31,7 +31,7 @@ one of the following must hold: -/ def OrdinalCardinalRamsey (α β : Ordinal.{u}) (c : Cardinal.{u}) : Prop := -- For any 2-coloring of `α`, - ∀ red blue : SimpleGraph α.toType, IsCompl red blue → + ∀ red blue : SimpleGraph α.ToType, IsCompl red blue → -- either there is a red `K_β` (∃ s, red.IsClique s ∧ typeLT s = β) ∨ -- or there is a blue `K_c`. diff --git a/docbuild/lakefile.toml b/docbuild/lakefile.toml index 5a31a1946..614627cb2 100644 --- a/docbuild/lakefile.toml +++ b/docbuild/lakefile.toml @@ -10,7 +10,7 @@ path = "../" [[require]] scope = "leanprover" name = "doc-gen4" -rev = "v4.22.0" +rev = "v4.27.0" [[lean_exe]] name = "overwrite_index" diff --git a/lake-manifest.json b/lake-manifest.json index eb4351f9b..13a1771e2 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -5,27 +5,27 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "79e94a093aff4a60fb1b1f92d9681e407124c2ca", + "rev": "a3a10db0e9d66acbebf76c5e6a135066525ac900", "name": "mathlib", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "v4.27.0", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/plausible", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "b100ad4c5d74a464f497aaa8e7c74d86bf39a56f", + "rev": "009dc1e6f2feb2c96c081537d80a0905b2c6498f", "name": "plausible", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "main", "inherited": true, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/LeanSearchClient", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "99657ad92e23804e279f77ea6dbdeebaa1317b98", + "rev": "5ce7f0a355f522a952a3d678d696bd563bb4fd28", "name": "LeanSearchClient", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -35,60 +35,60 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "eb164a46de87078f27640ee71e6c3841defc2484", + "rev": "8f497d55985a189cea8020d9dc51260af1e41ad2", "name": "importGraph", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "main", "inherited": true, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/ProofWidgets4", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "1253a071e6939b0faf5c09d2b30b0bfc79dae407", + "rev": "c04225ee7c0585effbd933662b3151f01b600e40", "name": "proofwidgets", "manifestFile": "lake-manifest.json", - "inputRev": "v0.0.68", + "inputRev": "v0.0.85", "inherited": true, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/aesop", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "1256a18522728c2eeed6109b02dd2b8f207a2a3c", + "rev": "cb837cc26236ada03c81837bebe0acd9c70ced7d", "name": "aesop", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "master", "inherited": true, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/quote4", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "917bfa5064b812b7fbd7112d018ea0b4def25ab3", + "rev": "bd58c9efe2086d56ca361807014141a860ddbf8c", "name": "Qq", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "master", "inherited": true, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/batteries", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "240676e9568c254a69be94801889d4b13f3b249f", + "rev": "b25b36a7caf8e237e7d1e6121543078a06777c8a", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "v4.22.0", + "inputRev": "main", "inherited": true, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", "type": "git", "subDir": null, "scope": "leanprover", - "rev": "c682c91d2d4dd59a7187e2ab977ac25bd1f87329", + "rev": "55c37290ff6186e2e965d68cf853a57c0702db82", "name": "Cli", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "v4.27.0", "inherited": true, "configFile": "lakefile.toml"}], "name": "formal_conjectures", diff --git a/lakefile.toml b/lakefile.toml index 17bd2f383..12847900f 100644 --- a/lakefile.toml +++ b/lakefile.toml @@ -23,7 +23,7 @@ relaxedAutoImplicit = false [[require]] name = "mathlib" scope = "leanprover-community" -rev = "v4.22.0" +rev = "v4.27.0" # We make this a separate library so that we can apply different lean options. [[lean_lib]] @@ -34,4 +34,3 @@ name = "FormalConjectures" globs = ["FormalConjectures.+"] # Switch off warnings generated by `sorry` leanOptions = { warn.sorry = false } - diff --git a/lean-toolchain b/lean-toolchain index 6ac6d4c4c..2bb276aae 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.22.0 +leanprover/lean4:v4.27.0 \ No newline at end of file