/-
Copyright (c) 2019 Alexander Bentkamp. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp, Yury Kudriashov, Yaël Dillies

! This file was ported from Lean 3 source module analysis.convex.basic
! leanprover-community/mathlib commit 9003f28797c0664a49e4179487267c494477d853
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Algebra.Order.Module
import Mathbin.Analysis.Convex.Star
import Mathbin.LinearAlgebra.AffineSpace.AffineSubspace

/-!
# Convex sets and functions in vector spaces

In a 𝕜-vector space, we define the following objects and properties.
* `convex 𝕜 s`: A set `s` is convex if for any two points `x y ∈ s` it includes `segment 𝕜 x y`.
* `std_simplex 𝕜 ι`: The standard simplex in `ι → 𝕜` (currently requires `fintype ι`). It is the
  intersection of the positive quadrant with the hyperplane `s.sum = 1`.

We also provide various equivalent versions of the definitions above, prove that some specific sets
are convex.

## TODO

Generalize all this file to affine spaces.
-/

variable {𝕜 E F β : Type _}

open LinearMap Set

open BigOperators Classical Convex Pointwise

/-! ### Convexity of sets -/

section OrderedSemiring

variable [OrderedSemiring 𝕜]

section AddCommMonoid

variable [AddCommMonoid E] [AddCommMonoid F]

section SMul

variable (𝕜) [SMul 𝕜 E] [SMul 𝕜 F] (s : Set E) {x : E}

#print Convex /-
/-- Convexity of sets. -/
def Convex : Prop :=
  ∀ ⦃x : E⦄, x ∈ s → StarConvex 𝕜 x s
#align convex Convex
-/

variable {𝕜 s}

/- warning: convex.star_convex -> Convex.starConvex is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E} {x : E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (StarConvex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 x s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E} {x : E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (StarConvex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 x s)
Case conversion may be inaccurate. Consider using '#align convex.star_convex Convex.starConvexₓ'. -/
theorem Convex.starConvex (hs : Convex 𝕜 s) (hx : x ∈ s) : StarConvex 𝕜 x s :=
  hs hx
#align convex.star_convex Convex.starConvex

/- warning: convex_iff_segment_subset -> convex_iff_segment_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) (forall {{x : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {{y : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (segment.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) (forall {{x : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {{y : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (segment.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s)))
Case conversion may be inaccurate. Consider using '#align convex_iff_segment_subset convex_iff_segment_subsetₓ'. -/
theorem convex_iff_segment_subset : Convex 𝕜 s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → [x -[𝕜] y] ⊆ s :=
  forall₂_congr fun x hx => starConvex_iff_segment_subset
#align convex_iff_segment_subset convex_iff_segment_subset

/- warning: convex.segment_subset -> Convex.segment_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {x : E} {y : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (segment.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {x : E} {y : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (segment.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s))
Case conversion may be inaccurate. Consider using '#align convex.segment_subset Convex.segment_subsetₓ'. -/
theorem Convex.segment_subset (h : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : y ∈ s) :
    [x -[𝕜] y] ⊆ s :=
  convex_iff_segment_subset.1 h hx hy
#align convex.segment_subset Convex.segment_subset

/- warning: convex.open_segment_subset -> Convex.openSegment_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {x : E} {y : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (openSegment.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {x : E} {y : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (openSegment.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 x y) s))
Case conversion may be inaccurate. Consider using '#align convex.open_segment_subset Convex.openSegment_subsetₓ'. -/
theorem Convex.openSegment_subset (h : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : y ∈ s) :
    openSegment 𝕜 x y ⊆ s :=
  (openSegment_subset_segment 𝕜 x y).trans (h.segment_subset hx hy)
#align convex.open_segment_subset Convex.openSegment_subset

/- warning: convex_iff_pointwise_add_subset -> convex_iff_pointwise_add_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) a) -> (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) b) -> (Eq.{succ u1} 𝕜 (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))))) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (HAdd.hAdd.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHAdd.{u2} (Set.{u2} E) (Set.add.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))))) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E _inst_4) a s) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E _inst_4) b s)) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) a) -> (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) b) -> (Eq.{succ u2} 𝕜 (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} (Set.{u1} E) (Set.{u1} E) (Set.{u1} E) (instHAdd.{u1} (Set.{u1} E) (Set.add.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2))))) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E _inst_4)) a s) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E _inst_4)) b s)) s))
Case conversion may be inaccurate. Consider using '#align convex_iff_pointwise_add_subset convex_iff_pointwise_add_subsetₓ'. -/
/-- Alternative definition of set convexity, in terms of pointwise set operations. -/
theorem convex_iff_pointwise_add_subset :
    Convex 𝕜 s ↔ ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → a + b = 1 → a • s + b • s ⊆ s :=
  Iff.intro
    (by
      rintro hA a b ha hb hab w ⟨au, bv, ⟨u, hu, rfl⟩, ⟨v, hv, rfl⟩, rfl⟩
      exact hA hu hv ha hb hab)
    fun h x hx y hy a b ha hb hab => (h ha hb hab) (Set.add_mem_add ⟨_, hx, rfl⟩ ⟨_, hy, rfl⟩)
#align convex_iff_pointwise_add_subset convex_iff_pointwise_add_subset

/- warning: convex.set_combo_subset -> Convex.set_combo_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) a) -> (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) b) -> (Eq.{succ u1} 𝕜 (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))))) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (HAdd.hAdd.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHAdd.{u2} (Set.{u2} E) (Set.add.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))))) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E _inst_4) a s) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E _inst_4) b s)) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) a) -> (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) b) -> (Eq.{succ u2} 𝕜 (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} (Set.{u1} E) (Set.{u1} E) (Set.{u1} E) (instHAdd.{u1} (Set.{u1} E) (Set.add.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2))))) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E _inst_4)) a s) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E _inst_4)) b s)) s))
Case conversion may be inaccurate. Consider using '#align convex.set_combo_subset Convex.set_combo_subsetₓ'. -/
alias convex_iff_pointwise_add_subset ↔ Convex.set_combo_subset _
#align convex.set_combo_subset Convex.set_combo_subset

/- warning: convex_empty -> convex_empty is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E], Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (EmptyCollection.emptyCollection.{u2} (Set.{u2} E) (Set.hasEmptyc.{u2} E))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E], Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 (EmptyCollection.emptyCollection.{u1} (Set.{u1} E) (Set.instEmptyCollectionSet.{u1} E))
Case conversion may be inaccurate. Consider using '#align convex_empty convex_emptyₓ'. -/
theorem convex_empty : Convex 𝕜 (∅ : Set E) := fun x => False.elim
#align convex_empty convex_empty

/- warning: convex_univ -> convex_univ is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E], Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (Set.univ.{u2} E)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : SMul.{u2, u1} 𝕜 E], Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 _inst_4 (Set.univ.{u1} E)
Case conversion may be inaccurate. Consider using '#align convex_univ convex_univₓ'. -/
theorem convex_univ : Convex 𝕜 (Set.univ : Set E) := fun _ _ => starConvex_univ _
#align convex_univ convex_univ

/- warning: convex.inter -> Convex.inter is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E} {t : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 t) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (Inter.inter.{u2} (Set.{u2} E) (Set.hasInter.{u2} E) s t))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {s : Set.{u2} E} {t : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 t) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (Inter.inter.{u2} (Set.{u2} E) (Set.instInterSet.{u2} E) s t))
Case conversion may be inaccurate. Consider using '#align convex.inter Convex.interₓ'. -/
theorem Convex.inter {t : Set E} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) : Convex 𝕜 (s ∩ t) :=
  fun x hx => (hs hx.1).inter (ht hx.2)
#align convex.inter Convex.inter

#print convex_interₛ /-
theorem convex_interₛ {S : Set (Set E)} (h : ∀ s ∈ S, Convex 𝕜 s) : Convex 𝕜 (⋂₀ S) := fun x hx =>
  starConvex_interₛ fun s hs => h _ hs <| hx _ hs
#align convex_sInter convex_interₛ
-/

#print convex_interᵢ /-
theorem convex_interᵢ {ι : Sort _} {s : ι → Set E} (h : ∀ i, Convex 𝕜 (s i)) :
    Convex 𝕜 (⋂ i, s i) :=
  interₛ_range s ▸ convex_interₛ <| forall_range_iff.2 h
#align convex_Inter convex_interᵢ
-/

/- warning: convex_Inter₂ -> convex_interᵢ₂ is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {ι : Sort.{u3}} {κ : ι -> Sort.{u4}} {s : forall (i : ι), (κ i) -> (Set.{u2} E)}, (forall (i : ι) (j : κ i), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (s i j)) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (Set.interᵢ.{u2, u3} E ι (fun (i : ι) => Set.interᵢ.{u2, u4} E (κ i) (fun (j : κ i) => s i j))))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : SMul.{u1, u2} 𝕜 E] {ι : Sort.{u4}} {κ : ι -> Sort.{u3}} {s : forall (i : ι), (κ i) -> (Set.{u2} E)}, (forall (i : ι) (j : κ i), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (s i j)) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 (Set.interᵢ.{u2, u4} E ι (fun (i : ι) => Set.interᵢ.{u2, u3} E (κ i) (fun (j : κ i) => s i j))))
Case conversion may be inaccurate. Consider using '#align convex_Inter₂ convex_interᵢ₂ₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem convex_interᵢ₂ {ι : Sort _} {κ : ι → Sort _} {s : ∀ i, κ i → Set E}
    (h : ∀ i j, Convex 𝕜 (s i j)) : Convex 𝕜 (⋂ (i) (j), s i j) :=
  convex_interᵢ fun i => convex_interᵢ <| h i
#align convex_Inter₂ convex_interᵢ₂

/- warning: convex.prod -> Convex.prod is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : SMul.{u1, u2} 𝕜 E] [_inst_5 : SMul.{u1, u3} 𝕜 F] {s : Set.{u2} E} {t : Set.{u3} F}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Convex.{u1, u3} 𝕜 F _inst_1 _inst_3 _inst_5 t) -> (Convex.{u1, max u2 u3} 𝕜 (Prod.{u2, u3} E F) _inst_1 (Prod.addCommMonoid.{u2, u3} E F _inst_2 _inst_3) (Prod.smul.{u1, u2, u3} 𝕜 E F _inst_4 _inst_5) (Set.prod.{u2, u3} E F s t))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {F : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u3} E] [_inst_3 : AddCommMonoid.{u2} F] [_inst_4 : SMul.{u1, u3} 𝕜 E] [_inst_5 : SMul.{u1, u2} 𝕜 F] {s : Set.{u3} E} {t : Set.{u2} F}, (Convex.{u1, u3} 𝕜 E _inst_1 _inst_2 _inst_4 s) -> (Convex.{u1, u2} 𝕜 F _inst_1 _inst_3 _inst_5 t) -> (Convex.{u1, max u2 u3} 𝕜 (Prod.{u3, u2} E F) _inst_1 (Prod.instAddCommMonoidSum.{u3, u2} E F _inst_2 _inst_3) (Prod.smul.{u1, u3, u2} 𝕜 E F _inst_4 _inst_5) (Set.prod.{u3, u2} E F s t))
Case conversion may be inaccurate. Consider using '#align convex.prod Convex.prodₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem Convex.prod {s : Set E} {t : Set F} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) :
    Convex 𝕜 (s ×ˢ t) := fun x hx => (hs hx.1).Prod (ht hx.2)
#align convex.prod Convex.prod

/- warning: convex_pi -> convex_pi is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} 𝕜] {ι : Type.{u2}} {E : ι -> Type.{u3}} [_inst_6 : forall (i : ι), AddCommMonoid.{u3} (E i)] [_inst_7 : forall (i : ι), SMul.{u1, u3} 𝕜 (E i)] {s : Set.{u2} ι} {t : forall (i : ι), Set.{u3} (E i)}, (forall {{i : ι}}, (Membership.Mem.{u2, u2} ι (Set.{u2} ι) (Set.hasMem.{u2} ι) i s) -> (Convex.{u1, u3} 𝕜 (E i) _inst_1 (_inst_6 i) (_inst_7 i) (t i))) -> (Convex.{u1, max u2 u3} 𝕜 (forall (i : ι), E i) _inst_1 (Pi.addCommMonoid.{u2, u3} ι (fun (i : ι) => E i) (fun (i : ι) => _inst_6 i)) (Pi.instSMul.{u2, u3, u1} ι 𝕜 (fun (i : ι) => E i) (fun (i : ι) => _inst_7 i)) (Set.pi.{u2, u3} ι (fun (i : ι) => E i) s t))
but is expected to have type
  forall {𝕜 : Type.{u1}} [_inst_1 : OrderedSemiring.{u1} 𝕜] {ι : Type.{u3}} {E : ι -> Type.{u2}} [_inst_6 : forall (i : ι), AddCommMonoid.{u2} (E i)] [_inst_7 : forall (i : ι), SMul.{u1, u2} 𝕜 (E i)] {s : Set.{u3} ι} {t : forall (i : ι), Set.{u2} (E i)}, (forall {{i : ι}}, (Membership.mem.{u3, u3} ι (Set.{u3} ι) (Set.instMembershipSet.{u3} ι) i s) -> (Convex.{u1, u2} 𝕜 (E i) _inst_1 (_inst_6 i) (_inst_7 i) (t i))) -> (Convex.{u1, max u3 u2} 𝕜 (forall (i : ι), E i) _inst_1 (Pi.addCommMonoid.{u3, u2} ι (fun (i : ι) => E i) (fun (i : ι) => _inst_6 i)) (Pi.instSMul.{u3, u2, u1} ι 𝕜 (fun (i : ι) => E i) (fun (i : ι) => _inst_7 i)) (Set.pi.{u3, u2} ι (fun (i : ι) => E i) s t))
Case conversion may be inaccurate. Consider using '#align convex_pi convex_piₓ'. -/
theorem convex_pi {ι : Type _} {E : ι → Type _} [∀ i, AddCommMonoid (E i)] [∀ i, SMul 𝕜 (E i)]
    {s : Set ι} {t : ∀ i, Set (E i)} (ht : ∀ ⦃i⦄, i ∈ s → Convex 𝕜 (t i)) : Convex 𝕜 (s.pi t) :=
  fun x hx => starConvex_pi fun i hi => ht hi <| hx _ hi
#align convex_pi convex_pi

#print Directed.convex_unionᵢ /-
theorem Directed.convex_unionᵢ {ι : Sort _} {s : ι → Set E} (hdir : Directed (· ⊆ ·) s)
    (hc : ∀ ⦃i : ι⦄, Convex 𝕜 (s i)) : Convex 𝕜 (⋃ i, s i) :=
  by
  rintro x hx y hy a b ha hb hab
  rw [mem_Union] at hx hy⊢
  obtain ⟨i, hx⟩ := hx
  obtain ⟨j, hy⟩ := hy
  obtain ⟨k, hik, hjk⟩ := hdir i j
  exact ⟨k, hc (hik hx) (hjk hy) ha hb hab⟩
#align directed.convex_Union Directed.convex_unionᵢ
-/

#print DirectedOn.convex_unionₛ /-
theorem DirectedOn.convex_unionₛ {c : Set (Set E)} (hdir : DirectedOn (· ⊆ ·) c)
    (hc : ∀ ⦃A : Set E⦄, A ∈ c → Convex 𝕜 A) : Convex 𝕜 (⋃₀ c) :=
  by
  rw [sUnion_eq_Union]
  exact (directedOn_iff_directed.1 hdir).convex_unionᵢ fun A => hc A.2
#align directed_on.convex_sUnion DirectedOn.convex_unionₛ
-/

end SMul

section Module

variable [Module 𝕜 E] [Module 𝕜 F] {s : Set E} {x : E}

/- warning: convex_iff_open_segment_subset -> convex_iff_openSegment_subset is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (forall {{x : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {{y : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (HasSubset.Subset.{u2} (Set.{u2} E) (Set.hasSubset.{u2} E) (openSegment.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) x y) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (forall {{x : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {{y : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (HasSubset.Subset.{u1} (Set.{u1} E) (Set.instHasSubsetSet.{u1} E) (openSegment.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) x y) s)))
Case conversion may be inaccurate. Consider using '#align convex_iff_open_segment_subset convex_iff_openSegment_subsetₓ'. -/
theorem convex_iff_openSegment_subset :
    Convex 𝕜 s ↔ ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → openSegment 𝕜 x y ⊆ s :=
  forall₂_congr fun x => starConvex_iff_openSegment_subset
#align convex_iff_open_segment_subset convex_iff_openSegment_subset

/- warning: convex_iff_forall_pos -> convex_iff_forall_pos is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (forall {{x : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {{y : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LT.lt.{u1} 𝕜 (Preorder.toLT.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) a) -> (LT.lt.{u1} 𝕜 (Preorder.toLT.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) b) -> (Eq.{succ u1} 𝕜 (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))))) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) a x) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) b y)) s))))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (forall {{x : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {{y : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LT.lt.{u2} 𝕜 (Preorder.toLT.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) a) -> (LT.lt.{u2} 𝕜 (Preorder.toLT.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) b) -> (Eq.{succ u2} 𝕜 (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4))))) a x) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4))))) b y)) s))))
Case conversion may be inaccurate. Consider using '#align convex_iff_forall_pos convex_iff_forall_posₓ'. -/
theorem convex_iff_forall_pos :
    Convex 𝕜 s ↔
      ∀ ⦃x⦄, x ∈ s → ∀ ⦃y⦄, y ∈ s → ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1 → a • x + b • y ∈ s :=
  forall₂_congr fun x => starConvex_iff_forall_pos
#align convex_iff_forall_pos convex_iff_forall_pos

/- warning: convex_iff_pairwise_pos -> convex_iff_pairwise_pos is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (Set.Pairwise.{u2} E s (fun (x : E) (y : E) => forall {{a : 𝕜}} {{b : 𝕜}}, (LT.lt.{u1} 𝕜 (Preorder.toLT.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) a) -> (LT.lt.{u1} 𝕜 (Preorder.toLT.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) b) -> (Eq.{succ u1} 𝕜 (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))))) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) a x) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) b y)) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) (Set.Pairwise.{u1} E s (fun (x : E) (y : E) => forall {{a : 𝕜}} {{b : 𝕜}}, (LT.lt.{u2} 𝕜 (Preorder.toLT.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) a) -> (LT.lt.{u2} 𝕜 (Preorder.toLT.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) b) -> (Eq.{succ u2} 𝕜 (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))) a b) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4))))) a x) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4))))) b y)) s)))
Case conversion may be inaccurate. Consider using '#align convex_iff_pairwise_pos convex_iff_pairwise_posₓ'. -/
theorem convex_iff_pairwise_pos :
    Convex 𝕜 s ↔ s.Pairwise fun x y => ∀ ⦃a b : 𝕜⦄, 0 < a → 0 < b → a + b = 1 → a • x + b • y ∈ s :=
  by
  refine' convex_iff_forall_pos.trans ⟨fun h x hx y hy _ => h hx hy, _⟩
  intro h x hx y hy a b ha hb hab
  obtain rfl | hxy := eq_or_ne x y
  · rwa [Convex.combo_self hab]
  · exact h hx hy hxy ha hb hab
#align convex_iff_pairwise_pos convex_iff_pairwise_pos

/- warning: convex.star_convex_iff -> Convex.starConvex_iff is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E} {x : E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (Set.Nonempty.{u2} E s) -> (Iff (StarConvex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) x s) (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E} {x : E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (Set.Nonempty.{u1} E s) -> (Iff (StarConvex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) x s) (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s))
Case conversion may be inaccurate. Consider using '#align convex.star_convex_iff Convex.starConvex_iffₓ'. -/
theorem Convex.starConvex_iff (hs : Convex 𝕜 s) (h : s.Nonempty) : StarConvex 𝕜 x s ↔ x ∈ s :=
  ⟨fun hxs => hxs.Mem h, hs.StarConvex⟩
#align convex.star_convex_iff Convex.starConvex_iff

#print Set.Subsingleton.convex /-
protected theorem Set.Subsingleton.convex {s : Set E} (h : s.Subsingleton) : Convex 𝕜 s :=
  convex_iff_pairwise_pos.mpr (h.Pairwise _)
#align set.subsingleton.convex Set.Subsingleton.convex
-/

/- warning: convex_singleton -> convex_singleton is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] (c : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Singleton.singleton.{u2, u2} E (Set.{u2} E) (Set.hasSingleton.{u2} E) c)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] (c : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Singleton.singleton.{u1, u1} E (Set.{u1} E) (Set.instSingletonSet.{u1} E) c)
Case conversion may be inaccurate. Consider using '#align convex_singleton convex_singletonₓ'. -/
theorem convex_singleton (c : E) : Convex 𝕜 ({c} : Set E) :=
  subsingleton_singleton.Convex
#align convex_singleton convex_singleton

/- warning: convex_segment -> convex_segment is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] (x : E) (y : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (segment.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) x y)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] (x : E) (y : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (segment.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) x y)
Case conversion may be inaccurate. Consider using '#align convex_segment convex_segmentₓ'. -/
theorem convex_segment (x y : E) : Convex 𝕜 [x -[𝕜] y] :=
  by
  rintro p ⟨ap, bp, hap, hbp, habp, rfl⟩ q ⟨aq, bq, haq, hbq, habq, rfl⟩ a b ha hb hab
  refine'
    ⟨a * ap + b * aq, a * bp + b * bq, add_nonneg (mul_nonneg ha hap) (mul_nonneg hb haq),
      add_nonneg (mul_nonneg ha hbp) (mul_nonneg hb hbq), _, _⟩
  · rw [add_add_add_comm, ← mul_add, ← mul_add, habp, habq, mul_one, mul_one, hab]
  · simp_rw [add_smul, mul_smul, smul_add]
    exact add_add_add_comm _ _ _ _
#align convex_segment convex_segment

/- warning: convex.linear_image -> Convex.linear_image is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (f : LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5), Convex.{u1, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3 _inst_5)))) (Set.image.{u2, u3} E F (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) (fun (_x : LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) => E -> F) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} 𝕜 𝕜 E F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))) f) s))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {F : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u1} F] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_3] {s : Set.{u2} E}, (Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (f : LinearMap.{u3, u3, u2, u1} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (RingHom.id.{u3} 𝕜 (Semiring.toNonAssocSemiring.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5), Convex.{u3, u1} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toSMul.{u3, u1} 𝕜 F (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (SMulWithZero.toSMulZeroClass.{u3, u1} 𝕜 F (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 F (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (Module.toMulActionWithZero.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_3 _inst_5)))) (Set.image.{u2, u1} E F (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (LinearMap.{u3, u3, u2, u1} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (RingHom.id.{u3} 𝕜 (Semiring.toNonAssocSemiring.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) E (fun (_x : E) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : E) => F) _x) (LinearMap.instFunLikeLinearMap.{u3, u3, u2, u1} 𝕜 𝕜 E F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 (RingHom.id.{u3} 𝕜 (Semiring.toNonAssocSemiring.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)))) f) s))
Case conversion may be inaccurate. Consider using '#align convex.linear_image Convex.linear_imageₓ'. -/
theorem Convex.linear_image (hs : Convex 𝕜 s) (f : E →ₗ[𝕜] F) : Convex 𝕜 (f '' s) :=
  by
  intro x hx y hy a b ha hb hab
  obtain ⟨x', hx', rfl⟩ := mem_image_iff_bex.1 hx
  obtain ⟨y', hy', rfl⟩ := mem_image_iff_bex.1 hy
  exact ⟨a • x' + b • y', hs hx' hy' ha hb hab, by rw [f.map_add, f.map_smul, f.map_smul]⟩
#align convex.linear_image Convex.linear_image

/- warning: convex.is_linear_image -> Convex.is_linear_image is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall {f : E -> F}, (IsLinearMap.{u1, u2, u3} 𝕜 E F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 f) -> (Convex.{u1, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3 _inst_5)))) (Set.image.{u2, u3} E F f s)))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {F : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u1} F] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_3] {s : Set.{u2} E}, (Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall {f : E -> F}, (IsLinearMap.{u3, u2, u1} 𝕜 E F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 f) -> (Convex.{u3, u1} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toSMul.{u3, u1} 𝕜 F (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (SMulWithZero.toSMulZeroClass.{u3, u1} 𝕜 F (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 F (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} F (AddCommMonoid.toAddMonoid.{u1} F _inst_3)) (Module.toMulActionWithZero.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_3 _inst_5)))) (Set.image.{u2, u1} E F f s)))
Case conversion may be inaccurate. Consider using '#align convex.is_linear_image Convex.is_linear_imageₓ'. -/
theorem Convex.is_linear_image (hs : Convex 𝕜 s) {f : E → F} (hf : IsLinearMap 𝕜 f) :
    Convex 𝕜 (f '' s) :=
  hs.linear_image <| hf.mk' f
#align convex.is_linear_image Convex.is_linear_image

/- warning: convex.linear_preimage -> Convex.linear_preimage is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3] {s : Set.{u3} F}, (Convex.{u1, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3 _inst_5)))) s) -> (forall (f : LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u2, u3} E F (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) (fun (_x : LinearMap.{u1, u1, u2, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) => E -> F) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} 𝕜 𝕜 E F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 (RingHom.id.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))) f) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u2, u3} 𝕜 F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_3] {s : Set.{u3} F}, (Convex.{u2, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toSMul.{u2, u3} 𝕜 F (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (SMulWithZero.toSMulZeroClass.{u2, u3} 𝕜 F (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (MulActionWithZero.toSMulWithZero.{u2, u3} 𝕜 F (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (Module.toMulActionWithZero.{u2, u3} 𝕜 F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_3 _inst_5)))) s) -> (forall (f : LinearMap.{u2, u2, u1, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (RingHom.id.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u1, u3} E F (FunLike.coe.{max (succ u1) (succ u3), succ u1, succ u3} (LinearMap.{u2, u2, u1, u3} 𝕜 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (RingHom.id.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) E F _inst_2 _inst_3 _inst_4 _inst_5) E (fun (_x : E) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : E) => F) _x) (LinearMap.instFunLikeLinearMap.{u2, u2, u1, u3} 𝕜 𝕜 E F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 (RingHom.id.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))) f) s))
Case conversion may be inaccurate. Consider using '#align convex.linear_preimage Convex.linear_preimageₓ'. -/
theorem Convex.linear_preimage {s : Set F} (hs : Convex 𝕜 s) (f : E →ₗ[𝕜] F) : Convex 𝕜 (f ⁻¹' s) :=
  by
  intro x hx y hy a b ha hb hab
  rw [mem_preimage, f.map_add, f.map_smul, f.map_smul]
  exact hs hx hy ha hb hab
#align convex.linear_preimage Convex.linear_preimage

/- warning: convex.is_linear_preimage -> Convex.is_linear_preimage is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3] {s : Set.{u3} F}, (Convex.{u1, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_3 _inst_5)))) s) -> (forall {f : E -> F}, (IsLinearMap.{u1, u2, u3} 𝕜 E F (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 f) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u2, u3} E F f s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} {F : Type.{u3}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_3 : AddCommMonoid.{u3} F] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] [_inst_5 : Module.{u2, u3} 𝕜 F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_3] {s : Set.{u3} F}, (Convex.{u2, u3} 𝕜 F _inst_1 _inst_3 (SMulZeroClass.toSMul.{u2, u3} 𝕜 F (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (SMulWithZero.toSMulZeroClass.{u2, u3} 𝕜 F (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (MulActionWithZero.toSMulWithZero.{u2, u3} 𝕜 F (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} F (AddCommMonoid.toAddMonoid.{u3} F _inst_3)) (Module.toMulActionWithZero.{u2, u3} 𝕜 F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_3 _inst_5)))) s) -> (forall {f : E -> F}, (IsLinearMap.{u2, u1, u3} 𝕜 E F (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3 _inst_4 _inst_5 f) -> (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u1, u3} E F f s)))
Case conversion may be inaccurate. Consider using '#align convex.is_linear_preimage Convex.is_linear_preimageₓ'. -/
theorem Convex.is_linear_preimage {s : Set F} (hs : Convex 𝕜 s) {f : E → F} (hf : IsLinearMap 𝕜 f) :
    Convex 𝕜 (f ⁻¹' s) :=
  hs.linear_preimage <| hf.mk' f
#align convex.is_linear_preimage Convex.is_linear_preimage

/- warning: convex.add -> Convex.add is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E} {t : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) t) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (HAdd.hAdd.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHAdd.{u2} (Set.{u2} E) (Set.add.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))))) s t))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E} {t : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u1, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u2} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u1, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u2} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) t) -> (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u1, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u1, u2} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (HAdd.hAdd.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHAdd.{u2} (Set.{u2} E) (Set.add.{u2} E (AddZeroClass.toAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))))) s t))
Case conversion may be inaccurate. Consider using '#align convex.add Convex.addₓ'. -/
theorem Convex.add {t : Set E} (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) : Convex 𝕜 (s + t) :=
  by
  rw [← add_image_prod]
  exact (hs.prod ht).is_linear_image IsLinearMap.isLinearMap_add
#align convex.add Convex.add

/- warning: convex.vadd -> Convex.vadd is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (VAdd.vadd.{u2, u2} E (Set.{u2} E) (Set.vaddSet.{u2, u2} E E (Add.toVAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))))) z s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (HVAdd.hVAdd.{u1, u1, u1} E (Set.{u1} E) (Set.{u1} E) (instHVAdd.{u1, u1} E (Set.{u1} E) (Set.vaddSet.{u1, u1} E E (AddAction.toVAdd.{u1, u1} E E (AddCommMonoid.toAddMonoid.{u1} E _inst_2) (AddMonoid.toAddAction.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2))))) z s))
Case conversion may be inaccurate. Consider using '#align convex.vadd Convex.vaddₓ'. -/
theorem Convex.vadd (hs : Convex 𝕜 s) (z : E) : Convex 𝕜 (z +ᵥ s) :=
  by
  simp_rw [← image_vadd, vadd_eq_add, ← singleton_add]
  exact (convex_singleton _).add hs
#align convex.vadd Convex.vadd

/- warning: convex.translate -> Convex.translate is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.image.{u2, u2} E E (fun (x : E) => HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) z x) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.image.{u1, u1} E E (fun (x : E) => HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) z x) s))
Case conversion may be inaccurate. Consider using '#align convex.translate Convex.translateₓ'. -/
theorem Convex.translate (hs : Convex 𝕜 s) (z : E) : Convex 𝕜 ((fun x => z + x) '' s) :=
  hs.vadd _
#align convex.translate Convex.translate

/- warning: convex.translate_preimage_right -> Convex.translate_preimage_right is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u2, u2} E E (fun (x : E) => HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) z x) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u1, u1} E E (fun (x : E) => HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) z x) s))
Case conversion may be inaccurate. Consider using '#align convex.translate_preimage_right Convex.translate_preimage_rightₓ'. -/
/-- The translation of a convex set is also convex. -/
theorem Convex.translate_preimage_right (hs : Convex 𝕜 s) (z : E) :
    Convex 𝕜 ((fun x => z + x) ⁻¹' s) :=
  by
  intro x hx y hy a b ha hb hab
  have h := hs hx hy ha hb hab
  rwa [smul_add, smul_add, add_add_add_comm, ← add_smul, hab, one_smul] at h
#align convex.translate_preimage_right Convex.translate_preimage_right

/- warning: convex.translate_preimage_left -> Convex.translate_preimage_left is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u2, u2} E E (fun (x : E) => HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) x z) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) s) -> (forall (z : E), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_4)))) (Set.preimage.{u1, u1} E E (fun (x : E) => HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) x z) s))
Case conversion may be inaccurate. Consider using '#align convex.translate_preimage_left Convex.translate_preimage_leftₓ'. -/
/-- The translation of a convex set is also convex. -/
theorem Convex.translate_preimage_left (hs : Convex 𝕜 s) (z : E) :
    Convex 𝕜 ((fun x => x + z) ⁻¹' s) := by
  simpa only [add_comm] using hs.translate_preimage_right z
#align convex.translate_preimage_left Convex.translate_preimage_left

section OrderedAddCommMonoid

variable [OrderedAddCommMonoid β] [Module 𝕜 β] [OrderedSMul 𝕜 β]

/- warning: convex_Iic -> convex_Iic is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Iic.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Iic.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r)
Case conversion may be inaccurate. Consider using '#align convex_Iic convex_Iicₓ'. -/
theorem convex_Iic (r : β) : Convex 𝕜 (Iic r) := fun x hx y hy a b ha hb hab =>
  calc
    a • x + b • y ≤ a • r + b • r :=
      add_le_add (smul_le_smul_of_nonneg hx ha) (smul_le_smul_of_nonneg hy hb)
    _ = r := Convex.combo_self hab _

#align convex_Iic convex_Iic

/- warning: convex_Ici -> convex_Ici is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Ici.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Ici.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r)
Case conversion may be inaccurate. Consider using '#align convex_Ici convex_Iciₓ'. -/
theorem convex_Ici (r : β) : Convex 𝕜 (Ici r) :=
  @convex_Iic 𝕜 βᵒᵈ _ _ _ _ r
#align convex_Ici convex_Ici

/- warning: convex_Icc -> convex_Icc is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Icc.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Icc.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r s)
Case conversion may be inaccurate. Consider using '#align convex_Icc convex_Iccₓ'. -/
theorem convex_Icc (r s : β) : Convex 𝕜 (Icc r s) :=
  Ici_inter_Iic.subst ((convex_Ici r).inter <| convex_Iic s)
#align convex_Icc convex_Icc

/- warning: convex_halfspace_le -> convex_halfspace_le is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u3} β] [_inst_7 : Module.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u3} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} β (AddMonoid.toAddZeroClass.{u3} β (AddCommMonoid.toAddMonoid.{u3} β (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u1, u2, u3} 𝕜 E β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_6))) (f w) r)))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u3, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 β (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u3, u2, u1} 𝕜 E β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedAddCommMonoid.toPartialOrder.{u1} β _inst_6))) (f w) r)))
Case conversion may be inaccurate. Consider using '#align convex_halfspace_le convex_halfspace_leₓ'. -/
theorem convex_halfspace_le {f : E → β} (h : IsLinearMap 𝕜 f) (r : β) : Convex 𝕜 { w | f w ≤ r } :=
  (convex_Iic r).is_linear_preimage h
#align convex_halfspace_le convex_halfspace_le

/- warning: convex_halfspace_ge -> convex_halfspace_ge is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u3} β] [_inst_7 : Module.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u3} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} β (AddMonoid.toAddZeroClass.{u3} β (AddCommMonoid.toAddMonoid.{u3} β (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u1, u2, u3} 𝕜 E β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_6))) r (f w))))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u3, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 β (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u3, u2, u1} 𝕜 E β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedAddCommMonoid.toPartialOrder.{u1} β _inst_6))) r (f w))))
Case conversion may be inaccurate. Consider using '#align convex_halfspace_ge convex_halfspace_geₓ'. -/
theorem convex_halfspace_ge {f : E → β} (h : IsLinearMap 𝕜 f) (r : β) : Convex 𝕜 { w | r ≤ f w } :=
  (convex_Ici r).is_linear_preimage h
#align convex_halfspace_ge convex_halfspace_ge

/- warning: convex_hyperplane -> convex_hyperplane is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u3} β] [_inst_7 : Module.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u3} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} β (AddMonoid.toAddZeroClass.{u3} β (AddCommMonoid.toAddMonoid.{u3} β (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u1, u2, u3} 𝕜 E β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => Eq.{succ u3} β (f w) r)))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u3, u1} 𝕜 β _inst_1 _inst_6 (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 β (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u3, u2, u1} 𝕜 E β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 (OrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => Eq.{succ u1} β (f w) r)))
Case conversion may be inaccurate. Consider using '#align convex_hyperplane convex_hyperplaneₓ'. -/
theorem convex_hyperplane {f : E → β} (h : IsLinearMap 𝕜 f) (r : β) : Convex 𝕜 { w | f w = r } :=
  by
  simp_rw [le_antisymm_iff]
  exact (convex_halfspace_le h r).inter (convex_halfspace_ge h r)
#align convex_hyperplane convex_hyperplane

end OrderedAddCommMonoid

section OrderedCancelAddCommMonoid

variable [OrderedCancelAddCommMonoid β] [Module 𝕜 β] [OrderedSMul 𝕜 β]

/- warning: convex_Iio -> convex_Iio is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Iio.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedCancelAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Iio.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r)
Case conversion may be inaccurate. Consider using '#align convex_Iio convex_Iioₓ'. -/
theorem convex_Iio (r : β) : Convex 𝕜 (Iio r) :=
  by
  intro x hx y hy a b ha hb hab
  obtain rfl | ha' := ha.eq_or_lt
  · rw [zero_add] at hab
    rwa [zero_smul, zero_add, hab, one_smul]
  rw [mem_Iio] at hx hy
  calc
    a • x + b • y < a • r + b • r :=
      add_lt_add_of_lt_of_le (smul_lt_smul_of_pos hx ha') (smul_le_smul_of_nonneg hy.le hb)
    _ = r := Convex.combo_self hab _

#align convex_Iio convex_Iio

/- warning: convex_Ioi -> convex_Ioi is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Ioi.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedCancelAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Ioi.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r)
Case conversion may be inaccurate. Consider using '#align convex_Ioi convex_Ioiₓ'. -/
theorem convex_Ioi (r : β) : Convex 𝕜 (Ioi r) :=
  @convex_Iio 𝕜 βᵒᵈ _ _ _ _ r
#align convex_Ioi convex_Ioi

/- warning: convex_Ioo -> convex_Ioo is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Ioo.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedCancelAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Ioo.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r s)
Case conversion may be inaccurate. Consider using '#align convex_Ioo convex_Iooₓ'. -/
theorem convex_Ioo (r s : β) : Convex 𝕜 (Ioo r s) :=
  Ioi_inter_Iio.subst ((convex_Ioi r).inter <| convex_Iio s)
#align convex_Ioo convex_Ioo

/- warning: convex_Ico -> convex_Ico is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Ico.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedCancelAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Ico.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r s)
Case conversion may be inaccurate. Consider using '#align convex_Ico convex_Icoₓ'. -/
theorem convex_Ico (r s : β) : Convex 𝕜 (Ico r s) :=
  Ici_inter_Iio.subst ((convex_Ici r).inter <| convex_Iio s)
#align convex_Ico convex_Ico

/- warning: convex_Ioc -> convex_Ioc is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u2} β _inst_6) _inst_7)))) (Set.Ioc.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedCancelAddCommMonoid.toPartialOrder.{u2} β _inst_6)) r s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u2, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddRightCancelMonoid.toZero.{u1} β (AddCancelMonoid.toAddRightCancelMonoid.{u1} β (AddCancelCommMonoid.toAddCancelMonoid.{u1} β (OrderedCancelAddCommMonoid.toCancelAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.Ioc.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6)) r s)
Case conversion may be inaccurate. Consider using '#align convex_Ioc convex_Iocₓ'. -/
theorem convex_Ioc (r s : β) : Convex 𝕜 (Ioc r s) :=
  Ioi_inter_Iic.subst ((convex_Ioi r).inter <| convex_Iic s)
#align convex_Ioc convex_Ioc

/- warning: convex_halfspace_lt -> convex_halfspace_lt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedCancelAddCommMonoid.{u3} β] [_inst_7 : Module.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u3} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u3} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} β (AddMonoid.toAddZeroClass.{u3} β (AddCommMonoid.toAddMonoid.{u3} β (OrderedAddCommMonoid.toAddCommMonoid.{u3} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u3} β _inst_6))))) (Module.toMulActionWithZero.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u1, u2, u3} 𝕜 E β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedCancelAddCommMonoid.toPartialOrder.{u3} β _inst_6))) (f w) r)))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u3, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 β (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u3, u2, u1} 𝕜 E β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6))) (f w) r)))
Case conversion may be inaccurate. Consider using '#align convex_halfspace_lt convex_halfspace_ltₓ'. -/
theorem convex_halfspace_lt {f : E → β} (h : IsLinearMap 𝕜 f) (r : β) : Convex 𝕜 { w | f w < r } :=
  (convex_Iio r).is_linear_preimage h
#align convex_halfspace_lt convex_halfspace_lt

/- warning: convex_halfspace_gt -> convex_halfspace_gt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedCancelAddCommMonoid.{u3} β] [_inst_7 : Module.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6)] [_inst_8 : OrderedSMul.{u1, u3} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u3} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u3} β (AddMonoid.toAddZeroClass.{u3} β (AddCommMonoid.toAddMonoid.{u3} β (OrderedAddCommMonoid.toAddCommMonoid.{u3} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u3} β _inst_6))))) (Module.toMulActionWithZero.{u1, u3} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u1, u2, u3} 𝕜 E β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u3} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedCancelAddCommMonoid.toPartialOrder.{u3} β _inst_6))) r (f w))))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u3} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2] [_inst_6 : OrderedCancelAddCommMonoid.{u1} β] [_inst_7 : Module.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u3, u1} 𝕜 β _inst_1 (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 β (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (OrderedCancelAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u3, u1} 𝕜 β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] {f : E -> β}, (IsLinearMap.{u3, u2, u1} 𝕜 E β (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_4 _inst_7 f) -> (forall (r : β), Convex.{u3, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1))) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1)) (AddMonoid.toZero.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 _inst_1) _inst_2 _inst_4)))) (setOf.{u2} E (fun (w : E) => LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (OrderedCancelAddCommMonoid.toPartialOrder.{u1} β _inst_6))) r (f w))))
Case conversion may be inaccurate. Consider using '#align convex_halfspace_gt convex_halfspace_gtₓ'. -/
theorem convex_halfspace_gt {f : E → β} (h : IsLinearMap 𝕜 f) (r : β) : Convex 𝕜 { w | r < f w } :=
  (convex_Ioi r).is_linear_preimage h
#align convex_halfspace_gt convex_halfspace_gt

end OrderedCancelAddCommMonoid

section LinearOrderedAddCommMonoid

variable [LinearOrderedAddCommMonoid β] [Module 𝕜 β] [OrderedSMul 𝕜 β]

/- warning: convex_uIcc -> convex_uIcc is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_6 : LinearOrderedAddCommMonoid.{u2} β] [_inst_7 : Module.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))] [_inst_8 : OrderedSMul.{u1, u2} 𝕜 β _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6)) _inst_7))] (r : β) (s : β), Convex.{u1, u2} 𝕜 β _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 β (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 β (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 β (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} β (AddMonoid.toAddZeroClass.{u2} β (AddCommMonoid.toAddMonoid.{u2} β (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 β (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} β _inst_6)) _inst_7)))) (Set.uIcc.{u2} β (LinearOrder.toLattice.{u2} β (LinearOrderedAddCommMonoid.toLinearOrder.{u2} β _inst_6)) r s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {β : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_6 : LinearOrderedAddCommMonoid.{u1} β] [_inst_7 : Module.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6)] [_inst_8 : OrderedSMul.{u2, u1} 𝕜 β _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (OrderedAddCommMonoid.toAddCommMonoid.{u1} β (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u1} β _inst_6)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7))] (r : β) (s : β), Convex.{u2, u1} 𝕜 β _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) (SMulZeroClass.toSMul.{u2, u1} 𝕜 β (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 β (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 β (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} β (AddCommMonoid.toAddMonoid.{u1} β (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6))) (Module.toMulActionWithZero.{u2, u1} 𝕜 β (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} β _inst_6) _inst_7)))) (Set.uIcc.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β (LinearOrderedAddCommMonoid.toLinearOrder.{u1} β _inst_6))) r s)
Case conversion may be inaccurate. Consider using '#align convex_uIcc convex_uIccₓ'. -/
theorem convex_uIcc (r s : β) : Convex 𝕜 (uIcc r s) :=
  convex_Icc _ _
#align convex_uIcc convex_uIcc

end LinearOrderedAddCommMonoid

end Module

end AddCommMonoid

section LinearOrderedAddCommMonoid

variable [LinearOrderedAddCommMonoid E] [OrderedAddCommMonoid β] [Module 𝕜 E] [OrderedSMul 𝕜 E]
  {s : Set E} {f : E → β}

/- warning: monotone_on.convex_le -> MonotoneOn.convex_le is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (MonotoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (MonotoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r))))
Case conversion may be inaccurate. Consider using '#align monotone_on.convex_le MonotoneOn.convex_leₓ'. -/
theorem MonotoneOn.convex_le (hf : MonotoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | f x ≤ r }) := fun x hx y hy a b ha hb hab =>
  ⟨hs hx.1 hy.1 ha hb hab,
    (hf (hs hx.1 hy.1 ha hb hab) (max_rec' s hx.1 hy.1) (Convex.combo_le_max x y ha hb hab)).trans
      (max_rec' _ hx.2 hy.2)⟩
#align monotone_on.convex_le MonotoneOn.convex_le

/- warning: monotone_on.convex_lt -> MonotoneOn.convex_lt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (MonotoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (MonotoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r))))
Case conversion may be inaccurate. Consider using '#align monotone_on.convex_lt MonotoneOn.convex_ltₓ'. -/
theorem MonotoneOn.convex_lt (hf : MonotoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | f x < r }) := fun x hx y hy a b ha hb hab =>
  ⟨hs hx.1 hy.1 ha hb hab,
    (hf (hs hx.1 hy.1 ha hb hab) (max_rec' s hx.1 hy.1)
          (Convex.combo_le_max x y ha hb hab)).trans_lt
      (max_rec' _ hx.2 hy.2)⟩
#align monotone_on.convex_lt MonotoneOn.convex_lt

/- warning: monotone_on.convex_ge -> MonotoneOn.convex_ge is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (MonotoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x)) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (MonotoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x)))))
Case conversion may be inaccurate. Consider using '#align monotone_on.convex_ge MonotoneOn.convex_geₓ'. -/
theorem MonotoneOn.convex_ge (hf : MonotoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | r ≤ f x }) :=
  @MonotoneOn.convex_le 𝕜 Eᵒᵈ βᵒᵈ _ _ _ _ _ _ _ hf.dual hs r
#align monotone_on.convex_ge MonotoneOn.convex_ge

/- warning: monotone_on.convex_gt -> MonotoneOn.convex_gt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (MonotoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x)) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (MonotoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x)))))
Case conversion may be inaccurate. Consider using '#align monotone_on.convex_gt MonotoneOn.convex_gtₓ'. -/
theorem MonotoneOn.convex_gt (hf : MonotoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | r < f x }) :=
  @MonotoneOn.convex_lt 𝕜 Eᵒᵈ βᵒᵈ _ _ _ _ _ _ _ hf.dual hs r
#align monotone_on.convex_gt MonotoneOn.convex_gt

/- warning: antitone_on.convex_le -> AntitoneOn.convex_le is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (AntitoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (AntitoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r))))
Case conversion may be inaccurate. Consider using '#align antitone_on.convex_le AntitoneOn.convex_leₓ'. -/
theorem AntitoneOn.convex_le (hf : AntitoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | f x ≤ r }) :=
  @MonotoneOn.convex_ge 𝕜 E βᵒᵈ _ _ _ _ _ _ _ hf hs r
#align antitone_on.convex_le AntitoneOn.convex_le

/- warning: antitone_on.convex_lt -> AntitoneOn.convex_lt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (AntitoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (AntitoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r))))
Case conversion may be inaccurate. Consider using '#align antitone_on.convex_lt AntitoneOn.convex_ltₓ'. -/
theorem AntitoneOn.convex_lt (hf : AntitoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | f x < r }) :=
  @MonotoneOn.convex_gt 𝕜 E βᵒᵈ _ _ _ _ _ _ _ hf hs r
#align antitone_on.convex_lt AntitoneOn.convex_lt

/- warning: antitone_on.convex_ge -> AntitoneOn.convex_ge is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (AntitoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x)) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (AntitoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x)))))
Case conversion may be inaccurate. Consider using '#align antitone_on.convex_ge AntitoneOn.convex_geₓ'. -/
theorem AntitoneOn.convex_ge (hf : AntitoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | r ≤ f x }) :=
  @MonotoneOn.convex_le 𝕜 E βᵒᵈ _ _ _ _ _ _ _ hf hs r
#align antitone_on.convex_ge AntitoneOn.convex_ge

/- warning: antitone_on.convex_gt -> AntitoneOn.convex_gt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {s : Set.{u2} E} {f : E -> β}, (AntitoneOn.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (Sep.sep.{u2, u2} E (Set.{u2} E) (Set.hasSep.{u2} E) (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x)) s))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {s : Set.{u3} E} {f : E -> β}, (AntitoneOn.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f s) -> (Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) s) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => And (Membership.mem.{u3, u3} E (Set.{u3} E) (Set.instMembershipSet.{u3} E) x s) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x)))))
Case conversion may be inaccurate. Consider using '#align antitone_on.convex_gt AntitoneOn.convex_gtₓ'. -/
theorem AntitoneOn.convex_gt (hf : AntitoneOn f s) (hs : Convex 𝕜 s) (r : β) :
    Convex 𝕜 ({ x ∈ s | r < f x }) :=
  @MonotoneOn.convex_lt 𝕜 E βᵒᵈ _ _ _ _ _ _ _ hf hs r
#align antitone_on.convex_gt AntitoneOn.convex_gt

/- warning: monotone.convex_le -> Monotone.convex_le is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Monotone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r)))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Monotone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r)))
Case conversion may be inaccurate. Consider using '#align monotone.convex_le Monotone.convex_leₓ'. -/
theorem Monotone.convex_le (hf : Monotone f) (r : β) : Convex 𝕜 { x | f x ≤ r } :=
  Set.sep_univ.subst ((hf.MonotoneOn univ).convex_le convex_univ r)
#align monotone.convex_le Monotone.convex_le

/- warning: monotone.convex_lt -> Monotone.convex_lt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Monotone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r)))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Monotone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r)))
Case conversion may be inaccurate. Consider using '#align monotone.convex_lt Monotone.convex_ltₓ'. -/
theorem Monotone.convex_lt (hf : Monotone f) (r : β) : Convex 𝕜 { x | f x ≤ r } :=
  Set.sep_univ.subst ((hf.MonotoneOn univ).convex_le convex_univ r)
#align monotone.convex_lt Monotone.convex_lt

/- warning: monotone.convex_ge -> Monotone.convex_ge is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Monotone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x))))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Monotone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x))))
Case conversion may be inaccurate. Consider using '#align monotone.convex_ge Monotone.convex_geₓ'. -/
theorem Monotone.convex_ge (hf : Monotone f) (r : β) : Convex 𝕜 { x | r ≤ f x } :=
  Set.sep_univ.subst ((hf.MonotoneOn univ).convex_ge convex_univ r)
#align monotone.convex_ge Monotone.convex_ge

/- warning: monotone.convex_gt -> Monotone.convex_gt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Monotone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r)))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Monotone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r)))
Case conversion may be inaccurate. Consider using '#align monotone.convex_gt Monotone.convex_gtₓ'. -/
theorem Monotone.convex_gt (hf : Monotone f) (r : β) : Convex 𝕜 { x | f x ≤ r } :=
  Set.sep_univ.subst ((hf.MonotoneOn univ).convex_le convex_univ r)
#align monotone.convex_gt Monotone.convex_gt

/- warning: antitone.convex_le -> Antitone.convex_le is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Antitone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r)))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Antitone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r)))
Case conversion may be inaccurate. Consider using '#align antitone.convex_le Antitone.convex_leₓ'. -/
theorem Antitone.convex_le (hf : Antitone f) (r : β) : Convex 𝕜 { x | f x ≤ r } :=
  Set.sep_univ.subst ((hf.AntitoneOn univ).convex_le convex_univ r)
#align antitone.convex_le Antitone.convex_le

/- warning: antitone.convex_lt -> Antitone.convex_lt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Antitone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) (f x) r)))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Antitone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) (f x) r)))
Case conversion may be inaccurate. Consider using '#align antitone.convex_lt Antitone.convex_ltₓ'. -/
theorem Antitone.convex_lt (hf : Antitone f) (r : β) : Convex 𝕜 { x | f x < r } :=
  Set.sep_univ.subst ((hf.AntitoneOn univ).convex_lt convex_univ r)
#align antitone.convex_lt Antitone.convex_lt

/- warning: antitone.convex_ge -> Antitone.convex_ge is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Antitone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LE.le.{u3} β (Preorder.toLE.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x))))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Antitone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x))))
Case conversion may be inaccurate. Consider using '#align antitone.convex_ge Antitone.convex_geₓ'. -/
theorem Antitone.convex_ge (hf : Antitone f) (r : β) : Convex 𝕜 { x | r ≤ f x } :=
  Set.sep_univ.subst ((hf.AntitoneOn univ).convex_ge convex_univ r)
#align antitone.convex_ge Antitone.convex_ge

/- warning: antitone.convex_gt -> Antitone.convex_gt is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {β : Type.{u3}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : OrderedAddCommMonoid.{u3} β] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_5 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4))] {f : E -> β}, (Antitone.{u2, u3} E β (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_4)))) (setOf.{u2} E (fun (x : E) => LT.lt.{u3} β (Preorder.toLT.{u3} β (PartialOrder.toPreorder.{u3} β (OrderedAddCommMonoid.toPartialOrder.{u3} β _inst_3))) r (f x))))
but is expected to have type
  forall {𝕜 : Type.{u1}} {E : Type.{u3}} {β : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u3} E] [_inst_3 : OrderedAddCommMonoid.{u2} β] [_inst_4 : Module.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2)] [_inst_5 : OrderedSMul.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (OrderedAddCommMonoid.toAddCommMonoid.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4))] {f : E -> β}, (Antitone.{u3, u2} E β (PartialOrder.toPreorder.{u3} E (OrderedAddCommMonoid.toPartialOrder.{u3} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u3} E _inst_2))) (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3)) f) -> (forall (r : β), Convex.{u1, u3} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) (SMulZeroClass.toSMul.{u1, u3} 𝕜 E (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u1, u3} 𝕜 E (MonoidWithZero.toZero.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddMonoid.toZero.{u3} E (AddCommMonoid.toAddMonoid.{u3} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2))) (Module.toMulActionWithZero.{u1, u3} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u3} E _inst_2) _inst_4)))) (setOf.{u3} E (fun (x : E) => LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (OrderedAddCommMonoid.toPartialOrder.{u2} β _inst_3))) r (f x))))
Case conversion may be inaccurate. Consider using '#align antitone.convex_gt Antitone.convex_gtₓ'. -/
theorem Antitone.convex_gt (hf : Antitone f) (r : β) : Convex 𝕜 { x | r < f x } :=
  Set.sep_univ.subst ((hf.AntitoneOn univ).convex_gt convex_univ r)
#align antitone.convex_gt Antitone.convex_gt

end LinearOrderedAddCommMonoid

end OrderedSemiring

section OrderedCommSemiring

variable [OrderedCommSemiring 𝕜]

section AddCommMonoid

variable [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F] {s : Set E}

/- warning: convex.smul -> Convex.smul is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedCommSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (c : 𝕜), Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4))))) c s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedCommSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (c : 𝕜), Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))))) c s))
Case conversion may be inaccurate. Consider using '#align convex.smul Convex.smulₓ'. -/
theorem Convex.smul (hs : Convex 𝕜 s) (c : 𝕜) : Convex 𝕜 (c • s) :=
  hs.linear_image (LinearMap.lsmul _ _ c)
#align convex.smul Convex.smul

/- warning: convex.smul_preimage -> Convex.smul_preimage is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedCommSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (c : 𝕜), Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) (Set.preimage.{u2, u2} E E (fun (z : E) => SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) c z) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedCommSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (c : 𝕜), Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) (Set.preimage.{u1, u1} E E (fun (z : E) => HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4))))) c z) s))
Case conversion may be inaccurate. Consider using '#align convex.smul_preimage Convex.smul_preimageₓ'. -/
theorem Convex.smul_preimage (hs : Convex 𝕜 s) (c : 𝕜) : Convex 𝕜 ((fun z => c • z) ⁻¹' s) :=
  hs.linear_preimage (LinearMap.lsmul _ _ c)
#align convex.smul_preimage Convex.smul_preimage

/- warning: convex.affinity -> Convex.affinity is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedCommSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (z : E) (c : 𝕜), Convex.{u1, u2} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) (Set.image.{u2, u2} E E (fun (x : E) => HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))) z (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 _inst_1)) _inst_2 _inst_4)))) c x)) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedCommSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) s) -> (forall (z : E) (c : 𝕜), Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1) _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4)))) (Set.image.{u1, u1} E E (fun (x : E) => HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) z (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (OrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 _inst_1)) _inst_2 _inst_4))))) c x)) s))
Case conversion may be inaccurate. Consider using '#align convex.affinity Convex.affinityₓ'. -/
theorem Convex.affinity (hs : Convex 𝕜 s) (z : E) (c : 𝕜) : Convex 𝕜 ((fun x => z + c • x) '' s) :=
  by simpa only [← image_smul, ← image_vadd, image_image] using (hs.smul c).vadd z
#align convex.affinity Convex.affinity

end AddCommMonoid

end OrderedCommSemiring

section StrictOrderedCommSemiring

variable [StrictOrderedCommSemiring 𝕜] [AddCommGroup E] [Module 𝕜 E]

/- warning: convex_open_segment -> convex_openSegment is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : StrictOrderedCommSemiring.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_3 : Module.{u1, u2} 𝕜 E (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] (a : E) (b : E), Convex.{u1, u2} 𝕜 E (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_3)))) (openSegment.{u1, u2} 𝕜 E (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_3)))) a b)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : StrictOrderedCommSemiring.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_3 : Module.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] (a : E) (b : E), Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_3)))) (openSegment.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommSemiring.toCommMonoidWithZero.{u2} 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toStrictOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_3)))) a b)
Case conversion may be inaccurate. Consider using '#align convex_open_segment convex_openSegmentₓ'. -/
theorem convex_openSegment (a b : E) : Convex 𝕜 (openSegment 𝕜 a b) :=
  by
  rw [convex_iff_openSegment_subset]
  rintro p ⟨ap, bp, hap, hbp, habp, rfl⟩ q ⟨aq, bq, haq, hbq, habq, rfl⟩ z ⟨a, b, ha, hb, hab, rfl⟩
  refine' ⟨a * ap + b * aq, a * bp + b * bq, by positivity, by positivity, _, _⟩
  · rw [add_add_add_comm, ← mul_add, ← mul_add, habp, habq, mul_one, mul_one, hab]
  · simp_rw [add_smul, mul_smul, smul_add, add_add_add_comm]
#align convex_open_segment convex_openSegment

end StrictOrderedCommSemiring

section OrderedRing

variable [OrderedRing 𝕜]

section AddCommGroup

variable [AddCommGroup E] [AddCommGroup F] [Module 𝕜 E] [Module 𝕜 F] {s t : Set E}

/- warning: convex.add_smul_mem -> Convex.add_smul_mem is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (forall {x : E} {y : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))) x y) s) -> (forall {t : 𝕜}, (Membership.Mem.{u1, u1} 𝕜 (Set.{u1} 𝕜) (Set.hasMem.{u1} 𝕜) t (Set.Icc.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (OrderedRing.toOrderedAddCommGroup.{u1} 𝕜 _inst_1))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))))))))) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddGroupWithOne.toAddMonoidWithOne.{u1} 𝕜 (AddCommGroupWithOne.toAddGroupWithOne.{u1} 𝕜 (Ring.toAddCommGroupWithOne.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))))))) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))) x (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) t y)) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (forall {x : E} {y : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (SubNegMonoid.toAddMonoid.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2)))))) x y) s) -> (forall {t : 𝕜}, (Membership.mem.{u2, u2} 𝕜 (Set.{u2} 𝕜) (Set.instMembershipSet.{u2} 𝕜) t (Set.Icc.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedRing.toPartialOrder.{u2} 𝕜 _inst_1)) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (NonAssocRing.toOne.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (OrderedRing.toRing.{u2} 𝕜 _inst_1))))))) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (SubNegMonoid.toAddMonoid.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2)))))) x (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4))))) t y)) s)))
Case conversion may be inaccurate. Consider using '#align convex.add_smul_mem Convex.add_smul_memₓ'. -/
theorem Convex.add_smul_mem (hs : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : x + y ∈ s) {t : 𝕜}
    (ht : t ∈ Icc (0 : 𝕜) 1) : x + t • y ∈ s :=
  by
  have h : x + t • y = (1 - t) • x + t • (x + y) := by
    rw [smul_add, ← add_assoc, ← add_smul, sub_add_cancel, one_smul]
  rw [h]
  exact hs hx hy (sub_nonneg_of_le ht.2) ht.1 (sub_add_cancel _ _)
#align convex.add_smul_mem Convex.add_smul_mem

/- warning: convex.smul_mem_of_zero_mem -> Convex.smul_mem_of_zero_mem is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (forall {x : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (OfNat.ofNat.{u2} E 0 (OfNat.mk.{u2} E 0 (Zero.zero.{u2} E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))))) s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {t : 𝕜}, (Membership.Mem.{u1, u1} 𝕜 (Set.{u1} 𝕜) (Set.hasMem.{u1} 𝕜) t (Set.Icc.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (OrderedRing.toOrderedAddCommGroup.{u1} 𝕜 _inst_1))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))))))))) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddGroupWithOne.toAddMonoidWithOne.{u1} 𝕜 (AddCommGroupWithOne.toAddGroupWithOne.{u1} 𝕜 (Ring.toAddCommGroupWithOne.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))))))) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) t x) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (forall {x : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (OfNat.ofNat.{u1} E 0 (Zero.toOfNat0.{u1} E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))))) s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {t : 𝕜}, (Membership.mem.{u2, u2} 𝕜 (Set.{u2} 𝕜) (Set.instMembershipSet.{u2} 𝕜) t (Set.Icc.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedRing.toPartialOrder.{u2} 𝕜 _inst_1)) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (NonAssocRing.toOne.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (OrderedRing.toRing.{u2} 𝕜 _inst_1))))))) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4))))) t x) s)))
Case conversion may be inaccurate. Consider using '#align convex.smul_mem_of_zero_mem Convex.smul_mem_of_zero_memₓ'. -/
theorem Convex.smul_mem_of_zero_mem (hs : Convex 𝕜 s) {x : E} (zero_mem : (0 : E) ∈ s) (hx : x ∈ s)
    {t : 𝕜} (ht : t ∈ Icc (0 : 𝕜) 1) : t • x ∈ s := by
  simpa using hs.add_smul_mem zero_mem (by simpa using hx) ht
#align convex.smul_mem_of_zero_mem Convex.smul_mem_of_zero_mem

/- warning: convex.add_smul_sub_mem -> Convex.add_smul_sub_mem is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (forall {x : E} {y : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (forall {t : 𝕜}, (Membership.Mem.{u1, u1} 𝕜 (Set.{u1} 𝕜) (Set.hasMem.{u1} 𝕜) t (Set.Icc.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (OrderedRing.toOrderedAddCommGroup.{u1} 𝕜 _inst_1))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))))))))) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddGroupWithOne.toAddMonoidWithOne.{u1} 𝕜 (AddCommGroupWithOne.toAddGroupWithOne.{u1} 𝕜 (Ring.toAddCommGroupWithOne.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))))))) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))) x (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) t (HSub.hSub.{u2, u2, u2} E E E (instHSub.{u2} E (SubNegMonoid.toHasSub.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))) y x))) s)))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (forall {x : E} {y : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (forall {t : 𝕜}, (Membership.mem.{u2, u2} 𝕜 (Set.{u2} 𝕜) (Set.instMembershipSet.{u2} 𝕜) t (Set.Icc.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedRing.toPartialOrder.{u2} 𝕜 _inst_1)) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (NonAssocRing.toOne.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (OrderedRing.toRing.{u2} 𝕜 _inst_1))))))) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (SubNegMonoid.toAddMonoid.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2)))))) x (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4))))) t (HSub.hSub.{u1, u1, u1} E E E (instHSub.{u1} E (SubNegMonoid.toSub.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2)))) y x))) s)))
Case conversion may be inaccurate. Consider using '#align convex.add_smul_sub_mem Convex.add_smul_sub_memₓ'. -/
theorem Convex.add_smul_sub_mem (h : Convex 𝕜 s) {x y : E} (hx : x ∈ s) (hy : y ∈ s) {t : 𝕜}
    (ht : t ∈ Icc (0 : 𝕜) 1) : x + t • (y - x) ∈ s :=
  by
  apply h.segment_subset hx hy
  rw [segment_eq_image']
  exact mem_image_of_mem _ ht
#align convex.add_smul_sub_mem Convex.add_smul_sub_mem

/- warning: affine_subspace.convex -> AffineSubspace.convex is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] (Q : AffineSubspace.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))), Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (AffineSubspace.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))) (Set.{u2} E) (HasLiftT.mk.{succ u2, succ u2} (AffineSubspace.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))) (Set.{u2} E) (CoeTCₓ.coe.{succ u2, succ u2} (AffineSubspace.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))) (Set.{u2} E) (SetLike.Set.hasCoeT.{u2, u2} (AffineSubspace.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))) E (AffineSubspace.setLike.{u1, u2, u2} 𝕜 E E (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))) Q)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] (Q : AffineSubspace.{u2, u1, u1} 𝕜 E E (OrderedRing.toRing.{u2} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2))), Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) (SetLike.coe.{u1, u1} (AffineSubspace.{u2, u1, u1} 𝕜 E E (OrderedRing.toRing.{u2} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2))) E (AffineSubspace.instSetLikeAffineSubspace.{u2, u1, u1} 𝕜 E E (OrderedRing.toRing.{u2} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2))) Q)
Case conversion may be inaccurate. Consider using '#align affine_subspace.convex AffineSubspace.convexₓ'. -/
/-- Affine subspaces are convex. -/
theorem AffineSubspace.convex (Q : AffineSubspace 𝕜 E) : Convex 𝕜 (Q : Set E) :=
  by
  intro x hx y hy a b ha hb hab
  rw [eq_sub_of_add_eq hab, ← AffineMap.lineMap_apply_module]
  exact AffineMap.lineMap_mem b hx hy
#align affine_subspace.convex AffineSubspace.convex

/- warning: convex.affine_preimage -> Convex.affine_preimage is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_3 : AddCommGroup.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] [_inst_5 : Module.{u1, u3} 𝕜 F (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)] (f : AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) {s : Set.{u3} F}, (Convex.{u1, u3} 𝕜 F (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3) (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3) _inst_5)))) s) -> (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (Set.preimage.{u2, u3} E F (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) (fun (_x : AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) => E -> F) (AffineMap.hasCoeToFun.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) f) s))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {F : Type.{u1}} [_inst_1 : OrderedRing.{u3} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_3 : AddCommGroup.{u1} F] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] [_inst_5 : Module.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3)] (f : AffineMap.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))) {s : Set.{u1} F}, (Convex.{u3, u1} 𝕜 F (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3) (SMulZeroClass.toSMul.{u3, u1} 𝕜 F (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (SMulWithZero.toSMulZeroClass.{u3, u1} 𝕜 F (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 F (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (Module.toMulActionWithZero.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3) _inst_5)))) s) -> (Convex.{u3, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1))) (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (Set.preimage.{u2, u1} E F (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (AffineMap.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))) E (fun (_x : E) => (fun (a._@.Mathlib.LinearAlgebra.AffineSpace.AffineMap._hyg.1004 : E) => F) _x) (AffineMap.funLike.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))) f) s))
Case conversion may be inaccurate. Consider using '#align convex.affine_preimage Convex.affine_preimageₓ'. -/
/-- The preimage of a convex set under an affine map is convex. -/
theorem Convex.affine_preimage (f : E →ᵃ[𝕜] F) {s : Set F} (hs : Convex 𝕜 s) : Convex 𝕜 (f ⁻¹' s) :=
  fun x hx => (hs hx).affine_preimage _
#align convex.affine_preimage Convex.affine_preimage

/- warning: convex.affine_image -> Convex.affine_image is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} {F : Type.{u3}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_3 : AddCommGroup.{u3} F] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] [_inst_5 : Module.{u1, u3} 𝕜 F (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)] {s : Set.{u2} E} (f : AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))), (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (Convex.{u1, u3} 𝕜 F (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3) (SMulZeroClass.toHasSmul.{u1, u3} 𝕜 F (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (SMulWithZero.toSmulZeroClass.{u1, u3} 𝕜 F (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (MulActionWithZero.toSMulWithZero.{u1, u3} 𝕜 F (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u3} F (AddMonoid.toAddZeroClass.{u3} F (AddCommMonoid.toAddMonoid.{u3} F (AddCommGroup.toAddCommMonoid.{u3} F _inst_3)))) (Module.toMulActionWithZero.{u1, u3} 𝕜 F (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u3} F _inst_3) _inst_5)))) (Set.image.{u2, u3} E F (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) (fun (_x : AffineMap.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) => E -> F) (AffineMap.hasCoeToFun.{u1, u2, u2, u3, u3} 𝕜 E E F F (OrderedRing.toRing.{u1} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u3} F (AddCommGroup.toAddGroup.{u3} F _inst_3))) f) s))
but is expected to have type
  forall {𝕜 : Type.{u3}} {E : Type.{u2}} {F : Type.{u1}} [_inst_1 : OrderedRing.{u3} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_3 : AddCommGroup.{u1} F] [_inst_4 : Module.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] [_inst_5 : Module.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3)] {s : Set.{u2} E} (f : AffineMap.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))), (Convex.{u3, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toSMul.{u3, u2} 𝕜 E (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u3, u2} 𝕜 E (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u3, u2} 𝕜 E (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1))) (NegZeroClass.toZero.{u2} E (SubNegZeroMonoid.toNegZeroClass.{u2} E (SubtractionMonoid.toSubNegZeroMonoid.{u2} E (SubtractionCommMonoid.toSubtractionMonoid.{u2} E (AddCommGroup.toDivisionAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u3, u2} 𝕜 E (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (Convex.{u3, u1} 𝕜 F (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3) (SMulZeroClass.toSMul.{u3, u1} 𝕜 F (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (SMulWithZero.toSMulZeroClass.{u3, u1} 𝕜 F (MonoidWithZero.toZero.{u3} 𝕜 (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (MulActionWithZero.toSMulWithZero.{u3, u1} 𝕜 F (Semiring.toMonoidWithZero.{u3} 𝕜 (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} F (SubNegZeroMonoid.toNegZeroClass.{u1} F (SubtractionMonoid.toSubNegZeroMonoid.{u1} F (SubtractionCommMonoid.toSubtractionMonoid.{u1} F (AddCommGroup.toDivisionAddCommMonoid.{u1} F _inst_3))))) (Module.toMulActionWithZero.{u3, u1} 𝕜 F (OrderedSemiring.toSemiring.{u3} 𝕜 (OrderedRing.toOrderedSemiring.{u3} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} F _inst_3) _inst_5)))) (Set.image.{u2, u1} E F (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (AffineMap.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))) E (fun (_x : E) => (fun (a._@.Mathlib.LinearAlgebra.AffineSpace.AffineMap._hyg.1004 : E) => F) _x) (AffineMap.funLike.{u3, u2, u2, u1, u1} 𝕜 E E F F (OrderedRing.toRing.{u3} 𝕜 _inst_1) _inst_2 _inst_4 (addGroupIsAddTorsor.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)) _inst_3 _inst_5 (addGroupIsAddTorsor.{u1} F (AddCommGroup.toAddGroup.{u1} F _inst_3))) f) s))
Case conversion may be inaccurate. Consider using '#align convex.affine_image Convex.affine_imageₓ'. -/
/-- The image of a convex set under an affine map is convex. -/
theorem Convex.affine_image (f : E →ᵃ[𝕜] F) (hs : Convex 𝕜 s) : Convex 𝕜 (f '' s) :=
  by
  rintro _ ⟨x, hx, rfl⟩
  exact (hs hx).affine_image _
#align convex.affine_image Convex.affine_image

/- warning: convex.neg -> Convex.neg is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (Neg.neg.{u2} (Set.{u2} E) (Set.neg.{u2} E (SubNegMonoid.toHasNeg.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))) s))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) (Neg.neg.{u1} (Set.{u1} E) (Set.neg.{u1} E (NegZeroClass.toNeg.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2)))))) s))
Case conversion may be inaccurate. Consider using '#align convex.neg Convex.negₓ'. -/
theorem Convex.neg (hs : Convex 𝕜 s) : Convex 𝕜 (-s) :=
  hs.is_linear_preimage IsLinearMap.isLinearMap_neg
#align convex.neg Convex.neg

/- warning: convex.sub -> Convex.sub is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedRing.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E} {t : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) t) -> (Convex.{u1, u2} 𝕜 E (OrderedRing.toOrderedSemiring.{u1} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (OrderedRing.toRing.{u1} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (HSub.hSub.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHSub.{u2} (Set.{u2} E) (Set.sub.{u2} E (SubNegMonoid.toHasSub.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))))) s t))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedRing.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E} {t : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) t) -> (Convex.{u2, u1} 𝕜 E (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 (OrderedRing.toOrderedSemiring.{u2} 𝕜 _inst_1)) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) (HSub.hSub.{u1, u1, u1} (Set.{u1} E) (Set.{u1} E) (Set.{u1} E) (instHSub.{u1} (Set.{u1} E) (Set.sub.{u1} E (SubNegMonoid.toSub.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2))))) s t))
Case conversion may be inaccurate. Consider using '#align convex.sub Convex.subₓ'. -/
theorem Convex.sub (hs : Convex 𝕜 s) (ht : Convex 𝕜 t) : Convex 𝕜 (s - t) :=
  by
  rw [sub_eq_add_neg]
  exact hs.add ht.neg
#align convex.sub Convex.sub

end AddCommGroup

end OrderedRing

section LinearOrderedField

variable [LinearOrderedField 𝕜]

section AddCommGroup

variable [AddCommGroup E] [AddCommGroup F] [Module 𝕜 E] [Module 𝕜 F] {s : Set E}

/- warning: convex_iff_div -> convex_iff_div is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : LinearOrderedField.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, Iff (Convex.{u1, u2} 𝕜 E (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedRing.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) (forall {{x : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {{y : E}}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) y s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))))))))) a) -> (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))))))))) b) -> (LT.lt.{u1} 𝕜 (Preorder.toLT.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))))))))) (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) a b)) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (HAdd.hAdd.{u2, u2, u2} E E E (instHAdd.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (HDiv.hDiv.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHDiv.{u1} 𝕜 (DivInvMonoid.toHasDiv.{u1} 𝕜 (DivisionRing.toDivInvMonoid.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) a (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) a b)) x) (SMul.smul.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) (HDiv.hDiv.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHDiv.{u1} 𝕜 (DivInvMonoid.toHasDiv.{u1} 𝕜 (DivisionRing.toDivInvMonoid.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) b (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) a b)) y)) s))))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : LinearOrderedField.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, Iff (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) (forall {{x : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {{y : E}}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) y s) -> (forall {{a : 𝕜}} {{b : 𝕜}}, (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))))) a) -> (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))))) b) -> (LT.lt.{u2} 𝕜 (Preorder.toLT.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))))) (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u2} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (StrictOrderedRing.toRing.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))))))) a b)) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (HAdd.hAdd.{u1, u1, u1} E E E (instHAdd.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (SubNegMonoid.toAddMonoid.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2)))))) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4))))) (HDiv.hDiv.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHDiv.{u2} 𝕜 (LinearOrderedField.toDiv.{u2} 𝕜 _inst_1)) a (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u2} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (StrictOrderedRing.toRing.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))))))) a b)) x) (HSMul.hSMul.{u2, u1, u1} 𝕜 E E (instHSMul.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4))))) (HDiv.hDiv.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHDiv.{u2} 𝕜 (LinearOrderedField.toDiv.{u2} 𝕜 _inst_1)) b (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u2} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (StrictOrderedRing.toRing.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))))))) a b)) y)) s))))
Case conversion may be inaccurate. Consider using '#align convex_iff_div convex_iff_divₓ'. -/
/-- Alternative definition of set convexity, using division. -/
theorem convex_iff_div :
    Convex 𝕜 s ↔
      ∀ ⦃x⦄,
        x ∈ s →
          ∀ ⦃y⦄,
            y ∈ s →
              ∀ ⦃a b : 𝕜⦄, 0 ≤ a → 0 ≤ b → 0 < a + b → (a / (a + b)) • x + (b / (a + b)) • y ∈ s :=
  forall₂_congr fun x hx => starConvex_iff_div
#align convex_iff_div convex_iff_div

/- warning: convex.mem_smul_of_zero_mem -> Convex.mem_smul_of_zero_mem is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : LinearOrderedField.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedRing.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (forall {x : E}, (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) (OfNat.ofNat.{u2} E 0 (OfNat.mk.{u2} E 0 (Zero.zero.{u2} E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2)))))))) s) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x s) -> (forall {t : 𝕜}, (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddGroupWithOne.toAddMonoidWithOne.{u1} 𝕜 (AddCommGroupWithOne.toAddGroupWithOne.{u1} 𝕜 (Ring.toAddCommGroupWithOne.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))))) t) -> (Membership.Mem.{u2, u2} E (Set.{u2} E) (Set.hasMem.{u2} E) x (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4))))) t s))))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : LinearOrderedField.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (forall {x : E}, (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) (OfNat.ofNat.{u1} E 0 (Zero.toOfNat0.{u1} E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))))) s) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x s) -> (forall {t : 𝕜}, (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (NonAssocRing.toOne.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (StrictOrderedRing.toRing.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))))) t) -> (Membership.mem.{u1, u1} E (Set.{u1} E) (Set.instMembershipSet.{u1} E) x (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))))) t s))))
Case conversion may be inaccurate. Consider using '#align convex.mem_smul_of_zero_mem Convex.mem_smul_of_zero_memₓ'. -/
theorem Convex.mem_smul_of_zero_mem (h : Convex 𝕜 s) {x : E} (zero_mem : (0 : E) ∈ s) (hx : x ∈ s)
    {t : 𝕜} (ht : 1 ≤ t) : x ∈ t • s :=
  by
  rw [mem_smul_set_iff_inv_smul_mem₀ (zero_lt_one.trans_le ht).ne']
  exact h.smul_mem_of_zero_mem zero_mem hx ⟨inv_nonneg.2 (zero_le_one.trans ht), inv_le_one ht⟩
#align convex.mem_smul_of_zero_mem Convex.mem_smul_of_zero_mem

/- warning: convex.add_smul -> Convex.add_smul is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : LinearOrderedField.{u1} 𝕜] [_inst_2 : AddCommGroup.{u2} E] [_inst_4 : Module.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)] {s : Set.{u2} E}, (Convex.{u1, u2} 𝕜 E (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedRing.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4)))) s) -> (forall {p : 𝕜} {q : 𝕜}, (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))))))))) p) -> (LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u1} 𝕜 (Ring.toNonAssocRing.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))))))))) q) -> (Eq.{succ u2} (Set.{u2} E) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4))))) (HAdd.hAdd.{u1, u1, u1} 𝕜 𝕜 𝕜 (instHAdd.{u1} 𝕜 (Distrib.toHasAdd.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) p q) s) (HAdd.hAdd.{u2, u2, u2} (Set.{u2} E) (Set.{u2} E) (Set.{u2} E) (instHAdd.{u2} (Set.{u2} E) (Set.add.{u2} E (AddZeroClass.toHasAdd.{u2} E (AddMonoid.toAddZeroClass.{u2} E (SubNegMonoid.toAddMonoid.{u2} E (AddGroup.toSubNegMonoid.{u2} E (AddCommGroup.toAddGroup.{u2} E _inst_2))))))) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4))))) p s) (SMul.smul.{u1, u2} 𝕜 (Set.{u2} E) (Set.smulSet.{u1, u2} 𝕜 E (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (AddCommGroup.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (Ring.toSemiring.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))) (AddCommGroup.toAddCommMonoid.{u2} E _inst_2) _inst_4))))) q s))))
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : LinearOrderedField.{u2} 𝕜] [_inst_2 : AddCommGroup.{u1} E] [_inst_4 : Module.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2)] {s : Set.{u1} E}, (Convex.{u2, u1} 𝕜 E (OrderedCommSemiring.toOrderedSemiring.{u2} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))) s) -> (forall {p : 𝕜} {q : 𝕜}, (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))))) p) -> (LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (StrictOrderedRing.toPartialOrder.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))))) q) -> (Eq.{succ u1} (Set.{u1} E) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))))) (HAdd.hAdd.{u2, u2, u2} 𝕜 𝕜 𝕜 (instHAdd.{u2} 𝕜 (Distrib.toAdd.{u2} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u2} 𝕜 (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u2} 𝕜 (NonAssocRing.toNonUnitalNonAssocRing.{u2} 𝕜 (Ring.toNonAssocRing.{u2} 𝕜 (StrictOrderedRing.toRing.{u2} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u2} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u2} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u2} 𝕜 _inst_1)))))))))) p q) s) (HAdd.hAdd.{u1, u1, u1} (Set.{u1} E) (Set.{u1} E) (Set.{u1} E) (instHAdd.{u1} (Set.{u1} E) (Set.add.{u1} E (AddZeroClass.toAdd.{u1} E (AddMonoid.toAddZeroClass.{u1} E (SubNegMonoid.toAddMonoid.{u1} E (AddGroup.toSubNegMonoid.{u1} E (AddCommGroup.toAddGroup.{u1} E _inst_2))))))) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))))) p s) (HSMul.hSMul.{u2, u1, u1} 𝕜 (Set.{u1} E) (Set.{u1} E) (instHSMul.{u2, u1} 𝕜 (Set.{u1} E) (Set.smulSet.{u2, u1} 𝕜 E (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (CommMonoidWithZero.toZero.{u2} 𝕜 (CommGroupWithZero.toCommMonoidWithZero.{u2} 𝕜 (Semifield.toCommGroupWithZero.{u2} 𝕜 (LinearOrderedSemifield.toSemifield.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1)))))) (NegZeroClass.toZero.{u1} E (SubNegZeroMonoid.toNegZeroClass.{u1} E (SubtractionMonoid.toSubNegZeroMonoid.{u1} E (SubtractionCommMonoid.toSubtractionMonoid.{u1} E (AddCommGroup.toDivisionAddCommMonoid.{u1} E _inst_2))))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (StrictOrderedSemiring.toSemiring.{u2} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u2} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u2} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u2} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u2} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} E _inst_2) _inst_4)))))) q s))))
Case conversion may be inaccurate. Consider using '#align convex.add_smul Convex.add_smulₓ'. -/
theorem Convex.add_smul (h_conv : Convex 𝕜 s) {p q : 𝕜} (hp : 0 ≤ p) (hq : 0 ≤ q) :
    (p + q) • s = p • s + q • s :=
  by
  obtain rfl | hs := s.eq_empty_or_nonempty
  · simp_rw [smul_set_empty, add_empty]
  obtain rfl | hp' := hp.eq_or_lt
  · rw [zero_add, zero_smul_set hs, zero_add]
  obtain rfl | hq' := hq.eq_or_lt
  · rw [add_zero, zero_smul_set hs, add_zero]
  ext
  constructor
  · rintro ⟨v, hv, rfl⟩
    exact ⟨p • v, q • v, smul_mem_smul_set hv, smul_mem_smul_set hv, (add_smul _ _ _).symm⟩
  · rintro ⟨v₁, v₂, ⟨v₁₁, h₁₂, rfl⟩, ⟨v₂₁, h₂₂, rfl⟩, rfl⟩
    have hpq := add_pos hp' hq'
    refine'
        mem_smul_set.2
          ⟨_,
            h_conv h₁₂ h₂₂ _ _
              (by rw [← div_self hpq.ne', add_div] : p / (p + q) + q / (p + q) = 1),
            by simp only [← mul_smul, smul_add, mul_div_cancel' _ hpq.ne']⟩ <;>
      positivity
#align convex.add_smul Convex.add_smul

end AddCommGroup

end LinearOrderedField

/-!
#### Convex sets in an ordered space
Relates `convex` and `ord_connected`.
-/

section

/- warning: set.ord_connected.convex_of_chain -> Set.OrdConnected.convex_of_chain is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : OrderedAddCommMonoid.{u2} E] [_inst_3 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2)] [_inst_4 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 _inst_2 (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2) _inst_3))] {s : Set.{u2} E}, (Set.OrdConnected.{u2} E (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E _inst_2)) s) -> (IsChain.{u2} E (LE.le.{u2} E (Preorder.toLE.{u2} E (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E _inst_2)))) s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2)))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2)))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2)))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E _inst_2) _inst_3)))) s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : OrderedAddCommMonoid.{u1} E] [_inst_3 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2)] [_inst_4 : OrderedSMul.{u2, u1} 𝕜 E _inst_1 _inst_2 (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) _inst_3))] {s : Set.{u1} E}, (Set.OrdConnected.{u1} E (PartialOrder.toPreorder.{u1} E (OrderedAddCommMonoid.toPartialOrder.{u1} E _inst_2)) s) -> (IsChain.{u1} E (fun (x._@.Mathlib.Analysis.Convex.Basic._hyg.6992 : E) (x._@.Mathlib.Analysis.Convex.Basic._hyg.6994 : E) => LE.le.{u1} E (Preorder.toLE.{u1} E (PartialOrder.toPreorder.{u1} E (OrderedAddCommMonoid.toPartialOrder.{u1} E _inst_2))) x._@.Mathlib.Analysis.Convex.Basic._hyg.6992 x._@.Mathlib.Analysis.Convex.Basic._hyg.6994) s) -> (Convex.{u2, u1} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) _inst_3)))) s)
Case conversion may be inaccurate. Consider using '#align set.ord_connected.convex_of_chain Set.OrdConnected.convex_of_chainₓ'. -/
theorem Set.OrdConnected.convex_of_chain [OrderedSemiring 𝕜] [OrderedAddCommMonoid E] [Module 𝕜 E]
    [OrderedSMul 𝕜 E] {s : Set E} (hs : s.OrdConnected) (h : IsChain (· ≤ ·) s) : Convex 𝕜 s :=
  by
  refine' convex_iff_segment_subset.mpr fun x hx y hy => _
  obtain hxy | hyx := h.total hx hy
  · exact (segment_subset_Icc hxy).trans (hs.out hx hy)
  · rw [segment_symm]
    exact (segment_subset_Icc hyx).trans (hs.out hy hx)
#align set.ord_connected.convex_of_chain Set.OrdConnected.convex_of_chain

/- warning: set.ord_connected.convex -> Set.OrdConnected.convex is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u2} E] [_inst_3 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))] [_inst_4 : OrderedSMul.{u1, u2} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_3))] {s : Set.{u2} E}, (Set.OrdConnected.{u2} E (PartialOrder.toPreorder.{u2} E (OrderedAddCommMonoid.toPartialOrder.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))) s) -> (Convex.{u1, u2} 𝕜 E _inst_1 (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2))))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) (OrderedAddCommMonoid.toAddCommMonoid.{u2} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u2} E _inst_2)) _inst_3)))) s)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : LinearOrderedAddCommMonoid.{u1} E] [_inst_3 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2)] [_inst_4 : OrderedSMul.{u2, u1} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u1} E _inst_2) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (OrderedAddCommMonoid.toAddCommMonoid.{u1} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u1} E _inst_2)))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) _inst_3))] {s : Set.{u1} E}, (Set.OrdConnected.{u1} E (PartialOrder.toPreorder.{u1} E (OrderedAddCommMonoid.toPartialOrder.{u1} E (LinearOrderedAddCommMonoid.toOrderedAddCommMonoid.{u1} E _inst_2))) s) -> (Convex.{u2, u1} 𝕜 E _inst_1 (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2))) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) (LinearOrderedAddCommMonoid.toAddCommMonoid.{u1} E _inst_2) _inst_3)))) s)
Case conversion may be inaccurate. Consider using '#align set.ord_connected.convex Set.OrdConnected.convexₓ'. -/
theorem Set.OrdConnected.convex [OrderedSemiring 𝕜] [LinearOrderedAddCommMonoid E] [Module 𝕜 E]
    [OrderedSMul 𝕜 E] {s : Set E} (hs : s.OrdConnected) : Convex 𝕜 s :=
  hs.convex_of_chain <| isChain_of_trichotomous s
#align set.ord_connected.convex Set.OrdConnected.convex

/- warning: convex_iff_ord_connected -> convex_iff_ordConnected is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} [_inst_1 : LinearOrderedField.{u1} 𝕜] {s : Set.{u1} 𝕜}, Iff (Convex.{u1, u1} 𝕜 𝕜 (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedRing.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} 𝕜 (OrderedAddCommGroup.toAddCommGroup.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1)))))) (Mul.toSMul.{u1} 𝕜 (Distrib.toHasMul.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) s) (Set.OrdConnected.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1)))))) s)
but is expected to have type
  forall {𝕜 : Type.{u1}} [_inst_1 : LinearOrderedField.{u1} 𝕜] {s : Set.{u1} 𝕜}, Iff (Convex.{u1, u1} 𝕜 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1))))) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} 𝕜 (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))))) (Algebra.toSMul.{u1, u1} 𝕜 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))) (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1))))) (Algebra.id.{u1} 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))))) s) (Set.OrdConnected.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (StrictOrderedRing.toPartialOrder.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) s)
Case conversion may be inaccurate. Consider using '#align convex_iff_ord_connected convex_iff_ordConnectedₓ'. -/
theorem convex_iff_ordConnected [LinearOrderedField 𝕜] {s : Set 𝕜} : Convex 𝕜 s ↔ s.OrdConnected :=
  by simp_rw [convex_iff_segment_subset, segment_eq_uIcc, ord_connected_iff_uIcc_subset]
#align convex_iff_ord_connected convex_iff_ordConnected

/- warning: convex.ord_connected -> Convex.ordConnected is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} [_inst_1 : LinearOrderedField.{u1} 𝕜] {s : Set.{u1} 𝕜}, (Convex.{u1, u1} 𝕜 𝕜 (StrictOrderedSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedRing.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) (AddCommGroup.toAddCommMonoid.{u1} 𝕜 (OrderedAddCommGroup.toAddCommGroup.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1)))))) (Mul.toSMul.{u1} 𝕜 (Distrib.toHasMul.{u1} 𝕜 (Ring.toDistrib.{u1} 𝕜 (DivisionRing.toRing.{u1} 𝕜 (Field.toDivisionRing.{u1} 𝕜 (LinearOrderedField.toField.{u1} 𝕜 _inst_1)))))) s) -> (Set.OrdConnected.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommGroup.toPartialOrder.{u1} 𝕜 (StrictOrderedRing.toOrderedAddCommGroup.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1)))))) s)
but is expected to have type
  forall {𝕜 : Type.{u1}} [_inst_1 : LinearOrderedField.{u1} 𝕜] {s : Set.{u1} 𝕜}, (Convex.{u1, u1} 𝕜 𝕜 (OrderedCommSemiring.toOrderedSemiring.{u1} 𝕜 (StrictOrderedCommSemiring.toOrderedCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1))))) (OrderedCancelAddCommMonoid.toAddCommMonoid.{u1} 𝕜 (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))))) (Algebra.toSMul.{u1, u1} 𝕜 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))) (StrictOrderedSemiring.toSemiring.{u1} 𝕜 (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toLinearOrderedSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1))))) (Algebra.id.{u1} 𝕜 (StrictOrderedCommSemiring.toCommSemiring.{u1} 𝕜 (LinearOrderedCommSemiring.toStrictOrderedCommSemiring.{u1} 𝕜 (LinearOrderedSemifield.toLinearOrderedCommSemiring.{u1} 𝕜 (LinearOrderedField.toLinearOrderedSemifield.{u1} 𝕜 _inst_1)))))) s) -> (Set.OrdConnected.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (StrictOrderedRing.toPartialOrder.{u1} 𝕜 (LinearOrderedRing.toStrictOrderedRing.{u1} 𝕜 (LinearOrderedCommRing.toLinearOrderedRing.{u1} 𝕜 (LinearOrderedField.toLinearOrderedCommRing.{u1} 𝕜 _inst_1))))) s)
Case conversion may be inaccurate. Consider using '#align convex.ord_connected Convex.ordConnectedₓ'. -/
alias convex_iff_ordConnected ↔ Convex.ordConnected _
#align convex.ord_connected Convex.ordConnected

end

/-! #### Convexity of submodules/subspaces -/

namespace Submodule

variable [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E]

/- warning: submodule.convex -> Submodule.convex is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] (K : Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3), Convex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3)))) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) E (Submodule.setLike.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3)))) K)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_3 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] (K : Submodule.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3), Convex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3)))) (SetLike.coe.{u1, u1} (Submodule.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3) E (Submodule.setLike.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3) K)
Case conversion may be inaccurate. Consider using '#align submodule.convex Submodule.convexₓ'. -/
protected theorem convex (K : Submodule 𝕜 E) : Convex 𝕜 (↑K : Set E) :=
  by
  repeat' intro
  refine' add_mem (smul_mem _ _ _) (smul_mem _ _ _) <;> assumption
#align submodule.convex Submodule.convex

/- warning: submodule.star_convex -> Submodule.starConvex is a dubious translation:
lean 3 declaration is
  forall {𝕜 : Type.{u1}} {E : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : AddCommMonoid.{u2} E] [_inst_3 : Module.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2] (K : Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3), StarConvex.{u1, u2} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toHasSmul.{u1, u2} 𝕜 E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (SMulWithZero.toSmulZeroClass.{u1, u2} 𝕜 E (MulZeroClass.toHasZero.{u1} 𝕜 (MulZeroOneClass.toMulZeroClass.{u1} 𝕜 (MonoidWithZero.toMulZeroOneClass.{u1} 𝕜 (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (MulActionWithZero.toSMulWithZero.{u1, u2} 𝕜 E (Semiring.toMonoidWithZero.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)) (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2))) (Module.toMulActionWithZero.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3)))) (OfNat.ofNat.{u2} E 0 (OfNat.mk.{u2} E 0 (Zero.zero.{u2} E (AddZeroClass.toHasZero.{u2} E (AddMonoid.toAddZeroClass.{u2} E (AddCommMonoid.toAddMonoid.{u2} E _inst_2)))))) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) (Set.{u2} E) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3) E (Submodule.setLike.{u1, u2} 𝕜 E (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1) _inst_2 _inst_3)))) K)
but is expected to have type
  forall {𝕜 : Type.{u2}} {E : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : AddCommMonoid.{u1} E] [_inst_3 : Module.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2] (K : Submodule.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3), StarConvex.{u2, u1} 𝕜 E _inst_1 _inst_2 (SMulZeroClass.toSMul.{u2, u1} 𝕜 E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (SMulWithZero.toSMulZeroClass.{u2, u1} 𝕜 E (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (MulActionWithZero.toSMulWithZero.{u2, u1} 𝕜 E (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)) (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)) (Module.toMulActionWithZero.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3)))) (OfNat.ofNat.{u1} E 0 (Zero.toOfNat0.{u1} E (AddMonoid.toZero.{u1} E (AddCommMonoid.toAddMonoid.{u1} E _inst_2)))) (SetLike.coe.{u1, u1} (Submodule.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3) E (Submodule.setLike.{u2, u1} 𝕜 E (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1) _inst_2 _inst_3) K)
Case conversion may be inaccurate. Consider using '#align submodule.star_convex Submodule.starConvexₓ'. -/
protected theorem starConvex (K : Submodule 𝕜 E) : StarConvex 𝕜 (0 : E) K :=
  K.Convex K.zero_mem
#align submodule.star_convex Submodule.starConvex

end Submodule

/-! ### Simplex -/

section Simplex

variable (𝕜) (ι : Type _) [OrderedSemiring 𝕜] [Fintype ι]

#print stdSimplex /-
/-- The standard simplex in the space of functions `ι → 𝕜` is the set of vectors with non-negative
coordinates with total sum `1`. This is the free object in the category of convex spaces. -/
def stdSimplex : Set (ι → 𝕜) :=
  { f | (∀ x, 0 ≤ f x) ∧ (∑ x, f x) = 1 }
#align std_simplex stdSimplex
-/

/- warning: std_simplex_eq_inter -> stdSimplex_eq_inter is a dubious translation:
lean 3 declaration is
  forall (𝕜 : Type.{u1}) (ι : Type.{u2}) [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : Fintype.{u2} ι], Eq.{succ (max u2 u1)} (Set.{max u2 u1} (ι -> 𝕜)) (stdSimplex.{u1, u2} 𝕜 ι _inst_1 _inst_2) (Inter.inter.{max u2 u1} (Set.{max u2 u1} (ι -> 𝕜)) (Set.hasInter.{max u2 u1} (ι -> 𝕜)) (Set.interᵢ.{max u2 u1, succ u2} (ι -> 𝕜) ι (fun (x : ι) => setOf.{max u2 u1} (ι -> 𝕜) (fun (f : ι -> 𝕜) => LE.le.{u1} 𝕜 (Preorder.toLE.{u1} 𝕜 (PartialOrder.toPreorder.{u1} 𝕜 (OrderedAddCommMonoid.toPartialOrder.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) (f x)))) (setOf.{max u2 u1} (ι -> 𝕜) (fun (f : ι -> 𝕜) => Eq.{succ u1} 𝕜 (Finset.sum.{u1, u2} 𝕜 ι (OrderedAddCommMonoid.toAddCommMonoid.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1)) (Finset.univ.{u2} ι _inst_2) (fun (x : ι) => f x)) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))))))
but is expected to have type
  forall (𝕜 : Type.{u2}) (ι : Type.{u1}) [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : Fintype.{u1} ι], Eq.{max (succ u2) (succ u1)} (Set.{max u2 u1} (ι -> 𝕜)) (stdSimplex.{u2, u1} 𝕜 ι _inst_1 _inst_2) (Inter.inter.{max u2 u1} (Set.{max u2 u1} (ι -> 𝕜)) (Set.instInterSet.{max u2 u1} (ι -> 𝕜)) (Set.interᵢ.{max u2 u1, succ u1} (ι -> 𝕜) ι (fun (x : ι) => setOf.{max u2 u1} (ι -> 𝕜) (fun (f : ι -> 𝕜) => LE.le.{u2} 𝕜 (Preorder.toLE.{u2} 𝕜 (PartialOrder.toPreorder.{u2} 𝕜 (OrderedSemiring.toPartialOrder.{u2} 𝕜 _inst_1))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))))) (f x)))) (setOf.{max u2 u1} (ι -> 𝕜) (fun (f : ι -> 𝕜) => Eq.{succ u2} 𝕜 (Finset.sum.{u2, u1} 𝕜 ι (OrderedAddCommMonoid.toAddCommMonoid.{u2} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u2} 𝕜 _inst_1)) (Finset.univ.{u1} ι _inst_2) (fun (x : ι) => f x)) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))))
Case conversion may be inaccurate. Consider using '#align std_simplex_eq_inter stdSimplex_eq_interₓ'. -/
theorem stdSimplex_eq_inter : stdSimplex 𝕜 ι = (⋂ x, { f | 0 ≤ f x }) ∩ { f | (∑ x, f x) = 1 } :=
  by
  ext f
  simp only [stdSimplex, Set.mem_inter_iff, Set.mem_interᵢ, Set.mem_setOf_eq]
#align std_simplex_eq_inter stdSimplex_eq_inter

/- warning: convex_std_simplex -> convex_stdSimplex is a dubious translation:
lean 3 declaration is
  forall (𝕜 : Type.{u1}) (ι : Type.{u2}) [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : Fintype.{u2} ι], Convex.{u1, max u2 u1} 𝕜 (ι -> 𝕜) _inst_1 (Pi.addCommMonoid.{u2, u1} ι (fun (ᾰ : ι) => 𝕜) (fun (i : ι) => OrderedAddCommMonoid.toAddCommMonoid.{u1} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u1} 𝕜 _inst_1))) (Function.hasSMul.{u2, u1, u1} ι 𝕜 𝕜 (Mul.toSMul.{u1} 𝕜 (Distrib.toHasMul.{u1} 𝕜 (NonUnitalNonAssocSemiring.toDistrib.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))) (stdSimplex.{u1, u2} 𝕜 ι _inst_1 _inst_2)
but is expected to have type
  forall (𝕜 : Type.{u2}) (ι : Type.{u1}) [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : Fintype.{u1} ι], Convex.{u2, max u2 u1} 𝕜 (ι -> 𝕜) _inst_1 (Pi.addCommMonoid.{u1, u2} ι (fun (ᾰ : ι) => 𝕜) (fun (i : ι) => OrderedAddCommMonoid.toAddCommMonoid.{u2} 𝕜 (OrderedSemiring.toOrderedAddCommMonoid.{u2} 𝕜 _inst_1))) (Pi.instSMul.{u1, u2, u2} ι 𝕜 (fun (a._@.Mathlib.Analysis.Convex.Basic._hyg.7327 : ι) => 𝕜) (fun (i : ι) => SMulZeroClass.toSMul.{u2, u2} 𝕜 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (SMulWithZero.toSMulZeroClass.{u2, u2} 𝕜 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1))) (MulZeroClass.toSMulWithZero.{u2} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} 𝕜 (Semiring.toNonAssocSemiring.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))))) (stdSimplex.{u2, u1} 𝕜 ι _inst_1 _inst_2)
Case conversion may be inaccurate. Consider using '#align convex_std_simplex convex_stdSimplexₓ'. -/
theorem convex_stdSimplex : Convex 𝕜 (stdSimplex 𝕜 ι) :=
  by
  refine' fun f hf g hg a b ha hb hab => ⟨fun x => _, _⟩
  · apply_rules [add_nonneg, mul_nonneg, hf.1, hg.1]
  · erw [Finset.sum_add_distrib, ← Finset.smul_sum, ← Finset.smul_sum, hf.2, hg.2, smul_eq_mul,
      smul_eq_mul, mul_one, mul_one]
    exact hab
#align convex_std_simplex convex_stdSimplex

variable {ι}

/- warning: ite_eq_mem_std_simplex -> ite_eq_mem_stdSimplex is a dubious translation:
lean 3 declaration is
  forall (𝕜 : Type.{u1}) {ι : Type.{u2}} [_inst_1 : OrderedSemiring.{u1} 𝕜] [_inst_2 : Fintype.{u2} ι] (i : ι), Membership.Mem.{max u2 u1, max u2 u1} (ι -> 𝕜) (Set.{max u2 u1} (ι -> 𝕜)) (Set.hasMem.{max u2 u1} (ι -> 𝕜)) (fun (j : ι) => ite.{succ u1} 𝕜 (Eq.{succ u2} ι i j) (Classical.propDecidable (Eq.{succ u2} ι i j)) (OfNat.ofNat.{u1} 𝕜 1 (OfNat.mk.{u1} 𝕜 1 (One.one.{u1} 𝕜 (AddMonoidWithOne.toOne.{u1} 𝕜 (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} 𝕜 (NonAssocSemiring.toAddCommMonoidWithOne.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1)))))))) (OfNat.ofNat.{u1} 𝕜 0 (OfNat.mk.{u1} 𝕜 0 (Zero.zero.{u1} 𝕜 (MulZeroClass.toHasZero.{u1} 𝕜 (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} 𝕜 (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} 𝕜 (Semiring.toNonAssocSemiring.{u1} 𝕜 (OrderedSemiring.toSemiring.{u1} 𝕜 _inst_1))))))))) (stdSimplex.{u1, u2} 𝕜 ι _inst_1 _inst_2)
but is expected to have type
  forall (𝕜 : Type.{u2}) {ι : Type.{u1}} [_inst_1 : OrderedSemiring.{u2} 𝕜] [_inst_2 : Fintype.{u1} ι] (i : ι), Membership.mem.{max u2 u1, max u2 u1} (ι -> 𝕜) (Set.{max u2 u1} (ι -> 𝕜)) (Set.instMembershipSet.{max u2 u1} (ι -> 𝕜)) (fun (j : ι) => ite.{succ u2} 𝕜 (Eq.{succ u1} ι i j) (Classical.propDecidable (Eq.{succ u1} ι i j)) (OfNat.ofNat.{u2} 𝕜 1 (One.toOfNat1.{u2} 𝕜 (Semiring.toOne.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))) (OfNat.ofNat.{u2} 𝕜 0 (Zero.toOfNat0.{u2} 𝕜 (MonoidWithZero.toZero.{u2} 𝕜 (Semiring.toMonoidWithZero.{u2} 𝕜 (OrderedSemiring.toSemiring.{u2} 𝕜 _inst_1)))))) (stdSimplex.{u2, u1} 𝕜 ι _inst_1 _inst_2)
Case conversion may be inaccurate. Consider using '#align ite_eq_mem_std_simplex ite_eq_mem_stdSimplexₓ'. -/
theorem ite_eq_mem_stdSimplex (i : ι) : (fun j => ite (i = j) (1 : 𝕜) 0) ∈ stdSimplex 𝕜 ι :=
  ⟨fun j => by simp only <;> split_ifs <;> norm_num, by
    rw [Finset.sum_ite_eq, if_pos (Finset.mem_univ _)]⟩
#align ite_eq_mem_std_simplex ite_eq_mem_stdSimplex

end Simplex