chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
91
leanexplore_declaration
leanexplore:386287
leanexplore_sqlite
leanexplore_declarations
theorem squarefreePart_ne_zero (n : ℕ) : n.squarefreePart ≠ 0 := by simp [squarefreePart]
414
leanexplore_declaration
leanexplore:386288
leanexplore_sqlite
leanexplore_declarations
/-- `n.squarefreePart` is the unique `a₀ : ℕ` such that `a₀` is squarefree and `n = a₀ * b ^ 2`, for some `b : ℕ`. At `0` this property is not well defined because `b` must be `0` and `a₀` can be any squarefree number; we give the junk value `1` at `n = 0` following the convention that the squarefree part of any square...
160
leanexplore_declaration
leanexplore:386289
leanexplore_sqlite
leanexplore_declarations
/-- **Catalan's constant** $$G = \sum_{n=0}^∞ (-1)^n / (2n + 1)^2 \approx 0.91596$$ -/ noncomputable def catalanConstant : ℝ := ∑' n : ℕ, (-1)^n / (2*n + 1)^2
171
leanexplore_declaration
leanexplore:386290
leanexplore_sqlite
leanexplore_declarations
/-- **Gompertz constant** $$\delta = -e * \int_1^∞ e^{-t}/t dt \approx 0.59634$$ -/ noncomputable def gompertzConstant : ℝ := -exp 1 * ∫ (t:ℝ) in Set.Ioi 1, exp (-t) / t
126
leanexplore_declaration
leanexplore:386291
leanexplore_sqlite
leanexplore_declarations
/-- The distance from a real number to the nearest integer. -/ noncomputable def distToNearestInt (x : ℝ) : ℝ := |x - round x|
483
leanexplore_declaration
leanexplore:386292
leanexplore_sqlite
leanexplore_declarations
/-- A set `A` of natural numbers has logarithmic density `d` if the sequence $(1 / \log n) \cdot \sum_{k \in A, k \le n} (1/k)$ converges to `d`. Logarithmic density is a weaker notion than natural density: if a set has natural density `d`, then it also has logarithmic density `d` (see `Set.HasDensity.hasLogDensity`), ...
233
leanexplore_declaration
leanexplore:386293
leanexplore_sqlite
leanexplore_declarations
/-- A set of positive natural density is infinite. -/ theorem infinite_of_hasDensity_pos {S : Set ℕ} {α : ℝ} (h : S.HasDensity α) (hα : α ≠ 0) : S.Infinite := mt hasDensity_zero_of_finite fun h' => hα (tendsto_nhds_unique h h')
582
leanexplore_declaration
leanexplore:386294
leanexplore_sqlite
leanexplore_declarations
/-- A finite set has natural density zero. -/ theorem hasDensity_zero_of_finite {S : Set ℕ} (h : S.Finite) : S.HasDensity 0 := by simp [HasDensity, partialDensity] have (n : ℕ) : ((S ∩ Set.Iio n).ncard : ℝ) / n ≤ S.ncard / n := by by_cases h₀ : n = 0; simp [h₀] exact div_le_div₀ (by simp) (by simpa using Se...
1,219
leanexplore_declaration
leanexplore:386295
leanexplore_sqlite
leanexplore_declarations
/-- The natural density of the set of even numbers is `1 / 2`. -/ theorem hasDensity_even : {n : ℕ | Even n}.HasDensity (1 / 2) := by simp [HasDensity, partialDensity] have h {n : ℕ} (hn : 1 ≤ n) : (({n : ℕ | Even n} ∩ Iio n).ncard : ℝ) / n = if Even n then 2⁻¹ else (n + 1 : ℝ) / n * 2⁻¹ := by split_ifs ...
230
leanexplore_declaration
leanexplore:386296
leanexplore_sqlite
leanexplore_declarations
theorem nonneg {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] [(atTop : Filter β).NeBot] {S : Set β} {α : ℝ} (h : S.HasDensity α) : 0 ≤ α := le_of_tendsto_of_tendsto' empty h fun b => by simp [div_nonneg, partialDensity]
473
leanexplore_declaration
leanexplore:386297
leanexplore_sqlite
leanexplore_declarations
theorem mono {β : Type*} [PartialOrder β] [LocallyFiniteOrder β] [OrderBot β] {S T : Set β} {αS αT : ℝ} [(atTop (α := β)).NeBot] (h : S ⊆ T) (hS : S.HasDensity αS) (hT : T.HasDensity αT) : αS ≤ αT := by rw [HasDensity] at hS hT apply le_of_tendsto_of_tendsto hS hT filter_upwards [eventually_ge_atTop ⊥] wi...
201
leanexplore_declaration
leanexplore:386298
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem empty {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (A : Set β := Set.univ) : Set.HasDensity (∅ : Set β) 0 A := by simpa [HasDensity, partialDensity] using tendsto_const_nhds
68
leanexplore_declaration
leanexplore:386299
leanexplore_sqlite
leanexplore_declarations
theorem univ_nat_hasDensity_one : (@Set.univ ℕ).HasDensity 1 := univ
517
leanexplore_declaration
leanexplore:386300
leanexplore_sqlite
leanexplore_declarations
/-- In a non-trivial partial order with a least element, the set of all elements has density one. -/ @[simp] theorem univ {β : Type*} [PartialOrder β] [LocallyFiniteOrder β] [OrderBot β] [Nontrivial β] : (@Set.univ β).HasDensity 1 := by by_cases h : atTop (α := β) = ⊥ · simp [h, HasDensity] · simp [HasDensity...
371
leanexplore_declaration
leanexplore:386301
leanexplore_sqlite
leanexplore_declarations
/-- A set `S` in an order `β` where all intervals bounded above are finite is said to have positive density (relative to a set `A`) if there exists a positive `α : ℝ` such that `S` has density `α` (relative to a set `A`). -/ def HasPosDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β...
495
leanexplore_declaration
leanexplore:386302
leanexplore_sqlite
leanexplore_declarations
/-- A set `S` in an order `β` where all intervals bounded above are finite is said to have density `α : ℝ` (relative to a set `A`) if the proportion of `x ∈ S` such that `x < n` in `A` tends to `α` as `n → ∞`. When `β = ℕ` this by default defines the natural density of a set (i.e., relative to all of `ℕ`). -/ def HasD...
298
leanexplore_declaration
leanexplore:386303
leanexplore_sqlite
leanexplore_declarations
theorem lowerDensity_nonneg {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : 0 ≤ S.lowerDensity A := by rw [Set.lowerDensity, Filter.liminf_eq] exact (em _).elim (le_csSup · <| .of_forall fun _ ↦ by positivity) (Real.sSup_of_not_bddAbove · |>.ge)
399
leanexplore_declaration
leanexplore:386304
leanexplore_sqlite
leanexplore_declarations
theorem lowerDensity_le_one {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) : S.lowerDensity A ≤ 1 := by by_cases h : atTop (α := β) = ⊥ · simp [h, Set.lowerDensity, Filter.liminf_eq] · have : (atTop (α := β)).NeBot := ⟨h⟩ apply Real.sSup_le (fun x hx ↦ ?_) one_pos.l...
403
leanexplore_declaration
leanexplore:386305
leanexplore_sqlite
leanexplore_declarations
/-- Given a set `S` in an order `β`, where all intervals bounded above are finite, we define the lower density of `S` (relative to a set `A`) to be the liminf of the partial densities of `S` (relative to `A`) for `b → ∞`. -/ noncomputable def lowerDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set ...
403
leanexplore_declaration
leanexplore:386306
leanexplore_sqlite
leanexplore_declarations
/-- Given a set `S` in an order `β`, where all intervals bounded above are finite, we define the upper density of `S` (relative to a set `A`) to be the limsup of the partial densities of `S` (relative to `A`) for `b → ∞`. -/ noncomputable def upperDensity {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set ...
297
leanexplore_declaration
leanexplore:386307
leanexplore_sqlite
leanexplore_declarations
theorem partialDensity_le_one {β : Type*} [Preorder β] [LocallyFiniteOrderBot β] (S : Set β) (A : Set β := Set.univ) (b : β) : S.partialDensity A b ≤ 1 := by apply div_le_one_of_le₀ _ (Nat.cast_nonneg _) exact mod_cast Set.ncard_le_ncard <| Set.inter_subset_inter_left _ inter_subset_right
515
leanexplore_declaration
leanexplore:386308
leanexplore_sqlite
leanexplore_declarations
/-- Given a set `S` and an element `b` in an order `β`, where all intervals bounded above are finite, we define the partial density of `S` (relative to a set `A`) to be the proportion of elements in `{x ∈ A | x < b}` that lie in `S ∩ A`. This definition was inspired from https://github.com/b-mehta/unit-fractions -/ @[...
491
leanexplore_declaration
leanexplore:386309
leanexplore_sqlite
leanexplore_declarations
theorem triplewise_set_pred_iff {S : Set α} {P : Set α → Prop} : S.Triplewise (P {·, ·, ·}) ↔ ∀ T ⊆ S, T.ncard = 3 → P T := by constructor · intro h T hT T_ncard obtain ⟨x, y, z, hxy, hxz, hyz, rfl⟩ := ncard_eq_three.mp T_ncard simp_rw [insert_subset_iff, singleton_subset_iff] at hT exact h hT.1 hT....
236
leanexplore_declaration
leanexplore:386310
leanexplore_sqlite
leanexplore_declarations
protected theorem Triplewise.insert_of_not_mem (hx : x ∉ s) (hs : s.Triplewise r) (h : ∀ y ∈ s, ∀ z ∈ s, y ≠ z → r x y z ∧ r y x z ∧ r y z x) : (insert x s).Triplewise r := (Set.triplewise_insert_of_not_mem hx).mpr ⟨hs, h⟩
208
leanexplore_declaration
leanexplore:386311
leanexplore_sqlite
leanexplore_declarations
protected theorem Triplewise.insert (hs : s.Triplewise r) (h : ∀ y ∈ s, ∀ z ∈ s, x ≠ y → x ≠ z → y ≠ z → r x y z ∧ r y x z ∧ r y z x) : (insert x s).Triplewise r := Set.triplewise_insert.mpr ⟨hs, h⟩
337
leanexplore_declaration
leanexplore:386312
leanexplore_sqlite
leanexplore_declarations
theorem triplewise_insert_of_not_mem (hx : x ∉ s) : (insert x s).Triplewise r ↔ s.Triplewise r ∧ ∀ y ∈ s, ∀ z ∈ s, y ≠ z → r x y z ∧ r y x z ∧ r y z x := by refine Set.triplewise_insert.trans <| and_congr_right' <| forall₄_congr ?_ intro y hy z hz simp [(ne_of_mem_of_not_mem hy hx).symm, (ne_of_mem_of_not...
1,019
leanexplore_declaration
leanexplore:386313
leanexplore_sqlite
leanexplore_declarations
theorem triplewise_insert : (insert x s).Triplewise r ↔ s.Triplewise r ∧ ∀ y ∈ s, ∀ z ∈ s, x ≠ y → x ≠ z → y ≠ z → r x y z ∧ r y x z ∧ r y z x := by refine ⟨fun hxs ↦ ?_, fun ⟨hs, hxs⟩ ↦ ?_⟩ · refine ⟨hxs.mono (subset_insert x s), fun y hy z hz hxy hxz hyz ↦ ⟨?_, ?_, ?_⟩⟩ · exact hxs (mem_insert x s) (m...
182
leanexplore_declaration
leanexplore:386314
leanexplore_sqlite
leanexplore_declarations
@[simp] 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
131
leanexplore_declaration
leanexplore:386315
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem triplewise_singleton (r : α → α → α → Prop) : Set.Triplewise {x} r := by apply triplewise_of_encard_lt simp
112
leanexplore_declaration
leanexplore:386316
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem triplewise_empty (r : α → α → α → Prop) : Set.Triplewise ∅ r := (notMem_empty · · |>.elim)
354
leanexplore_declaration
leanexplore:386317
leanexplore_sqlite
leanexplore_declarations
theorem triplewise_of_encard_lt (r : α → α → α → Prop) (h : s.encard < 3) : s.Triplewise r := by unfold Set.Triplewise contrapose! h obtain ⟨x, hx, y, hy, z, hz, hxy, hyz, hxz, _⟩ := h trans encard {x, y, z} · simp [Set.encard_insert_of_notMem, *] norm_num · exact encard_le_encard_of_injOn (by simp ...
120
leanexplore_declaration
leanexplore:386318
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem Triplewise_univ_iff : Set.univ.Triplewise r ↔ Triplewise r := by simp [Set.Triplewise, Triplewise]
152
leanexplore_declaration
leanexplore:386319
leanexplore_sqlite
leanexplore_declarations
theorem Triplewise.mono (h : t ⊆ s) (hs : s.Triplewise r) : t.Triplewise r := fun _ hx _ hy _ hz hxy hyz hxz ↦ hs (h hx) (h hy) (h hz) hxy hyz hxz
188
leanexplore_declaration
leanexplore:386320
leanexplore_sqlite
leanexplore_declarations
protected theorem Triplewise.eq (hs : s.Triplewise r) (hx : x ∈ s) (hy : y ∈ s) (hz : z ∈ s) (h : ¬r x y z) : x = y ∨ y = z ∨ x = z := by have := (h <| hs hx hy hz · · ·) tauto
257
leanexplore_declaration
leanexplore:386321
leanexplore_sqlite
leanexplore_declarations
/-- The ternary relation `r` holds triplewise on the set `s` if `r x y z` for all *distinct* `x y z ∈ s`. -/ protected def Triplewise (s : Set α) (r : α → α → α → Prop) : Prop := ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ∀ ⦃z⦄, z ∈ s → x ≠ y → y ≠ z → x ≠ z → r x y z
105
leanexplore_declaration
leanexplore:386322
leanexplore_sqlite
leanexplore_declarations
def Triplewise {α : Type*} (r : α → α → α → Prop) : Prop := ∀ ⦃i j k ⦄, i ≠ j → j ≠ k → i ≠ k → r i j k
278
leanexplore_declaration
leanexplore:386323
leanexplore_sqlite
leanexplore_declarations
/-- A perfect difference set modulo `n` is a set `D` such that the map `(a, b) ↦ a - b` from `D.offDiag` to `{x : ZMod n | x ≠ 0}` is a bijection. -/ def IsPerfectDifferenceSet (D : Set ℕ) (n : ℕ) : Prop := D.offDiag.BijOn (fun (a, b) => (a - b : ZMod n)) {x : ZMod n | x ≠ 0}
72
leanexplore_declaration
leanexplore:386324
leanexplore_sqlite
leanexplore_declarations
scoped[EuclideanGeometry] notation "ℝ^" n:65 => EuclideanSpace ℝ (Fin n)
194
leanexplore_declaration
leanexplore:386325
leanexplore_sqlite
leanexplore_declarations
/-- The number of pairs of points of a finite set `s` in a metric space that are distance 1 apart. -/ noncomputable def unitDistNum (s : Finset X) : ℕ := #{p ∈ s.sym2 | dist p.out.1 p.out.2 = 1}
109
leanexplore_declaration
leanexplore:386326
leanexplore_sqlite
leanexplore_declarations
nonrec def Set.IsIsosceles {α : Type} [Dist α] (A : Set α) := Nonempty A ∧ A.Triplewise (IsIsosceles · · ·)
124
leanexplore_declaration
leanexplore:386327
leanexplore_sqlite
leanexplore_declarations
def IsIsosceles {α : Type*} [Dist α] (p q r : α) : Prop := dist p q = dist q r ∨ dist q r = dist r p ∨ dist r p = dist p q
260
leanexplore_declaration
leanexplore:386328
leanexplore_sqlite
leanexplore_declarations
/-- A collection $x_1, \dots, x_n\in\mathbb{R}^2$ is in _general position_ if no three are collinear and no four lie on a circle. -/ def InGeneralPosition (X : Finset ℝ²) : Prop := NonTrilinear (SetLike.coe X) ∧ ∀ T ⊆ X, #T = 4 → ¬Cospherical (SetLike.coe T)
374
leanexplore_declaration
leanexplore:386329
leanexplore_sqlite
leanexplore_declarations
/-- Let $x_1,\ldots,x_n\in \mathbb{R}^2$ and let $R(x_i)=\#\{ \lvert x_j-x_i\rvert : j\neq i\}$, where the points are ordered such that \[R(x_1)\leq \cdots \leq R(x_n).\] Let $g(n)$ be the maximum number of distinct values the $R(x_i)$ can take.-/ noncomputable def maximalDistinctDistancesFrom (n : ℕ) : ℕ := sSup {#(...
244
leanexplore_declaration
leanexplore:386330
leanexplore_sqlite
leanexplore_declarations
/-- Given a finite set of points in the, we define the number of distinct distances between a given point and all other points -/ noncomputable def distinctDistancesFrom (points : Finset ℝ²) (pt : ℝ²) : ℕ := #(points.image fun x => dist x pt)
228
leanexplore_declaration
leanexplore:386331
leanexplore_sqlite
leanexplore_declarations
/-- The minimum number of distinct distances guaranteed for any set of $n$ points. -/ noncomputable def minimalDistinctDistances (n : ℕ) : ℕ := sInf {(distinctDistances points : ℝ) | (points : Finset ℝ²) (_ : points.card = n)}
250
leanexplore_declaration
leanexplore:386332
leanexplore_sqlite
leanexplore_declarations
/-- Given a finite set of points in the plane, we define the number of distinct distances between pairs of points. -/ noncomputable def distinctDistances (points : Finset ℝ²) : ℕ := #(points.offDiag.image fun (pair : ℝ² × ℝ²) => dist pair.1 pair.2)
572
leanexplore_declaration
leanexplore:386333
leanexplore_sqlite
leanexplore_declarations
lemma triangle_area_eq_det (a b c : ℝ²) : triangle_area a b c = Matrix.det !![a 0, b 0, c 0; a 1, b 1, c 1; 1, 1, 1] / 2 := by rw [triangle_area, Orientation.areaForm_to_volumeForm, positiveOrientation.volumeForm_robust (EuclideanSpace.basisFun (Fin 2) ℝ) rfl, Modul...
103
leanexplore_declaration
leanexplore:386334
leanexplore_sqlite
leanexplore_declarations
noncomputable def triangle_area (a b c : P) : ℝ := positiveOrientation.areaForm (a -ᵥ c) (b -ᵥ c) / 2
269
leanexplore_declaration
leanexplore:386335
leanexplore_sqlite
leanexplore_declarations
theorem isConvexPolygon_triangle (t : Affine.Triangle ℝ P) : IsConvexPolygon t.points := by have : t.points = ![t.points 0, t.points 1, t.points 2] := by ext i; fin_cases i <;> rfl rw [this, isConvexPolygon_three_iff_affineIndependent, ← this] exact t.independent
664
leanexplore_declaration
leanexplore:386336
leanexplore_sqlite
leanexplore_declarations
theorem isConvexPolygon_three_iff_affineIndependent {A B C : P} : IsConvexPolygon ![A, B, C] ↔ AffineIndependent ℝ ![A, B, C] := by refine ⟨fun h => ?_, isConvexPolygon_three_of_affineIndependent⟩ rw [← oangle_ne_zero_and_ne_pi_iff_affineIndependent, ← Real.Angle.sign_ne_zero_iff] let p := ![A, B, C] change...
710
leanexplore_declaration
leanexplore:386337
leanexplore_sqlite
leanexplore_declarations
/-- Three affine independent points always form a convex polygon. -/ theorem isConvexPolygon_three_of_affineIndependent {A B C : P} (hABC : AffineIndependent ℝ ![A, B, C]) : IsConvexPolygon ![A, B, C] := by rw [← oangle_ne_zero_and_ne_pi_iff_affineIndependent, ← Real.Angle.sign_ne_zero_iff] at hABC cases hsABC ...
183
leanexplore_declaration
leanexplore:386338
leanexplore_sqlite
leanexplore_declarations
/-- The statement that a sequence of points form a convex polygon. -/ def IsConvexPolygon {n : ℕ} (p : Fin n → P) : Prop := IsCcwConvexPolygon p ∨ IsCcwConvexPolygon fun i => p (-i)
212
leanexplore_declaration
leanexplore:386339
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem isCcwConvexPolygon_four (A B C D : P) : IsCcwConvexPolygon ![A, B, C, D] ↔ (∡ A B C).sign = 1 ∧ (∡ B C D).sign = 1 ∧ (∡ C D A).sign = 1 ∧ (∡ D A B).sign = 1 := isCcwConvexPolygon_four'
805
leanexplore_declaration
leanexplore:386340
leanexplore_sqlite
leanexplore_declarations
theorem isCcwConvexPolygon_four' {p : Fin 4 → P} : IsCcwConvexPolygon p ↔ (∡ (p 0) (p 1) (p 2)).sign = 1 ∧ (∡ (p 1) (p 2) (p 3)).sign = 1 ∧ (∡ (p 2) (p 3) (p 0)).sign = 1 ∧ (∡ (p 3) (p 0) (p 1)).sign = 1 := by refine ⟨fun h ↦ ?_, fun ⟨h1, h2, h3, h4⟩ ↦ ?_⟩ · obtain ⟨h01, h12, h23⟩ : (0 : Fin 4) < 1 ∧ (1 : F...
96
leanexplore_declaration
leanexplore:386341
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem isCcwConvexPolygon_two (p : Fin 2 → P) : IsCcwConvexPolygon p := by intro; omega
96
leanexplore_declaration
leanexplore:386342
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem isCcwConvexPolygon_one (p : Fin 1 → P) : IsCcwConvexPolygon p := by intro; omega
93
leanexplore_declaration
leanexplore:386343
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem isCcwConvexPolygon_zero (p : Fin 0 → P) : IsCcwConvexPolygon p := finZeroElim
709
leanexplore_declaration
leanexplore:386344
leanexplore_sqlite
leanexplore_declarations
theorem IsCcwConvexPolygon.sign_oangle_finRotate (hp : IsCcwConvexPolygon p) (hn : 3 ≤ n) (i : Fin n) : (∡ (p i) (p <| finRotate _ i) (p <| finRotate _ (finRotate _ i))).sign = 1 := by obtain ⟨n, rfl⟩ := le_iff_exists_add'.mp hn by_cases hi : i = Fin.last (n + 2) · rw [hi, finRotate_last, finRotate_apply_...
220
leanexplore_declaration
leanexplore:386345
leanexplore_sqlite
leanexplore_declarations
theorem IsCcwConvexPolygon.sign_oangle'' (hp : IsCcwConvexPolygon p) {i j k : Fin n} (hij : i < j) (hjk : j < k) : (∡ (p k) (p i) (p j)).sign = 1 := by rw [← EuclideanGeometry.oangle_rotate_sign] exact hp hij hjk
217
leanexplore_declaration
leanexplore:386346
leanexplore_sqlite
leanexplore_declarations
theorem IsCcwConvexPolygon.sign_oangle' (hp : IsCcwConvexPolygon p) {i j k : Fin n} (hij : i < j) (hjk : j < k) : (∡ (p j) (p k) (p i)).sign = 1 := by rw [EuclideanGeometry.oangle_rotate_sign] exact hp hij hjk
159
leanexplore_declaration
leanexplore:386347
leanexplore_sqlite
leanexplore_declarations
theorem IsCcwConvexPolygon.sign_oangle (hp : IsCcwConvexPolygon p) {i j k : Fin n} (hij : i < j) (hjk : j < k) : (∡ (p i) (p j) (p k)).sign = 1 := hp hij hjk
196
leanexplore_declaration
leanexplore:386348
leanexplore_sqlite
leanexplore_declarations
/-- The statement that a sequence of points form a counter-clockwise convex polygon. -/ def IsCcwConvexPolygon (p : Fin n → P) : Prop := ∀ ⦃i j k⦄, i < j → j < k → (∡ (p i) (p j) (p k)).sign = 1
177
leanexplore_declaration
leanexplore:386349
leanexplore_sqlite
leanexplore_declarations
/-- The set `P` contains a convex `n`-gon. See also `IsConvexPolygon`. -/ def HasConvexNGon (n : ℕ) (P : Set ℝ²) : Prop := ∃ S : Finset ℝ², S.card = n ∧ ↑S ⊆ P ∧ ConvexIndep S
249
leanexplore_declaration
leanexplore:386350
leanexplore_sqlite
leanexplore_declarations
/-- `ConvexIndep S` means that `S` consists of extremal points of its convex hull, i.e., the point set encloses a convex shape. Also known as a "convex-independent set". -/ def ConvexIndep (S : Set ℝ²) : Prop := ∀ a ∈ S, a ∉ convexHull ℝ (S \ {a})
182
leanexplore_declaration
leanexplore:386351
leanexplore_sqlite
leanexplore_declarations
lemma NonCollinearFor.subset {n : ℕ} {S T : Set P} (h : S ⊆ T) (hS : NonCollinearFor n T) : NonCollinearFor n S := by intro A hA hFin hCard exact hS A (hA.trans h) hFin hCard
240
leanexplore_declaration
leanexplore:386352
leanexplore_sqlite
leanexplore_declarations
/-- We say a subset `S` of points is non-collinear for $n$ points if it contains no $n$ points that lie on the same line. -/ def NonCollinearFor (n : ℕ) (S : Set P) : Prop := ∀ (A : Set P), A ⊆ S → A.Finite → A.ncard = n → ¬ Collinear ℝ A
216
leanexplore_declaration
leanexplore:386353
leanexplore_sqlite
leanexplore_declarations
/-- We say a subset `A` of points in the plane is non-trilinear if it contains no three points that lie on the same line. -/ def NonTrilinear (A : Set P) : Prop := A.Triplewise (fun x y z ↦ ¬ Collinear ℝ {x, y, z})
170
leanexplore_declaration
leanexplore:386354
leanexplore_sqlite
leanexplore_declarations
/-- Two dimensional euclidean space is two-dimensional. -/ instance fact_finrank_euclideanSpace_fin_two : Fact (Module.finrank ℝ ℝ² = 2) := ⟨finrank_euclideanSpace_fin⟩
312
leanexplore_declaration
leanexplore:386355
leanexplore_sqlite
leanexplore_declarations
/-- Oriented angles make sense in 2d. 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 <| PiLp.basisFun 2 _ _⟩
67
leanexplore_declaration
leanexplore:386356
leanexplore_sqlite
leanexplore_declarations
scoped[EuclideanGeometry] notation "ℝ²" => EuclideanSpace ℝ (Fin 2)
176
leanexplore_declaration
leanexplore:386357
leanexplore_sqlite
leanexplore_declarations
/-- Three dimensional euclidean space is three-dimensional. -/ instance fact_finrank_euclideanSpace_fin_three : Fact (Module.finrank ℝ ℝ³ = 3) := ⟨finrank_euclideanSpace_fin⟩
408
leanexplore_declaration
leanexplore:386358
leanexplore_sqlite
leanexplore_declarations
/-- The standard basis gives us a preferred orientation in `ℝ³`. 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.orientedEuclideanS...
67
leanexplore_declaration
leanexplore:386359
leanexplore_sqlite
leanexplore_declarations
scoped[EuclideanGeometry] notation "ℝ³" => EuclideanSpace ℝ (Fin 3)
491
leanexplore_declaration
leanexplore:386360
leanexplore_sqlite
leanexplore_declarations
/-- Visit nodes in an infotree, where state is set only within a single branch. -/ partial def Lean.Elab.InfoTree.visitStateOf [MonadStateOf σ m] (visit : ContextInfo → Info → (children : PersistentArray InfoTree) → m Unit) : InfoTree → m Unit := go none where go | ctx?, context ctx t => go (ctx.mergeIntoOu...
124
leanexplore_declaration
leanexplore:386361
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma closedInterior_nonempty (s : Simplex k P n) : s.closedInterior.Nonempty := ⟨_, s.point_mem_closedInterior 0⟩
196
leanexplore_declaration
leanexplore:386362
leanexplore_sqlite
leanexplore_declarations
/-- The group of invertible diagonal matrices. -/ def Matrix.GeneralLinearGroup.diagonalSubgroup : Subgroup (GeneralLinearGroup n R) := Subgroup.map (Matrix.GeneralLinearGroup.diagonalHom n R) ⊤
398
leanexplore_declaration
leanexplore:386363
leanexplore_sqlite
leanexplore_declarations
/-- The multiplicative group homomorphism `(Rˣ)ⁿ →* GL(n, R)` given by mapping a vector `x` to `Matrix.diagonal x`. -/ def Matrix.GeneralLinearGroup.diagonalHom : (n → Rˣ) →* GeneralLinearGroup n R where toFun := fun d ↦ ⟨Matrix.diagonal (fun i ↦ d i), Matrix.diagonal (fun i ↦ (d i).inv), by simp, by simp⟩ map_mul'...
242
leanexplore_declaration
leanexplore:386364
leanexplore_sqlite
leanexplore_declarations
/-- The group of invertible diagonal matrices with determinant 1. -/ def Matrix.SpecialLinearGroup.diagonalSubgroup : Subgroup (SpecialLinearGroup n R) := (Matrix.GeneralLinearGroup.diagonalSubgroup n R).comap Matrix.SpecialLinearGroup.toGL
168
leanexplore_declaration
leanexplore:386365
leanexplore_sqlite
leanexplore_declarations
theorem lt_finRotate_of_ne_last {i : Fin (n + 1)} (hi : i ≠ Fin.last n) : i < finRotate _ i := by rw [Fin.lt_def, coe_finRotate_of_ne_last hi, Nat.lt_add_one_iff]
218
leanexplore_declaration
leanexplore:386366
leanexplore_sqlite
leanexplore_declarations
/-- A sequence `A` is complete if every sufficiently large element of `M` is a sum of (not necessarily distinct) terms of `A`. -/ def IsAddCompleteNatSeq' (A : ℕ → M) : Prop := ∀ᶠ k in Filter.atTop, k ∈ subseqSums' A
621
leanexplore_declaration
leanexplore:386367
leanexplore_sqlite
leanexplore_declarations
/-- If `A` is strongly complete and the preimage of each element is finite, then the range of `A` is strongly complete. -/ theorem IsAddStronglyCompleteNatSeq.isAddStronglyComplete {A : ℕ → M} (h : IsAddStronglyCompleteNatSeq A) (hA : ∀ m, (A ⁻¹' {m}).Finite) : IsAddStronglyComplete (.range A) := by refine fu...
376
leanexplore_declaration
leanexplore:386368
leanexplore_sqlite
leanexplore_declarations
/-- If the range of a sequence `A` is strongly complete, then `A` is strongly complete. -/ theorem IsAddStronglyCompleteNatSeq.of_isAddStronglyComplete {A : ℕ → M} (h : IsAddStronglyComplete (.range A)) : IsAddStronglyCompleteNatSeq A := fun n => (h (Finset.finite_toSet _)).mono (A := .range A \ ((Finset.range n)...
208
leanexplore_declaration
leanexplore:386369
leanexplore_sqlite
leanexplore_declarations
/-- A strongly complete sequence is complete. -/ theorem IsAddStronglyCompleteNatSeq.isAddComplete {A : ℕ → M} (hA : IsAddStronglyCompleteNatSeq A) : IsAddComplete (Set.range A) := by simpa using hA 0
205
leanexplore_declaration
leanexplore:386370
leanexplore_sqlite
leanexplore_declarations
/-- A sequence `A` is strongly complete if `fun m => A (n + m)` is still complete for all `n`. -/ def IsAddStronglyCompleteNatSeq (A : ℕ → M) : Prop := ∀ n, IsAddComplete (Set.range (fun m => A (n + m)))
244
leanexplore_declaration
leanexplore:386371
leanexplore_sqlite
leanexplore_declarations
/-- If `A ⊆ B` and `A` is strongly complete, then `B` is also strongly complete. -/ theorem IsAddStronglyComplete.mono {A B : Set M} (h : A ⊆ B) (ha : IsAddStronglyComplete A) : IsAddStronglyComplete B := fun C hC => (ha hC).mono (by grind)
190
leanexplore_declaration
leanexplore:386372
leanexplore_sqlite
leanexplore_declarations
/-- A strongly complete set is complete. -/ theorem IsAddStronglyComplete.isAddComplete {A : Set M} (hA : IsAddStronglyComplete A) : IsAddComplete A := by simpa using hA Set.finite_empty
197
leanexplore_declaration
leanexplore:386373
leanexplore_sqlite
leanexplore_declarations
/-- A set `A ⊆ M` is complete if every sufficiently large element of `M` is a subset sum of `A`. -/ def IsAddStronglyComplete (A : Set M) : Prop := ∀ ⦃B : Set M⦄, B.Finite → IsAddComplete (A \ B)
238
leanexplore_declaration
leanexplore:386374
leanexplore_sqlite
leanexplore_declarations
/-- If `A ⊆ B` and `A` is complete, then `B` is also complete. -/ @[gcongr] theorem IsAddComplete.mono {A B : Set M} (h : A ⊆ B) (ha : IsAddComplete A) : IsAddComplete B := by filter_upwards [ha] with x hx exact (subsetSums_mono h) hx
180
leanexplore_declaration
leanexplore:386375
leanexplore_sqlite
leanexplore_declarations
/-- A set `A ⊆ M` is complete if every sufficiently large element of `M` is a subset sum of `A`. -/ def IsAddComplete (A : Set M) : Prop := ∀ᶠ k in Filter.atTop, k ∈ subsetSums A
161
leanexplore_declaration
leanexplore:386376
leanexplore_sqlite
leanexplore_declarations
/-- The set of subset sums of a sequence `ℕ → M`, where repetition is allowed. -/ def subseqSums' (A : ℕ → M) : Set M := {n | ∃ B : Finset ℕ, n = ∑ i ∈ B, A i}
190
leanexplore_declaration
leanexplore:386377
leanexplore_sqlite
leanexplore_declarations
/-- If `A ⊆ B`, then `subsetSums A ⊆ subsetSums B`. -/ @[gcongr] theorem subsetSums_mono {A B : Set M} (h : A ⊆ B) : subsetSums A ⊆ subsetSums B := fun _ ⟨C, hC⟩ => ⟨C, hC.1.trans h, hC.2⟩
133
leanexplore_declaration
leanexplore:386378
leanexplore_sqlite
leanexplore_declarations
/-- The set of subset sums of a set `A ⊆ M`. -/ def subsetSums (A : Set M) : Set M := {n | ∃ B : Finset M, ↑B ⊆ A ∧ n = ∑ i ∈ B, i}
100
leanexplore_declaration
leanexplore:386381
leanexplore_sqlite
leanexplore_declarations
@[mk_iff] structure IsAmicable (a b : ℕ) : Prop where left : σ 1 a = a + b right : σ 1 b = a + b
190
leanexplore_declaration
leanexplore:386382
leanexplore_sqlite
leanexplore_declarations
/-- We say that $a,b\in \mathbb{N}$ are an amicable pair if $\sigma(a)=\sigma(b)=a+b$. -/ @[mk_iff] structure IsAmicable (a b : ℕ) : Prop where left : σ 1 a = a + b right : σ 1 b = a + b
304
leanexplore_declaration
leanexplore:386383
leanexplore_sqlite
leanexplore_declarations
/-- The set of Beurling integers is closed under taking powers. -/ lemma pow_mem_beurling {a : ℕ → ℝ} {x : ℝ} (k : ℕ) (hx : x ∈ BeurlingIntegers a) : x ^ k ∈ BeurlingIntegers a := by induction k with | zero => exact ⟨0, by norm_num⟩ | succ k ih => simpa [pow_succ'] using mul_mem_beurling hx ih
319
leanexplore_declaration
leanexplore:386384
leanexplore_sqlite
leanexplore_declarations
/-- The set of Beurling integers is closed under multiplication. -/ lemma mul_mem_beurling {a : ℕ → ℝ} {x y : ℝ} (hx : x ∈ BeurlingIntegers a) (hy : y ∈ BeurlingIntegers a) : x * y ∈ BeurlingIntegers a := by obtain ⟨k, rfl⟩ := hx obtain ⟨l, rfl⟩ := hy exact ⟨k + l, by simp [Finsupp.prod_add_index', pow_add]⟩
175
leanexplore_declaration
leanexplore:386385
leanexplore_sqlite
leanexplore_declarations
/-- Every element of the sequence `a` is a Beurling integer. -/ lemma generator_mem_beurling (a : ℕ → ℝ) (i : ℕ) : a i ∈ BeurlingIntegers a := ⟨Finsupp.single i 1, by aesop⟩
105
leanexplore_declaration
leanexplore:386386
leanexplore_sqlite
leanexplore_declarations
theorem beurlingInteger_mem (a k) : beurlingInteger a k ∈ BeurlingIntegers a := by simpa using ⟨k, rfl⟩
182
leanexplore_declaration
leanexplore:386387
leanexplore_sqlite
leanexplore_declarations
/-- The set of Beurling integers are numbers of the form `∏ i, (a i) ^ (k i)`, where `k` has finite support. -/ def BeurlingIntegers (a : ℕ → ℝ) : Set ℝ := .range (beurlingInteger a)
100
leanexplore_declaration
leanexplore:386388
leanexplore_sqlite
leanexplore_declarations
@[simp] theorem beurlingInteger_def (a k) : beurlingInteger a k = k.prod fun x y ↦ (a x) ^ y := rfl