state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
C : Type u_1 D : Type u_2 inst✝² : Category.{?u.38, u_1} C inst✝¹ : Category.{?u.42, u_2} D inst✝ : Preadditive D P✝ Q✝ R✝ : C β₯€ D f✝ f'✝ : P✝ ⟢ Q✝ g✝ : Q✝ ⟢ R✝ ⊒ (f✝ + f'✝) ≫ g✝ = f✝ ≫ g✝ + f'✝ ≫ g✝
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros
ext
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros
Mathlib.CategoryTheory.Preadditive.FunctorCategory.27_0.Nvs9V8Hq6lv6L8Y
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G
Mathlib_CategoryTheory_Preadditive_FunctorCategory
case w.h C : Type u_1 D : Type u_2 inst✝² : Category.{?u.38, u_1} C inst✝¹ : Category.{?u.42, u_2} D inst✝ : Preadditive D P✝ Q✝ R✝ : C β₯€ D f✝ f'✝ : P✝ ⟢ Q✝ g✝ : Q✝ ⟢ R✝ x✝ : C ⊒ ((f✝ + f'✝) ≫ g✝).app x✝ = (f✝ ≫ g✝ + f'✝ ≫ g✝).app x✝
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext
apply add_comp
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext
Mathlib.CategoryTheory.Preadditive.FunctorCategory.27_0.Nvs9V8Hq6lv6L8Y
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G
Mathlib_CategoryTheory_Preadditive_FunctorCategory
C : Type u_1 D : Type u_2 inst✝² : Category.{?u.38, u_1} C inst✝¹ : Category.{?u.42, u_2} D inst✝ : Preadditive D ⊒ βˆ€ (P Q R : C β₯€ D) (f : P ⟢ Q) (g g' : Q ⟢ R), f ≫ (g + g') = f ≫ g + f ≫ g'
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by
intros
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by
Mathlib.CategoryTheory.Preadditive.FunctorCategory.27_0.Nvs9V8Hq6lv6L8Y
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G
Mathlib_CategoryTheory_Preadditive_FunctorCategory
C : Type u_1 D : Type u_2 inst✝² : Category.{?u.38, u_1} C inst✝¹ : Category.{?u.42, u_2} D inst✝ : Preadditive D P✝ Q✝ R✝ : C β₯€ D f✝ : P✝ ⟢ Q✝ g✝ g'✝ : Q✝ ⟢ R✝ ⊒ f✝ ≫ (g✝ + g'✝) = f✝ ≫ g✝ + f✝ ≫ g'✝
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by intros
ext
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by intros
Mathlib.CategoryTheory.Preadditive.FunctorCategory.27_0.Nvs9V8Hq6lv6L8Y
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G
Mathlib_CategoryTheory_Preadditive_FunctorCategory
case w.h C : Type u_1 D : Type u_2 inst✝² : Category.{?u.38, u_1} C inst✝¹ : Category.{?u.42, u_2} D inst✝ : Preadditive D P✝ Q✝ R✝ : C β₯€ D f✝ : P✝ ⟢ Q✝ g✝ g'✝ : Q✝ ⟢ R✝ x✝ : C ⊒ (f✝ ≫ (g✝ + g'✝)).app x✝ = (f✝ ≫ g✝ + f✝ ≫ g'✝).app x✝
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by intros ext
apply comp_add
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by intros ext
Mathlib.CategoryTheory.Preadditive.FunctorCategory.27_0.Nvs9V8Hq6lv6L8Y
instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G
Mathlib_CategoryTheory_Preadditive_FunctorCategory
C : Type u_1 D : Type u_2 inst✝² : Category.{u_5, u_1} C inst✝¹ : Category.{u_4, u_2} D inst✝ : Preadditive D F G : C β₯€ D ΞΉ : Type u_3 s : Finset ΞΉ X : C Ξ± : ΞΉ β†’ (F ⟢ G) ⊒ (βˆ‘ i in s, Ξ± i).app X = βˆ‘ i in s, (Ξ± i).app X
/- Copyright (c) 2021 Johan Commelin. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Johan Commelin -/ import Mathlib.CategoryTheory.Preadditive.Basic #align_import category_theory.preadditive.functor_category from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3" /-! # Preadditive structure on functor categories If `C` and `D` are categories and `D` is preadditive, then `C β₯€ D` is also preadditive. -/ open BigOperators namespace CategoryTheory open CategoryTheory.Limits Preadditive variable {C D : Type*} [Category C] [Category D] [Preadditive D] instance functorCategoryPreadditive : Preadditive (C β₯€ D) where homGroup F G := { add := fun Ξ± Ξ² => { app := fun X => Ξ±.app X + Ξ².app X } zero := { app := fun X => 0 } neg := fun Ξ± => { app := fun X => -Ξ±.app X } sub := fun Ξ± Ξ² => { app := fun X => Ξ±.app X - Ξ².app X } add_assoc := by intros ext apply add_assoc zero_add := by intros ext apply zero_add add_zero := by intros ext apply add_zero add_comm := by intros ext apply add_comm sub_eq_add_neg := by intros ext apply sub_eq_add_neg add_left_neg := by intros ext apply add_left_neg } add_comp := by intros ext apply add_comp comp_add := by intros ext apply comp_add #align category_theory.functor_category_preadditive CategoryTheory.functorCategoryPreadditive namespace NatTrans variable {F G : C β₯€ D} /-- Application of a natural transformation at a fixed object, as group homomorphism -/ @[simps] def appHom (X : C) : (F ⟢ G) β†’+ (F.obj X ⟢ G.obj X) where toFun Ξ± := Ξ±.app X map_zero' := rfl map_add' _ _ := rfl #align category_theory.nat_trans.app_hom CategoryTheory.NatTrans.appHom @[simp] theorem app_zero (X : C) : (0 : F ⟢ G).app X = 0 := rfl #align category_theory.nat_trans.app_zero CategoryTheory.NatTrans.app_zero @[simp] theorem app_add (X : C) (Ξ± Ξ² : F ⟢ G) : (Ξ± + Ξ²).app X = Ξ±.app X + Ξ².app X := rfl #align category_theory.nat_trans.app_add CategoryTheory.NatTrans.app_add @[simp] theorem app_sub (X : C) (Ξ± Ξ² : F ⟢ G) : (Ξ± - Ξ²).app X = Ξ±.app X - Ξ².app X := rfl #align category_theory.nat_trans.app_sub CategoryTheory.NatTrans.app_sub @[simp] theorem app_neg (X : C) (Ξ± : F ⟢ G) : (-Ξ±).app X = -Ξ±.app X := rfl #align category_theory.nat_trans.app_neg CategoryTheory.NatTrans.app_neg @[simp] theorem app_nsmul (X : C) (Ξ± : F ⟢ G) (n : β„•) : (n β€’ Ξ±).app X = n β€’ Ξ±.app X := (appHom X).map_nsmul Ξ± n #align category_theory.nat_trans.app_nsmul CategoryTheory.NatTrans.app_nsmul @[simp] theorem app_zsmul (X : C) (Ξ± : F ⟢ G) (n : β„€) : (n β€’ Ξ±).app X = n β€’ Ξ±.app X := (appHom X : (F ⟢ G) β†’+ (F.obj X ⟢ G.obj X)).map_zsmul Ξ± n #align category_theory.nat_trans.app_zsmul CategoryTheory.NatTrans.app_zsmul @[simp] theorem app_sum {ΞΉ : Type*} (s : Finset ΞΉ) (X : C) (Ξ± : ΞΉ β†’ (F ⟢ G)) : (βˆ‘ i in s, Ξ± i).app X = βˆ‘ i in s, (Ξ± i).app X := by
simp only [← appHom_apply, map_sum]
@[simp] theorem app_sum {ΞΉ : Type*} (s : Finset ΞΉ) (X : C) (Ξ± : ΞΉ β†’ (F ⟢ G)) : (βˆ‘ i in s, Ξ± i).app X = βˆ‘ i in s, (Ξ± i).app X := by
Mathlib.CategoryTheory.Preadditive.FunctorCategory.112_0.Nvs9V8Hq6lv6L8Y
@[simp] theorem app_sum {ΞΉ : Type*} (s : Finset ΞΉ) (X : C) (Ξ± : ΞΉ β†’ (F ⟢ G)) : (βˆ‘ i in s, Ξ± i).app X = βˆ‘ i in s, (Ξ± i).app X
Mathlib_CategoryTheory_Preadditive_FunctorCategory
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : StrictConvexSpace π•œ E x : E r : ℝ ⊒ StrictConvex π•œ (closedBall x r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by
rcases le_or_lt r 0 with hr | hr
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by
Mathlib.Analysis.Convex.StrictConvexSpace.80_0.LKetms5NIkPrXf9
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r)
Mathlib_Analysis_Convex_StrictConvexSpace
case inl π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : StrictConvexSpace π•œ E x : E r : ℝ hr : r ≀ 0 ⊒ StrictConvex π•œ (closedBall x r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β·
exact (subsingleton_closedBall x hr).strictConvex
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β·
Mathlib.Analysis.Convex.StrictConvexSpace.80_0.LKetms5NIkPrXf9
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r)
Mathlib_Analysis_Convex_StrictConvexSpace
case inr π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : StrictConvexSpace π•œ E x : E r : ℝ hr : 0 < r ⊒ StrictConvex π•œ (closedBall x r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex
rw [← vadd_closedBall_zero]
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex
Mathlib.Analysis.Convex.StrictConvexSpace.80_0.LKetms5NIkPrXf9
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r)
Mathlib_Analysis_Convex_StrictConvexSpace
case inr π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : StrictConvexSpace π•œ E x : E r : ℝ hr : 0 < r ⊒ StrictConvex π•œ (x +α΅₯ closedBall 0 r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero]
exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero]
Mathlib.Analysis.Convex.StrictConvexSpace.80_0.LKetms5NIkPrXf9
/-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r)
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : LinearMap.CompatibleSMul E E π•œ ℝ h : StrictConvex π•œ (closedBall 0 1) r : ℝ hr : 0 < r ⊒ StrictConvex π•œ (closedBall 0 r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by
simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r
/-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by
Mathlib.Analysis.Convex.StrictConvexSpace.91_0.LKetms5NIkPrXf9
/-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1 ⊒ StrictConvexSpace ℝ E
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by
refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _)
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by
Mathlib.Analysis.Convex.StrictConvexSpace.97_0.LKetms5NIkPrXf9
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1 x : E hx : x ∈ closedBall 0 1 \ interior (closedBall 0 1) y : E hy : y ∈ closedBall 0 1 \ interior (closedBall 0 1) hne : x β‰  y ⊒ (fun x y => βˆƒ c, (AffineMap.lineMap x y) c ∈ interior (closedBall 0 1)) x y
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _)
rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _)
Mathlib.Analysis.Convex.StrictConvexSpace.97_0.LKetms5NIkPrXf9
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1 x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hne : x β‰  y ⊒ βˆƒ c, (AffineMap.lineMap x y) c ∈ interior (closedBall 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy
rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy
Mathlib.Analysis.Convex.StrictConvexSpace.97_0.LKetms5NIkPrXf9
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro.intro π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1 x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hne : x β‰  y a b : ℝ hab : a + b = 1 hlt : β€–a β€’ x + b β€’ yβ€– < 1 ⊒ βˆƒ c, (AffineMap.lineMap x y) c ∈ interior (closedBall 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩
use b
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩
Mathlib.Analysis.Convex.StrictConvexSpace.97_0.LKetms5NIkPrXf9
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
case h π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1 x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hne : x β‰  y a b : ℝ hab : a + b = 1 hlt : β€–a β€’ x + b β€’ yβ€– < 1 ⊒ (AffineMap.lineMap x y) b ∈ interior (closedBall 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b
rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm]
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b
Mathlib.Analysis.Convex.StrictConvexSpace.97_0.LKetms5NIkPrXf9
/-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1 ⊒ StrictConvexSpace ℝ E
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by
refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _)
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by
Mathlib.Analysis.Convex.StrictConvexSpace.114_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1 ⊒ Set.Pairwise (closedBall 0 1 \ interior (closedBall 0 1)) fun x y => Set.Nonempty ([x-[ℝ]y] \ frontier (closedBall 0 1))
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _)
simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm]
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _)
Mathlib.Analysis.Convex.StrictConvexSpace.114_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1 ⊒ βˆ€ ⦃x : E⦄, β€–xβ€– = 1 β†’ βˆ€ ⦃y : E⦄, β€–yβ€– = 1 β†’ x β‰  y β†’ Set.Nonempty ([x-[ℝ]y] \ sphere 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm]
intro x hx y hy hne
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm]
Mathlib.Analysis.Convex.StrictConvexSpace.114_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1 x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hne : x β‰  y ⊒ Set.Nonempty ([x-[ℝ]y] \ sphere 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne
rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne
Mathlib.Analysis.Convex.StrictConvexSpace.114_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro.intro.intro.intro π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1 x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hne : x β‰  y a b : ℝ ha : 0 ≀ a hb : 0 ≀ b hab : a + b = 1 hne' : β€–a β€’ x + b β€’ yβ€– β‰  1 ⊒ Set.Nonempty ([x-[ℝ]y] \ sphere 0 1)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩
exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩
Mathlib.Analysis.Convex.StrictConvexSpace.114_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2 ⊒ StrictConvexSpace ℝ E
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by
refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by
Mathlib.Analysis.Convex.StrictConvexSpace.128_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2 x y : E hx : β€–xβ€– = 1 hy : β€–yβ€– = 1 hne : x β‰  y ⊒ β€–(1 / 2) β€’ x + (1 / 2) β€’ yβ€– β‰  1
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩
rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)]
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩
Mathlib.Analysis.Convex.StrictConvexSpace.128_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2 x y : E hx : β€–xβ€– = 1 hy : β€–yβ€– = 1 hne : x β‰  y ⊒ Β¬β€–x + yβ€– = 2
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)]
exact h hx hy hne
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)]
Mathlib.Analysis.Convex.StrictConvexSpace.128_0.LKetms5NIkPrXf9
theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y ⊒ StrictConvexSpace ℝ E
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by
refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by
Mathlib.Analysis.Convex.StrictConvexSpace.144_0.LKetms5NIkPrXf9
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y x : E hx : x ∈ sphere 0 1 y : E hy : y ∈ sphere 0 1 hβ‚‚ : β€–x + yβ€– = 2 ⊒ x = y
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _
rw [mem_sphere_zero_iff_norm] at hx hy
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _
Mathlib.Analysis.Convex.StrictConvexSpace.144_0.LKetms5NIkPrXf9
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝³ : NormedLinearOrderedField π•œ inst✝² : NormedAddCommGroup E inst✝¹ : NormedSpace π•œ E inst✝ : NormedSpace ℝ E h : βˆ€ (x y : E), β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y x : E hx : β€–xβ€– = 1 y : E hy : β€–yβ€– = 1 hβ‚‚ : β€–x + yβ€– = 2 ⊒ x = y
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy
exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚)
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy
Mathlib.Analysis.Convex.StrictConvexSpace.144_0.LKetms5NIkPrXf9
/-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : x ∈ closedBall z r hy : y ∈ closedBall z r hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 ⊒ a β€’ x + b β€’ y ∈ ball z r
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by
rcases eq_or_ne r 0 with (rfl | hr)
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by
Mathlib.Analysis.Convex.StrictConvexSpace.155_0.LKetms5NIkPrXf9
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r
Mathlib_Analysis_Convex_StrictConvexSpace
case inl π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b : ℝ hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 hx : x ∈ closedBall z 0 hy : y ∈ closedBall z 0 ⊒ a β€’ x + b β€’ y ∈ ball z 0
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β·
rw [closedBall_zero, mem_singleton_iff] at hx hy
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β·
Mathlib.Analysis.Convex.StrictConvexSpace.155_0.LKetms5NIkPrXf9
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r
Mathlib_Analysis_Convex_StrictConvexSpace
case inl π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b : ℝ hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 hx : x = z hy : y = z ⊒ a β€’ x + b β€’ y ∈ ball z 0
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy
exact (hne (hx.trans hy.symm)).elim
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy
Mathlib.Analysis.Convex.StrictConvexSpace.155_0.LKetms5NIkPrXf9
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r
Mathlib_Analysis_Convex_StrictConvexSpace
case inr π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : x ∈ closedBall z r hy : y ∈ closedBall z r hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 hr : r β‰  0 ⊒ a β€’ x + b β€’ y ∈ ball z r
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β·
simp only [← interior_closedBall _ hr] at hx hy ⊒
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β·
Mathlib.Analysis.Convex.StrictConvexSpace.155_0.LKetms5NIkPrXf9
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r
Mathlib_Analysis_Convex_StrictConvexSpace
case inr π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : x ∈ closedBall z r hy : y ∈ closedBall z r hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 hr : r β‰  0 ⊒ a β€’ x + b β€’ y ∈ interior (closedBall z r)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒
exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒
Mathlib.Analysis.Convex.StrictConvexSpace.155_0.LKetms5NIkPrXf9
/-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : β€–xβ€– ≀ r hy : β€–yβ€– ≀ r hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 ⊒ β€–a β€’ x + b β€’ yβ€– < r
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by
simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒
/-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by
Mathlib.Analysis.Convex.StrictConvexSpace.173_0.LKetms5NIkPrXf9
/-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hne : x β‰  y ha : 0 < a hb : 0 < b hab : a + b = 1 hx : x ∈ closedBall 0 r hy : y ∈ closedBall 0 r ⊒ a β€’ x + b β€’ y ∈ ball 0 r
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒
exact combo_mem_ball_of_ne hx hy hne ha hb hab
/-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒
Mathlib.Analysis.Convex.StrictConvexSpace.173_0.LKetms5NIkPrXf9
/-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ x y ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by
simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : x β‰  0 ∧ y β‰  0 ∧ β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h
rcases h with ⟨hx, hy, hne⟩
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : x β‰  0 hy : y β‰  0 hne : β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩
rw [← norm_pos_iff] at hx hy
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : 0 < β€–xβ€– hy : 0 < β€–yβ€– hne : β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy
have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : 0 < β€–xβ€– hy : 0 < β€–yβ€– hne : β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y hxy : 0 < β€–xβ€– + β€–yβ€– ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy
have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne'])
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : 0 < β€–xβ€– hy : 0 < β€–yβ€– hne : β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y hxy : 0 < β€–xβ€– + β€–yβ€– ⊒ β€–xβ€– / (β€–xβ€– + β€–yβ€–) + β€–yβ€– / (β€–xβ€– + β€–yβ€–) = 1
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by
rw [← add_div, div_self hxy.ne']
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
case intro.intro π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ hx : 0 < β€–xβ€– hy : 0 < β€–yβ€– hne : β€–x‖⁻¹ β€’ x β‰  β€–y‖⁻¹ β€’ y hxy : 0 < β€–xβ€– + β€–yβ€– this : (β€–xβ€– / (β€–xβ€– + β€–yβ€–)) β€’ β€–x‖⁻¹ β€’ x + (β€–yβ€– / (β€–xβ€– + β€–yβ€–)) β€’ β€–y‖⁻¹ β€’ y ∈ ball 0 1 ⊒ β€–x + yβ€– < β€–xβ€– + β€–yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne'])
rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne'])
Mathlib.Analysis.Convex.StrictConvexSpace.181_0.LKetms5NIkPrXf9
/-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ x y ⊒ β€–xβ€– - β€–yβ€– < β€–x - yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by
nth_rw 1 [← sub_add_cancel x y] at h ⊒
theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by
Mathlib.Analysis.Convex.StrictConvexSpace.197_0.LKetms5NIkPrXf9
theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ (x - y + y) y ⊒ β€–x - y + yβ€– - β€–yβ€– < β€–x - yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒
exact sub_lt_iff_lt_add.2 (norm_add_lt_of_not_sameRay fun H' => h <| H'.add_left SameRay.rfl)
theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒
Mathlib.Analysis.Convex.StrictConvexSpace.197_0.LKetms5NIkPrXf9
theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ x y ⊒ |β€–xβ€– - β€–yβ€–| < β€–x - yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒ exact sub_lt_iff_lt_add.2 (norm_add_lt_of_not_sameRay fun H' => h <| H'.add_left SameRay.rfl) #align lt_norm_sub_of_not_same_ray lt_norm_sub_of_not_sameRay theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by
refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by
Mathlib.Analysis.Convex.StrictConvexSpace.202_0.LKetms5NIkPrXf9
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ x y ⊒ β€–yβ€– - β€–xβ€– < β€–x - yβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒ exact sub_lt_iff_lt_add.2 (norm_add_lt_of_not_sameRay fun H' => h <| H'.add_left SameRay.rfl) #align lt_norm_sub_of_not_same_ray lt_norm_sub_of_not_sameRay theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩
rw [norm_sub_rev]
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩
Mathlib.Analysis.Convex.StrictConvexSpace.202_0.LKetms5NIkPrXf9
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : Β¬SameRay ℝ x y ⊒ β€–yβ€– - β€–xβ€– < β€–y - xβ€–
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒ exact sub_lt_iff_lt_add.2 (norm_add_lt_of_not_sameRay fun H' => h <| H'.add_left SameRay.rfl) #align lt_norm_sub_of_not_same_ray lt_norm_sub_of_not_sameRay theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩ rw [norm_sub_rev]
exact lt_norm_sub_of_not_sameRay (mt SameRay.symm h)
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩ rw [norm_sub_rev]
Mathlib.Analysis.Convex.StrictConvexSpace.202_0.LKetms5NIkPrXf9
theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€–
Mathlib_Analysis_Convex_StrictConvexSpace
π•œ : Type u_1 E : Type u_2 inst✝⁴ : NormedLinearOrderedField π•œ inst✝³ : NormedAddCommGroup E inst✝² : NormedSpace π•œ E inst✝¹ : NormedSpace ℝ E inst✝ : StrictConvexSpace ℝ E x y z : E a b r : ℝ h : β€–xβ€– = β€–yβ€– ⊒ β€–(1 / 2) β€’ (x + y)β€– < β€–xβ€– ↔ x β‰  y
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies, Yury Kudryashov -/ import Mathlib.Analysis.Convex.Normed import Mathlib.Analysis.Convex.Strict import Mathlib.Analysis.Normed.Order.Basic import Mathlib.Analysis.NormedSpace.AddTorsor import Mathlib.Analysis.NormedSpace.Pointwise import Mathlib.Analysis.NormedSpace.AffineIsometry #align_import analysis.convex.strict_convex_space from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f" /-! # Strictly convex spaces This file defines strictly convex spaces. A normed space is strictly convex if all closed balls are strictly convex. This does **not** mean that the norm is strictly convex (in fact, it never is). ## Main definitions `StrictConvexSpace`: a typeclass saying that a given normed space over a normed linear ordered field (e.g., `ℝ` or `β„š`) is strictly convex. The definition requires strict convexity of a closed ball of positive radius with center at the origin; strict convexity of any other closed ball follows from this assumption. ## Main results In a strictly convex space, we prove - `strictConvex_closedBall`: a closed ball is strictly convex. - `combo_mem_ball_of_ne`, `openSegment_subset_ball_of_ne`, `norm_combo_lt_of_ne`: a nontrivial convex combination of two points in a closed ball belong to the corresponding open ball; - `norm_add_lt_of_not_sameRay`, `sameRay_iff_norm_add`, `dist_add_dist_eq_iff`: the triangle inequality `dist x y + dist y z ≀ dist x z` is a strict inequality unless `y` belongs to the segment `[x -[ℝ] z]`. - `Isometry.affineIsometryOfStrictConvexSpace`: an isometry of `NormedAddTorsor`s for real normed spaces, strictly convex in the case of the codomain, is an affine isometry. We also provide several lemmas that can be used as alternative constructors for `StrictConvex ℝ E`: - `StrictConvexSpace.of_strictConvex_closed_unit_ball`: if `closed_ball (0 : E) 1` is strictly convex, then `E` is a strictly convex space; - `StrictConvexSpace.of_norm_add`: if `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies `SameRay ℝ x y` for all nonzero `x y : E`, then `E` is a strictly convex space. ## Implementation notes While the definition is formulated for any normed linear ordered field, most of the lemmas are formulated only for the case `π•œ = ℝ`. ## Tags convex, strictly convex -/ set_option autoImplicit true open Set Metric open Convex Pointwise /-- A *strictly convex space* is a normed space where the closed balls are strictly convex. We only require balls of positive radius with center at the origin to be strictly convex in the definition, then prove that any closed ball is strictly convex in `strictConvex_closedBall` below. See also `StrictConvexSpace.of_strictConvex_closed_unit_ball`. -/ class StrictConvexSpace (π•œ E : Type*) [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] : Prop where strictConvex_closedBall : βˆ€ r : ℝ, 0 < r β†’ StrictConvex π•œ (closedBall (0 : E) r) #align strict_convex_space StrictConvexSpace variable (π•œ : Type*) {E : Type*} [NormedLinearOrderedField π•œ] [NormedAddCommGroup E] [NormedSpace π•œ E] /-- A closed ball in a strictly convex space is strictly convex. -/ theorem strictConvex_closedBall [StrictConvexSpace π•œ E] (x : E) (r : ℝ) : StrictConvex π•œ (closedBall x r) := by rcases le_or_lt r 0 with hr | hr Β· exact (subsingleton_closedBall x hr).strictConvex rw [← vadd_closedBall_zero] exact (StrictConvexSpace.strictConvex_closedBall r hr).vadd _ #align strict_convex_closed_ball strictConvex_closedBall variable [NormedSpace ℝ E] /-- A real normed vector space is strictly convex provided that the unit ball is strictly convex. -/ theorem StrictConvexSpace.of_strictConvex_closed_unit_ball [LinearMap.CompatibleSMul E E π•œ ℝ] (h : StrictConvex π•œ (closedBall (0 : E) 1)) : StrictConvexSpace π•œ E := ⟨fun r hr => by simpa only [smul_closedUnitBall_of_nonneg hr.le] using h.smul r⟩ #align strict_convex_space.of_strict_convex_closed_unit_ball StrictConvexSpace.of_strictConvex_closed_unit_ball /-- Strict convexity is equivalent to `β€–a β€’ x + b β€’ yβ€– < 1` for all `x` and `y` of norm at most `1` and all strictly positive `a` and `b` such that `a + b = 1`. This lemma shows that it suffices to check this for points of norm one and some `a`, `b` such that `a + b = 1`. -/ theorem StrictConvexSpace.of_norm_combo_lt_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– < 1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex' fun x hx y hy hne => _) rw [interior_closedBall (0 : E) one_ne_zero, closedBall_diff_ball, mem_sphere_zero_iff_norm] at hx hy rcases h x y hx hy hne with ⟨a, b, hab, hlt⟩ use b rwa [AffineMap.lineMap_apply_module, interior_closedBall (0 : E) one_ne_zero, mem_ball_zero_iff, sub_eq_iff_eq_add.2 hab.symm] #align strict_convex_space.of_norm_combo_lt_one StrictConvexSpace.of_norm_combo_lt_one theorem StrictConvexSpace.of_norm_combo_ne_one (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ βˆƒ a b : ℝ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ β€–a β€’ x + b β€’ yβ€– β‰  1) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_strictConvex_closed_unit_ball ℝ ((convex_closedBall _ _).strictConvex _) simp only [interior_closedBall _ one_ne_zero, closedBall_diff_ball, Set.Pairwise, frontier_closedBall _ one_ne_zero, mem_sphere_zero_iff_norm] intro x hx y hy hne rcases h x y hx hy hne with ⟨a, b, ha, hb, hab, hne'⟩ exact ⟨_, ⟨a, b, ha, hb, hab, rfl⟩, mt mem_sphere_zero_iff_norm.1 hne'⟩ #align strict_convex_space.of_norm_combo_ne_one StrictConvexSpace.of_norm_combo_ne_one theorem StrictConvexSpace.of_norm_add_ne_two (h : βˆ€ ⦃x y : E⦄, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ x β‰  y β†’ β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_norm_combo_ne_one fun x y hx hy hne => ⟨1 / 2, 1 / 2, one_half_pos.le, one_half_pos.le, add_halves _, _⟩ rw [← smul_add, norm_smul, Real.norm_of_nonneg one_half_pos.le, one_div, ← div_eq_inv_mul, Ne.def, div_eq_one_iff_eq (two_ne_zero' ℝ)] exact h hx hy hne #align strict_convex_space.of_norm_add_ne_two StrictConvexSpace.of_norm_add_ne_two theorem StrictConvexSpace.of_pairwise_sphere_norm_ne_two (h : (sphere (0 : E) 1).Pairwise fun x y => β€–x + yβ€– β‰  2) : StrictConvexSpace ℝ E := StrictConvexSpace.of_norm_add_ne_two fun _ _ hx hy => h (mem_sphere_zero_iff_norm.2 hx) (mem_sphere_zero_iff_norm.2 hy) #align strict_convex_space.of_pairwise_sphere_norm_ne_two StrictConvexSpace.of_pairwise_sphere_norm_ne_two /-- If `β€–x + yβ€– = β€–xβ€– + β€–yβ€–` implies that `x y : E` are in the same ray, then `E` is a strictly convex space. See also a more -/ theorem StrictConvexSpace.of_norm_add (h : βˆ€ x y : E, β€–xβ€– = 1 β†’ β€–yβ€– = 1 β†’ β€–x + yβ€– = 2 β†’ SameRay ℝ x y) : StrictConvexSpace ℝ E := by refine' StrictConvexSpace.of_pairwise_sphere_norm_ne_two fun x hx y hy => mt fun hβ‚‚ => _ rw [mem_sphere_zero_iff_norm] at hx hy exact (sameRay_iff_of_norm_eq (hx.trans hy.symm)).1 (h x y hx hy hβ‚‚) #align strict_convex_space.of_norm_add StrictConvexSpace.of_norm_add variable [StrictConvexSpace ℝ E] {x y z : E} {a b r : ℝ} /-- If `x β‰  y` belong to the same closed ball, then a convex combination of `x` and `y` with positive coefficients belongs to the corresponding open ball. -/ theorem combo_mem_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : a β€’ x + b β€’ y ∈ ball z r := by rcases eq_or_ne r 0 with (rfl | hr) Β· rw [closedBall_zero, mem_singleton_iff] at hx hy exact (hne (hx.trans hy.symm)).elim Β· simp only [← interior_closedBall _ hr] at hx hy ⊒ exact strictConvex_closedBall ℝ z r hx hy hne ha hb hab #align combo_mem_ball_of_ne combo_mem_ball_of_ne /-- If `x β‰  y` belong to the same closed ball, then the open segment with endpoints `x` and `y` is included in the corresponding open ball. -/ theorem openSegment_subset_ball_of_ne (hx : x ∈ closedBall z r) (hy : y ∈ closedBall z r) (hne : x β‰  y) : openSegment ℝ x y βŠ† ball z r := (openSegment_subset_iff _).2 fun _ _ => combo_mem_ball_of_ne hx hy hne #align open_segment_subset_ball_of_ne openSegment_subset_ball_of_ne /-- If `x` and `y` are two distinct vectors of norm at most `r`, then a convex combination of `x` and `y` with positive coefficients has norm strictly less than `r`. -/ theorem norm_combo_lt_of_ne (hx : β€–xβ€– ≀ r) (hy : β€–yβ€– ≀ r) (hne : x β‰  y) (ha : 0 < a) (hb : 0 < b) (hab : a + b = 1) : β€–a β€’ x + b β€’ yβ€– < r := by simp only [← mem_ball_zero_iff, ← mem_closedBall_zero_iff] at hx hy ⊒ exact combo_mem_ball_of_ne hx hy hne ha hb hab #align norm_combo_lt_of_ne norm_combo_lt_of_ne /-- In a strictly convex space, if `x` and `y` are not in the same ray, then `β€–x + yβ€– < β€–xβ€– + β€–yβ€–`. -/ theorem norm_add_lt_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–x + yβ€– < β€–xβ€– + β€–yβ€– := by simp only [sameRay_iff_inv_norm_smul_eq, not_or, ← Ne.def] at h rcases h with ⟨hx, hy, hne⟩ rw [← norm_pos_iff] at hx hy have hxy : 0 < β€–xβ€– + β€–yβ€– := add_pos hx hy have := combo_mem_ball_of_ne (inv_norm_smul_mem_closed_unit_ball x) (inv_norm_smul_mem_closed_unit_ball y) hne (div_pos hx hxy) (div_pos hy hxy) (by rw [← add_div, div_self hxy.ne']) rwa [mem_ball_zero_iff, div_eq_inv_mul, div_eq_inv_mul, mul_smul, mul_smul, smul_inv_smulβ‚€ hx.ne', smul_inv_smulβ‚€ hy.ne', ← smul_add, norm_smul, Real.norm_of_nonneg (inv_pos.2 hxy).le, ← div_eq_inv_mul, div_lt_one hxy] at this #align norm_add_lt_of_not_same_ray norm_add_lt_of_not_sameRay theorem lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : β€–xβ€– - β€–yβ€– < β€–x - yβ€– := by nth_rw 1 [← sub_add_cancel x y] at h ⊒ exact sub_lt_iff_lt_add.2 (norm_add_lt_of_not_sameRay fun H' => h <| H'.add_left SameRay.rfl) #align lt_norm_sub_of_not_same_ray lt_norm_sub_of_not_sameRay theorem abs_lt_norm_sub_of_not_sameRay (h : Β¬SameRay ℝ x y) : |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := by refine' abs_sub_lt_iff.2 ⟨lt_norm_sub_of_not_sameRay h, _⟩ rw [norm_sub_rev] exact lt_norm_sub_of_not_sameRay (mt SameRay.symm h) #align abs_lt_norm_sub_of_not_same_ray abs_lt_norm_sub_of_not_sameRay /-- In a strictly convex space, two vectors `x`, `y` are in the same ray if and only if the triangle inequality for `x` and `y` becomes an equality. -/ theorem sameRay_iff_norm_add : SameRay ℝ x y ↔ β€–x + yβ€– = β€–xβ€– + β€–yβ€– := ⟨SameRay.norm_add, fun h => Classical.not_not.1 fun h' => (norm_add_lt_of_not_sameRay h').ne h⟩ #align same_ray_iff_norm_add sameRay_iff_norm_add /-- If `x` and `y` are two vectors in a strictly convex space have the same norm and the norm of their sum is equal to the sum of their norms, then they are equal. -/ theorem eq_of_norm_eq_of_norm_add_eq (h₁ : β€–xβ€– = β€–yβ€–) (hβ‚‚ : β€–x + yβ€– = β€–xβ€– + β€–yβ€–) : x = y := (sameRay_iff_norm_add.mpr hβ‚‚).eq_of_norm_eq h₁ #align eq_of_norm_eq_of_norm_add_eq eq_of_norm_eq_of_norm_add_eq /-- In a strictly convex space, two vectors `x`, `y` are not in the same ray if and only if the triangle inequality for `x` and `y` is strict. -/ theorem not_sameRay_iff_norm_add_lt : Β¬SameRay ℝ x y ↔ β€–x + yβ€– < β€–xβ€– + β€–yβ€– := sameRay_iff_norm_add.not.trans (norm_add_le _ _).lt_iff_ne.symm #align not_same_ray_iff_norm_add_lt not_sameRay_iff_norm_add_lt theorem sameRay_iff_norm_sub : SameRay ℝ x y ↔ β€–x - yβ€– = |β€–xβ€– - β€–yβ€–| := ⟨SameRay.norm_sub, fun h => Classical.not_not.1 fun h' => (abs_lt_norm_sub_of_not_sameRay h').ne' h⟩ #align same_ray_iff_norm_sub sameRay_iff_norm_sub theorem not_sameRay_iff_abs_lt_norm_sub : Β¬SameRay ℝ x y ↔ |β€–xβ€– - β€–yβ€–| < β€–x - yβ€– := sameRay_iff_norm_sub.not.trans <| ne_comm.trans (abs_norm_sub_norm_le _ _).lt_iff_ne.symm #align not_same_ray_iff_abs_lt_norm_sub not_sameRay_iff_abs_lt_norm_sub theorem norm_midpoint_lt_iff (h : β€–xβ€– = β€–yβ€–) : β€–(1 / 2 : ℝ) β€’ (x + y)β€– < β€–xβ€– ↔ x β‰  y := by
rw [norm_smul, Real.norm_of_nonneg (one_div_nonneg.2 zero_le_two), ← inv_eq_one_div, ← div_eq_inv_mul, div_lt_iff (zero_lt_two' ℝ), mul_two, ← not_sameRay_iff_of_norm_eq h, not_sameRay_iff_norm_add_lt, h]
theorem norm_midpoint_lt_iff (h : β€–xβ€– = β€–yβ€–) : β€–(1 / 2 : ℝ) β€’ (x + y)β€– < β€–xβ€– ↔ x β‰  y := by
Mathlib.Analysis.Convex.StrictConvexSpace.235_0.LKetms5NIkPrXf9
theorem norm_midpoint_lt_iff (h : β€–xβ€– = β€–yβ€–) : β€–(1 / 2 : ℝ) β€’ (x + y)β€– < β€–xβ€– ↔ x β‰  y
Mathlib_Analysis_Convex_StrictConvexSpace
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : t βŠ† s hs : Shatters π’œ s u : Finset Ξ± hu : u βŠ† t ⊒ βˆƒ u_1 ∈ π’œ, t ∩ u_1 = u
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by
obtain ⟨v, hv, rfl⟩ := hs (hu.trans h)
lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by
Mathlib.Combinatorics.SetFamily.Shatter.46_0.9SFN902fumqg7uv
lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t
Mathlib_Combinatorics_SetFamily_Shatter
case intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : t βŠ† s hs : Shatters π’œ s v : Finset Ξ± hv : v ∈ π’œ hu : s ∩ v βŠ† t ⊒ βˆƒ u ∈ π’œ, t ∩ u = s ∩ v
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h);
exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩
lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h);
Mathlib.Combinatorics.SetFamily.Shatter.46_0.9SFN902fumqg7uv
lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s✝ t✝ : Finset Ξ± a : Ξ± n : β„• x✝ : Finset.Nonempty π’œ t : Finset Ξ± ht : t βŠ† βˆ… s : Finset Ξ± hs : s ∈ π’œ ⊒ βˆ… ∩ s = t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by
rwa [empty_inter, eq_comm, ← subset_empty]
@[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by
Mathlib.Combinatorics.SetFamily.Shatter.58_0.9SFN902fumqg7uv
@[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s ⊒ (βˆƒ u ∈ π’œ, s ∩ u = t) β†’ t βŠ† s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by
rintro ⟨u, _, rfl⟩
protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by
Mathlib.Combinatorics.SetFamily.Shatter.61_0.9SFN902fumqg7uv
protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t
Mathlib_Combinatorics_SetFamily_Shatter
case intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s u : Finset Ξ± left✝ : u ∈ π’œ ⊒ s ∩ u βŠ† s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩;
exact inter_subset_left _ _
protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩;
Mathlib.Combinatorics.SetFamily.Shatter.61_0.9SFN902fumqg7uv
protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s ⊒ image (fun t => s ∩ t) π’œ = powerset s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by
ext t
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by
Mathlib.Combinatorics.SetFamily.Shatter.64_0.9SFN902fumqg7uv
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset
Mathlib_Combinatorics_SetFamily_Shatter
case a Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t✝ : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s t : Finset Ξ± ⊒ t ∈ image (fun t => s ∩ t) π’œ ↔ t ∈ powerset s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t;
rw [mem_image, mem_powerset, h.subset_iff]
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t;
Mathlib.Combinatorics.SetFamily.Shatter.64_0.9SFN902fumqg7uv
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t✝ : Finset Ξ± a : Ξ± n : β„• h : image (fun t => s ∩ t) π’œ = powerset s t : Finset Ξ± ht : t βŠ† s ⊒ βˆƒ u ∈ π’œ, s ∩ u = t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by
rwa [← mem_powerset, ← h, mem_image] at ht
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by
Mathlib.Combinatorics.SetFamily.Shatter.64_0.9SFN902fumqg7uv
lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝¹ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• inst✝ : Fintype Ξ± ⊒ Shatters π’œ univ ↔ π’œ = univ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by
rw [shatters_iff, powerset_univ]
@[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by
Mathlib.Combinatorics.SetFamily.Shatter.71_0.9SFN902fumqg7uv
@[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝¹ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• inst✝ : Fintype Ξ± ⊒ image (fun t => univ ∩ t) π’œ = univ ↔ π’œ = univ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ];
simp_rw [univ_inter, image_id']
@[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ];
Mathlib.Combinatorics.SetFamily.Shatter.71_0.9SFN902fumqg7uv
@[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• ⊒ s ∈ shatterer π’œ ↔ Shatters π’œ s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by
refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by
Mathlib.Combinatorics.SetFamily.Shatter.77_0.9SFN902fumqg7uv
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s ⊒ s ∈ Finset.biUnion π’œ powerset
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_
simp_rw [mem_biUnion, mem_powerset]
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_
Mathlib.Combinatorics.SetFamily.Shatter.77_0.9SFN902fumqg7uv
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : Shatters π’œ s ⊒ βˆƒ a ∈ π’œ, s βŠ† a
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset]
exact h.exists_superset
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset]
Mathlib.Combinatorics.SetFamily.Shatter.77_0.9SFN902fumqg7uv
@[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : π’œ βŠ† ℬ x✝ : Finset Ξ± ⊒ x✝ ∈ shatterer π’œ β†’ x✝ ∈ shatterer ℬ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by
simpa using Shatters.mono_left h
lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by
Mathlib.Combinatorics.SetFamily.Shatter.82_0.9SFN902fumqg7uv
lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœ ℬ : Finset (Finset Ξ±) s✝ t✝ : Finset Ξ± a : Ξ± n : β„• π’œ : Finset (Finset Ξ±) s t : Finset Ξ± ⊒ t ≀ s β†’ s ∈ ↑(shatterer π’œ) β†’ t ∈ ↑(shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by
simpa using Shatters.mono_right
@[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by
Mathlib.Combinatorics.SetFamily.Shatter.88_0.9SFN902fumqg7uv
@[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• ⊒ shatterer π’œ = π’œ ↔ IsLowerSet β†‘π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by
refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by
Mathlib.Combinatorics.SetFamily.Shatter.91_0.9SFN902fumqg7uv
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
case refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : shatterer π’œ = π’œ ⊒ IsLowerSet β†‘π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β·
rw [← h]
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β·
Mathlib.Combinatorics.SetFamily.Shatter.91_0.9SFN902fumqg7uv
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
case refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : shatterer π’œ = π’œ ⊒ IsLowerSet ↑(shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h]
exact isLowerSet_shatterer _
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h]
Mathlib.Combinatorics.SetFamily.Shatter.91_0.9SFN902fumqg7uv
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
case refine_2 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a : Ξ± n : β„• h : IsLowerSet β†‘π’œ s : Finset Ξ± hs : s ∈ shatterer π’œ ⊒ s ∈ π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β·
obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β·
Mathlib.Combinatorics.SetFamily.Shatter.91_0.9SFN902fumqg7uv
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
case refine_2.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s✝ t✝ : Finset Ξ± a : Ξ± n : β„• h : IsLowerSet β†‘π’œ s : Finset Ξ± hs : s ∈ shatterer π’œ t : Finset Ξ± ht : t ∈ π’œ hst : s βŠ† t ⊒ s ∈ π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset
exact h hst ht
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset
Mathlib.Combinatorics.SetFamily.Shatter.91_0.9SFN902fumqg7uv
@[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±))
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• ⊒ shatterer (shatterer π’œ) = shatterer π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by
simp
@[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by
Mathlib.Combinatorics.SetFamily.Shatter.98_0.9SFN902fumqg7uv
@[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• ⊒ Shatters (shatterer π’œ) s ↔ Shatters π’œ s
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by
simp_rw [← mem_shatterer, shatterer_idem]
@[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by
Mathlib.Combinatorics.SetFamily.Shatter.100_0.9SFN902fumqg7uv
@[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : βˆ€ t ∈ π’œ, a βˆ‰ t ht : Shatters π’œ t ⊒ a βˆ‰ t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by
obtain ⟨u, hu, htu⟩ := ht.exists_superset
private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by
Mathlib.Combinatorics.SetFamily.Shatter.105_0.9SFN902fumqg7uv
private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t
Mathlib_Combinatorics_SetFamily_Shatter
case intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• h : βˆ€ t ∈ π’œ, a βˆ‰ t ht : Shatters π’œ t u : Finset Ξ± hu : u ∈ π’œ htu : t βŠ† u ⊒ a βˆ‰ t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset;
exact not_mem_mono htu <| h u hu
private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset;
Mathlib.Combinatorics.SetFamily.Shatter.105_0.9SFN902fumqg7uv
private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t
Mathlib_Combinatorics_SetFamily_Shatter
Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• π’œ : Finset (Finset Ξ±) ⊒ card π’œ ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by
refine memberFamily_induction_on π’œ ?_ ?_ ?_
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• π’œ : Finset (Finset Ξ±) ⊒ card βˆ… ≀ card (shatterer βˆ…)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β·
simp
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_2 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• π’œ : Finset (Finset Ξ±) ⊒ card {βˆ…} ≀ card (shatterer {βˆ…})
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β·
rfl
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a : Ξ± n : β„• π’œ : Finset (Finset Ξ±) ⊒ βˆ€ (a : Ξ±) β¦ƒπ’œ : Finset (Finset Ξ±)⦄, card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) β†’ card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) β†’ card π’œ ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl
intros a π’œ ihβ‚€ ih₁
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ ℬ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ⊒ card π’œ ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁
set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a)
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card π’œ ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a)
have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a)
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case hℬ Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ))
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β·
refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case hℬ Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ ↑(shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) βŠ† {s | a βˆ‰ s}
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_
simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer]
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case hℬ Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ βˆ€ (x : Finset Ξ±), Shatters (memberSubfamily a π’œ) x β†’ Shatters (nonMemberSubfamily a π’œ) x β†’ a βˆ‰ x
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer]
exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2)
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer]
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card π’œ ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2)
rw [← card_memberSubfamily_add_card_nonMemberSubfamily a]
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2)
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card (memberSubfamily a π’œ) + card (nonMemberSubfamily a π’œ) ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a]
refine (add_le_add ih₁ ihβ‚€).trans ?_
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a]
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card (shatterer (memberSubfamily a π’œ)) + card (shatterer (nonMemberSubfamily a π’œ)) ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_
rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union]
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card (shatterer (memberSubfamily a π’œ) βˆͺ shatterer (nonMemberSubfamily a π’œ) βˆͺ ℬ) ≀ card (shatterer π’œ) case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ Disjoint (shatterer (memberSubfamily a π’œ) βˆͺ shatterer (nonMemberSubfamily a π’œ)) ℬ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union]
swap
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union]
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ Disjoint (shatterer (memberSubfamily a π’œ) βˆͺ shatterer (nonMemberSubfamily a π’œ)) ℬ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β·
simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and]
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ βˆ€ ⦃a_1 : Finset α⦄, Shatters (memberSubfamily a π’œ) a_1 ∨ Shatters (nonMemberSubfamily a π’œ) a_1 β†’ βˆ€ x ∈ shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ), Β¬insert a x = a_1
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and]
rintro _ (hs | hs) s - rfl
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and]
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.inl Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) (insert a s) ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β·
exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.inr Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (nonMemberSubfamily a π’œ) (insert a s) ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β·
exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ card (shatterer (memberSubfamily a π’œ) βˆͺ shatterer (nonMemberSubfamily a π’œ) βˆͺ ℬ) ≀ card (shatterer π’œ)
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _
refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ shatterer (memberSubfamily a π’œ) βŠ† shatterer π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β·
simp only [subset_iff, mem_shatterer]
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ βˆ€ ⦃x : Finset α⦄, Shatters (memberSubfamily a π’œ) x β†’ Shatters π’œ x
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer]
rintro s hs t ht
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer]
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t✝ : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s t : Finset Ξ± ht : t βŠ† s ⊒ βˆƒ u ∈ π’œ, s ∩ u = t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht
obtain ⟨u, hu, rfl⟩ := hs ht
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : u ∈ memberSubfamily a π’œ ht : s ∩ u βŠ† s ⊒ βˆƒ u_1 ∈ π’œ, s ∩ u_1 = s ∩ u
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht
rw [mem_memberSubfamily] at hu
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : insert a u ∈ π’œ ∧ a βˆ‰ u ht : s ∩ u βŠ† s ⊒ βˆƒ u_1 ∈ π’œ, s ∩ u_1 = s ∩ u
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu
refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : insert a u ∈ π’œ ∧ a βˆ‰ u ht : s ∩ u βŠ† s ha : a ∈ s ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩
obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : insert a u ∈ π’œ ∧ a βˆ‰ u ht : s ∩ u βŠ† s ha : a ∈ s v : Finset Ξ± hv : v ∈ memberSubfamily a π’œ hsv : s ∩ v = {a} ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha
rw [mem_memberSubfamily] at hv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : insert a u ∈ π’œ ∧ a βˆ‰ u ht : s ∩ u βŠ† s ha : a ∈ s v : Finset Ξ± hv : insert a v ∈ π’œ ∧ a βˆ‰ v hsv : s ∩ v = {a} ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv
rw [← singleton_subset_iff (a := a), ← hsv] at hv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_1.intro.intro.intro.intro Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : Shatters (memberSubfamily a π’œ) s u : Finset Ξ± hu : insert a u ∈ π’œ ∧ a βˆ‰ u ht : s ∩ u βŠ† s ha : a ∈ s v : Finset Ξ± hv : insert a v ∈ π’œ ∧ Β¬s ∩ v βŠ† v hsv : s ∩ v = {a} ⊒ False
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv
exact hv.2 <| inter_subset_right _ _
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_2 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s t : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) ⊒ ℬ βŠ† shatterer π’œ
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv exact hv.2 <| inter_subset_right _ _ Β·
refine forall_image.2 fun s hs ↦ mem_shatterer.2 fun t ht ↦ ?_
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv exact hv.2 <| inter_subset_right _ _ Β·
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter
case refine_3.refine_2 Ξ± : Type u_1 inst✝ : DecidableEq Ξ± π’œβœΒΉ β„¬βœ : Finset (Finset Ξ±) s✝ t✝ : Finset Ξ± a✝ : Ξ± n : β„• π’œβœ : Finset (Finset Ξ±) a : Ξ± π’œ : Finset (Finset Ξ±) ihβ‚€ : card (nonMemberSubfamily a π’œ) ≀ card (shatterer (nonMemberSubfamily a π’œ)) ih₁ : card (memberSubfamily a π’œ) ≀ card (shatterer (memberSubfamily a π’œ)) ℬ : Finset (Finset Ξ±) := image (insert a) (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) hℬ : card ℬ = card (shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ)) s : Finset Ξ± hs : s ∈ shatterer (memberSubfamily a π’œ) ∩ shatterer (nonMemberSubfamily a π’œ) t : Finset Ξ± ht : t βŠ† insert a s ⊒ βˆƒ u ∈ π’œ, insert a s ∩ u = t
/- Copyright (c) 2022 YaΓ«l Dillies. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: YaΓ«l Dillies -/ import Mathlib.Data.Finset.Sort import Mathlib.Data.Nat.Interval import Mathlib.Order.UpperLower.Basic import Mathlib.Combinatorics.SetFamily.Compression.Down /-! # Shattering families This file defines the shattering property and VC-dimension of set families. ## Main declarations * `Finset.Shatters`: The shattering property. * `Finset.shatterer`: The set family of sets shattered by a set family. * `Finset.vcDim`: The Vapnik-Chervonenkis dimension. ## TODO * Order-shattering * Strong shattering -/ open scoped BigOperators FinsetFamily namespace Finset variable {Ξ± : Type*} [DecidableEq Ξ±] {π’œ ℬ : Finset (Finset Ξ±)} {s t : Finset Ξ±} {a : Ξ±} {n : β„•} /-- A set family `π’œ` shatters a set `s` if all subsets of `s` can be obtained as the intersection of `s` and some element of the set family, and we denote this `π’œ.Shatters s`. We also say that `s` is *traced* by `π’œ`. -/ def Shatters (π’œ : Finset (Finset Ξ±)) (s : Finset Ξ±) : Prop := βˆ€ ⦃t⦄, t βŠ† s β†’ βˆƒ u ∈ π’œ, s ∩ u = t instance : DecidablePred π’œ.Shatters := fun _s ↦ decidableForallOfDecidableSubsets lemma Shatters.exists_inter_eq_singleton (hs : Shatters π’œ s) (ha : a ∈ s) : βˆƒ t ∈ π’œ, s ∩ t = {a} := hs <| singleton_subset_iff.2 ha lemma Shatters.mono_left (h : π’œ βŠ† ℬ) (hπ’œ : π’œ.Shatters s) : ℬ.Shatters s := fun _t ht ↦ let ⟨u, hu, hut⟩ := hπ’œ ht; ⟨u, h hu, hut⟩ lemma Shatters.mono_right (h : t βŠ† s) (hs : π’œ.Shatters s) : π’œ.Shatters t := fun u hu ↦ by obtain ⟨v, hv, rfl⟩ := hs (hu.trans h); exact ⟨v, hv, inf_congr_right hu <| inf_le_of_left_le h⟩ lemma Shatters.exists_superset (h : π’œ.Shatters s) : βˆƒ t ∈ π’œ, s βŠ† t := let ⟨t, ht, hst⟩ := h Subset.rfl; ⟨t, ht, inter_eq_left.1 hst⟩ lemma shatters_of_forall_subset (h : βˆ€ t, t βŠ† s β†’ t ∈ π’œ) : π’œ.Shatters s := fun t ht ↦ ⟨t, h _ ht, inter_eq_right.2 ht⟩ protected lemma Shatters.nonempty (h : π’œ.Shatters s) : π’œ.Nonempty := let ⟨t, ht, _⟩ := h Subset.rfl; ⟨t, ht⟩ @[simp] lemma shatters_empty : π’œ.Shatters βˆ… ↔ π’œ.Nonempty := ⟨Shatters.nonempty, fun ⟨s, hs⟩ t ht ↦ ⟨s, hs, by rwa [empty_inter, eq_comm, ← subset_empty]⟩⟩ protected lemma Shatters.subset_iff (h : π’œ.Shatters s) : t βŠ† s ↔ βˆƒ u ∈ π’œ, s ∩ u = t := ⟨fun ht ↦ h ht, by rintro ⟨u, _, rfl⟩; exact inter_subset_left _ _⟩ lemma shatters_iff : π’œ.Shatters s ↔ π’œ.image (fun t ↦ s ∩ t) = s.powerset := ⟨fun h ↦ by ext t; rw [mem_image, mem_powerset, h.subset_iff], fun h t ht ↦ by rwa [← mem_powerset, ← h, mem_image] at ht⟩ lemma univ_shatters [Fintype Ξ±] : univ.Shatters s := shatters_of_forall_subset <| fun _ _ ↦ mem_univ _ @[simp] lemma shatters_univ [Fintype Ξ±] : π’œ.Shatters univ ↔ π’œ = univ := by rw [shatters_iff, powerset_univ]; simp_rw [univ_inter, image_id'] /-- The set family of sets that are shattered by `π’œ`. -/ def shatterer (π’œ : Finset (Finset Ξ±)) : Finset (Finset Ξ±) := (π’œ.biUnion powerset).filter π’œ.Shatters @[simp] lemma mem_shatterer : s ∈ π’œ.shatterer ↔ π’œ.Shatters s := by refine mem_filter.trans <| and_iff_right_of_imp <| fun h ↦ ?_ simp_rw [mem_biUnion, mem_powerset] exact h.exists_superset lemma shatterer_mono (h : π’œ βŠ† ℬ) : π’œ.shatterer βŠ† ℬ.shatterer := fun _ ↦ by simpa using Shatters.mono_left h lemma subset_shatterer (h : IsLowerSet (π’œ : Set (Finset Ξ±))) : π’œ βŠ† π’œ.shatterer := fun _s hs ↦ mem_shatterer.2 <| fun t ht ↦ ⟨t, h ht hs, inter_eq_right.2 ht⟩ @[simp] lemma isLowerSet_shatterer (π’œ : Finset (Finset Ξ±)) : IsLowerSet (π’œ.shatterer : Set (Finset Ξ±)) := fun s t ↦ by simpa using Shatters.mono_right @[simp] lemma shatterer_eq : π’œ.shatterer = π’œ ↔ IsLowerSet (π’œ : Set (Finset Ξ±)) := by refine ⟨fun h ↦ ?_, fun h ↦ Subset.antisymm (fun s hs ↦ ?_) <| subset_shatterer h⟩ Β· rw [← h] exact isLowerSet_shatterer _ Β· obtain ⟨t, ht, hst⟩ := (mem_shatterer.1 hs).exists_superset exact h hst ht @[simp] lemma shatterer_idem : π’œ.shatterer.shatterer = π’œ.shatterer := by simp @[simp] lemma shatters_shatterer : π’œ.shatterer.Shatters s ↔ π’œ.Shatters s := by simp_rw [← mem_shatterer, shatterer_idem] protected alias ⟨_, Shatters.shatterer⟩ := shatters_shatterer private lemma aux (h : βˆ€ t ∈ π’œ, a βˆ‰ t) (ht : π’œ.Shatters t) : a βˆ‰ t := by obtain ⟨u, hu, htu⟩ := ht.exists_superset; exact not_mem_mono htu <| h u hu /-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv exact hv.2 <| inter_subset_right _ _ Β· refine forall_image.2 fun s hs ↦ mem_shatterer.2 fun t ht ↦ ?_
simp only [mem_inter, mem_shatterer] at hs
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card := by refine memberFamily_induction_on π’œ ?_ ?_ ?_ Β· simp Β· rfl intros a π’œ ihβ‚€ ih₁ set ℬ : Finset (Finset Ξ±) := ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).image (insert a) have hℬ : ℬ.card = ((memberSubfamily a π’œ).shatterer ∩ (nonMemberSubfamily a π’œ).shatterer).card Β· refine card_image_of_injOn <| insert_erase_invOn.2.injOn.mono ?_ simp only [coe_inter, Set.subset_def, Set.mem_inter_iff, mem_coe, Set.mem_setOf_eq, and_imp, mem_shatterer] exact fun s _ ↦ aux (fun t ht ↦ (mem_filter.1 ht).2) rw [← card_memberSubfamily_add_card_nonMemberSubfamily a] refine (add_le_add ih₁ ihβ‚€).trans ?_ rw [← card_union_add_card_inter, ← hℬ, ← card_disjoint_union] swap Β· simp only [disjoint_left, mem_union, mem_shatterer, mem_image, not_exists, not_and] rintro _ (hs | hs) s - rfl Β· exact aux (fun t ht ↦ (mem_memberSubfamily.1 ht).2) hs <| mem_insert_self _ _ Β· exact aux (fun t ht ↦ (mem_nonMemberSubfamily.1 ht).2) hs <| mem_insert_self _ _ refine card_mono <| union_subset (union_subset ?_ <| shatterer_mono <| filter_subset _ _) ?_ Β· simp only [subset_iff, mem_shatterer] rintro s hs t ht obtain ⟨u, hu, rfl⟩ := hs ht rw [mem_memberSubfamily] at hu refine ⟨insert a u, hu.1, inter_insert_of_not_mem fun ha ↦ ?_⟩ obtain ⟨v, hv, hsv⟩ := hs.exists_inter_eq_singleton ha rw [mem_memberSubfamily] at hv rw [← singleton_subset_iff (a := a), ← hsv] at hv exact hv.2 <| inter_subset_right _ _ Β· refine forall_image.2 fun s hs ↦ mem_shatterer.2 fun t ht ↦ ?_
Mathlib.Combinatorics.SetFamily.Shatter.108_0.9SFN902fumqg7uv
/-- Pajor's variant of the **Sauer-Shelah lemma**. -/ lemma card_le_card_shatterer (π’œ : Finset (Finset Ξ±)) : π’œ.card ≀ π’œ.shatterer.card
Mathlib_Combinatorics_SetFamily_Shatter