math / data /lean /OAI /Geometry /ProjectionBody /SimplexFacets.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.17 kB
import OAI.Geometry.ProjectionBody.ConvexGeometry
import OAI.Geometry.ProjectionBody.FacetCover
import Mathlib.Analysis.InnerProductSpace.Projection.Basic
namespace OAI
noncomputable section
open Set
namespace ProjectionCounterexample
/-- Coordinate linear functional on the Euclidean space. -/
def coordinateFunctional {d : β„•} (i : Fin d) : E d β†’β‚—[ℝ] ℝ where
toFun x := x i
map_add' _ _ := rfl
map_smul' _ _ := rfl
@[simp] theorem coordinateFunctional_apply {d : β„•} (i : Fin d) (x : E d) :
coordinateFunctional i x = x i := rfl
/-- Outward defining functionals: the sum facet, then the coordinate facets. -/
def simplexFunctional (d : β„•) : Option (Fin d) β†’ E d β†’β‚—[ℝ] ℝ
| none => βˆ‘ i, coordinateFunctional i
| some i => -coordinateFunctional i
def simplexLevel {d : β„•} : Option (Fin d) β†’ ℝ
| none => 1
| some _ => 0
@[simp] theorem simplexFunctional_none (d : β„•) (x : E d) :
simplexFunctional d none x = βˆ‘ i, x i := by
simp [simplexFunctional]
@[simp] theorem simplexFunctional_some {d : β„•} (i : Fin d) (x : E d) :
simplexFunctional d (some i) x = -x i := rfl
theorem simplex_eq_halfspaceBody (d : β„•) :
simplex d = halfspaceBody (simplexFunctional d) simplexLevel := by
rw [simplex_eq_coordinates]
ext x
constructor
· rintro ⟨hx, hs⟩ i
cases i with
| none => simpa [simplexLevel] using hs
| some i => simpa [simplexLevel] using neg_nonpos.mpr (hx i)
Β· intro hx
constructor
Β· intro i
have := hx (some i)
simpa [simplexLevel] using this
Β· have := hx none
simpa [simplexLevel] using this
/-- Every nonzero direction has a visible defining facet of the simplex. -/
theorem simplex_has_positive_slope {d : β„•} {u : E d} (hu : u β‰  0) :
βˆƒ i, 0 < simplexFunctional d i u := by
by_contra h
have hall (i : Option (Fin d)) : simplexFunctional d i u ≀ 0 :=
le_of_not_gt (fun hi => h ⟨i, hi⟩)
have hcoords (i : Fin d) : 0 ≀ u i := by
have := hall (some i)
simpa using this
have hsum : βˆ‘ i, u i = 0 := by
apply le_antisymm
Β· simpa using hall none
Β· exact Finset.sum_nonneg fun i _ => hcoords i
have hzero : βˆ€ i : Fin d, u i = 0 := by
simpa using (Finset.sum_eq_zero_iff_of_nonneg (fun i _ => hcoords i)).mp hsum
apply hu
ext i
exact hzero i
theorem simplex_functional_balance {d : β„•} (u : E d) :
βˆ‘ i, simplexFunctional d i u = 0 := by
simp [Fintype.sum_option, Finset.sum_neg_distrib]
theorem simplex_absolute_slopes {d : β„•} (u : E d) :
βˆ‘ i, |simplexFunctional d i u| = (βˆ‘ i, |u i|) + |βˆ‘ i, u i| := by
simp [Fintype.sum_option, add_comm]
theorem simplex_boundingFace_coordinate {d : β„•} (i : Fin d) :
boundingFace (simplexFunctional d) simplexLevel (some i) =
{x ∈ simplex d | x i = 0} := by
ext x
simp [boundingFace, ← simplex_eq_halfspaceBody, simplexLevel]
theorem simplex_boundingFace_sum (d : β„•) :
boundingFace (simplexFunctional d) simplexLevel none =
{x ∈ simplex d | βˆ‘ i, x i = 1} := by
ext x
simp [boundingFace, ← simplex_eq_halfspaceBody, simplexLevel]
end ProjectionCounterexample
end
end OAI