File size: 3,622 Bytes
2fca478 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | import OAI.Geometry.ProjectionBody.ConvexGeometry
import Mathlib.Algebra.BigOperators.Fin
namespace OAI
noncomputable section
open Set
namespace ProjectionCounterexample
/-- The coordinate isometry inserting a zero in slot `i`. -/
def insertZero {n : ℕ} (i : Fin (n + 1)) : E n →ₗᵢ[ℝ] E (n + 1) where
toFun x := WithLp.toLp 2 (i.insertNth 0 x)
map_add' x y := by
ext j
induction j using i.succAboveCases <;> simp
map_smul' c x := by
ext j
induction j using i.succAboveCases <;> simp
norm_map' x := by
apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp
rw [EuclideanSpace.real_norm_sq_eq, EuclideanSpace.real_norm_sq_eq,
Fin.sum_univ_succAbove _ i]
simp
@[simp] theorem insertZero_same {n : ℕ} (i : Fin (n + 1)) (x : E n) :
insertZero i x i = 0 := by simp [insertZero]
@[simp] theorem insertZero_succAbove {n : ℕ} (i : Fin (n + 1)) (x : E n)
(j : Fin n) : insertZero i x (i.succAbove j) = x j := by simp [insertZero]
theorem sum_insertZero {n : ℕ} (i : Fin (n + 1)) (x : E n) :
∑ j, insertZero i x j = ∑ j, x j := by
rw [Fin.sum_univ_succAbove _ i]
simp
/-- A coordinate facet is an actual isometric image of the lower-dimensional simplex. -/
theorem coordinate_facet_eq_image {n : ℕ} (i : Fin (n + 1)) :
{x ∈ simplex (n + 1) | x i = 0} = insertZero i '' simplex n := by
simp_rw [simplex_eq_coordinates]
apply Subset.antisymm
· rintro x ⟨⟨hx, hs⟩, hxi⟩
let y : E n := WithLp.toLp 2 (fun j => x (i.succAbove j))
have hy : (∀ j, 0 ≤ y j) ∧ ∑ j, y j ≤ 1 := by
refine ⟨fun j => hx _, ?_⟩
rw [Fin.sum_univ_succAbove _ i, hxi, zero_add] at hs
exact hs
refine ⟨y, hy, ?_⟩
ext j
induction j using i.succAboveCases
· simpa using hxi.symm
· simp [y]
· rintro x ⟨y, ⟨hy, hs⟩, rfl⟩
refine ⟨⟨?_, ?_⟩, by simp⟩
· intro j
induction j using i.succAboveCases
· simp
· simpa using hy _
· simpa [sum_insertZero] using hs
/-- The affine chart on the facet whose coordinate sum is one. -/
def sumFacetMap (n : ℕ) (x : E n) : E (n + 1) :=
WithLp.toLp 2 (Fin.snoc (fun j => x j) (1 - ∑ j, x j))
@[simp] theorem sumFacetMap_castSucc (n : ℕ) (x : E n) (i : Fin n) :
sumFacetMap n x i.castSucc = x i := by simp [sumFacetMap]
@[simp] theorem sumFacetMap_last (n : ℕ) (x : E n) :
sumFacetMap n x (Fin.last n) = 1 - ∑ j, x j := by simp [sumFacetMap]
@[simp] theorem sum_sumFacetMap (n : ℕ) (x : E n) :
∑ j, sumFacetMap n x j = 1 := by
rw [Fin.sum_univ_castSucc]
simp
/-- The non-coordinate facet is an actual affine image of the lower-dimensional simplex. -/
theorem sum_facet_eq_image (n : ℕ) :
{x ∈ simplex (n + 1) | ∑ j, x j = 1} = sumFacetMap n '' simplex n := by
simp_rw [simplex_eq_coordinates]
apply Subset.antisymm
· rintro x ⟨⟨hx, _⟩, hs⟩
let y : E n := WithLp.toLp 2 (fun j : Fin n => x j.castSucc)
have hsum : ∑ j, y j = 1 - x (Fin.last n) := by
rw [Fin.sum_univ_castSucc] at hs
dsimp [y]
linarith
have hy : (∀ j, 0 ≤ y j) ∧ ∑ j, y j ≤ 1 := by
refine ⟨fun j => hx _, ?_⟩
rw [hsum]
linarith [hx (Fin.last n)]
refine ⟨y, hy, ?_⟩
ext j
induction j using Fin.lastCases
· simp [hsum]
· simp [y]
· rintro x ⟨y, ⟨hy, hs⟩, rfl⟩
refine ⟨⟨?_, by simp⟩, by simp⟩
intro j
induction j using Fin.lastCases
· simp only [sumFacetMap_last]
exact sub_nonneg.mpr hs
· simpa using hy _
end ProjectionCounterexample
end
end OAI
|