Add lean source and binary files (part 72)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/Geometry/ProjectionBody/ProductFacetProjection.lean +39 -0
- lean/OAI/Geometry/ProjectionBody/ProductFacets.lean +101 -0
- lean/OAI/Geometry/ProjectionBody/ProductVolumes.lean +41 -0
- lean/OAI/Geometry/ProjectionBody/ProductZonotopeBridge.lean +74 -0
- lean/OAI/Geometry/ProjectionBody/ProjectionKernel.lean +21 -0
- lean/OAI/Geometry/ProjectionBody/SimplexBrightness.lean +99 -0
- lean/OAI/Geometry/ProjectionBody/SimplexFacetCharts.lean +81 -0
- lean/OAI/Geometry/ProjectionBody/SimplexFacets.lean +97 -0
- lean/OAI/Geometry/ProjectionBody/SimplexVolume.lean +188 -0
- lean/OAI/Geometry/ProjectionBody/Specification.lean +40 -0
- lean/OAI/Geometry/ProjectionBody/UnitSupport.lean +43 -0
- lean/OAI/Geometry/ProjectionBody/ZonotopeBridge.lean +68 -0
- lean/OAI/Geometry/ProjectionVolume/AffineBrightness.lean +191 -0
- lean/OAI/Geometry/ProjectionVolume/AffineCovariance.lean +86 -0
- lean/OAI/Geometry/ProjectionVolume/ApproximationBounds.lean +122 -0
- lean/OAI/Geometry/ProjectionVolume/AreaNormalVectors.lean +71 -0
- lean/OAI/Geometry/ProjectionVolume/Arithmetic.lean +41 -0
- lean/OAI/Geometry/ProjectionVolume/AugmentedDeterminant.lean +106 -0
- lean/OAI/Geometry/ProjectionVolume/BallBrightness.lean +91 -0
- lean/OAI/Geometry/ProjectionVolume/Basic.lean +27 -0
- lean/OAI/Geometry/ProjectionVolume/Brightness.lean +133 -0
- lean/OAI/Geometry/ProjectionVolume/CoordinateDrop.lean +75 -0
- lean/OAI/Geometry/ProjectionVolume/CounterexampleComparison.lean +17 -0
- lean/OAI/Geometry/ProjectionVolume/CubeBrightness.lean +191 -0
- lean/OAI/Geometry/ProjectionVolume/CubeFibers.lean +119 -0
- lean/OAI/Geometry/ProjectionVolume/EuclideanVolume.lean +37 -0
- lean/OAI/Geometry/ProjectionVolume/ExposedBounds.lean +55 -0
- lean/OAI/Geometry/ProjectionVolume/ExposedProduct.lean +104 -0
- lean/OAI/Geometry/ProjectionVolume/Extrusion.lean +220 -0
- lean/OAI/Geometry/ProjectionVolume/FacetAreas.lean +166 -0
- lean/OAI/Geometry/ProjectionVolume/FacetBijection.lean +69 -0
- lean/OAI/Geometry/ProjectionVolume/FacetDimension.lean +98 -0
- lean/OAI/Geometry/ProjectionVolume/FacetExhaustiveness.lean +117 -0
- lean/OAI/Geometry/ProjectionVolume/FacetLinearImage.lean +99 -0
- lean/OAI/Geometry/ProjectionVolume/FacetPrism.lean +106 -0
- lean/OAI/Geometry/ProjectionVolume/FacetUniqueness.lean +77 -0
- lean/OAI/Geometry/ProjectionVolume/FiniteApproximation.lean +45 -0
- lean/OAI/Geometry/ProjectionVolume/FiniteVertices.lean +84 -0
- lean/OAI/Geometry/ProjectionVolume/GeneralProduct.lean +88 -0
- lean/OAI/Geometry/ProjectionVolume/InnerSequence.lean +116 -0
- lean/OAI/Geometry/ProjectionVolume/LinearApproximation.lean +59 -0
- lean/OAI/Geometry/ProjectionVolume/Main.lean +26 -0
- lean/OAI/Geometry/ProjectionVolume/Model.lean +49 -0
- lean/OAI/Geometry/ProjectionVolume/OuterApproximation.lean +156 -0
- lean/OAI/Geometry/ProjectionVolume/PolarRepresentation.lean +181 -0
- lean/OAI/Geometry/ProjectionVolume/PolytopeCauchy.lean +108 -0
- lean/OAI/Geometry/ProjectionVolume/PolytopeDefinitions.lean +43 -0
- lean/OAI/Geometry/ProjectionVolume/PolytopeFaceGeometry.lean +155 -0
- lean/OAI/Geometry/ProjectionVolume/PolytopeFacets.lean +80 -0
- lean/OAI/Geometry/ProjectionVolume/PolytopeFront.lean +263 -0
lean/OAI/Geometry/ProjectionBody/ProductFacetProjection.lean
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.ProductFacetGraphs
|
| 2 |
+
import OAI.Geometry.ProjectionBody.GraphProjection
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped RealInnerProductSpace
|
| 8 |
+
|
| 9 |
+
namespace ProjectionCounterexample
|
| 10 |
+
|
| 11 |
+
/-- The true projected area scale of each product facet chart. -/
|
| 12 |
+
theorem productFacetProjection_normDet (i : Bool × Option (Fin 10))
|
| 13 |
+
{u : E 20} (hu : ‖u‖ = 1) :
|
| 14 |
+
((project u).toLinearMap.comp (productFacetLinear i)).normDet =
|
| 15 |
+
|productFunctional i u| := by
|
| 16 |
+
rcases i with ⟨b, i⟩
|
| 17 |
+
cases b
|
| 18 |
+
· cases i with
|
| 19 |
+
| none =>
|
| 20 |
+
rw [productFacetLinear_first_sum, graphProjection_normDet _ _ hu,
|
| 21 |
+
firstSumGraph_normal_inner]
|
| 22 |
+
rfl
|
| 23 |
+
| some i =>
|
| 24 |
+
rw [productFacetLinear_first_coordinate, coordinateProjection_normDet _ hu]
|
| 25 |
+
simp [firstBlock]
|
| 26 |
+
· cases i with
|
| 27 |
+
| none =>
|
| 28 |
+
rw [productFacetLinear_second_sum, graphProjection_normDet _ _ hu,
|
| 29 |
+
secondSumGraph_normal_inner]
|
| 30 |
+
rfl
|
| 31 |
+
| some i =>
|
| 32 |
+
rw [productFacetLinear_second_coordinate, coordinateProjection_normDet _ hu]
|
| 33 |
+
simp [secondBlock]
|
| 34 |
+
|
| 35 |
+
end ProjectionCounterexample
|
| 36 |
+
|
| 37 |
+
end
|
| 38 |
+
|
| 39 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/ProductFacets.lean
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.SimplexFacets
|
| 2 |
+
import Mathlib.Tactic.Tauto
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open Set
|
| 8 |
+
|
| 9 |
+
namespace ProjectionCounterexample
|
| 10 |
+
|
| 11 |
+
def firstBlockLinear : E 20 →ₗ[ℝ] E 10 where
|
| 12 |
+
toFun := firstBlock
|
| 13 |
+
map_add' _ _ := rfl
|
| 14 |
+
map_smul' _ _ := rfl
|
| 15 |
+
|
| 16 |
+
def secondBlockLinear : E 20 →ₗ[ℝ] E 10 where
|
| 17 |
+
toFun := secondBlock
|
| 18 |
+
map_add' _ _ := rfl
|
| 19 |
+
map_smul' _ _ := rfl
|
| 20 |
+
|
| 21 |
+
/-- The twenty-two bounding inequalities of the actual Cartesian product. -/
|
| 22 |
+
def productFunctional : Bool × Option (Fin 10) → E 20 →ₗ[ℝ] ℝ
|
| 23 |
+
| (false, i) => (simplexFunctional 10 i).comp firstBlockLinear
|
| 24 |
+
| (true, i) => (simplexFunctional 10 i).comp secondBlockLinear
|
| 25 |
+
|
| 26 |
+
def productLevel (i : Bool × Option (Fin 10)) : ℝ := simplexLevel i.2
|
| 27 |
+
|
| 28 |
+
@[simp] theorem productFunctional_first (i : Option (Fin 10)) (x : E 20) :
|
| 29 |
+
productFunctional (false, i) x = simplexFunctional 10 i (firstBlock x) := rfl
|
| 30 |
+
|
| 31 |
+
@[simp] theorem productFunctional_second (i : Option (Fin 10)) (x : E 20) :
|
| 32 |
+
productFunctional (true, i) x = simplexFunctional 10 i (secondBlock x) := rfl
|
| 33 |
+
|
| 34 |
+
theorem productBody_eq_halfspaceBody :
|
| 35 |
+
productBody = halfspaceBody productFunctional productLevel := by
|
| 36 |
+
ext x
|
| 37 |
+
change (firstBlock x ∈ simplex 10 ∧ secondBlock x ∈ simplex 10) ↔ _
|
| 38 |
+
rw [simplex_eq_halfspaceBody]
|
| 39 |
+
constructor
|
| 40 |
+
· rintro ⟨hx, hy⟩ ⟨b, i⟩
|
| 41 |
+
cases b
|
| 42 |
+
· exact hx i
|
| 43 |
+
· exact hy i
|
| 44 |
+
· intro hx
|
| 45 |
+
exact ⟨fun i => hx (false, i), fun i => hx (true, i)⟩
|
| 46 |
+
|
| 47 |
+
theorem blocks_eq_zero_iff (x : E 20) :
|
| 48 |
+
firstBlock x = 0 ∧ secondBlock x = 0 ↔ x = 0 := by
|
| 49 |
+
constructor
|
| 50 |
+
· rintro ⟨hfirst, hsecond⟩
|
| 51 |
+
ext i
|
| 52 |
+
refine Fin.addCases (n := 10) (m := 10) (fun j => ?_) (fun j => ?_) i
|
| 53 |
+
· exact congrArg (fun y : E 10 => y j) hfirst
|
| 54 |
+
· exact congrArg (fun y : E 10 => y j) hsecond
|
| 55 |
+
· rintro rfl
|
| 56 |
+
exact ⟨rfl, rfl⟩
|
| 57 |
+
|
| 58 |
+
theorem product_has_positive_slope {u : E 20} (hu : u ≠ 0) :
|
| 59 |
+
∃ i, 0 < productFunctional i u := by
|
| 60 |
+
by_cases hfirst : firstBlock u = 0
|
| 61 |
+
· have hsecond : secondBlock u ≠ 0 := by
|
| 62 |
+
intro hsecond
|
| 63 |
+
exact hu ((blocks_eq_zero_iff u).mp ⟨hfirst, hsecond⟩)
|
| 64 |
+
obtain ⟨i, hi⟩ := simplex_has_positive_slope hsecond
|
| 65 |
+
exact ⟨(true, i), hi⟩
|
| 66 |
+
· obtain ⟨i, hi⟩ := simplex_has_positive_slope hfirst
|
| 67 |
+
exact ⟨(false, i), hi⟩
|
| 68 |
+
|
| 69 |
+
theorem product_boundingFace_first (i : Option (Fin 10)) :
|
| 70 |
+
boundingFace productFunctional productLevel (false, i) =
|
| 71 |
+
{x | firstBlock x ∈ boundingFace (simplexFunctional 10) simplexLevel i ∧
|
| 72 |
+
secondBlock x ∈ simplex 10} := by
|
| 73 |
+
ext x
|
| 74 |
+
simp only [boundingFace, ← productBody_eq_halfspaceBody, productBody,
|
| 75 |
+
mem_ofPred_eq, productFunctional_first, productLevel, simplex_eq_halfspaceBody]
|
| 76 |
+
tauto
|
| 77 |
+
|
| 78 |
+
theorem product_boundingFace_second (i : Option (Fin 10)) :
|
| 79 |
+
boundingFace productFunctional productLevel (true, i) =
|
| 80 |
+
{x | firstBlock x ∈ simplex 10 ∧
|
| 81 |
+
secondBlock x ∈ boundingFace (simplexFunctional 10) simplexLevel i} := by
|
| 82 |
+
ext x
|
| 83 |
+
simp only [boundingFace, ← productBody_eq_halfspaceBody, productBody,
|
| 84 |
+
mem_ofPred_eq, productFunctional_second, productLevel, simplex_eq_halfspaceBody]
|
| 85 |
+
tauto
|
| 86 |
+
|
| 87 |
+
theorem product_functional_balance (u : E 20) :
|
| 88 |
+
∑ i, productFunctional i u = 0 := by
|
| 89 |
+
simp [Fintype.sum_prod_type]
|
| 90 |
+
|
| 91 |
+
theorem product_absolute_slopes (u : E 20) :
|
| 92 |
+
∑ i, |productFunctional i u| =
|
| 93 |
+
((∑ i, |firstBlock u i|) + |∑ i, firstBlock u i|) +
|
| 94 |
+
((∑ i, |secondBlock u i|) + |∑ i, secondBlock u i|) := by
|
| 95 |
+
simp [Fintype.sum_prod_type, add_comm]
|
| 96 |
+
|
| 97 |
+
end ProjectionCounterexample
|
| 98 |
+
|
| 99 |
+
end
|
| 100 |
+
|
| 101 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/ProductVolumes.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.SimplexVolume
|
| 2 |
+
import OAI.Geometry.ProjectionBody.ProductFacetCharts
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
|
| 9 |
+
namespace ProjectionCounterexample
|
| 10 |
+
|
| 11 |
+
theorem volume_productBody :
|
| 12 |
+
volume productBody = ENNReal.ofReal (1 / ((Nat.factorial 10 : ℝ) * Nat.factorial 10)) := by
|
| 13 |
+
simpa only [productBody, simplex_eq_coordinates, firstBlock, secondBlock,
|
| 14 |
+
Set.mem_ofPred_eq, WithLp.ofLp_toLp] using
|
| 15 |
+
volume_euclideanSimplexProduct 10 10
|
| 16 |
+
|
| 17 |
+
theorem volume_productFacetDomain (b : Bool) :
|
| 18 |
+
volume (productFacetDomain b) =
|
| 19 |
+
ENNReal.ofReal (1 / ((Nat.factorial 9 : ℝ) * Nat.factorial 10)) := by
|
| 20 |
+
cases b
|
| 21 |
+
· simpa only [productFacetDomain, simplex_eq_coordinates, Set.preimage,
|
| 22 |
+
Set.mem_prod, Set.mem_ofPred_eq, DiagonalZonotope.finAddEquivProd_apply,
|
| 23 |
+
WithLp.ofLp_toLp] using
|
| 24 |
+
volume_euclideanSimplexProduct 9 10
|
| 25 |
+
· simpa only [productFacetDomain, simplex_eq_coordinates, Set.preimage,
|
| 26 |
+
Set.mem_prod, Set.mem_ofPred_eq, DiagonalZonotope.finAddEquivProd_apply, WithLp.ofLp_toLp,
|
| 27 |
+
mul_comm] using
|
| 28 |
+
volume_euclideanSimplexProduct 10 9
|
| 29 |
+
|
| 30 |
+
theorem productFacetDomain_compact (b : Bool) : IsCompact (productFacetDomain b) := by
|
| 31 |
+
cases b
|
| 32 |
+
· exact (@EuclideanSpace.finAddEquivProd ℝ _ 9 10).toHomeomorph.isCompact_preimage.mpr
|
| 33 |
+
((simplex_compact 9).prod (simplex_compact 10))
|
| 34 |
+
· exact (@EuclideanSpace.finAddEquivProd ℝ _ 10 9).toHomeomorph.isCompact_preimage.mpr
|
| 35 |
+
((simplex_compact 10).prod (simplex_compact 9))
|
| 36 |
+
|
| 37 |
+
end ProjectionCounterexample
|
| 38 |
+
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/ProductZonotopeBridge.lean
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.ZonotopeBridge
|
| 2 |
+
import OAI.Geometry.Zonotope.Product
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open Set
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace ProjectionCounterexample
|
| 11 |
+
|
| 12 |
+
/-- The sum of the two block support functions, with a common scale. -/
|
| 13 |
+
def blockSupport {n m : ℕ} (u : E (n + m)) : ℝ :=
|
| 14 |
+
DiagonalZonotope.support (WithLp.ofLp (EuclideanSpace.finAddEquivProd u).1) +
|
| 15 |
+
DiagonalZonotope.support (WithLp.ofLp (EuclideanSpace.finAddEquivProd u).2)
|
| 16 |
+
|
| 17 |
+
lemma blockSupport_zero (n m : ℕ) : blockSupport (0 : E (n + m)) = 0 := by
|
| 18 |
+
simp [blockSupport, DiagonalZonotope.support]
|
| 19 |
+
|
| 20 |
+
lemma blockSupport_smul {n m : ℕ} (u : E (n + m)) (a : ℝ) :
|
| 21 |
+
blockSupport (a • u) = |a| * blockSupport u := by
|
| 22 |
+
simp only [blockSupport, map_smul, Prod.smul_fst, Prod.smul_snd]
|
| 23 |
+
change DiagonalZonotope.support (a • WithLp.ofLp (EuclideanSpace.finAddEquivProd u).1) +
|
| 24 |
+
DiagonalZonotope.support (a • WithLp.ofLp (EuclideanSpace.finAddEquivProd u).2) = _
|
| 25 |
+
rw [DiagonalZonotope.support_smul, DiagonalZonotope.support_smul, mul_add]
|
| 26 |
+
|
| 27 |
+
/-- A proved block brightness formula identifies the product projection zonotope. -/
|
| 28 |
+
theorem projectionBody_eq_productZonotope {n m : ℕ} (P : Set (E (n + m)))
|
| 29 |
+
(c : ℝ) (hc : 0 < c)
|
| 30 |
+
(hbrightness : ∀ u : E (n + m), ‖u‖ = 1 → projectionVolume P u = c * blockSupport u) :
|
| 31 |
+
projectionBody P = DiagonalZonotope.euclideanProduct n m c := by
|
| 32 |
+
calc
|
| 33 |
+
projectionBody P = {x : E (n + m) | ∀ u : E (n + m), ‖u‖ = 1 →
|
| 34 |
+
⟪u, x⟫ ≤ c * blockSupport u} := by
|
| 35 |
+
ext x
|
| 36 |
+
constructor
|
| 37 |
+
· intro hx u hu
|
| 38 |
+
rw [← hbrightness u hu]
|
| 39 |
+
exact hx u hu
|
| 40 |
+
· intro hx u hu
|
| 41 |
+
rw [hbrightness u hu]
|
| 42 |
+
exact hx u hu
|
| 43 |
+
_ = {x : E (n + m) | ∀ u : E (n + m), ⟪u, x⟫ ≤ c * blockSupport u} := by
|
| 44 |
+
apply unit_support_halfspaces_eq
|
| 45 |
+
· simp [blockSupport_zero]
|
| 46 |
+
· intro a ha u
|
| 47 |
+
rw [blockSupport_smul, abs_of_nonneg ha]
|
| 48 |
+
ring
|
| 49 |
+
_ = DiagonalZonotope.euclideanProduct n m c :=
|
| 50 |
+
(DiagonalZonotope.euclideanProduct_eq_halfspaces n m c hc).symm
|
| 51 |
+
|
| 52 |
+
/-- Body structure and attained orthogonal-projection support values for a block formula. -/
|
| 53 |
+
theorem projection_productZonotope_is_body_and_attains {n m : ℕ}
|
| 54 |
+
(P : Set (E (n + m))) (c : ℝ) (hc : 0 < c)
|
| 55 |
+
(hbrightness : ∀ u : E (n + m), ‖u‖ = 1 → projectionVolume P u = c * blockSupport u) :
|
| 56 |
+
IsConvexBody (projectionBody P) ∧
|
| 57 |
+
∀ u : E (n + m), ‖u‖ = 1 → ∃ x ∈ projectionBody P, ⟪u, x⟫ = projectionVolume P u := by
|
| 58 |
+
have hbody := projectionBody_eq_productZonotope P c hc hbrightness
|
| 59 |
+
constructor
|
| 60 |
+
· rw [hbody]
|
| 61 |
+
exact ⟨DiagonalZonotope.isCompact_euclideanProduct n m c,
|
| 62 |
+
DiagonalZonotope.convex_euclideanProduct n m c,
|
| 63 |
+
DiagonalZonotope.euclideanProduct_interior_nonempty n m c hc.ne'⟩
|
| 64 |
+
· intro u hu
|
| 65 |
+
obtain ⟨x, hx, heq⟩ := DiagonalZonotope.euclideanProduct_support_attained n m c u
|
| 66 |
+
refine ⟨x, hbody.symm ▸ hx, ?_⟩
|
| 67 |
+
rw [hbrightness u hu]
|
| 68 |
+
exact heq
|
| 69 |
+
|
| 70 |
+
end ProjectionCounterexample
|
| 71 |
+
|
| 72 |
+
end
|
| 73 |
+
|
| 74 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/ProjectionKernel.lean
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.Definitions
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace ProjectionCounterexample
|
| 8 |
+
|
| 9 |
+
@[simp] theorem project_self {d : ℕ} (u : E d) : project u u = 0 :=
|
| 10 |
+
Submodule.starProjection_orthogonalComplement_singleton_eq_zero u
|
| 11 |
+
|
| 12 |
+
theorem project_ker {d : ℕ} (u : E d) :
|
| 13 |
+
(project u).toLinearMap.ker = Submodule.span ℝ {u} := by
|
| 14 |
+
change (ℝ ∙ u)ᗮ.starProjection.ker = ℝ ∙ u
|
| 15 |
+
rw [Submodule.ker_starProjection, Submodule.orthogonal_orthogonal]
|
| 16 |
+
|
| 17 |
+
end ProjectionCounterexample
|
| 18 |
+
|
| 19 |
+
end
|
| 20 |
+
|
| 21 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/SimplexBrightness.lean
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.SimplexFacetCharts
|
| 2 |
+
import OAI.Geometry.ProjectionBody.GraphProjection
|
| 3 |
+
import OAI.Geometry.ProjectionBody.SimplexVolume
|
| 4 |
+
import OAI.Geometry.ProjectionBody.AffineChartMeasure
|
| 5 |
+
import OAI.Geometry.ProjectionBody.BrightnessSum
|
| 6 |
+
import OAI.Geometry.ProjectionBody.ProjectionKernel
|
| 7 |
+
|
| 8 |
+
namespace OAI
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
open Set MeasureTheory Measure
|
| 12 |
+
open scoped RealInnerProductSpace
|
| 13 |
+
|
| 14 |
+
namespace ProjectionCounterexample
|
| 15 |
+
|
| 16 |
+
theorem volume_simplex (n : ℕ) :
|
| 17 |
+
volume (simplex n) = ENNReal.ofReal (1 / (n.factorial : ℝ)) := by
|
| 18 |
+
rw [simplex_eq_coordinates]
|
| 19 |
+
exact volume_unit_euclideanSimplex n
|
| 20 |
+
|
| 21 |
+
theorem simplexFacetProjection_normDet {n : ℕ} (i : Option (Fin (n + 1)))
|
| 22 |
+
{u : E (n + 1)} (hu : ‖u‖ = 1) :
|
| 23 |
+
((project u).toLinearMap.comp (simplexFacetLinear n i)).normDet =
|
| 24 |
+
|simplexFunctional (n + 1) i u| := by
|
| 25 |
+
cases i with
|
| 26 |
+
| none =>
|
| 27 |
+
change ((project u).toLinearMap.comp
|
| 28 |
+
(graphLinear (Fin.last n) (allOnes n))).normDet = _
|
| 29 |
+
rw [graphProjection_normDet _ _ hu]
|
| 30 |
+
have hnormal : graphNormal (Fin.last n) (allOnes n) = allOnes (n + 1) := by
|
| 31 |
+
ext j
|
| 32 |
+
induction j using Fin.lastCases <;>
|
| 33 |
+
simp [graphNormal, insertZero, Fin.insertNth_last']
|
| 34 |
+
simp [hnormal]
|
| 35 |
+
| some i =>
|
| 36 |
+
change ((project u).toLinearMap.comp (insertZero i).toLinearMap).normDet = _
|
| 37 |
+
rw [coordinateProjection_normDet i hu]
|
| 38 |
+
simp
|
| 39 |
+
|
| 40 |
+
theorem simplex_projected_facet_volume {n : ℕ} (i : Option (Fin (n + 1)))
|
| 41 |
+
{u : E (n + 1)} (hu : ‖u‖ = 1) :
|
| 42 |
+
μHE[n] (project u '' boundingFace (simplexFunctional (n + 1)) simplexLevel i) =
|
| 43 |
+
ENNReal.ofReal ((1 / (n.factorial : ℝ)) * |simplexFunctional (n + 1) i u|) := by
|
| 44 |
+
rw [simplex_facet_eq_affine_image]
|
| 45 |
+
have h := measure_projected_affine_chart (simplexFacetLinear n i)
|
| 46 |
+
(simplexFacetCenter n i) (project u).toLinearMap (simplex n)
|
| 47 |
+
simp only [finrank_euclideanSpace_fin, ContinuousLinearMap.coe_coe] at h
|
| 48 |
+
rw [h, simplexFacetProjection_normDet i hu, volume_simplex,
|
| 49 |
+
← ENNReal.ofReal_mul (abs_nonneg _), mul_comm]
|
| 50 |
+
|
| 51 |
+
theorem simplex_projected_facet_measurable {n : ℕ}
|
| 52 |
+
(i : Option (Fin (n + 1))) (u : E (n + 1)) :
|
| 53 |
+
MeasurableSet (project u '' boundingFace (simplexFunctional (n + 1)) simplexLevel i) := by
|
| 54 |
+
rw [simplex_facet_eq_affine_image]
|
| 55 |
+
apply IsCompact.measurableSet
|
| 56 |
+
apply IsCompact.image _ (project u).continuous
|
| 57 |
+
apply (simplex_compact n).image
|
| 58 |
+
exact continuous_const.add (simplexFacetLinear n i).continuous_of_finiteDimensional
|
| 59 |
+
|
| 60 |
+
theorem simplex_projected_facet_intersection_null {n : ℕ} (hn : 0 < n)
|
| 61 |
+
(i j : Option (Fin (n + 1))) (hij : i ≠ j) (u : E (n + 1)) :
|
| 62 |
+
μHE[n] (project u ''
|
| 63 |
+
(boundingFace (simplexFunctional (n + 1)) simplexLevel i ∩
|
| 64 |
+
boundingFace (simplexFunctional (n + 1)) simplexLevel j)) = 0 := by
|
| 65 |
+
have hS : boundingFace (simplexFunctional (n + 1)) simplexLevel i ⊆
|
| 66 |
+
(fun x => simplexFacetCenter n i + simplexFacetLinear n i x) '' (univ : Set (E n)) := by
|
| 67 |
+
rw [simplex_facet_eq_affine_image]
|
| 68 |
+
exact Set.image_mono (subset_univ _)
|
| 69 |
+
simpa only [finrank_euclideanSpace_fin, ContinuousLinearMap.coe_coe] using
|
| 70 |
+
measure_projected_transverse_intersection (simplexFacetLinear n i)
|
| 71 |
+
(simplexFacetCenter n i) (project u).toLinearMap
|
| 72 |
+
(simplexFunctional (n + 1) j) (simplexLevel j) _ _ hS
|
| 73 |
+
(fun _ h => h.2) (simplex_facet_transverse hn i j hij)
|
| 74 |
+
|
| 75 |
+
/-- Actual orthogonal projection volume of the convex-hull standard simplex. -/
|
| 76 |
+
theorem simplex_projectionVolume {n : ℕ} (hn : 0 < n)
|
| 77 |
+
{u : E (n + 1)} (hu : ‖u‖ = 1) :
|
| 78 |
+
projectionVolume (simplex (n + 1)) u =
|
| 79 |
+
((∑ i, |u i|) + |∑ i, u i|) / (2 * (n.factorial : ℝ)) := by
|
| 80 |
+
have hu0 : u ≠ 0 := by intro h; simp [h] at hu
|
| 81 |
+
have h := real_measure_image_halfspaceBody
|
| 82 |
+
(simplexFunctional (n + 1)) simplexLevel (project u).toLinearMap μHE[n]
|
| 83 |
+
(project_self u) (simplex_has_positive_slope hu0) (project_ker u)
|
| 84 |
+
(fun i => simplex_projected_facet_measurable i u)
|
| 85 |
+
(fun i j hij => simplex_projected_facet_intersection_null hn i j hij u)
|
| 86 |
+
(1 / (n.factorial : ℝ)) (by positivity) (simplex_functional_balance u)
|
| 87 |
+
(fun i => simplex_projected_facet_volume i hu)
|
| 88 |
+
rw [← simplex_eq_halfspaceBody, simplex_absolute_slopes] at h
|
| 89 |
+
simp only [ContinuousLinearMap.coe_coe] at h
|
| 90 |
+
unfold projectionVolume
|
| 91 |
+
simp only [Nat.add_sub_cancel]
|
| 92 |
+
rw [h]
|
| 93 |
+
ring
|
| 94 |
+
|
| 95 |
+
end ProjectionCounterexample
|
| 96 |
+
|
| 97 |
+
end
|
| 98 |
+
|
| 99 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/SimplexFacetCharts.lean
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.GraphChart
|
| 2 |
+
import OAI.Geometry.ProjectionBody.SimplexFacets
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open Set
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace ProjectionCounterexample
|
| 11 |
+
|
| 12 |
+
def allOnes (n : ℕ) : E n := WithLp.toLp 2 (fun _ => 1)
|
| 13 |
+
|
| 14 |
+
@[simp] theorem allOnes_apply {n : ℕ} (i : Fin n) : allOnes n i = 1 := rfl
|
| 15 |
+
|
| 16 |
+
@[simp] theorem inner_allOnes {n : ℕ} (x : E n) : ⟪allOnes n, x⟫ = ∑ i, x i := by
|
| 17 |
+
simp [PiLp.inner_apply, allOnes]
|
| 18 |
+
|
| 19 |
+
/-- Linear part of each simplex facet chart. -/
|
| 20 |
+
def simplexFacetLinear (n : ℕ) : Option (Fin (n + 1)) → E n →ₗ[ℝ] E (n + 1)
|
| 21 |
+
| none => graphLinear (Fin.last n) (allOnes n)
|
| 22 |
+
| some i => (insertZero i).toLinearMap
|
| 23 |
+
|
| 24 |
+
def simplexFacetCenter (n : ℕ) : Option (Fin (n + 1)) → E (n + 1)
|
| 25 |
+
| none => EuclideanSpace.single (Fin.last n) 1
|
| 26 |
+
| some _ => 0
|
| 27 |
+
|
| 28 |
+
theorem simplexFacetChart_none (n : ℕ) (x : E n) :
|
| 29 |
+
simplexFacetCenter n none + simplexFacetLinear n none x = sumFacetMap n x := by
|
| 30 |
+
ext j
|
| 31 |
+
induction j using Fin.lastCases
|
| 32 |
+
· simp [simplexFacetCenter, simplexFacetLinear, graphLinear, sub_eq_add_neg]
|
| 33 |
+
· simp [simplexFacetCenter, simplexFacetLinear, graphLinear, insertZero,
|
| 34 |
+
Fin.insertNth_last']
|
| 35 |
+
|
| 36 |
+
theorem simplex_facet_eq_affine_image (n : ℕ) (i : Option (Fin (n + 1))) :
|
| 37 |
+
boundingFace (simplexFunctional (n + 1)) simplexLevel i =
|
| 38 |
+
(fun x => simplexFacetCenter n i + simplexFacetLinear n i x) '' simplex n := by
|
| 39 |
+
cases i with
|
| 40 |
+
| none =>
|
| 41 |
+
simp_rw [simplex_boundingFace_sum, simplexFacetChart_none]
|
| 42 |
+
exact sum_facet_eq_image n
|
| 43 |
+
| some i =>
|
| 44 |
+
rw [simplex_boundingFace_coordinate, coordinate_facet_eq_image]
|
| 45 |
+
simp [simplexFacetCenter, simplexFacetLinear]
|
| 46 |
+
|
| 47 |
+
/-- Every defining hyperplane other than the chart's own hyperplane is transverse.
|
| 48 |
+
The positive dimension excludes the degenerate segment-endpoint case. -/
|
| 49 |
+
theorem simplex_facet_transverse {n : ℕ} (hn : 0 < n)
|
| 50 |
+
(i j : Option (Fin (n + 1))) (hij : i ≠ j) :
|
| 51 |
+
(simplexFunctional (n + 1) j).comp (simplexFacetLinear n i) ≠ 0 := by
|
| 52 |
+
intro heq
|
| 53 |
+
let k : Fin n := ⟨0, hn⟩
|
| 54 |
+
cases i with
|
| 55 |
+
| none =>
|
| 56 |
+
cases j with
|
| 57 |
+
| none => exact hij rfl
|
| 58 |
+
| some j =>
|
| 59 |
+
induction j using Fin.lastCases with
|
| 60 |
+
| last =>
|
| 61 |
+
have h := LinearMap.congr_fun heq (EuclideanSpace.single k 1)
|
| 62 |
+
simp [simplexFacetLinear, graphLinear] at h
|
| 63 |
+
| cast j =>
|
| 64 |
+
have h := LinearMap.congr_fun heq (EuclideanSpace.single j 1)
|
| 65 |
+
simp [simplexFacetLinear, graphLinear, insertZero, Fin.insertNth_last'] at h
|
| 66 |
+
| some i =>
|
| 67 |
+
cases j with
|
| 68 |
+
| none =>
|
| 69 |
+
have h := LinearMap.congr_fun heq (EuclideanSpace.single k 1)
|
| 70 |
+
simp [simplexFacetLinear, sum_insertZero] at h
|
| 71 |
+
| some j =>
|
| 72 |
+
have hji : j ≠ i := fun h => hij (congrArg some h.symm)
|
| 73 |
+
obtain ⟨k, rfl⟩ := Fin.exists_succAbove_eq hji
|
| 74 |
+
have h := LinearMap.congr_fun heq (EuclideanSpace.single k 1)
|
| 75 |
+
simp [simplexFacetLinear] at h
|
| 76 |
+
|
| 77 |
+
end ProjectionCounterexample
|
| 78 |
+
|
| 79 |
+
end
|
| 80 |
+
|
| 81 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/SimplexFacets.lean
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.ConvexGeometry
|
| 2 |
+
import OAI.Geometry.ProjectionBody.FacetCover
|
| 3 |
+
import Mathlib.Analysis.InnerProductSpace.Projection.Basic
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open Set
|
| 9 |
+
|
| 10 |
+
namespace ProjectionCounterexample
|
| 11 |
+
|
| 12 |
+
/-- Coordinate linear functional on the Euclidean space. -/
|
| 13 |
+
def coordinateFunctional {d : ℕ} (i : Fin d) : E d →ₗ[ℝ] ℝ where
|
| 14 |
+
toFun x := x i
|
| 15 |
+
map_add' _ _ := rfl
|
| 16 |
+
map_smul' _ _ := rfl
|
| 17 |
+
|
| 18 |
+
@[simp] theorem coordinateFunctional_apply {d : ℕ} (i : Fin d) (x : E d) :
|
| 19 |
+
coordinateFunctional i x = x i := rfl
|
| 20 |
+
|
| 21 |
+
/-- Outward defining functionals: the sum facet, then the coordinate facets. -/
|
| 22 |
+
def simplexFunctional (d : ℕ) : Option (Fin d) → E d →ₗ[ℝ] ℝ
|
| 23 |
+
| none => ∑ i, coordinateFunctional i
|
| 24 |
+
| some i => -coordinateFunctional i
|
| 25 |
+
|
| 26 |
+
def simplexLevel {d : ℕ} : Option (Fin d) → ℝ
|
| 27 |
+
| none => 1
|
| 28 |
+
| some _ => 0
|
| 29 |
+
|
| 30 |
+
@[simp] theorem simplexFunctional_none (d : ℕ) (x : E d) :
|
| 31 |
+
simplexFunctional d none x = ∑ i, x i := by
|
| 32 |
+
simp [simplexFunctional]
|
| 33 |
+
|
| 34 |
+
@[simp] theorem simplexFunctional_some {d : ℕ} (i : Fin d) (x : E d) :
|
| 35 |
+
simplexFunctional d (some i) x = -x i := rfl
|
| 36 |
+
|
| 37 |
+
theorem simplex_eq_halfspaceBody (d : ℕ) :
|
| 38 |
+
simplex d = halfspaceBody (simplexFunctional d) simplexLevel := by
|
| 39 |
+
rw [simplex_eq_coordinates]
|
| 40 |
+
ext x
|
| 41 |
+
constructor
|
| 42 |
+
· rintro ⟨hx, hs⟩ i
|
| 43 |
+
cases i with
|
| 44 |
+
| none => simpa [simplexLevel] using hs
|
| 45 |
+
| some i => simpa [simplexLevel] using neg_nonpos.mpr (hx i)
|
| 46 |
+
· intro hx
|
| 47 |
+
constructor
|
| 48 |
+
· intro i
|
| 49 |
+
have := hx (some i)
|
| 50 |
+
simpa [simplexLevel] using this
|
| 51 |
+
· have := hx none
|
| 52 |
+
simpa [simplexLevel] using this
|
| 53 |
+
|
| 54 |
+
/-- Every nonzero direction has a visible defining facet of the simplex. -/
|
| 55 |
+
theorem simplex_has_positive_slope {d : ℕ} {u : E d} (hu : u ≠ 0) :
|
| 56 |
+
∃ i, 0 < simplexFunctional d i u := by
|
| 57 |
+
by_contra h
|
| 58 |
+
have hall (i : Option (Fin d)) : simplexFunctional d i u ≤ 0 :=
|
| 59 |
+
le_of_not_gt (fun hi => h ⟨i, hi⟩)
|
| 60 |
+
have hcoords (i : Fin d) : 0 ≤ u i := by
|
| 61 |
+
have := hall (some i)
|
| 62 |
+
simpa using this
|
| 63 |
+
have hsum : ∑ i, u i = 0 := by
|
| 64 |
+
apply le_antisymm
|
| 65 |
+
· simpa using hall none
|
| 66 |
+
· exact Finset.sum_nonneg fun i _ => hcoords i
|
| 67 |
+
have hzero : ∀ i : Fin d, u i = 0 := by
|
| 68 |
+
simpa using (Finset.sum_eq_zero_iff_of_nonneg (fun i _ => hcoords i)).mp hsum
|
| 69 |
+
apply hu
|
| 70 |
+
ext i
|
| 71 |
+
exact hzero i
|
| 72 |
+
|
| 73 |
+
theorem simplex_functional_balance {d : ℕ} (u : E d) :
|
| 74 |
+
∑ i, simplexFunctional d i u = 0 := by
|
| 75 |
+
simp [Fintype.sum_option, Finset.sum_neg_distrib]
|
| 76 |
+
|
| 77 |
+
theorem simplex_absolute_slopes {d : ℕ} (u : E d) :
|
| 78 |
+
∑ i, |simplexFunctional d i u| = (∑ i, |u i|) + |∑ i, u i| := by
|
| 79 |
+
simp [Fintype.sum_option, add_comm]
|
| 80 |
+
|
| 81 |
+
theorem simplex_boundingFace_coordinate {d : ℕ} (i : Fin d) :
|
| 82 |
+
boundingFace (simplexFunctional d) simplexLevel (some i) =
|
| 83 |
+
{x ∈ simplex d | x i = 0} := by
|
| 84 |
+
ext x
|
| 85 |
+
simp [boundingFace, ← simplex_eq_halfspaceBody, simplexLevel]
|
| 86 |
+
|
| 87 |
+
theorem simplex_boundingFace_sum (d : ℕ) :
|
| 88 |
+
boundingFace (simplexFunctional d) simplexLevel none =
|
| 89 |
+
{x ∈ simplex d | ∑ i, x i = 1} := by
|
| 90 |
+
ext x
|
| 91 |
+
simp [boundingFace, ← simplex_eq_halfspaceBody, simplexLevel]
|
| 92 |
+
|
| 93 |
+
end ProjectionCounterexample
|
| 94 |
+
|
| 95 |
+
end
|
| 96 |
+
|
| 97 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/SimplexVolume.lean
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Logic.Equiv.Fin.Basic
|
| 2 |
+
import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
|
| 3 |
+
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
|
| 4 |
+
import Mathlib.MeasureTheory.Constructions.Pi
|
| 5 |
+
import Mathlib.Tactic.Linarith
|
| 6 |
+
import Mathlib.Tactic.Ring
|
| 7 |
+
import Mathlib.Tactic.Positivity
|
| 8 |
+
import Mathlib.Tactic.FunProp
|
| 9 |
+
import Mathlib.Tactic.Measurability
|
| 10 |
+
import Mathlib.Tactic.SplitIfs
|
| 11 |
+
|
| 12 |
+
namespace OAI
|
| 13 |
+
|
| 14 |
+
/-!
|
| 15 |
+
# Volumes of standard simplices and their products
|
| 16 |
+
|
| 17 |
+
The simplex-volume calculation below uses Tonelli's theorem and induction on the
|
| 18 |
+
dimension. At first coordinate `t`, the remaining section is a simplex of radius
|
| 19 |
+
`r - t`; its volume is integrated over `0 ≤ t ≤ r`. The Euclidean versions use
|
| 20 |
+
the measure-preserving equivalence between coordinate space and `EuclideanSpace`.
|
| 21 |
+
The product formula is proved using the product Lebesgue measure under the
|
| 22 |
+
canonical splitting of `Fin (p + q)`.
|
| 23 |
+
-/
|
| 24 |
+
|
| 25 |
+
open MeasureTheory Set
|
| 26 |
+
open scoped BigOperators ENNReal
|
| 27 |
+
|
| 28 |
+
namespace ProjectionCounterexample
|
| 29 |
+
|
| 30 |
+
/-- The coordinate standard simplex with nonnegative coordinates and sum at most `r`. -/
|
| 31 |
+
def coordinateSimplex (n : ℕ) (r : ℝ) : Set (Fin n → ℝ) :=
|
| 32 |
+
{x | (∀ i, 0 ≤ x i) ∧ ∑ i, x i ≤ r}
|
| 33 |
+
|
| 34 |
+
theorem coordinateSimplex_measurableSet (n : ℕ) (r : ℝ) :
|
| 35 |
+
MeasurableSet (coordinateSimplex n r) := by
|
| 36 |
+
unfold coordinateSimplex
|
| 37 |
+
measurability
|
| 38 |
+
|
| 39 |
+
theorem coordinateSimplex_eq_empty_of_neg (n : ℕ) {r : ℝ} (hr : r < 0) :
|
| 40 |
+
coordinateSimplex n r = ∅ := by
|
| 41 |
+
apply Set.eq_empty_iff_forall_notMem.mpr
|
| 42 |
+
intro x hx
|
| 43 |
+
have hsum : 0 ≤ ∑ i, x i := Finset.sum_nonneg fun i _ => hx.1 i
|
| 44 |
+
exact (not_lt_of_ge (hsum.trans hx.2)) hr
|
| 45 |
+
|
| 46 |
+
theorem integral_simplex_slice (n : ℕ) {r : ℝ} (hr : 0 ≤ r) :
|
| 47 |
+
(∫⁻ t in Icc 0 r, ENNReal.ofReal ((r - t) ^ n / (n.factorial : ℝ))) =
|
| 48 |
+
ENNReal.ofReal (r ^ (n + 1) / ((n + 1).factorial : ℝ)) := by
|
| 49 |
+
have hi : IntegrableOn (fun t : ℝ => (r - t) ^ n / (n.factorial : ℝ)) (Icc 0 r) :=
|
| 50 |
+
ContinuousOn.integrableOn_Icc (by fun_prop)
|
| 51 |
+
have hn : 0 ≤ᵐ[volume.restrict (Icc 0 r)]
|
| 52 |
+
(fun t : ℝ => (r - t) ^ n / (n.factorial : ℝ)) := by
|
| 53 |
+
filter_upwards [ae_restrict_mem measurableSet_Icc] with t ht
|
| 54 |
+
exact div_nonneg (pow_nonneg (sub_nonneg.mpr ht.2) n) (by positivity)
|
| 55 |
+
rw [← ofReal_integral_eq_lintegral_ofReal hi hn,
|
| 56 |
+
integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le hr,
|
| 57 |
+
intervalIntegral.integral_div, intervalIntegral.integral_comp_sub_left (fun t : ℝ => t ^ n) r]
|
| 58 |
+
simp only [sub_self, sub_zero, integral_pow,
|
| 59 |
+
zero_pow (Nat.succ_ne_zero n), sub_zero]
|
| 60 |
+
congr 1
|
| 61 |
+
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, div_div]
|
| 62 |
+
|
| 63 |
+
theorem volume_coordinateSimplex (n : ℕ) (r : ℝ) (hr : 0 ≤ r) :
|
| 64 |
+
volume (coordinateSimplex n r) =
|
| 65 |
+
ENNReal.ofReal (r ^ n / (n.factorial : ℝ)) := by
|
| 66 |
+
induction n generalizing r with
|
| 67 |
+
| zero =>
|
| 68 |
+
have h : coordinateSimplex 0 r = univ := by
|
| 69 |
+
ext x
|
| 70 |
+
simp [coordinateSimplex, hr]
|
| 71 |
+
simp [h, Measure.volume_pi_eq_dirac (0 : Fin 0 → ℝ)]
|
| 72 |
+
| succ n ih =>
|
| 73 |
+
let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n + 1) => ℝ) 0
|
| 74 |
+
have he (p : ℝ × (Fin n → ℝ)) : e.symm p = Fin.cons p.1 p.2 := by
|
| 75 |
+
ext i
|
| 76 |
+
refine Fin.cases ?_ (fun j => ?_) i <;> simp [e, MeasurableEquiv.piFinSuccAbove]
|
| 77 |
+
have hslice (t : ℝ) :
|
| 78 |
+
Prod.mk t ⁻¹' (e.symm ⁻¹' coordinateSimplex (n + 1) r) =
|
| 79 |
+
if t ∈ Icc 0 r then coordinateSimplex n (r - t) else ∅ := by
|
| 80 |
+
ext x
|
| 81 |
+
simp only [mem_preimage, he, coordinateSimplex, mem_ofPred_eq,
|
| 82 |
+
Fin.forall_fin_succ, Fin.cons_zero, Fin.cons_succ, Fin.sum_univ_succ]
|
| 83 |
+
split_ifs with ht
|
| 84 |
+
· simp only [mem_ofPred_eq]
|
| 85 |
+
constructor
|
| 86 |
+
· rintro ⟨⟨_, hx⟩, hs⟩
|
| 87 |
+
exact ⟨hx, by linarith⟩
|
| 88 |
+
· rintro ⟨hx, hs⟩
|
| 89 |
+
exact ⟨⟨ht.1, hx⟩, by linarith⟩
|
| 90 |
+
· simp only [mem_empty_iff_false, iff_false]
|
| 91 |
+
rintro ⟨⟨ht0, hx⟩, hs⟩
|
| 92 |
+
apply ht
|
| 93 |
+
have hsum : 0 ≤ ∑ i, x i := Finset.sum_nonneg fun i _ => hx i
|
| 94 |
+
exact ⟨ht0, by linarith⟩
|
| 95 |
+
rw [← (volume_preserving_piFinSuccAbove
|
| 96 |
+
(fun _ : Fin (n + 1) => ℝ) 0).symm.measure_preimage_equiv]
|
| 97 |
+
change volume (e.symm ⁻¹' coordinateSimplex (n + 1) r) = _
|
| 98 |
+
rw [Measure.volume_eq_prod, Measure.prod_apply
|
| 99 |
+
((coordinateSimplex_measurableSet (n + 1) r).preimage e.symm.measurable)]
|
| 100 |
+
simp_rw [hslice]
|
| 101 |
+
have hfun : (fun t : ℝ => volume
|
| 102 |
+
(if t ∈ Icc 0 r then coordinateSimplex n (r - t) else ∅)) =
|
| 103 |
+
(Icc 0 r).indicator
|
| 104 |
+
(fun t : ℝ => ENNReal.ofReal ((r - t) ^ n / (n.factorial : ℝ))) := by
|
| 105 |
+
funext t
|
| 106 |
+
by_cases ht : t ∈ Icc 0 r
|
| 107 |
+
· simp [ht, ih (r - t) (sub_nonneg.mpr ht.2)]
|
| 108 |
+
· simp [ht]
|
| 109 |
+
rw [hfun, lintegral_indicator measurableSet_Icc]
|
| 110 |
+
exact integral_simplex_slice n hr
|
| 111 |
+
|
| 112 |
+
/-- The standard simplex has ordinary Lebesgue volume `1 / n!`. -/
|
| 113 |
+
theorem volume_unit_coordinateSimplex (n : ℕ) :
|
| 114 |
+
volume (coordinateSimplex n 1) = ENNReal.ofReal (1 / (n.factorial : ℝ)) := by
|
| 115 |
+
simpa using volume_coordinateSimplex n 1 zero_le_one
|
| 116 |
+
|
| 117 |
+
/-- Exact volume of a possibly degenerate linear image of the coordinate simplex. -/
|
| 118 |
+
theorem volume_linearImage_unit_coordinateSimplex (n : ℕ)
|
| 119 |
+
(f : (Fin n → ℝ) →ₗ[ℝ] (Fin n → ℝ)) :
|
| 120 |
+
volume (f '' coordinateSimplex n 1) =
|
| 121 |
+
ENNReal.ofReal (|LinearMap.det f| / (n.factorial : ℝ)) := by
|
| 122 |
+
rw [Measure.addHaar_image_linearMap, volume_unit_coordinateSimplex,
|
| 123 |
+
← ENNReal.ofReal_mul (abs_nonneg _)]
|
| 124 |
+
congr 1
|
| 125 |
+
ring
|
| 126 |
+
|
| 127 |
+
/-- The same volume statement in Euclidean space with its canonical Euclidean measure. -/
|
| 128 |
+
theorem volume_unit_euclideanSimplex (n : ℕ) :
|
| 129 |
+
volume {x : EuclideanSpace ℝ (Fin n) | (∀ i, 0 ≤ x i) ∧ ∑ i, x i ≤ 1} =
|
| 130 |
+
ENNReal.ofReal (1 / (n.factorial : ℝ)) := by
|
| 131 |
+
have hs : MeasurableSet
|
| 132 |
+
{x : EuclideanSpace ℝ (Fin n) | (∀ i, 0 ≤ x i) ∧ ∑ i, x i ≤ 1} := by
|
| 133 |
+
measurability
|
| 134 |
+
rw [← (PiLp.volume_preserving_toLp (Fin n)).measure_preimage hs.nullMeasurableSet]
|
| 135 |
+
exact volume_unit_coordinateSimplex n
|
| 136 |
+
|
| 137 |
+
/-- Real-valued version of the Euclidean simplex volume. -/
|
| 138 |
+
theorem realVolume_unit_euclideanSimplex (n : ℕ) :
|
| 139 |
+
(volume {x : EuclideanSpace ℝ (Fin n) |
|
| 140 |
+
(∀ i, 0 ≤ x i) ∧ ∑ i, x i ≤ 1}).toReal = 1 / (n.factorial : ℝ) := by
|
| 141 |
+
rw [volume_unit_euclideanSimplex, ENNReal.toReal_ofReal]
|
| 142 |
+
positivity
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
/-- The coordinate product, with the first `p` and last `q` coordinates separated. -/
|
| 146 |
+
def coordinateSimplexProduct (p q : ℕ) : Set (Fin (p + q) → ℝ) :=
|
| 147 |
+
{x | (fun i : Fin p => x (Fin.castAdd q i)) ∈ coordinateSimplex p 1 ∧
|
| 148 |
+
(fun i : Fin q => x (Fin.natAdd p i)) ∈ coordinateSimplex q 1}
|
| 149 |
+
|
| 150 |
+
/-- The product-volume identity uses the actual product Lebesgue measure. -/
|
| 151 |
+
theorem volume_coordinateSimplexProduct (p q : ℕ) :
|
| 152 |
+
volume (coordinateSimplexProduct p q) =
|
| 153 |
+
ENNReal.ofReal (1 / ((p.factorial : ℝ) * (q.factorial : ℝ))) := by
|
| 154 |
+
let e : (Fin (p + q) → ℝ) ≃ᵐ ((Fin p → ℝ) × (Fin q → ℝ)) :=
|
| 155 |
+
(MeasurableEquiv.piCongrLeft (fun _ : Fin (p + q) => ℝ)
|
| 156 |
+
finSumFinEquiv).symm.trans (MeasurableEquiv.sumPiEquivProdPi (fun _ => ℝ))
|
| 157 |
+
have he (x : Fin (p + q) → ℝ) :
|
| 158 |
+
e x = ((fun i : Fin p => x (Fin.castAdd q i)),
|
| 159 |
+
(fun i : Fin q => x (Fin.natAdd p i))) := by
|
| 160 |
+
rfl
|
| 161 |
+
have hm : MeasurePreserving e :=
|
| 162 |
+
(volume_measurePreserving_piCongrLeft (fun _ : Fin (p + q) => ℝ)
|
| 163 |
+
finSumFinEquiv).symm.trans (volume_measurePreserving_sumPiEquivProdPi (fun _ => ℝ))
|
| 164 |
+
have hs : coordinateSimplexProduct p q =
|
| 165 |
+
e ⁻¹' (coordinateSimplex p 1 ×ˢ coordinateSimplex q 1) := by
|
| 166 |
+
ext x
|
| 167 |
+
simp [coordinateSimplexProduct, he]
|
| 168 |
+
rw [hs, hm.measure_preimage_equiv, Measure.volume_eq_prod, Measure.prod_prod,
|
| 169 |
+
volume_unit_coordinateSimplex, volume_unit_coordinateSimplex,
|
| 170 |
+
← ENNReal.ofReal_mul (by positivity : 0 ≤ 1 / (p.factorial : ℝ))]
|
| 171 |
+
congr 1
|
| 172 |
+
ring
|
| 173 |
+
|
| 174 |
+
/-- Product-simplex volume in the canonical Euclidean coordinates. -/
|
| 175 |
+
theorem volume_euclideanSimplexProduct (p q : ℕ) :
|
| 176 |
+
volume {x : EuclideanSpace ℝ (Fin (p + q)) |
|
| 177 |
+
((∀ i : Fin p, 0 ≤ x (Fin.castAdd q i)) ∧
|
| 178 |
+
∑ i : Fin p, x (Fin.castAdd q i) ≤ 1) ∧
|
| 179 |
+
((∀ i : Fin q, 0 ≤ x (Fin.natAdd p i)) ∧
|
| 180 |
+
∑ i : Fin q, x (Fin.natAdd p i) ≤ 1)} =
|
| 181 |
+
ENNReal.ofReal (1 / ((p.factorial : ℝ) * (q.factorial : ℝ))) := by
|
| 182 |
+
rw [← (EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp
|
| 183 |
+
(Fin (p + q))).symm.measure_preimage_equiv]
|
| 184 |
+
exact volume_coordinateSimplexProduct p q
|
| 185 |
+
|
| 186 |
+
end ProjectionCounterexample
|
| 187 |
+
|
| 188 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/Specification.lean
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.Counterexample
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open Set
|
| 6 |
+
open scoped RealInnerProductSpace
|
| 7 |
+
|
| 8 |
+
namespace ProjectionCounterexample.Specification
|
| 9 |
+
|
| 10 |
+
theorem product_is_convex_body : IsConvexBody productBody := productBody_convexBody
|
| 11 |
+
|
| 12 |
+
theorem projection_support_attained :
|
| 13 |
+
∀ P : Set (E 20), P = simplex 20 ∨ P = productBody →
|
| 14 |
+
IsConvexBody (projectionBody P) ∧
|
| 15 |
+
∀ u : E 20, ‖u‖ = 1 →
|
| 16 |
+
∃ x ∈ projectionBody P, ⟪u, x⟫ = projectionVolume P u := by
|
| 17 |
+
intro P hP
|
| 18 |
+
rcases hP with rfl | rfl
|
| 19 |
+
· exact simplex_twenty_projection_support
|
| 20 |
+
· exact product_projection_support
|
| 21 |
+
|
| 22 |
+
theorem simplex_ratio :
|
| 23 |
+
ratio (simplex 20) = ((21 : ℝ) * (20 : ℝ) ^ 20) / (Nat.factorial 20 : ℝ) :=
|
| 24 |
+
simplex_twenty_ratio
|
| 25 |
+
|
| 26 |
+
theorem product_ratio :
|
| 27 |
+
ratio productBody / ratio (simplex 20) = (22355476 : ℝ) / 22020096 ∧
|
| 28 |
+
(1 : ℝ) < ratio productBody / ratio (simplex 20) := by
|
| 29 |
+
constructor
|
| 30 |
+
· exact product_to_simplex_ratio
|
| 31 |
+
· rw [product_to_simplex_ratio]
|
| 32 |
+
exact numerical_strict_excess
|
| 33 |
+
|
| 34 |
+
theorem simplex_upper_bound_false :
|
| 35 |
+
¬ (∀ P : Set (E 20), IsConvexBody P → ratio P ≤ ratio (simplex 20)) :=
|
| 36 |
+
universal_simplex_upper_bound_false
|
| 37 |
+
|
| 38 |
+
end ProjectionCounterexample.Specification
|
| 39 |
+
|
| 40 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/UnitSupport.lean
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Analysis.InnerProductSpace.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open Set
|
| 7 |
+
open scoped RealInnerProductSpace
|
| 8 |
+
|
| 9 |
+
namespace ProjectionCounterexample
|
| 10 |
+
|
| 11 |
+
/-- For a positively homogeneous support bound, unit directions determine all
|
| 12 |
+
directions. This connects the unit-sphere definition with an
|
| 13 |
+
explicit zonotope's halfspace description. -/
|
| 14 |
+
theorem unit_support_halfspaces_eq
|
| 15 |
+
{V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
|
| 16 |
+
(f : V → ℝ) (hzero : 0 ≤ f 0)
|
| 17 |
+
(hscale : ∀ (a : ℝ), 0 ≤ a → ∀ u, f (a • u) = a * f u) :
|
| 18 |
+
{x : V | ∀ u, ‖u‖ = 1 → ⟪u, x⟫ ≤ f u} =
|
| 19 |
+
{x : V | ∀ u, ⟪u, x⟫ ≤ f u} := by
|
| 20 |
+
ext x
|
| 21 |
+
constructor
|
| 22 |
+
· intro hx u
|
| 23 |
+
by_cases hu : u = 0
|
| 24 |
+
· simpa [hu] using hzero
|
| 25 |
+
have hnorm : ‖u‖ ≠ 0 := norm_ne_zero_iff.mpr hu
|
| 26 |
+
let v : V := ‖u‖⁻¹ • u
|
| 27 |
+
have hv : ‖v‖ = 1 := by
|
| 28 |
+
simp [v, norm_smul, hnorm]
|
| 29 |
+
have huv : ‖u‖ • v = u := by
|
| 30 |
+
simp [v, smul_smul, hnorm]
|
| 31 |
+
calc
|
| 32 |
+
⟪u, x⟫ = ‖u‖ * ⟪v, x⟫ := by
|
| 33 |
+
rw [← real_inner_smul_left, huv]
|
| 34 |
+
_ ≤ ‖u‖ * f v := mul_le_mul_of_nonneg_left (hx v hv) (norm_nonneg u)
|
| 35 |
+
_ = f u := by rw [← hscale ‖u‖ (norm_nonneg u) v, huv]
|
| 36 |
+
· intro hx u _
|
| 37 |
+
exact hx u
|
| 38 |
+
|
| 39 |
+
end ProjectionCounterexample
|
| 40 |
+
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/Geometry/ProjectionBody/ZonotopeBridge.lean
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionBody.Definitions
|
| 2 |
+
import OAI.Geometry.ProjectionBody.UnitSupport
|
| 3 |
+
import OAI.Geometry.Zonotope.Euclidean
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-!
|
| 8 |
+
Generic bridge from a *proved* directional projection-volume formula to the
|
| 9 |
+
explicit zonotope. The brightness formula is an explicit hypothesis of these
|
| 10 |
+
helper lemmas; no final counterexample theorem assumes it.
|
| 11 |
+
-/
|
| 12 |
+
noncomputable section
|
| 13 |
+
open Set
|
| 14 |
+
open scoped RealInnerProductSpace
|
| 15 |
+
|
| 16 |
+
namespace ProjectionCounterexample
|
| 17 |
+
|
| 18 |
+
/-- A unit-direction brightness formula identifies the actual projection body. -/
|
| 19 |
+
theorem projectionBody_eq_zonotope {d : ℕ} (P : Set (E d)) (c : ℝ) (hc : 0 < c)
|
| 20 |
+
(hbrightness : ∀ u : E d, ‖u‖ = 1 →
|
| 21 |
+
projectionVolume P u = c * DiagonalZonotope.support (WithLp.ofLp u)) :
|
| 22 |
+
projectionBody P = DiagonalZonotope.euclidean c := by
|
| 23 |
+
calc
|
| 24 |
+
projectionBody P = {x : E d | ∀ u : E d, ‖u‖ = 1 →
|
| 25 |
+
⟪u, x⟫ ≤ c * DiagonalZonotope.support (WithLp.ofLp u)} := by
|
| 26 |
+
ext x
|
| 27 |
+
constructor
|
| 28 |
+
· intro hx u hu
|
| 29 |
+
rw [← hbrightness u hu]
|
| 30 |
+
exact hx u hu
|
| 31 |
+
· intro hx u hu
|
| 32 |
+
rw [hbrightness u hu]
|
| 33 |
+
exact hx u hu
|
| 34 |
+
_ = {x : E d | ∀ u : E d,
|
| 35 |
+
⟪u, x⟫ ≤ c * DiagonalZonotope.support (WithLp.ofLp u)} := by
|
| 36 |
+
apply unit_support_halfspaces_eq
|
| 37 |
+
· simp [DiagonalZonotope.support]
|
| 38 |
+
· intro a ha u
|
| 39 |
+
change c * DiagonalZonotope.support (a • WithLp.ofLp u) = _
|
| 40 |
+
rw [DiagonalZonotope.support_smul, abs_of_nonneg ha]
|
| 41 |
+
ring
|
| 42 |
+
_ = DiagonalZonotope.euclidean c :=
|
| 43 |
+
(DiagonalZonotope.euclidean_eq_halfspaces c hc).symm
|
| 44 |
+
|
| 45 |
+
/-- The brightness hypothesis gives both a genuine body and support attainment. -/
|
| 46 |
+
theorem projection_zonotope_is_body_and_attains {d : ℕ} (P : Set (E d))
|
| 47 |
+
(c : ℝ) (hc : 0 < c)
|
| 48 |
+
(hbrightness : ∀ u : E d, ‖u‖ = 1 →
|
| 49 |
+
projectionVolume P u = c * DiagonalZonotope.support (WithLp.ofLp u)) :
|
| 50 |
+
IsConvexBody (projectionBody P) ∧
|
| 51 |
+
∀ u : E d, ‖u‖ = 1 → ∃ x ∈ projectionBody P, ⟪u, x⟫ = projectionVolume P u := by
|
| 52 |
+
have hbody := projectionBody_eq_zonotope P c hc hbrightness
|
| 53 |
+
constructor
|
| 54 |
+
· rw [hbody]
|
| 55 |
+
exact ⟨DiagonalZonotope.isCompact_euclidean c,
|
| 56 |
+
DiagonalZonotope.convex_euclidean c,
|
| 57 |
+
DiagonalZonotope.euclidean_interior_nonempty c hc.ne'⟩
|
| 58 |
+
· intro u hu
|
| 59 |
+
obtain ⟨x, hx, heq⟩ := DiagonalZonotope.euclidean_support_attained c u
|
| 60 |
+
refine ⟨x, hbody.symm ▸ hx, ?_⟩
|
| 61 |
+
rw [hbrightness u hu]
|
| 62 |
+
exact heq
|
| 63 |
+
|
| 64 |
+
end ProjectionCounterexample
|
| 65 |
+
|
| 66 |
+
end
|
| 67 |
+
|
| 68 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/AffineBrightness.lean
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Basic
|
| 2 |
+
import Mathlib.Analysis.InnerProductSpace.NormDet
|
| 3 |
+
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
|
| 4 |
+
import Mathlib.Tactic.FieldSimp
|
| 5 |
+
import Mathlib.Tactic.FunProp
|
| 6 |
+
import Mathlib.Tactic.Ring
|
| 7 |
+
|
| 8 |
+
namespace OAI
|
| 9 |
+
|
| 10 |
+
universe uι
|
| 11 |
+
|
| 12 |
+
open Set MeasureTheory
|
| 13 |
+
open scoped RealInnerProductSpace
|
| 14 |
+
|
| 15 |
+
noncomputable section
|
| 16 |
+
|
| 17 |
+
namespace Paper092
|
| 18 |
+
|
| 19 |
+
private def normalFrameVector {n : ℕ} {ι : Type uι} [Fintype ι]
|
| 20 |
+
(u : Euclidean n) (b : OrthonormalBasis ι ℝ (normalHyperplane u)) :
|
| 21 |
+
Unit ⊕ ι → Euclidean n
|
| 22 |
+
| .inl _ => ‖u‖⁻¹ • u
|
| 23 |
+
| .inr i => b i
|
| 24 |
+
|
| 25 |
+
private theorem normalFrameVector_orthonormal {n : ℕ} {ι : Type uι} [Fintype ι]
|
| 26 |
+
(u : Euclidean n) (hu : u ≠ 0)
|
| 27 |
+
(b : OrthonormalBasis ι ℝ (normalHyperplane u)) :
|
| 28 |
+
Orthonormal ℝ (normalFrameVector u b) := by
|
| 29 |
+
classical
|
| 30 |
+
have hn : ‖‖u‖⁻¹ • u‖ = 1 := by simp [norm_smul, hu]
|
| 31 |
+
have hb (i : ι) : ⟪u, (b i : Euclidean n)⟫ = 0 :=
|
| 32 |
+
Submodule.mem_orthogonal_singleton_iff_inner_right.mp (b i).property
|
| 33 |
+
rw [orthonormal_iff_ite]
|
| 34 |
+
intro i j
|
| 35 |
+
rcases i with i | i <;> rcases j with j | j
|
| 36 |
+
· simp [normalFrameVector, hn]
|
| 37 |
+
· simp [normalFrameVector, real_inner_smul_left, hb]
|
| 38 |
+
· have hbi : ⟪(b i : Euclidean n), u⟫ = 0 := by rw [real_inner_comm, hb]
|
| 39 |
+
simp [normalFrameVector, real_inner_smul_right, hbi]
|
| 40 |
+
· simpa only [normalFrameVector, Sum.inr.injEq, Submodule.coe_inner] using b.inner_eq_ite i j
|
| 41 |
+
|
| 42 |
+
private def normalFrame {n : ℕ} {ι : Type uι} [Fintype ι]
|
| 43 |
+
(u : Euclidean n) (hu : u ≠ 0)
|
| 44 |
+
(b : OrthonormalBasis ι ℝ (normalHyperplane u)) :
|
| 45 |
+
OrthonormalBasis (Unit ⊕ ι) ℝ (Euclidean n) :=
|
| 46 |
+
OrthonormalBasis.mk (normalFrameVector_orthonormal u hu b)
|
| 47 |
+
((normalFrameVector_orthonormal u hu b).linearIndependent.span_eq_top_of_card_eq_finrank'
|
| 48 |
+
(by
|
| 49 |
+
have h := (Submodule.span ℝ ({u} : Set (Euclidean n))).finrank_add_finrank_orthogonal
|
| 50 |
+
rw [finrank_span_singleton hu] at h
|
| 51 |
+
change 1 + Module.finrank ℝ (normalHyperplane u) = _ at h
|
| 52 |
+
rw [Module.finrank_eq_card_basis b.toBasis] at h
|
| 53 |
+
simpa only [Fintype.card_sum, Fintype.card_unique] using h)).ge
|
| 54 |
+
|
| 55 |
+
@[simp] private theorem normalFrame_inl {n : ℕ} {ι : Type uι} [Fintype ι]
|
| 56 |
+
(u : Euclidean n) (hu : u ≠ 0)
|
| 57 |
+
(b : OrthonormalBasis ι ℝ (normalHyperplane u)) (i : Unit) :
|
| 58 |
+
normalFrame u hu b (.inl i) = ‖u‖⁻¹ • u := by
|
| 59 |
+
simp [normalFrame, normalFrameVector]
|
| 60 |
+
|
| 61 |
+
@[simp] private theorem normalFrame_inr {n : ℕ} {ι : Type uι} [Fintype ι]
|
| 62 |
+
(u : Euclidean n) (hu : u ≠ 0)
|
| 63 |
+
(b : OrthonormalBasis ι ℝ (normalHyperplane u)) (i : ι) :
|
| 64 |
+
normalFrame u hu b (.inr i) = (b i : Euclidean n) := by
|
| 65 |
+
simp [normalFrame, normalFrameVector]
|
| 66 |
+
|
| 67 |
+
def projectionTransport {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n) (u : Euclidean n) :
|
| 68 |
+
normalHyperplane (L.symm u) →ₗ[ℝ] normalHyperplane u :=
|
| 69 |
+
(normalHyperplane u).orthogonalProjectionOnto.toLinearMap ∘ₗ
|
| 70 |
+
L.toLinearMap ∘ₗ (normalHyperplane (L.symm u)).subtype
|
| 71 |
+
|
| 72 |
+
private theorem projectionTransport_matrix {n : ℕ} {ι : Type uι} [Fintype ι] [DecidableEq ι]
|
| 73 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (u : Euclidean n) (hu : u ≠ 0)
|
| 74 |
+
(hv : L.symm u ≠ 0)
|
| 75 |
+
(bv : OrthonormalBasis ι ℝ (normalHyperplane (L.symm u)))
|
| 76 |
+
(bu : OrthonormalBasis ι ℝ (normalHyperplane u)) :
|
| 77 |
+
L.toLinearMap.toMatrix (normalFrame (L.symm u) hv bv).toBasis
|
| 78 |
+
(normalFrame u hu bu).toBasis =
|
| 79 |
+
Matrix.fromBlocks (Matrix.of (fun _ _ : Unit => ‖u‖ / ‖L.symm u‖))
|
| 80 |
+
(Matrix.of (fun (_ : Unit) j => ⟪‖u‖⁻¹ • u, L (bv j)⟫)) 0
|
| 81 |
+
((projectionTransport L u).toMatrix bv.toBasis bu.toBasis) := by
|
| 82 |
+
ext i j
|
| 83 |
+
simp only [LinearMap.toMatrix_apply, OrthonormalBasis.coe_toBasis,
|
| 84 |
+
OrthonormalBasis.coe_toBasis_repr_apply, OrthonormalBasis.repr_apply_apply]
|
| 85 |
+
rcases i with i | i <;> rcases j with j | j
|
| 86 |
+
· simp only [normalFrame_inl]
|
| 87 |
+
change ⟪‖u‖⁻¹ • u, L (‖L.symm u‖⁻¹ • L.symm u)⟫ = ‖u‖ / ‖L.symm u‖
|
| 88 |
+
rw [map_smul, L.apply_symm_apply, real_inner_smul_left, real_inner_smul_right,
|
| 89 |
+
real_inner_self_eq_norm_sq]
|
| 90 |
+
field_simp
|
| 91 |
+
· simp only [normalFrame_inl, normalFrame_inr]
|
| 92 |
+
rfl
|
| 93 |
+
· have hbi : ⟪(bu i : Euclidean n), u⟫ = 0 := by
|
| 94 |
+
rw [real_inner_comm]
|
| 95 |
+
exact Submodule.mem_orthogonal_singleton_iff_inner_right.mp (bu i).property
|
| 96 |
+
simp only [normalFrame_inr, normalFrame_inl]
|
| 97 |
+
change ⟪(bu i : Euclidean n), L (‖L.symm u‖⁻¹ • L.symm u)⟫ = 0
|
| 98 |
+
rw [map_smul, L.apply_symm_apply, real_inner_smul_right, hbi, mul_zero]
|
| 99 |
+
· simp only [normalFrame_inr]
|
| 100 |
+
change ⟪(bu i : Euclidean n), L (bv j)⟫ =
|
| 101 |
+
((projectionTransport L u).toMatrix bv.toBasis bu.toBasis) i j
|
| 102 |
+
rw [LinearMap.toMatrix_apply]
|
| 103 |
+
rw [bu.coe_toBasis_repr_apply, bu.repr_apply_apply]
|
| 104 |
+
change ⟪(bu i : Euclidean n), L (bv j)⟫ =
|
| 105 |
+
⟪bu i, (normalHyperplane u).orthogonalProjectionOnto (L (bv j))⟫
|
| 106 |
+
exact (Submodule.inner_orthogonalProjectionOnto_eq_of_mem_left _ _).symm
|
| 107 |
+
|
| 108 |
+
theorem projectionTransport_normDet {n : ℕ}
|
| 109 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (u : Euclidean n) (hu : u ≠ 0) :
|
| 110 |
+
(projectionTransport L u).normDet =
|
| 111 |
+
|L.toLinearMap.det| * ‖L.symm u‖ / ‖u‖ := by
|
| 112 |
+
have hv : L.symm u ≠ 0 := by simpa using hu
|
| 113 |
+
let bv := (stdOrthonormalBasis ℝ (normalHyperplane (L.symm u))).reindex
|
| 114 |
+
(finCongr (normalHyperplane_finrank (L.symm u) hv))
|
| 115 |
+
let bu := (stdOrthonormalBasis ℝ (normalHyperplane u)).reindex
|
| 116 |
+
(finCongr (normalHyperplane_finrank u hu))
|
| 117 |
+
have hL : |L.toLinearMap.det| =
|
| 118 |
+
|(L.toLinearMap.toMatrix (normalFrame (L.symm u) hv bv).toBasis
|
| 119 |
+
(normalFrame u hu bu).toBasis).det| := by
|
| 120 |
+
rw [← L.toLinearMap.normDet_eq_abs_det]
|
| 121 |
+
simpa only [Real.norm_eq_abs] using
|
| 122 |
+
L.toLinearMap.normDet_eq_norm_det_toMatrix
|
| 123 |
+
(normalFrame (L.symm u) hv bv) (normalFrame u hu bu)
|
| 124 |
+
rw [projectionTransport_matrix L u hu hv bv bu,
|
| 125 |
+
Matrix.det_fromBlocks_zero₂₁, Matrix.det_unique, Matrix.of_apply, abs_mul,
|
| 126 |
+
abs_of_nonneg (div_nonneg (norm_nonneg _) (norm_nonneg _))] at hL
|
| 127 |
+
have hA := (projectionTransport L u).normDet_eq_norm_det_toMatrix bv bu
|
| 128 |
+
rw [Real.norm_eq_abs] at hA
|
| 129 |
+
rw [← hA] at hL
|
| 130 |
+
rw [hL]
|
| 131 |
+
field_simp
|
| 132 |
+
|
| 133 |
+
theorem projectionTransport_project {n : ℕ}
|
| 134 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (u x : Euclidean n) :
|
| 135 |
+
projectionTransport L u ((normalHyperplane (L.symm u)).orthogonalProjectionOnto x) =
|
| 136 |
+
(normalHyperplane u).orthogonalProjectionOnto (L x) := by
|
| 137 |
+
have hmem := (normalHyperplane (L.symm u)).sub_starProjection_mem_orthogonal x
|
| 138 |
+
have hspan : (normalHyperplane (L.symm u))ᗮ =
|
| 139 |
+
Submodule.span ℝ ({L.symm u} : Set (Euclidean n)) := by
|
| 140 |
+
simp [normalHyperplane]
|
| 141 |
+
rw [hspan] at hmem
|
| 142 |
+
obtain ⟨t, ht⟩ := Submodule.mem_span_singleton.mp hmem
|
| 143 |
+
have huorth : L (x - (normalHyperplane (L.symm u)).starProjection x) ∈
|
| 144 |
+
(normalHyperplane u)ᗮ := by
|
| 145 |
+
rw [← ht, map_smul, L.apply_symm_apply]
|
| 146 |
+
simpa only [normalHyperplane, Submodule.orthogonal_orthogonal] using
|
| 147 |
+
(Submodule.span ℝ ({u} : Set (Euclidean n))).smul_mem t
|
| 148 |
+
(Submodule.mem_span_singleton_self u)
|
| 149 |
+
have hz := (normalHyperplane u).orthogonalProjectionOnto_apply_of_mem_orthogonal huorth
|
| 150 |
+
rw [map_sub, map_sub] at hz
|
| 151 |
+
exact (sub_eq_zero.mp hz).symm
|
| 152 |
+
|
| 153 |
+
theorem projection_image_linearEquiv {n : ℕ}
|
| 154 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (K : Set (Euclidean n)) (u : Euclidean n) :
|
| 155 |
+
(normalHyperplane u).orthogonalProjectionOnto '' (L '' K) =
|
| 156 |
+
projectionTransport L u ''
|
| 157 |
+
((normalHyperplane (L.symm u)).orthogonalProjectionOnto '' K) := by
|
| 158 |
+
simp only [Set.image_image, projectionTransport_project]
|
| 159 |
+
|
| 160 |
+
theorem projectionVolume_linearEquiv_image {n : ℕ}
|
| 161 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (K : Set (Euclidean n))
|
| 162 |
+
(u : Euclidean n) (hu : u ≠ 0) :
|
| 163 |
+
projectionVolume (L '' K) u =
|
| 164 |
+
ENNReal.ofReal (|L.toLinearMap.det| * ‖L.symm u‖ / ‖u‖) *
|
| 165 |
+
projectionVolume K (L.symm u) := by
|
| 166 |
+
have hv : L.symm u ≠ 0 := by simpa using hu
|
| 167 |
+
have hrank : Module.finrank ℝ (normalHyperplane (L.symm u)) =
|
| 168 |
+
Module.finrank ℝ (normalHyperplane u) := by
|
| 169 |
+
rw [normalHyperplane_finrank (L.symm u) hv, normalHyperplane_finrank u hu]
|
| 170 |
+
have h := (projectionTransport L u).euclideanHausdorffMeasure_image_eq_normDet_mul_volume
|
| 171 |
+
((normalHyperplane (L.symm u)).orthogonalProjectionOnto '' K)
|
| 172 |
+
rw [hrank, InnerProductSpace.euclideanHausdorffMeasure_eq_volume,
|
| 173 |
+
projectionTransport_normDet L u hu] at h
|
| 174 |
+
simpa only [projectionVolume, projection_image_linearEquiv] using h
|
| 175 |
+
|
| 176 |
+
theorem brightness_linearEquiv_image {n : ℕ}
|
| 177 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (K : Set (Euclidean n)) (u : Euclidean n) :
|
| 178 |
+
brightness (L '' K) u = |L.toLinearMap.det| * brightness K (L.symm u) := by
|
| 179 |
+
by_cases hu : u = 0
|
| 180 |
+
· simp [hu, brightness]
|
| 181 |
+
have hn : 0 ≤ |L.toLinearMap.det| * ‖L.symm u‖ / ‖u‖ :=
|
| 182 |
+
div_nonneg (mul_nonneg (abs_nonneg _) (norm_nonneg _)) (norm_nonneg _)
|
| 183 |
+
rw [brightness, projectionVolume_linearEquiv_image L K u hu,
|
| 184 |
+
ENNReal.toReal_mul, ENNReal.toReal_ofReal hn, brightness]
|
| 185 |
+
field_simp
|
| 186 |
+
|
| 187 |
+
end Paper092
|
| 188 |
+
|
| 189 |
+
end
|
| 190 |
+
|
| 191 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/AffineCovariance.lean
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.AffineBrightness
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.Translation
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.SimplexValue
|
| 4 |
+
import Mathlib.Analysis.InnerProductSpace.Adjoint
|
| 5 |
+
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
|
| 6 |
+
import Mathlib.Tactic.FieldSimp
|
| 7 |
+
import Mathlib.Tactic.Ring
|
| 8 |
+
|
| 9 |
+
namespace OAI
|
| 10 |
+
|
| 11 |
+
open Set MeasureTheory
|
| 12 |
+
open scoped RealInnerProductSpace Pointwise
|
| 13 |
+
|
| 14 |
+
namespace Paper092
|
| 15 |
+
|
| 16 |
+
theorem det_adjoint {n : ℕ} (A : Euclidean n →ₗ[ℝ] Euclidean n) :
|
| 17 |
+
A.adjoint.det = A.det := by
|
| 18 |
+
let b := stdOrthonormalBasis ℝ (Euclidean n)
|
| 19 |
+
rw [← LinearMap.det_toMatrix b.toBasis A.adjoint, LinearMap.toMatrix_adjoint,
|
| 20 |
+
Matrix.det_conjTranspose, LinearMap.det_toMatrix]
|
| 21 |
+
simp
|
| 22 |
+
|
| 23 |
+
theorem projectionBody_linearEquiv_image {n : ℕ}
|
| 24 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (K : Set (Euclidean n)) :
|
| 25 |
+
projectionBody (L '' K) =
|
| 26 |
+
(|L.toLinearMap.det| • L.symm.toLinearMap.adjoint) '' projectionBody K := by
|
| 27 |
+
have hb := brightness_linearEquiv_image L K
|
| 28 |
+
let c := |L.toLinearMap.det|
|
| 29 |
+
have hc : 0 < c := abs_pos.mpr L.isUnit_det'.ne_zero
|
| 30 |
+
ext y
|
| 31 |
+
constructor
|
| 32 |
+
· intro hy
|
| 33 |
+
let z := c⁻¹ • L.toLinearMap.adjoint y
|
| 34 |
+
refine ⟨z, ?_, ?_⟩
|
| 35 |
+
· intro u
|
| 36 |
+
have h := hy (L u)
|
| 37 |
+
rw [hb, L.symm_apply_apply] at h
|
| 38 |
+
change ⟪u, c⁻¹ • L.toLinearMap.adjoint y⟫ ≤ brightness K u
|
| 39 |
+
rw [inner_smul_right, LinearMap.adjoint_inner_right]
|
| 40 |
+
calc
|
| 41 |
+
c⁻¹ * ⟪L u, y⟫ ≤ c⁻¹ * (c * brightness K u) :=
|
| 42 |
+
mul_le_mul_of_nonneg_left h (inv_nonneg.mpr hc.le)
|
| 43 |
+
_ = brightness K u := by field_simp
|
| 44 |
+
· change c • L.symm.toLinearMap.adjoint z = y
|
| 45 |
+
have hcancel : L.symm.toLinearMap.adjoint (L.toLinearMap.adjoint y) = y := by
|
| 46 |
+
change (L.symm.toLinearMap.adjoint.comp L.toLinearMap.adjoint) y = y
|
| 47 |
+
rw [← LinearMap.adjoint_comp]
|
| 48 |
+
simp
|
| 49 |
+
simp [z, map_smul, hcancel, smul_smul, hc.ne']
|
| 50 |
+
· rintro ⟨z, hz, rfl⟩ u
|
| 51 |
+
change ⟪u, c • L.symm.toLinearMap.adjoint z⟫ ≤ _
|
| 52 |
+
rw [inner_smul_right, LinearMap.adjoint_inner_right, hb]
|
| 53 |
+
exact mul_le_mul_of_nonneg_left (hz (L.symm u)) hc.le
|
| 54 |
+
|
| 55 |
+
theorem det_projectionBody_transform {n : ℕ} (hn : 0 < n)
|
| 56 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) :
|
| 57 |
+
|(|L.toLinearMap.det| • L.symm.toLinearMap.adjoint).det| =
|
| 58 |
+
|L.toLinearMap.det| ^ (n - 1) := by
|
| 59 |
+
rw [LinearMap.det_smul, det_adjoint, LinearEquiv.det_coe_symm,
|
| 60 |
+
finrank_euclideanSpace_fin, abs_mul, abs_pow, abs_abs, abs_inv]
|
| 61 |
+
obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_zero_of_lt hn)
|
| 62 |
+
simp [pow_succ, L.isUnit_det'.ne_zero]
|
| 63 |
+
|
| 64 |
+
theorem normalizedProjectionVolume_linearEquiv_image {n : ℕ}
|
| 65 |
+
(hn : 0 < n) (L : Euclidean n ≃ₗ[ℝ] Euclidean n) (K : Set (Euclidean n)) :
|
| 66 |
+
normalizedProjectionVolume (L '' K) = normalizedProjectionVolume K := by
|
| 67 |
+
have hc : |L.toLinearMap.det| ≠ 0 := abs_ne_zero.mpr L.isUnit_det'.ne_zero
|
| 68 |
+
have hvol : volume (L '' K) =
|
| 69 |
+
ENNReal.ofReal |L.toLinearMap.det| * volume K :=
|
| 70 |
+
volume.addHaar_image_linearMap L.toLinearMap K
|
| 71 |
+
unfold normalizedProjectionVolume
|
| 72 |
+
rw [projectionBody_linearEquiv_image L K,
|
| 73 |
+
volume.addHaar_image_linearMap, det_projectionBody_transform hn L,
|
| 74 |
+
ENNReal.toReal_mul, ENNReal.toReal_ofReal (pow_nonneg (abs_nonneg _) _),
|
| 75 |
+
hvol, ENNReal.toReal_mul, ENNReal.toReal_ofReal (abs_nonneg _), mul_pow]
|
| 76 |
+
exact mul_div_mul_left _ _ (pow_ne_zero _ hc)
|
| 77 |
+
|
| 78 |
+
theorem standardSimplex_affine_image_normalizedProjectionVolume {n : ℕ} (hn : 0 < n)
|
| 79 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) :
|
| 80 |
+
normalizedProjectionVolume (v +ᵥ (L '' standardSimplex n)) = simplexConstant n := by
|
| 81 |
+
rw [normalizedProjectionVolume_vadd, normalizedProjectionVolume_linearEquiv_image hn,
|
| 82 |
+
standardSimplex_normalizedProjectionVolume n hn]
|
| 83 |
+
|
| 84 |
+
end Paper092
|
| 85 |
+
|
| 86 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/ApproximationBounds.lean
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.BallBrightness
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SupportLimit
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.InnerSequence
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open Set Metric Filter MeasureTheory
|
| 8 |
+
open scoped Pointwise Topology RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
theorem volume_smul_real {d : ℕ} (P : Set (Euclidean d)) {c : ℝ} (hc : 0 ≤ c) :
|
| 13 |
+
(volume (c • P)).toReal = c ^ d * (volume P).toReal := by
|
| 14 |
+
rw [Measure.addHaar_smul, finrank_euclideanSpace_fin, abs_pow, abs_of_nonneg hc,
|
| 15 |
+
ENNReal.toReal_mul, ENNReal.toReal_ofReal (pow_nonneg hc _)]
|
| 16 |
+
|
| 17 |
+
theorem volume_real_mono {d : ℕ} {P K : Set (Euclidean d)} (hK : IsCompact K) (h : P ⊆ K) :
|
| 18 |
+
(volume P).toReal ≤ (volume K).toReal :=
|
| 19 |
+
ENNReal.toReal_mono hK.measure_lt_top.ne (measure_mono h)
|
| 20 |
+
|
| 21 |
+
theorem approximation_brightness_bound {d : ℕ} (hd : 2 ≤ d)
|
| 22 |
+
{P K : Set (Euclidean d)} (hP : IsCompact P) (hK : IsCompact K)
|
| 23 |
+
{scale R : ℝ} (hscale : 1 ≤ scale) (hR : 0 ≤ R) (hPK : P ⊆ K) (hKP : K ⊆ scale • P)
|
| 24 |
+
(hKR : K ⊆ closedBall 0 R) (u : Euclidean d) (hu : ‖u‖ = 1) :
|
| 25 |
+
0 ≤ brightness K u - brightness P u ∧
|
| 26 |
+
brightness K u - brightness P u ≤
|
| 27 |
+
(scale ^ (d - 1) - 1) * (euclideanUnitBallVolume (d - 1) * R ^ (d - 1)) := by
|
| 28 |
+
have hmono := brightness_mono hPK hK u
|
| 29 |
+
have hupper : brightness K u ≤ scale ^ (d - 1) * brightness P u := by
|
| 30 |
+
have hh := brightness_mono hKP (hP.smul scale) u
|
| 31 |
+
simpa only [brightness_body_smul, abs_of_nonneg (zero_le_one.trans hscale)] using hh
|
| 32 |
+
have hbound : brightness P u ≤ euclideanUnitBallVolume (d - 1) * R ^ (d - 1) :=
|
| 33 |
+
hmono.trans (by simpa only [hu, one_mul] using brightness_le_ball_bound hd hR hKR u)
|
| 34 |
+
have hpow : 1 ≤ scale ^ (d - 1) := one_le_pow₀ hscale
|
| 35 |
+
refine ⟨sub_nonneg.mpr hmono, ?_⟩
|
| 36 |
+
calc
|
| 37 |
+
brightness K u - brightness P u ≤ (scale ^ (d - 1) - 1) * brightness P u := by nlinarith
|
| 38 |
+
_ ≤ _ := mul_le_mul_of_nonneg_left hbound (sub_nonneg.mpr hpow)
|
| 39 |
+
|
| 40 |
+
theorem approximation_projectionBody_sandwich {d : ℕ} {P K : Set (Euclidean d)}
|
| 41 |
+
(hP : IsCompact P) (hK : IsCompact K) {scale : ℝ} (hscale : 0 < scale)
|
| 42 |
+
(hPK : P ⊆ K) (hKP : K ⊆ scale • P) :
|
| 43 |
+
projectionBody P ⊆ projectionBody K ∧
|
| 44 |
+
projectionBody K ⊆ scale ^ (d - 1) • projectionBody P := by
|
| 45 |
+
refine ⟨projectionBody_mono hPK hK, ?_⟩
|
| 46 |
+
have hh := projectionBody_mono hKP (hP.smul scale)
|
| 47 |
+
simpa only [projectionBody_body_smul P scale hscale.ne', abs_of_pos hscale] using hh
|
| 48 |
+
|
| 49 |
+
theorem approximation_volume_sandwich {d : ℕ} {P K : Set (Euclidean d)}
|
| 50 |
+
(hP : IsCompact P) (hK : IsCompact K) {scale : ℝ} (hscale : 0 ≤ scale)
|
| 51 |
+
(hPK : P ⊆ K) (hKP : K ⊆ scale • P) :
|
| 52 |
+
(volume P).toReal ≤ (volume K).toReal ∧
|
| 53 |
+
(volume K).toReal ≤ scale ^ d * (volume P).toReal := by
|
| 54 |
+
refine ⟨volume_real_mono hK hPK, ?_⟩
|
| 55 |
+
exact (volume_real_mono (hP.smul scale) hKP).trans_eq (volume_smul_real P hscale)
|
| 56 |
+
|
| 57 |
+
theorem approximation_projectionBody_volume_sandwich {d : ℕ} {P K : Set (Euclidean d)}
|
| 58 |
+
(hP : IsCompact P) (hK : IsCompact K) {scale : ℝ} (hscale : 0 < scale)
|
| 59 |
+
(hPK : P ⊆ K) (hKP : K ⊆ scale • P) :
|
| 60 |
+
(volume (projectionBody P)).toReal ≤ (volume (projectionBody K)).toReal ∧
|
| 61 |
+
(volume (projectionBody K)).toReal ≤
|
| 62 |
+
scale ^ (d * (d - 1)) * (volume (projectionBody P)).toReal := by
|
| 63 |
+
obtain ⟨hPiPK, hPiKP⟩ := approximation_projectionBody_sandwich hP hK hscale hPK hKP
|
| 64 |
+
have hh := approximation_volume_sandwich (projectionBody_isCompact P)
|
| 65 |
+
(projectionBody_isCompact K) (pow_nonneg hscale.le _) hPiPK hPiKP
|
| 66 |
+
simpa only [← pow_mul, Nat.mul_comm (d - 1) d] using hh
|
| 67 |
+
|
| 68 |
+
theorem approximation_brightness_uniform {d : ℕ} (hd : 2 ≤ d)
|
| 69 |
+
{P : ℕ → Set (Euclidean d)} {K : Set (Euclidean d)}
|
| 70 |
+
(hP : ∀ m, IsCompact (P m)) (hK : IsCompact K)
|
| 71 |
+
{scale : ℕ → ℝ} (hscale : ∀ m, 1 ≤ scale m) (hscalelim : Tendsto scale atTop (𝓝 1))
|
| 72 |
+
{R : ℝ} (hR : 0 ≤ R) (hKR : K ⊆ closedBall 0 R)
|
| 73 |
+
(hPK : ∀ m, P m ⊆ K) (hKP : ∀ m, K ⊆ scale m • P m) :
|
| 74 |
+
TendstoUniformlyOn (fun m u => brightness (P m) u) (brightness K) atTop (sphere 0 1) := by
|
| 75 |
+
let C := euclideanUnitBallVolume (d - 1) * R ^ (d - 1)
|
| 76 |
+
have hcont : Continuous (fun r : ℝ => (r ^ (d - 1) - 1) * C) := by fun_prop
|
| 77 |
+
have hlim : Tendsto (fun m => (scale m ^ (d - 1) - 1) * C) atTop (𝓝 0) := by
|
| 78 |
+
simpa only [Function.comp_def, one_pow, sub_self, zero_mul] using (hcont.tendsto 1).comp hscalelim
|
| 79 |
+
apply Metric.tendstoUniformlyOn_iff.mpr
|
| 80 |
+
intro ε hε
|
| 81 |
+
filter_upwards [hlim.eventually (Iio_mem_nhds hε)] with m hm
|
| 82 |
+
intro u hu
|
| 83 |
+
have hunit : ‖u‖ = 1 := mem_sphere_zero_iff_norm.mp hu
|
| 84 |
+
have hb := approximation_brightness_bound hd (hP m) hK (hscale m) hR (hPK m) (hKP m) hKR u hunit
|
| 85 |
+
rw [Real.dist_eq, abs_of_nonneg hb.1]
|
| 86 |
+
exact hb.2.trans_lt hm
|
| 87 |
+
|
| 88 |
+
theorem tendsto_of_multiplicative_sandwich {f q : ℕ → ℝ} {L : ℝ}
|
| 89 |
+
(hq : ∀ m, 0 < q m) (hqlim : Tendsto q atTop (𝓝 1))
|
| 90 |
+
(hupper : ∀ m, f m ≤ L) (hlower : ∀ m, L ≤ q m * f m) :
|
| 91 |
+
Tendsto f atTop (𝓝 L) := by
|
| 92 |
+
have hlim : Tendsto (fun m => L / q m) atTop (𝓝 L) := by
|
| 93 |
+
have hcont : ContinuousAt (fun x : ℝ => L / x) 1 := by fun_prop (disch := norm_num)
|
| 94 |
+
simpa only [Function.comp_def, div_one] using hcont.tendsto.comp hqlim
|
| 95 |
+
apply tendsto_of_tendsto_of_tendsto_of_le_of_le hlim tendsto_const_nhds
|
| 96 |
+
· intro m
|
| 97 |
+
exact (div_le_iff₀ (hq m)).mpr (by simpa only [mul_comm] using hlower m)
|
| 98 |
+
· exact hupper
|
| 99 |
+
|
| 100 |
+
theorem approximation_volume_tendsto {d : ℕ}
|
| 101 |
+
{P : ℕ → Set (Euclidean d)} {K : Set (Euclidean d)}
|
| 102 |
+
(hP : ∀ m, IsCompact (P m)) (hK : IsCompact K)
|
| 103 |
+
{scale : ℕ → ℝ} (hscale : ∀ m, 0 < scale m) (hscalelim : Tendsto scale atTop (𝓝 1))
|
| 104 |
+
(hPK : ∀ m, P m ⊆ K) (hKP : ∀ m, K ⊆ scale m • P m) :
|
| 105 |
+
Tendsto (fun m => (volume (P m)).toReal) atTop (𝓝 (volume K).toReal) ∧
|
| 106 |
+
Tendsto (fun m => (volume (projectionBody (P m))).toReal) atTop
|
| 107 |
+
(𝓝 (volume (projectionBody K)).toReal) := by
|
| 108 |
+
have hq (k : ℕ) : Tendsto (fun m => scale m ^ k) atTop (𝓝 1) := by
|
| 109 |
+
have hcont : Continuous (fun x : ℝ => x ^ k) := by fun_prop
|
| 110 |
+
simpa only [Function.comp_def, one_pow] using (hcont.tendsto 1).comp hscalelim
|
| 111 |
+
constructor
|
| 112 |
+
· apply tendsto_of_multiplicative_sandwich (fun m => pow_pos (hscale m) d) (hq d)
|
| 113 |
+
· exact fun m => (approximation_volume_sandwich (hP m) hK (hscale m).le (hPK m) (hKP m)).1
|
| 114 |
+
· exact fun m => (approximation_volume_sandwich (hP m) hK (hscale m).le (hPK m) (hKP m)).2
|
| 115 |
+
· apply tendsto_of_multiplicative_sandwich (fun m => pow_pos (hscale m) (d * (d - 1)))
|
| 116 |
+
(hq (d * (d - 1)))
|
| 117 |
+
· exact fun m => (approximation_projectionBody_volume_sandwich (hP m) hK (hscale m) (hPK m) (hKP m)).1
|
| 118 |
+
· exact fun m => (approximation_projectionBody_volume_sandwich (hP m) hK (hscale m) (hPK m) (hKP m)).2
|
| 119 |
+
|
| 120 |
+
end Paper092
|
| 121 |
+
|
| 122 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/AreaNormalVectors.lean
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FacetLinearImage
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.GeneralProduct
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.SimplexPolytope
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι uκ
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Set MeasureTheory
|
| 11 |
+
open scoped RealInnerProductSpace
|
| 12 |
+
|
| 13 |
+
namespace Paper092
|
| 14 |
+
|
| 15 |
+
theorem affineHyperplane_linearImage_areaNormal {n : ℕ}
|
| 16 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 17 |
+
(c : ℝ) (F : Set (Euclidean n)) (hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 18 |
+
(μHE[n - 1] (L '' F)).toReal • linearImageNormal L v =
|
| 19 |
+
(|L.toLinearMap.det| • L.symm.toLinearMap.adjoint) ((μHE[n - 1] F).toReal • v) := by
|
| 20 |
+
rw [affineHyperplane_linearImage_area_real L v hv c F hplane, linearImageNormal,
|
| 21 |
+
smul_smul, LinearMap.smul_apply, map_smul, smul_smul]
|
| 22 |
+
congr 1
|
| 23 |
+
field_simp [norm_ne_zero_iff.mpr (inverseAdjoint_ne_zero L v hv)]
|
| 24 |
+
|
| 25 |
+
theorem simplexFacet_coordinate_areaNormal (n : ℕ) (i : Fin (n + 1)) :
|
| 26 |
+
(μHE[n] (simplexFacet (n + 1) (some i))).toReal •
|
| 27 |
+
(-EuclideanSpace.single i (1 : ℝ)) =
|
| 28 |
+
-(1 / (n.factorial : ℝ)) • EuclideanSpace.single i (1 : ℝ) := by
|
| 29 |
+
rw [simplexFacet_coordinate_area, ENNReal.toReal_ofReal (by positivity)]
|
| 30 |
+
exact (smul_neg _ _).trans (neg_smul _ _).symm
|
| 31 |
+
|
| 32 |
+
theorem simplexFacet_diagonal_areaNormal (n : ℕ) :
|
| 33 |
+
(μHE[n] (simplexFacet (n + 1) none)).toReal • diagonalUnitNormal (n + 1) =
|
| 34 |
+
(1 / (n.factorial : ℝ)) • diagonalVector (n + 1) := by
|
| 35 |
+
rw [simplexFacet_diagonal_area, ENNReal.toReal_ofReal (by positivity),
|
| 36 |
+
diagonalUnitNormal, smul_smul]
|
| 37 |
+
congr 1
|
| 38 |
+
have hs : Real.sqrt ((n : ℝ) + 1) ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (by positivity))
|
| 39 |
+
push_cast
|
| 40 |
+
field_simp
|
| 41 |
+
|
| 42 |
+
namespace HPolytope
|
| 43 |
+
|
| 44 |
+
theorem product_areaNormal_inl {r s : ℕ} (hr : 0 < r)
|
| 45 |
+
{ι : Type uι} {κ : Type uκ} [Fintype ι] [Fintype κ] (A : HPolytope r ι) (B : HPolytope s κ)
|
| 46 |
+
(i : ι) :
|
| 47 |
+
splitEuclideanProduct r s ((A.product B).faceArea (.inl i) •
|
| 48 |
+
(A.product B).normal (.inl i)) =
|
| 49 |
+
((volume B.body).toReal • (A.faceArea i • A.normal i), 0) := by
|
| 50 |
+
rw [product_faceArea_inl hr]
|
| 51 |
+
change splitEuclideanProduct r s ((A.faceArea i * (volume B.body).toReal) •
|
| 52 |
+
productLiftLeft r s (A.normal i)) = _
|
| 53 |
+
simp [productLiftLeft, smul_smul, mul_comm]
|
| 54 |
+
|
| 55 |
+
theorem product_areaNormal_inr {r s : ℕ} (hs : 0 < s)
|
| 56 |
+
{ι : Type uι} {κ : Type uκ} [Fintype ι] [Fintype κ] (A : HPolytope r ι) (B : HPolytope s κ)
|
| 57 |
+
(i : κ) :
|
| 58 |
+
splitEuclideanProduct r s ((A.product B).faceArea (.inr i) •
|
| 59 |
+
(A.product B).normal (.inr i)) =
|
| 60 |
+
(0, (volume A.body).toReal • (B.faceArea i • B.normal i)) := by
|
| 61 |
+
rw [product_faceArea_inr hs]
|
| 62 |
+
change splitEuclideanProduct r s (((volume A.body).toReal * B.faceArea i) •
|
| 63 |
+
productLiftRight r s (B.normal i)) = _
|
| 64 |
+
simp [productLiftRight, smul_smul]
|
| 65 |
+
|
| 66 |
+
end HPolytope
|
| 67 |
+
end Paper092
|
| 68 |
+
|
| 69 |
+
end
|
| 70 |
+
|
| 71 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/Arithmetic.lean
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Model
|
| 2 |
+
import Mathlib.Tactic.FieldSimp
|
| 3 |
+
import Mathlib.Tactic.Linarith
|
| 4 |
+
import Mathlib.Tactic.NormNum
|
| 5 |
+
import Mathlib.Tactic.Positivity
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
namespace Paper092
|
| 10 |
+
|
| 11 |
+
theorem simplex_constant_product_ratio (r s : ℕ) (hr : 0 < r) (hs : 0 < s) :
|
| 12 |
+
simplexConstant r * simplexConstant s / simplexConstant (r + s) =
|
| 13 |
+
((r + 1 : ℝ) * (s + 1) / (r + s + 1)) * (Nat.choose (r + s) r : ℝ) *
|
| 14 |
+
((r : ℝ) ^ r * (s : ℝ) ^ s / ((r + s : ℕ) : ℝ) ^ (r + s)) := by
|
| 15 |
+
have hfac := Nat.choose_mul_factorial_mul_factorial (show r ≤ r + s by omega)
|
| 16 |
+
simp only [Nat.add_sub_cancel_left] at hfac
|
| 17 |
+
have hfac' : (Nat.choose (r + s) r : ℝ) * r.factorial * s.factorial =
|
| 18 |
+
((r + s).factorial : ℝ) := by exact_mod_cast hfac
|
| 19 |
+
have hr0 : (r.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero r
|
| 20 |
+
have hs0 : (s.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero s
|
| 21 |
+
have hrs0 : ((r + s : ℕ) : ℝ) ≠ 0 := by positivity
|
| 22 |
+
have hrs1 : (r : ℝ) + s + 1 ≠ 0 := by positivity
|
| 23 |
+
have hfrs0 : ((r + s).factorial : ℝ) ≠ 0 := by
|
| 24 |
+
exact_mod_cast Nat.factorial_ne_zero (r + s)
|
| 25 |
+
unfold simplexConstant
|
| 26 |
+
push_cast
|
| 27 |
+
field_simp
|
| 28 |
+
nlinarith [hfac']
|
| 29 |
+
|
| 30 |
+
theorem dimension_twenty_ratio :
|
| 31 |
+
simplexConstant 10 * simplexConstant 10 / simplexConstant 20 =
|
| 32 |
+
(22355476 : ℝ) / 22020096 := by
|
| 33 |
+
norm_num [simplexConstant, Nat.factorial]
|
| 34 |
+
|
| 35 |
+
theorem dimension_twenty_strict :
|
| 36 |
+
simplexConstant 20 < simplexConstant 10 * simplexConstant 10 := by
|
| 37 |
+
norm_num [simplexConstant, Nat.factorial]
|
| 38 |
+
|
| 39 |
+
end Paper092
|
| 40 |
+
|
| 41 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/AugmentedDeterminant.lean
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ProjectionJacobian
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uι
|
| 6 |
+
|
| 7 |
+
open Set
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
noncomputable def augmentedTangentMatrix {d : ℕ} {ι : Type uι} [Fintype ι]
|
| 13 |
+
(v : Euclidean d) (b : OrthonormalBasis ι ℝ (normalHyperplane v))
|
| 14 |
+
(B : OrthonormalBasis (ι ⊕ Fin 1) ℝ (Euclidean d)) (u : Euclidean d) :
|
| 15 |
+
Matrix (ι ⊕ Fin 1) (ι ⊕ Fin 1) ℝ :=
|
| 16 |
+
fun i j => ⟪B i, Sum.elim (fun k => (b k : Euclidean d)) (fun _ => u) j⟫
|
| 17 |
+
|
| 18 |
+
theorem abs_det_augmentedTangentMatrix {d : ℕ} {ι : Type uι} [Fintype ι] [DecidableEq ι]
|
| 19 |
+
(v : Euclidean d) (hv : ‖v‖ = 1) (b : OrthonormalBasis ι ℝ (normalHyperplane v))
|
| 20 |
+
(B : OrthonormalBasis (ι ⊕ Fin 1) ℝ (Euclidean d)) (u : Euclidean d) :
|
| 21 |
+
|(augmentedTangentMatrix v b B u).det| = |⟪u, v⟫| := by
|
| 22 |
+
let w : ι ⊕ Fin 1 → Euclidean d := Sum.elim (fun k => (b k : Euclidean d)) (fun _ => u)
|
| 23 |
+
let a : ι → ℝ := fun i => ⟪u, (b i : Euclidean d)⟫
|
| 24 |
+
let M := augmentedTangentMatrix v b B u
|
| 25 |
+
have hgram : Matrix.gram ℝ w = Matrix.fromBlocks
|
| 26 |
+
(1 : Matrix ι ι ℝ) (Matrix.of fun i (_ : Fin 1) => a i)
|
| 27 |
+
(Matrix.of fun (_ : Fin 1) j => a j)
|
| 28 |
+
(Matrix.of fun (_ _ : Fin 1) => ‖u‖ ^ 2) := by
|
| 29 |
+
ext i j
|
| 30 |
+
rcases i with i | i <;> rcases j with j | j
|
| 31 |
+
· exact b.inner_eq_ite i j
|
| 32 |
+
· change ⟪(b i : Euclidean d), u⟫ = ⟪u, (b i : Euclidean d)⟫
|
| 33 |
+
exact real_inner_comm _ _
|
| 34 |
+
· rfl
|
| 35 |
+
· exact real_inner_self_eq_norm_sq u
|
| 36 |
+
have hsum : (∑ i, a i ^ 2) = ‖u‖ ^ 2 - ⟪u, v⟫ ^ 2 := by
|
| 37 |
+
have h := b.sum_sq_inner_left ((normalHyperplane v).orthogonalProjectionOnto u)
|
| 38 |
+
simp only [Submodule.inner_orthogonalProjectionOnto_eq_of_mem_right] at h
|
| 39 |
+
change (∑ i, a i ^ 2) = ‖(normalHyperplane v).orthogonalProjectionOnto u‖ ^ 2 at h
|
| 40 |
+
rw [h]
|
| 41 |
+
change ‖(normalHyperplane v).starProjection u‖ ^ 2 = _
|
| 42 |
+
rw [normal_starProjection_unit v u hv, ← real_inner_self_eq_norm_sq]
|
| 43 |
+
simp only [inner_sub_left, inner_sub_right, real_inner_smul_left, real_inner_smul_right,
|
| 44 |
+
real_inner_self_eq_norm_sq, norm_smul, Real.norm_eq_abs, hv, mul_one, sq_abs]
|
| 45 |
+
rw [real_inner_comm v u]
|
| 46 |
+
ring
|
| 47 |
+
have hgdet : (Matrix.gram ℝ w).det = ⟪u, v⟫ ^ 2 := by
|
| 48 |
+
rw [hgram, Matrix.det_fromBlocks_one₁₁, Matrix.det_unique]
|
| 49 |
+
change ‖u‖ ^ 2 - (∑ i, a i * a i) = ⟪u, v⟫ ^ 2
|
| 50 |
+
simp_rw [← pow_two]
|
| 51 |
+
rw [hsum]
|
| 52 |
+
ring
|
| 53 |
+
have hfactor : M.transpose * M = Matrix.gram ℝ w := by
|
| 54 |
+
ext i j
|
| 55 |
+
change (∑ k, ⟪B k, w i⟫ * ⟪B k, w j⟫) = ⟪w i, w j⟫
|
| 56 |
+
calc
|
| 57 |
+
(∑ k, ⟪B k, w i⟫ * ⟪B k, w j⟫) =
|
| 58 |
+
∑ k, ⟪w i, B k⟫ * ⟪B k, w j⟫ := by
|
| 59 |
+
apply Finset.sum_congr rfl
|
| 60 |
+
intro k _
|
| 61 |
+
rw [real_inner_comm (B k) (w i)]
|
| 62 |
+
_ = ⟪w i, w j⟫ := B.sum_inner_mul_inner _ _
|
| 63 |
+
have hsquare : M.det ^ 2 = ⟪u, v⟫ ^ 2 := by
|
| 64 |
+
calc
|
| 65 |
+
M.det ^ 2 = (M.transpose * M).det := by
|
| 66 |
+
rw [Matrix.det_mul, Matrix.det_transpose, pow_two]
|
| 67 |
+
_ = (Matrix.gram ℝ w).det := congrArg Matrix.det hfactor
|
| 68 |
+
_ = ⟪u, v⟫ ^ 2 := hgdet
|
| 69 |
+
change |M.det| = _
|
| 70 |
+
nlinarith [sq_abs M.det, sq_abs ⟪u, v⟫, abs_nonneg M.det, abs_nonneg ⟪u, v⟫]
|
| 71 |
+
|
| 72 |
+
noncomputable def tangentColumns {n : ℕ} (v : Euclidean (n + 1))
|
| 73 |
+
(b : OrthonormalBasis (Fin n) ℝ (normalHyperplane v)) (u : Euclidean (n + 1)) :
|
| 74 |
+
Matrix (Fin (n + 1)) (Fin (n + 1)) ℝ :=
|
| 75 |
+
fun i j => (Fin.append (fun k => (b k : Euclidean (n + 1))) (fun _ : Fin 1 => u) j) i
|
| 76 |
+
|
| 77 |
+
theorem abs_det_tangentColumns {n : ℕ} (v : Euclidean (n + 1)) (hv : ‖v‖ = 1)
|
| 78 |
+
(b : OrthonormalBasis (Fin n) ℝ (normalHyperplane v)) (u : Euclidean (n + 1)) :
|
| 79 |
+
|(tangentColumns v b u).det| = |⟪u, v⟫| := by
|
| 80 |
+
let e : Fin n ⊕ Fin 1 ≃ Fin (n + 1) := finSumFinEquiv
|
| 81 |
+
let B : OrthonormalBasis (Fin n ⊕ Fin 1) ℝ (Euclidean (n + 1)) :=
|
| 82 |
+
(EuclideanSpace.basisFun (Fin (n + 1)) ℝ).reindex e.symm
|
| 83 |
+
have hB (i : Fin n ⊕ Fin 1) : B i = EuclideanSpace.single (e i) 1 := by
|
| 84 |
+
rw [OrthonormalBasis.reindex_apply]
|
| 85 |
+
exact EuclideanSpace.basisFun_apply (Fin (n + 1)) ℝ (e i)
|
| 86 |
+
have hm : augmentedTangentMatrix v b B u = (tangentColumns v b u).submatrix e e := by
|
| 87 |
+
ext i j
|
| 88 |
+
change ⟪B i, Sum.elim (fun k => (b k : Euclidean (n + 1))) (fun _ => u) j⟫ =
|
| 89 |
+
(Fin.append (fun k => (b k : Euclidean (n + 1))) (fun _ : Fin 1 => u) (e j)) (e i)
|
| 90 |
+
rw [hB]
|
| 91 |
+
rcases j with j | j
|
| 92 |
+
· simp [e, EuclideanSpace.inner_single_left]
|
| 93 |
+
· simp [e, EuclideanSpace.inner_single_left]
|
| 94 |
+
have h := abs_det_augmentedTangentMatrix v hv b B u
|
| 95 |
+
rw [hm, Matrix.det_submatrix_equiv_self] at h
|
| 96 |
+
exact h
|
| 97 |
+
|
| 98 |
+
theorem hyperplaneProjection_normDet_eq_abs_augmented_det {n : ℕ}
|
| 99 |
+
(u v : Euclidean (n + 1)) (hu : ‖u‖ = 1) (hv : ‖v‖ = 1)
|
| 100 |
+
(b : OrthonormalBasis (Fin n) ℝ (normalHyperplane v)) :
|
| 101 |
+
(hyperplaneProjection u v).normDet = |(tangentColumns v b u).det| := by
|
| 102 |
+
rw [hyperplaneProjection_normDet u v hu hv, abs_det_tangentColumns v hv b u]
|
| 103 |
+
|
| 104 |
+
end Paper092
|
| 105 |
+
|
| 106 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/BallBrightness.lean
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Brightness
|
| 2 |
+
import Mathlib.MeasureTheory.Measure.Lebesgue.VolumeOfBalls
|
| 3 |
+
import Mathlib.Analysis.Normed.Module.Ball.Pointwise
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open Set Metric MeasureTheory
|
| 8 |
+
open scoped Pointwise RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
noncomputable def euclideanUnitBallVolume (d : ℕ) : ℝ :=
|
| 13 |
+
(volume (closedBall (0 : Euclidean d) 1)).toReal
|
| 14 |
+
|
| 15 |
+
theorem projection_image_closedBall {d : ℕ} (u : Euclidean d) (R : ℝ) :
|
| 16 |
+
(normalHyperplane u).orthogonalProjectionOnto '' closedBall (0 : Euclidean d) R =
|
| 17 |
+
closedBall (0 : normalHyperplane u) R := by
|
| 18 |
+
ext y
|
| 19 |
+
constructor
|
| 20 |
+
· rintro ⟨x, hx, rfl⟩
|
| 21 |
+
apply mem_closedBall_zero_iff.mpr
|
| 22 |
+
exact ((normalHyperplane u).norm_orthogonalProjectionOnto_apply_le x).trans
|
| 23 |
+
(mem_closedBall_zero_iff.mp hx)
|
| 24 |
+
· intro hy
|
| 25 |
+
refine ⟨y.val, ?_, (normalHyperplane u).orthogonalProjectionOnto_mem_subspace_eq_self y⟩
|
| 26 |
+
simpa only [mem_closedBall, dist_zero_right, Submodule.norm_coe] using hy
|
| 27 |
+
|
| 28 |
+
theorem projectionVolume_closedBall_real {d : ℕ} (hd : 2 ≤ d)
|
| 29 |
+
(u : Euclidean d) (hu : u ≠ 0) (R : ℝ) (hR : 0 ≤ R) :
|
| 30 |
+
(projectionVolume (closedBall (0 : Euclidean d) R) u).toReal =
|
| 31 |
+
euclideanUnitBallVolume (d - 1) * R ^ (d - 1) := by
|
| 32 |
+
let : Nontrivial (normalHyperplane u) := Module.nontrivial_of_finrank_pos (by
|
| 33 |
+
rw [normalHyperplane_finrank u hu]
|
| 34 |
+
omega)
|
| 35 |
+
let : Nontrivial (Euclidean (d - 1)) := Module.nontrivial_of_finrank_pos (by
|
| 36 |
+
rw [finrank_euclideanSpace_fin]
|
| 37 |
+
omega)
|
| 38 |
+
have hunit : (volume (closedBall (0 : normalHyperplane u) 1)) =
|
| 39 |
+
volume (closedBall (0 : Euclidean (d - 1)) 1) := by
|
| 40 |
+
rw [InnerProductSpace.volume_closedBall, InnerProductSpace.volume_closedBall,
|
| 41 |
+
normalHyperplane_finrank u hu, finrank_euclideanSpace_fin]
|
| 42 |
+
have hball : R • closedBall (0 : normalHyperplane u) 1 = closedBall 0 R := by
|
| 43 |
+
rw [_root_.smul_closedBall _ _ zero_le_one, smul_zero, Real.norm_eq_abs, abs_of_nonneg hR, mul_one]
|
| 44 |
+
unfold projectionVolume
|
| 45 |
+
rw [projection_image_closedBall, ← hball, Measure.addHaar_smul,
|
| 46 |
+
normalHyperplane_finrank u hu, abs_pow, abs_of_nonneg hR,
|
| 47 |
+
ENNReal.toReal_mul, ENNReal.toReal_ofReal (pow_nonneg hR _), hunit]
|
| 48 |
+
exact mul_comm _ _
|
| 49 |
+
|
| 50 |
+
theorem brightness_closedBall {d : ℕ} (hd : 2 ≤ d) (R : ℝ) (hR : 0 ≤ R)
|
| 51 |
+
(u : Euclidean d) :
|
| 52 |
+
brightness (closedBall (0 : Euclidean d) R) u =
|
| 53 |
+
‖u‖ * (euclideanUnitBallVolume (d - 1) * R ^ (d - 1)) := by
|
| 54 |
+
by_cases hu : u = 0
|
| 55 |
+
· simp [hu, brightness]
|
| 56 |
+
· unfold brightness
|
| 57 |
+
rw [projectionVolume_closedBall_real hd u hu R hR]
|
| 58 |
+
|
| 59 |
+
theorem brightness_le_ball_bound {d : ℕ} (hd : 2 ≤ d) {K : Set (Euclidean d)}
|
| 60 |
+
{R : ℝ} (hR : 0 ≤ R) (hK : K ⊆ closedBall 0 R) (u : Euclidean d) :
|
| 61 |
+
brightness K u ≤ ‖u‖ * (euclideanUnitBallVolume (d - 1) * R ^ (d - 1)) := by
|
| 62 |
+
exact (brightness_mono hK (isCompact_closedBall _ _) u).trans_eq
|
| 63 |
+
(brightness_closedBall hd R hR u)
|
| 64 |
+
|
| 65 |
+
theorem ball_subset_projectionBody {d : ℕ} (hd : 2 ≤ d) {K : Set (Euclidean d)}
|
| 66 |
+
(hK : IsCompact K) {a : ℝ} (ha : 0 ≤ a) (hball : closedBall 0 a ⊆ K) :
|
| 67 |
+
closedBall (0 : Euclidean d) (euclideanUnitBallVolume (d - 1) * a ^ (d - 1)) ⊆
|
| 68 |
+
projectionBody K := by
|
| 69 |
+
intro y hy u
|
| 70 |
+
calc
|
| 71 |
+
⟪u, y⟫ ≤ ‖u‖ * ‖y‖ := real_inner_le_norm _ _
|
| 72 |
+
_ ≤ ‖u‖ * (euclideanUnitBallVolume (d - 1) * a ^ (d - 1)) :=
|
| 73 |
+
mul_le_mul_of_nonneg_left (mem_closedBall_zero_iff.mp hy) (norm_nonneg u)
|
| 74 |
+
_ = brightness (closedBall (0 : Euclidean d) a) u := (brightness_closedBall hd a ha u).symm
|
| 75 |
+
_ ≤ brightness K u := brightness_mono hball hK u
|
| 76 |
+
|
| 77 |
+
theorem projectionBody_subset_ball {d : ℕ} (hd : 2 ≤ d) {K : Set (Euclidean d)}
|
| 78 |
+
{R : ℝ} (hR : 0 ≤ R) (hK : K ⊆ closedBall 0 R) :
|
| 79 |
+
projectionBody K ⊆
|
| 80 |
+
closedBall (0 : Euclidean d) (euclideanUnitBallVolume (d - 1) * R ^ (d - 1)) := by
|
| 81 |
+
intro y hy
|
| 82 |
+
have hc : 0 ≤ euclideanUnitBallVolume (d - 1) * R ^ (d - 1) := by
|
| 83 |
+
exact mul_nonneg ENNReal.toReal_nonneg (pow_nonneg hR _)
|
| 84 |
+
have h := (hy y).trans (brightness_le_ball_bound hd hR hK y)
|
| 85 |
+
rw [real_inner_self_eq_norm_sq] at h
|
| 86 |
+
apply mem_closedBall_zero_iff.mpr
|
| 87 |
+
nlinarith [norm_nonneg y]
|
| 88 |
+
|
| 89 |
+
end Paper092
|
| 90 |
+
|
| 91 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/Basic.lean
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Model
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
theorem normalHyperplane_volume_is_canonical {n : ℕ} (u : Euclidean n) :
|
| 13 |
+
(volume : Measure (normalHyperplane u)) =
|
| 14 |
+
(stdOrthonormalBasis ℝ (normalHyperplane u)).toBasis.addHaar := rfl
|
| 15 |
+
|
| 16 |
+
theorem normalHyperplane_finrank {n : ℕ} (u : Euclidean n) (hu : u ≠ 0) :
|
| 17 |
+
Module.finrank ℝ (normalHyperplane u) = n - 1 := by
|
| 18 |
+
have h := (Submodule.span ℝ ({u} : Set (Euclidean n))).finrank_add_finrank_orthogonal
|
| 19 |
+
simp only [finrank_span_singleton hu, finrank_euclideanSpace_fin] at h
|
| 20 |
+
change Module.finrank ℝ ((Submodule.span ℝ ({u} : Set (Euclidean n)))ᗮ) = n - 1
|
| 21 |
+
omega
|
| 22 |
+
|
| 23 |
+
end Paper092
|
| 24 |
+
|
| 25 |
+
end
|
| 26 |
+
|
| 27 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/Brightness.lean
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open Set MeasureTheory
|
| 6 |
+
open scoped RealInnerProductSpace Pointwise
|
| 7 |
+
|
| 8 |
+
namespace Paper092
|
| 9 |
+
|
| 10 |
+
theorem normalHyperplane_smul {n : ℕ} (u : Euclidean n) {c : ℝ} (hc : c ≠ 0) :
|
| 11 |
+
normalHyperplane (c • u) = normalHyperplane u := by
|
| 12 |
+
unfold normalHyperplane
|
| 13 |
+
rw [Submodule.span_singleton_smul_eq (isUnit_iff_ne_zero.mpr hc)]
|
| 14 |
+
|
| 15 |
+
theorem projectionVolume_smul {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n)
|
| 16 |
+
{c : ℝ} (hc : c ≠ 0) : projectionVolume K (c • u) = projectionVolume K u := by
|
| 17 |
+
exact congrArg (fun V : Submodule ℝ (Euclidean n) =>
|
| 18 |
+
(volume : Measure V) (V.orthogonalProjectionOnto '' K)) (normalHyperplane_smul u hc)
|
| 19 |
+
|
| 20 |
+
theorem brightness_smul {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) (c : ℝ) :
|
| 21 |
+
brightness K (c • u) = |c| * brightness K u := by
|
| 22 |
+
by_cases hc : c = 0
|
| 23 |
+
· simp [hc, brightness]
|
| 24 |
+
· rw [brightness, projectionVolume_smul K u hc, norm_smul, Real.norm_eq_abs, brightness]
|
| 25 |
+
ring
|
| 26 |
+
|
| 27 |
+
theorem brightness_neg {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) :
|
| 28 |
+
brightness K (-u) = brightness K u := by
|
| 29 |
+
simpa using brightness_smul K u (-1)
|
| 30 |
+
|
| 31 |
+
theorem brightness_nonneg {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) :
|
| 32 |
+
0 ≤ brightness K u := mul_nonneg (norm_nonneg u) ENNReal.toReal_nonneg
|
| 33 |
+
|
| 34 |
+
theorem zero_mem_projectionBody {n : ℕ} (K : Set (Euclidean n)) :
|
| 35 |
+
0 ∈ projectionBody K := by
|
| 36 |
+
intro u
|
| 37 |
+
simpa using brightness_nonneg K u
|
| 38 |
+
|
| 39 |
+
theorem neg_mem_projectionBody_iff {n : ℕ} (K : Set (Euclidean n)) (y : Euclidean n) :
|
| 40 |
+
-y ∈ projectionBody K ↔ y ∈ projectionBody K := by
|
| 41 |
+
constructor
|
| 42 |
+
· intro h u
|
| 43 |
+
simpa [brightness_neg] using h (-u)
|
| 44 |
+
· intro h u
|
| 45 |
+
simpa [brightness_neg] using h (-u)
|
| 46 |
+
|
| 47 |
+
theorem projectionBody_neg_eq {n : ℕ} (K : Set (Euclidean n)) :
|
| 48 |
+
-projectionBody K = projectionBody K := by
|
| 49 |
+
ext y
|
| 50 |
+
simp [neg_mem_projectionBody_iff]
|
| 51 |
+
|
| 52 |
+
theorem projectionVolume_lt_top {n : ℕ} {K : Set (Euclidean n)} (hK : IsCompact K)
|
| 53 |
+
(u : Euclidean n) : projectionVolume K u < ⊤ := by
|
| 54 |
+
exact (hK.image (normalHyperplane u).orthogonalProjectionOnto.continuous).measure_lt_top
|
| 55 |
+
|
| 56 |
+
theorem projectionVolume_mono {n : ℕ} {A B : Set (Euclidean n)} (h : A ⊆ B)
|
| 57 |
+
(u : Euclidean n) : projectionVolume A u ≤ projectionVolume B u :=
|
| 58 |
+
measure_mono (image_mono h)
|
| 59 |
+
|
| 60 |
+
theorem brightness_mono {n : ℕ} {A B : Set (Euclidean n)} (h : A ⊆ B)
|
| 61 |
+
(hB : IsCompact B) (u : Euclidean n) : brightness A u ≤ brightness B u :=
|
| 62 |
+
mul_le_mul_of_nonneg_left
|
| 63 |
+
(ENNReal.toReal_mono (projectionVolume_lt_top hB u).ne (projectionVolume_mono h u))
|
| 64 |
+
(norm_nonneg u)
|
| 65 |
+
|
| 66 |
+
theorem projectionBody_mono {n : ℕ} {A B : Set (Euclidean n)} (h : A ⊆ B)
|
| 67 |
+
(hB : IsCompact B) : projectionBody A ⊆ projectionBody B :=
|
| 68 |
+
fun _ hy u => (hy u).trans (brightness_mono h hB u)
|
| 69 |
+
|
| 70 |
+
theorem projectionBody_isClosed {n : ℕ} (K : Set (Euclidean n)) :
|
| 71 |
+
IsClosed (projectionBody K) := by
|
| 72 |
+
rw [projectionBody, ofPred_forall]
|
| 73 |
+
exact isClosed_iInter fun u => isClosed_le (innerSL ℝ u).continuous continuous_const
|
| 74 |
+
|
| 75 |
+
theorem projectionBody_convex {n : ℕ} (K : Set (Euclidean n)) :
|
| 76 |
+
Convex ℝ (projectionBody K) := by
|
| 77 |
+
rw [projectionBody, ofPred_forall]
|
| 78 |
+
exact convex_iInter fun u => (convex_Iic (brightness K u)).linear_preimage (innerSL ℝ u).toLinearMap
|
| 79 |
+
|
| 80 |
+
theorem projectionBody_norm_le {n : ℕ} (K : Set (Euclidean n))
|
| 81 |
+
{y : Euclidean n} (hy : y ∈ projectionBody K) :
|
| 82 |
+
‖y‖ ≤ ∑ i : Fin n, brightness K (EuclideanSpace.basisFun (Fin n) ℝ i) := by
|
| 83 |
+
let b := EuclideanSpace.basisFun (Fin n) ℝ
|
| 84 |
+
calc
|
| 85 |
+
‖y‖ = ‖∑ i : Fin n, inner ℝ (b i) y • b i‖ := by rw [b.sum_repr']
|
| 86 |
+
_ ≤ ∑ i : Fin n, ‖inner ℝ (b i) y • b i‖ := norm_sum_le _ _
|
| 87 |
+
_ = ∑ i : Fin n, |inner ℝ (b i) y| := by simp [norm_smul, Real.norm_eq_abs]
|
| 88 |
+
_ ≤ ∑ i : Fin n, brightness K (b i) := by
|
| 89 |
+
apply Finset.sum_le_sum
|
| 90 |
+
intro i _
|
| 91 |
+
apply abs_le.mpr
|
| 92 |
+
constructor
|
| 93 |
+
· have h := hy (-b i)
|
| 94 |
+
simpa [brightness_neg] using neg_le_neg h
|
| 95 |
+
· exact hy (b i)
|
| 96 |
+
|
| 97 |
+
theorem projectionBody_isCompact {n : ℕ} (K : Set (Euclidean n)) :
|
| 98 |
+
IsCompact (projectionBody K) := by
|
| 99 |
+
apply Metric.isCompact_iff_isClosed_bounded.mpr
|
| 100 |
+
refine ⟨projectionBody_isClosed K, isBounded_iff_forall_norm_le.mpr ?_⟩
|
| 101 |
+
exact ⟨_, fun _ hy => projectionBody_norm_le K hy⟩
|
| 102 |
+
|
| 103 |
+
theorem projectionVolume_body_smul {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n)
|
| 104 |
+
(hu : u ≠ 0) (c : ℝ) :
|
| 105 |
+
projectionVolume (c • K) u = ENNReal.ofReal (|c| ^ (n - 1)) * projectionVolume K u := by
|
| 106 |
+
unfold projectionVolume
|
| 107 |
+
rw [image_smul_comm _ c K (fun x => map_smul _ c x),
|
| 108 |
+
Measure.addHaar_smul, normalHyperplane_finrank u hu, abs_pow]
|
| 109 |
+
|
| 110 |
+
theorem brightness_body_smul {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) (c : ℝ) :
|
| 111 |
+
brightness (c • K) u = |c| ^ (n - 1) * brightness K u := by
|
| 112 |
+
by_cases hu : u = 0
|
| 113 |
+
· simp [hu, brightness]
|
| 114 |
+
· rw [brightness, projectionVolume_body_smul K u hu c, ENNReal.toReal_mul,
|
| 115 |
+
ENNReal.toReal_ofReal (pow_nonneg (abs_nonneg c) _), brightness]
|
| 116 |
+
ring
|
| 117 |
+
|
| 118 |
+
theorem projectionBody_body_smul {n : ℕ} (K : Set (Euclidean n)) (c : ℝ) (hc : c ≠ 0) :
|
| 119 |
+
projectionBody (c • K) = |c| ^ (n - 1) • projectionBody K := by
|
| 120 |
+
have hq : 0 < |c| ^ (n - 1) := pow_pos (abs_pos.mpr hc) _
|
| 121 |
+
ext y
|
| 122 |
+
rw [mem_smul_set_iff_inv_smul_mem₀ hq.ne']
|
| 123 |
+
constructor
|
| 124 |
+
· intro h u
|
| 125 |
+
have hh := mul_le_mul_of_nonneg_left (h u) (inv_nonneg.mpr hq.le)
|
| 126 |
+
simpa [brightness_body_smul, inner_smul_right, mul_assoc, hq.ne'] using hh
|
| 127 |
+
· intro h u
|
| 128 |
+
have hh := mul_le_mul_of_nonneg_left (h u) hq.le
|
| 129 |
+
simpa [brightness_body_smul, inner_smul_right, mul_assoc, hq.ne'] using hh
|
| 130 |
+
|
| 131 |
+
end Paper092
|
| 132 |
+
|
| 133 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/CoordinateDrop.lean
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FacetAreas
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SimplexNormals
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.ProjectionJacobian
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open Set
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
def coordinateDrop (n : ℕ) (i : Fin (n + 1)) : Euclidean (n + 1) →ₗ[ℝ] Euclidean n where
|
| 13 |
+
toFun y := WithLp.toLp 2 (i.removeNth y)
|
| 14 |
+
map_add' x y := by ext j; rfl
|
| 15 |
+
map_smul' a x := by ext j; rfl
|
| 16 |
+
|
| 17 |
+
theorem coordinateDrop_apply (n : ℕ) (i : Fin (n + 1)) (y : Euclidean (n + 1)) (j : Fin n) :
|
| 18 |
+
coordinateDrop n i y j = y (i.succAbove j) := rfl
|
| 19 |
+
|
| 20 |
+
theorem coordinateDrop_facetEmbedding (n : ℕ) (i : Fin (n + 1)) (c : ℝ) (x : Euclidean n) :
|
| 21 |
+
coordinateDrop n i (facetEmbedding n i c x) = x := by
|
| 22 |
+
ext j
|
| 23 |
+
exact facetEmbedding_apply_succAbove n i c x j
|
| 24 |
+
|
| 25 |
+
theorem facetEmbedding_mem_diagonal_tangent (n : ℕ) (i : Fin (n + 1)) (x : Euclidean n) :
|
| 26 |
+
facetEmbedding n i (-1) x ∈ normalHyperplane (diagonalVector (n + 1)) := by
|
| 27 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 28 |
+
rw [diagonalVector_inner, Fin.sum_univ_succAbove _ i]
|
| 29 |
+
simp only [facetEmbedding_apply_same, facetEmbedding_apply_succAbove, neg_one_mul, neg_add_cancel]
|
| 30 |
+
|
| 31 |
+
noncomputable def diagonalTangentEmbedding (n : ℕ) (i : Fin (n + 1)) :
|
| 32 |
+
Euclidean n →ₗ[ℝ] normalHyperplane (diagonalVector (n + 1)) :=
|
| 33 |
+
(facetEmbedding n i (-1)).codRestrict _ (facetEmbedding_mem_diagonal_tangent n i)
|
| 34 |
+
|
| 35 |
+
noncomputable def diagonalCoordinateDrop (n : ℕ) (i : Fin (n + 1)) :
|
| 36 |
+
normalHyperplane (diagonalVector (n + 1)) →ₗ[ℝ] Euclidean n :=
|
| 37 |
+
(coordinateDrop n i).comp (normalHyperplane (diagonalVector (n + 1))).subtype
|
| 38 |
+
|
| 39 |
+
theorem diagonalCoordinateDrop_comp_embedding (n : ℕ) (i : Fin (n + 1)) :
|
| 40 |
+
(diagonalCoordinateDrop n i).comp (diagonalTangentEmbedding n i) = LinearMap.id := by
|
| 41 |
+
ext x j
|
| 42 |
+
exact congrArg (fun y : Euclidean n => y j) (coordinateDrop_facetEmbedding n i (-1) x)
|
| 43 |
+
|
| 44 |
+
theorem diagonalCoordinateDrop_normDet (n : ℕ) (i : Fin (n + 1)) :
|
| 45 |
+
(diagonalCoordinateDrop n i).normDet = 1 / Real.sqrt (n + 1) := by
|
| 46 |
+
have hn : 0 < Real.sqrt (n + 1 : ℝ) := Real.sqrt_pos.mpr (by positivity)
|
| 47 |
+
have hw : diagonalVector (n + 1) ≠ 0 := by
|
| 48 |
+
intro h
|
| 49 |
+
have hh := diagonalVector_norm (n + 1)
|
| 50 |
+
simp only [h, norm_zero, Nat.cast_add, Nat.cast_one] at hh
|
| 51 |
+
exact hn.ne' hh.symm
|
| 52 |
+
have hdim : Module.finrank ℝ (Euclidean n) =
|
| 53 |
+
Module.finrank ℝ (normalHyperplane (diagonalVector (n + 1))) := by
|
| 54 |
+
rw [finrank_euclideanSpace_fin, normalHyperplane_finrank _ hw, Nat.add_sub_cancel]
|
| 55 |
+
have h := LinearMap.normDet_comp_of_finrank_eq
|
| 56 |
+
(diagonalTangentEmbedding n i) (diagonalCoordinateDrop n i) hdim
|
| 57 |
+
rw [diagonalCoordinateDrop_comp_embedding] at h
|
| 58 |
+
have he : (diagonalTangentEmbedding n i).normDet = Real.sqrt (n + 1) := by
|
| 59 |
+
rw [diagonalTangentEmbedding, LinearMap.normDet_codRestrict, facetEmbedding_normDet_neg_one]
|
| 60 |
+
rw [he] at h
|
| 61 |
+
have hh : 1 = (diagonalCoordinateDrop n i).normDet * Real.sqrt (n + 1) := by simpa using h
|
| 62 |
+
exact (eq_div_iff hn.ne').mpr hh.symm
|
| 63 |
+
|
| 64 |
+
theorem coordinateDrop_diagonalFacet (n : ℕ) (i : Fin (n + 1)) :
|
| 65 |
+
coordinateDrop n i '' simplexFacet (n + 1) none = standardSimplex n := by
|
| 66 |
+
rw [← diagonalFacetChart_image n i, image_image]
|
| 67 |
+
have he : (fun x => coordinateDrop n i (diagonalFacetChart n i x)) = id := by
|
| 68 |
+
funext x
|
| 69 |
+
ext j
|
| 70 |
+
simp [coordinateDrop, diagonalFacetChart]
|
| 71 |
+
rw [he, image_id]
|
| 72 |
+
|
| 73 |
+
end Paper092
|
| 74 |
+
|
| 75 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/CounterexampleComparison.lean
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ProductCounterexample
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SimplexValue
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
namespace Paper092
|
| 7 |
+
|
| 8 |
+
theorem standardSimplex_normalizedProjectionVolume_lt_productWitness :
|
| 9 |
+
normalizedProjectionVolume (standardSimplex 20) <
|
| 10 |
+
normalizedProjectionVolume productWitness := by
|
| 11 |
+
rw [standardSimplex_normalizedProjectionVolume 20 (by norm_num),
|
| 12 |
+
productWitness_normalizedProjectionVolume]
|
| 13 |
+
exact dimension_twenty_strict
|
| 14 |
+
|
| 15 |
+
end Paper092
|
| 16 |
+
|
| 17 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/CubeBrightness.lean
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeCauchy
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.EuclideanVolume
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.FacetAreas
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace Pointwise
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Paper092
|
| 13 |
+
|
| 14 |
+
def euclideanCube (d : ℕ) : Set (Euclidean d) :=
|
| 15 |
+
WithLp.toLp 2 '' Icc (0 : Fin d → ℝ) 1
|
| 16 |
+
|
| 17 |
+
theorem mem_euclideanCube {d : ℕ} (x : Euclidean d) :
|
| 18 |
+
x ∈ euclideanCube d ↔ (∀ i, 0 ≤ x i) ∧ ∀ i, x i ≤ 1 := by
|
| 19 |
+
constructor
|
| 20 |
+
· rintro ⟨y, hy, rfl⟩
|
| 21 |
+
exact hy
|
| 22 |
+
· intro hx
|
| 23 |
+
exact ⟨WithLp.ofLp x, hx, WithLp.toLp_ofLp 2 x⟩
|
| 24 |
+
|
| 25 |
+
theorem euclideanCube_isCompact (d : ℕ) : IsCompact (euclideanCube d) :=
|
| 26 |
+
isCompact_Icc.image (PiLp.continuous_toLp 2 _)
|
| 27 |
+
|
| 28 |
+
theorem euclideanCube_volume (d : ℕ) : volume (euclideanCube d) = 1 := by
|
| 29 |
+
rw [euclideanCube, volume_euclidean_image]
|
| 30 |
+
simp [Real.volume_Icc_pi]
|
| 31 |
+
|
| 32 |
+
def cubeNormal {d : ℕ} : Fin d ⊕ Fin d → Euclidean d
|
| 33 |
+
| .inl i => -EuclideanSpace.single i 1
|
| 34 |
+
| .inr i => EuclideanSpace.single i 1
|
| 35 |
+
|
| 36 |
+
def cubeOffset {d : ℕ} : Fin d ⊕ Fin d → ℝ
|
| 37 |
+
| .inl _ => 0
|
| 38 |
+
| .inr _ => 1
|
| 39 |
+
|
| 40 |
+
theorem cube_constraints (d : ℕ) :
|
| 41 |
+
{x : Euclidean d | ∀ i, ⟪cubeNormal i, x⟫ ≤ cubeOffset i} = euclideanCube d := by
|
| 42 |
+
ext x
|
| 43 |
+
simp [mem_euclideanCube, Sum.forall, cubeNormal, cubeOffset,
|
| 44 |
+
EuclideanSpace.inner_single_left]
|
| 45 |
+
|
| 46 |
+
def cubePolytope (d : ℕ) : HPolytope d (Fin d ⊕ Fin d) where
|
| 47 |
+
normal := cubeNormal
|
| 48 |
+
offset := cubeOffset
|
| 49 |
+
normal_unit i := by cases i <;> simp [cubeNormal]
|
| 50 |
+
compact := by rw [cube_constraints]; exact euclideanCube_isCompact d
|
| 51 |
+
strict_feasible := by
|
| 52 |
+
refine ⟨WithLp.toLp 2 (fun _ => (1 / 2 : ℝ)), ?_⟩
|
| 53 |
+
intro i
|
| 54 |
+
cases i <;> norm_num [cubeNormal, cubeOffset, EuclideanSpace.inner_single_left]
|
| 55 |
+
distinct := by
|
| 56 |
+
intro i j hij
|
| 57 |
+
rcases i with i | i <;> rcases j with j | j
|
| 58 |
+
· congr 1
|
| 59 |
+
by_contra h
|
| 60 |
+
have hc := congrArg (fun p : Euclidean d × ℝ => p.1 i) hij
|
| 61 |
+
simp [cubeNormal, h] at hc
|
| 62 |
+
· have hc := congrArg Prod.snd hij
|
| 63 |
+
norm_num [cubeOffset] at hc
|
| 64 |
+
· have hc := congrArg Prod.snd hij
|
| 65 |
+
norm_num [cubeOffset] at hc
|
| 66 |
+
· congr 1
|
| 67 |
+
by_contra h
|
| 68 |
+
have hc := congrArg (fun p : Euclidean d × ℝ => p.1 i) hij
|
| 69 |
+
simp [cubeNormal, h] at hc
|
| 70 |
+
|
| 71 |
+
theorem cubePolytope_body (d : ℕ) : (cubePolytope d).body = euclideanCube d :=
|
| 72 |
+
cube_constraints d
|
| 73 |
+
|
| 74 |
+
theorem cubePolytope_face_lower {d : ℕ} (i : Fin d) :
|
| 75 |
+
(cubePolytope d).face (.inl i) = {x | x ∈ euclideanCube d ∧ x i = 0} := by
|
| 76 |
+
ext x
|
| 77 |
+
change (x ∈ (cubePolytope d).body ∧ ⟪-EuclideanSpace.single i 1, x⟫ = 0) ↔ _
|
| 78 |
+
rw [cubePolytope_body]
|
| 79 |
+
simp [EuclideanSpace.inner_single_left]
|
| 80 |
+
|
| 81 |
+
theorem cubePolytope_face_upper {d : ℕ} (i : Fin d) :
|
| 82 |
+
(cubePolytope d).face (.inr i) = {x | x ∈ euclideanCube d ∧ x i = 1} := by
|
| 83 |
+
ext x
|
| 84 |
+
change (x ∈ (cubePolytope d).body ∧ ⟪EuclideanSpace.single i 1, x⟫ = 1) ↔ _
|
| 85 |
+
rw [cubePolytope_body]
|
| 86 |
+
simp [EuclideanSpace.inner_single_left]
|
| 87 |
+
|
| 88 |
+
theorem cube_lower_face_chart (n : ℕ) (i : Fin (n + 1)) :
|
| 89 |
+
facetEmbedding n i 0 '' euclideanCube n = (cubePolytope (n + 1)).face (.inl i) := by
|
| 90 |
+
rw [cubePolytope_face_lower]
|
| 91 |
+
ext y
|
| 92 |
+
constructor
|
| 93 |
+
· rintro ⟨x, hx, rfl⟩
|
| 94 |
+
change facetEmbedding n i 0 x ∈ euclideanCube (n + 1) ∧ facetEmbedding n i 0 x i = 0
|
| 95 |
+
rw [mem_euclideanCube] at hx ⊢
|
| 96 |
+
simp [facetEmbedding, Fin.forall_iff_succAbove i, hx]
|
| 97 |
+
· rintro ⟨hy, hi⟩
|
| 98 |
+
refine ⟨WithLp.toLp 2 (i.removeNth y), ?_, ?_⟩
|
| 99 |
+
· rw [mem_euclideanCube] at hy ⊢
|
| 100 |
+
exact ⟨fun j => hy.1 (i.succAbove j), fun j => hy.2 (i.succAbove j)⟩
|
| 101 |
+
· ext j
|
| 102 |
+
induction j using i.succAboveCases <;> simp [facetEmbedding, hi]
|
| 103 |
+
|
| 104 |
+
theorem cube_lower_face_area (n : ℕ) (i : Fin (n + 1)) :
|
| 105 |
+
μHE[n] ((cubePolytope (n + 1)).face (.inl i)) = 1 := by
|
| 106 |
+
rw [← cube_lower_face_chart]
|
| 107 |
+
have h := (facetEmbedding n i 0).euclideanHausdorffMeasure_image_eq_normDet_mul_volume
|
| 108 |
+
(euclideanCube n)
|
| 109 |
+
simpa only [finrank_euclideanSpace_fin, facetEmbedding_normDet_zero,
|
| 110 |
+
ENNReal.ofReal_one, euclideanCube_volume, mul_one] using h
|
| 111 |
+
|
| 112 |
+
theorem cube_upper_face_eq_vadd {d : ℕ} (i : Fin d) :
|
| 113 |
+
(cubePolytope d).face (.inr i) =
|
| 114 |
+
EuclideanSpace.single i (1 : ℝ) +ᵥ (cubePolytope d).face (.inl i) := by
|
| 115 |
+
rw [cubePolytope_face_upper, cubePolytope_face_lower]
|
| 116 |
+
ext y
|
| 117 |
+
constructor
|
| 118 |
+
· rintro ⟨hy, hi⟩
|
| 119 |
+
refine ⟨y - EuclideanSpace.single i 1, ⟨?_, ?_⟩, ?_⟩
|
| 120 |
+
· rw [mem_euclideanCube] at hy ⊢
|
| 121 |
+
constructor <;> intro j
|
| 122 |
+
· by_cases hj : j = i
|
| 123 |
+
· subst j; simp [PiLp.sub_apply, hi]
|
| 124 |
+
· simpa [PiLp.sub_apply, PiLp.single_apply, hj] using hy.1 j
|
| 125 |
+
· by_cases hj : j = i
|
| 126 |
+
· subst j; simp [PiLp.sub_apply, hi]
|
| 127 |
+
· simpa [PiLp.sub_apply, PiLp.single_apply, hj] using hy.2 j
|
| 128 |
+
· simp [PiLp.sub_apply, hi]
|
| 129 |
+
· change EuclideanSpace.single i 1 + (y - EuclideanSpace.single i 1) = y
|
| 130 |
+
abel
|
| 131 |
+
· rintro ⟨x, ⟨hx, hi⟩, rfl⟩
|
| 132 |
+
refine ⟨?_, ?_⟩
|
| 133 |
+
· rw [mem_euclideanCube] at hx ⊢
|
| 134 |
+
constructor <;> intro j
|
| 135 |
+
· by_cases hj : j = i
|
| 136 |
+
· subst j; simp [vadd_eq_add, PiLp.add_apply, hi]
|
| 137 |
+
· simpa [vadd_eq_add, PiLp.add_apply, PiLp.single_apply, hj] using hx.1 j
|
| 138 |
+
· by_cases hj : j = i
|
| 139 |
+
· subst j; simp [vadd_eq_add, PiLp.add_apply, hi]
|
| 140 |
+
· simpa [vadd_eq_add, PiLp.add_apply, PiLp.single_apply, hj] using hx.2 j
|
| 141 |
+
· simp [vadd_eq_add, PiLp.add_apply, hi]
|
| 142 |
+
|
| 143 |
+
theorem cube_upper_face_area (n : ℕ) (i : Fin (n + 1)) :
|
| 144 |
+
μHE[n] ((cubePolytope (n + 1)).face (.inr i)) = 1 := by
|
| 145 |
+
rw [cube_upper_face_eq_vadd, measure_vadd, cube_lower_face_area]
|
| 146 |
+
|
| 147 |
+
theorem cube_faceArea {d : ℕ} (hd : 0 < d) (i : Fin d ⊕ Fin d) :
|
| 148 |
+
(cubePolytope d).faceArea i = 1 := by
|
| 149 |
+
obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hd)
|
| 150 |
+
cases i with
|
| 151 |
+
| inl i =>
|
| 152 |
+
change (μHE[n] ((cubePolytope (n + 1)).face (.inl i))).toReal = 1
|
| 153 |
+
rw [cube_lower_face_area, ENNReal.toReal_one]
|
| 154 |
+
| inr i =>
|
| 155 |
+
change (μHE[n] ((cubePolytope (n + 1)).face (.inr i))).toReal = 1
|
| 156 |
+
rw [cube_upper_face_area, ENNReal.toReal_one]
|
| 157 |
+
|
| 158 |
+
theorem euclideanCube_brightness {d : ℕ} (hd : 0 < d) (u : Euclidean d) :
|
| 159 |
+
brightness (euclideanCube d) u = ∑ i, |u i| := by
|
| 160 |
+
rw [← cubePolytope_body, (cubePolytope d).brightness_eq_sum]
|
| 161 |
+
simp only [cube_faceArea hd, one_mul, Fintype.sum_sum_type]
|
| 162 |
+
simp only [cubePolytope, cubeNormal, inner_neg_right, abs_neg,
|
| 163 |
+
EuclideanSpace.inner_single_right, one_mul, starRingEnd_apply, star_trivial]
|
| 164 |
+
ring
|
| 165 |
+
|
| 166 |
+
theorem euclideanCube_diagonal_brightness {d : ℕ} (hd : 0 < d) :
|
| 167 |
+
brightness (euclideanCube d) (WithLp.toLp 2 (1 : Fin d → ℝ)) = d := by
|
| 168 |
+
rw [euclideanCube_brightness hd]
|
| 169 |
+
simp
|
| 170 |
+
|
| 171 |
+
theorem euclideanCube_diagonal_extrusion {d : ℕ} (hd : 0 < d) :
|
| 172 |
+
(volume (euclideanCube d +
|
| 173 |
+
segment ℝ (0 : Euclidean d) (WithLp.toLp 2 (1 : Fin d → ℝ)))).toReal =
|
| 174 |
+
(volume (euclideanCube d)).toReal +
|
| 175 |
+
brightness (euclideanCube d) (WithLp.toLp 2 (1 : Fin d → ℝ)) := by
|
| 176 |
+
rw [euclideanCube_volume, ENNReal.toReal_one, euclideanCube_diagonal_brightness hd]
|
| 177 |
+
rw [euclideanCube, volume_euclidean_cube_add_diagonal d hd]
|
| 178 |
+
rw [ENNReal.toReal_add (by simp) (by simp), ENNReal.toReal_natCast, ENNReal.toReal_one]
|
| 179 |
+
ring
|
| 180 |
+
|
| 181 |
+
theorem euclideanCube_diagonal_projectionBody_support {d : ℕ} (hd : 0 < d) :
|
| 182 |
+
SupportGeometry.support (projectionBody (euclideanCube d))
|
| 183 |
+
(innerSL ℝ (WithLp.toLp 2 (1 : Fin d → ℝ))) = d := by
|
| 184 |
+
rw [← cubePolytope_body, (cubePolytope d).projectionBody_support, cubePolytope_body,
|
| 185 |
+
euclideanCube_diagonal_brightness hd]
|
| 186 |
+
|
| 187 |
+
end Paper092
|
| 188 |
+
|
| 189 |
+
end
|
| 190 |
+
|
| 191 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/CubeFibers.lean
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.CubeBrightness
|
| 2 |
+
import Mathlib.Algebra.Order.Group.Pointwise.Interval
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
open Set MeasureTheory
|
| 7 |
+
open scoped RealInnerProductSpace Pointwise
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
|
| 11 |
+
namespace Paper092
|
| 12 |
+
|
| 13 |
+
def lineFiber {d : ℕ} (K : Set (Euclidean d)) (x u : Euclidean d) : Set ℝ :=
|
| 14 |
+
{t | x + t • u ∈ K}
|
| 15 |
+
|
| 16 |
+
theorem lineFiber_add_segment {d : ℕ} (K : Set (Euclidean d)) (x u : Euclidean d) :
|
| 17 |
+
lineFiber (K + segment ℝ 0 u) x u = lineFiber K x u + Icc (0 : ℝ) 1 := by
|
| 18 |
+
ext t
|
| 19 |
+
constructor
|
| 20 |
+
· rintro ⟨y, hy, z, hz, hsum⟩
|
| 21 |
+
rw [segment_eq_image] at hz
|
| 22 |
+
obtain ⟨s, hs, rfl⟩ := hz
|
| 23 |
+
simp only [smul_zero, zero_add] at hsum
|
| 24 |
+
refine ⟨t - s, ?_, s, hs, sub_add_cancel t s⟩
|
| 25 |
+
change x + (t - s) • u ∈ K
|
| 26 |
+
have heq : x + (t - s) • u = y := by
|
| 27 |
+
rw [sub_smul, ← add_sub_assoc, ← hsum, add_sub_cancel_right]
|
| 28 |
+
rwa [heq]
|
| 29 |
+
· rintro ⟨r, hr, s, hs, rfl⟩
|
| 30 |
+
refine ⟨x + r • u, hr, s • u, ?_, ?_⟩
|
| 31 |
+
· rw [segment_eq_image]
|
| 32 |
+
exact ⟨s, hs, by simp⟩
|
| 33 |
+
· rw [add_smul]
|
| 34 |
+
abel_nf
|
| 35 |
+
|
| 36 |
+
theorem projection_add_parallel_segment {d : ℕ} (K : Set (Euclidean d)) (u : Euclidean d) :
|
| 37 |
+
(normalHyperplane u).orthogonalProjectionOnto '' (K + segment ℝ 0 u) =
|
| 38 |
+
(normalHyperplane u).orthogonalProjectionOnto '' K := by
|
| 39 |
+
ext y
|
| 40 |
+
constructor
|
| 41 |
+
· rintro ⟨z, ⟨x, hx, v, hv, rfl⟩, rfl⟩
|
| 42 |
+
rw [segment_eq_image] at hv
|
| 43 |
+
obtain ⟨t, ht, rfl⟩ := hv
|
| 44 |
+
simp only [smul_zero, zero_add]
|
| 45 |
+
refine ⟨x, hx, ?_⟩
|
| 46 |
+
exact ((projection_eq_iff_parallel u (x + t • u) x).mpr ⟨t, rfl⟩).symm
|
| 47 |
+
· rintro ⟨x, hx, rfl⟩
|
| 48 |
+
exact ⟨x, ⟨x, hx, 0, left_mem_segment ℝ _ _, add_zero x⟩, rfl⟩
|
| 49 |
+
|
| 50 |
+
theorem cube_lineFiber_eq_interval {d : ℕ} (hd : 0 < d) (x : Euclidean d) :
|
| 51 |
+
∃ a b : ℝ, lineFiber (euclideanCube d) x (WithLp.toLp 2 (1 : Fin d → ℝ)) = Icc a b := by
|
| 52 |
+
have : Nonempty (Fin d) := ⟨⟨0, hd⟩⟩
|
| 53 |
+
let a := Finset.univ.sup' Finset.univ_nonempty (fun i : Fin d => -x i)
|
| 54 |
+
let b := Finset.univ.inf' Finset.univ_nonempty (fun i : Fin d => 1 - x i)
|
| 55 |
+
refine ⟨a, b, ?_⟩
|
| 56 |
+
ext t
|
| 57 |
+
simp only [lineFiber, mem_ofPred_eq, mem_euclideanCube, PiLp.add_apply, PiLp.smul_apply,
|
| 58 |
+
Pi.one_apply, smul_eq_mul, mul_one, mem_Icc,
|
| 59 |
+
a, b, Finset.sup'_le_iff, Finset.le_inf'_iff, Finset.mem_univ, forall_true_left]
|
| 60 |
+
constructor
|
| 61 |
+
· intro h
|
| 62 |
+
exact ⟨fun i => by linarith [h.1 i], fun i => by linarith [h.2 i]⟩
|
| 63 |
+
· intro h
|
| 64 |
+
exact ⟨fun i => by linarith [h.1 i], fun i => by linarith [h.2 i]⟩
|
| 65 |
+
|
| 66 |
+
theorem cube_lineFiber_extrusion_intervals {d : ℕ} (hd : 0 < d) (x : Euclidean d)
|
| 67 |
+
(hne : (lineFiber (euclideanCube d) x (WithLp.toLp 2 (1 : Fin d → ℝ))).Nonempty) :
|
| 68 |
+
∃ a b : ℝ, a ≤ b ∧
|
| 69 |
+
lineFiber (euclideanCube d) x (WithLp.toLp 2 (1 : Fin d → ℝ)) = Icc a b ∧
|
| 70 |
+
lineFiber (euclideanCube d + segment ℝ 0 (WithLp.toLp 2 (1 : Fin d → ℝ))) x
|
| 71 |
+
(WithLp.toLp 2 (1 : Fin d → ℝ)) = Icc a (b + 1) := by
|
| 72 |
+
obtain ⟨a, b, hab⟩ := cube_lineFiber_eq_interval hd x
|
| 73 |
+
have hle : a ≤ b := nonempty_Icc.mp (hab ▸ hne)
|
| 74 |
+
refine ⟨a, b, hle, hab, ?_⟩
|
| 75 |
+
rw [lineFiber_add_segment, hab, Set.Icc_add_Icc hle (by norm_num : (0 : ℝ) ≤ 1), add_zero]
|
| 76 |
+
|
| 77 |
+
theorem interval_line_image {d : ℕ} (x u : Euclidean d) {a b : ℝ} (hab : a ≤ b) :
|
| 78 |
+
(fun t : ℝ => x + t • u) '' Icc a b = segment ℝ (x + a • u) (x + b • u) := by
|
| 79 |
+
let f : ℝ →ᵃ[ℝ] Euclidean d :=
|
| 80 |
+
AffineMap.const ℝ ℝ x + (LinearMap.toSpanSingleton ℝ (Euclidean d) u).toAffineMap
|
| 81 |
+
have hf (t : ℝ) : f t = x + t • u := rfl
|
| 82 |
+
simpa only [hf, segment_eq_Icc hab] using image_segment ℝ f a b
|
| 83 |
+
|
| 84 |
+
theorem interval_line_length_increase {d : ℕ} (x u : Euclidean d) {a b : ℝ} (hab : a ≤ b) :
|
| 85 |
+
dist (x + a • u) (x + (b + 1) • u) = dist (x + a • u) (x + b • u) + ‖u‖ := by
|
| 86 |
+
rw [dist_eq_norm, dist_eq_norm]
|
| 87 |
+
have hsub (s : ℝ) : x + a • u - (x + s • u) = (a - s) • u := by
|
| 88 |
+
rw [sub_smul]
|
| 89 |
+
abel_nf
|
| 90 |
+
rw [hsub, hsub, norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs,
|
| 91 |
+
abs_of_nonpos (by linarith : a - (b + 1) ≤ 0),
|
| 92 |
+
abs_of_nonpos (by linarith : a - b ≤ 0)]
|
| 93 |
+
ring
|
| 94 |
+
|
| 95 |
+
def lineFiberLength {d : ℕ} (K : Set (Euclidean d)) (x u : Euclidean d) : ℝ :=
|
| 96 |
+
(μH[1] ((fun t : ℝ => x + t • u) '' lineFiber K x u)).toReal
|
| 97 |
+
|
| 98 |
+
theorem lineFiberLength_of_eq_Icc {d : ℕ} (K : Set (Euclidean d)) (x u : Euclidean d)
|
| 99 |
+
{a b : ℝ} (hab : a ≤ b) (h : lineFiber K x u = Icc a b) :
|
| 100 |
+
lineFiberLength K x u = dist (x + a • u) (x + b • u) := by
|
| 101 |
+
rw [lineFiberLength, h, interval_line_image x u hab, hausdorffMeasure_segment]
|
| 102 |
+
rw [edist_dist, ENNReal.toReal_ofReal dist_nonneg]
|
| 103 |
+
|
| 104 |
+
theorem cube_lineFiberLength_extrusion {d : ℕ} (hd : 0 < d) (x : Euclidean d)
|
| 105 |
+
(hne : (lineFiber (euclideanCube d) x (WithLp.toLp 2 (1 : Fin d → ℝ))).Nonempty) :
|
| 106 |
+
lineFiberLength (euclideanCube d + segment ℝ 0 (WithLp.toLp 2 (1 : Fin d → ℝ))) x
|
| 107 |
+
(WithLp.toLp 2 (1 : Fin d → ℝ)) =
|
| 108 |
+
lineFiberLength (euclideanCube d) x (WithLp.toLp 2 (1 : Fin d → ℝ)) +
|
| 109 |
+
‖WithLp.toLp 2 (1 : Fin d → ℝ)‖ := by
|
| 110 |
+
obtain ⟨a, b, hab, hcube, hextrusion⟩ := cube_lineFiber_extrusion_intervals hd x hne
|
| 111 |
+
rw [lineFiberLength_of_eq_Icc _ _ _ (by linarith : a ≤ b + 1) hextrusion,
|
| 112 |
+
lineFiberLength_of_eq_Icc _ _ _ hab hcube]
|
| 113 |
+
exact interval_line_length_increase _ _ hab
|
| 114 |
+
|
| 115 |
+
end Paper092
|
| 116 |
+
|
| 117 |
+
end
|
| 118 |
+
|
| 119 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/EuclideanVolume.lean
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.Extrusion
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
universe uι
|
| 7 |
+
|
| 8 |
+
open Set MeasureTheory
|
| 9 |
+
open scoped Pointwise
|
| 10 |
+
|
| 11 |
+
namespace Paper092
|
| 12 |
+
|
| 13 |
+
theorem volume_euclidean_image {ι : Type uι} [Fintype ι] (s : Set (ι → ℝ)) :
|
| 14 |
+
(volume : Measure (EuclideanSpace ℝ ι)) (WithLp.toLp 2 '' s) = volume s := by
|
| 15 |
+
change volume ((MeasurableEquiv.toLp 2 (ι → ℝ)) '' s) = volume s
|
| 16 |
+
rw [MeasurableEquiv.image_eq_preimage_symm]
|
| 17 |
+
exact (EuclideanSpace.volume_preserving_symm_measurableEquiv_toLp ι).measure_preimage_equiv s
|
| 18 |
+
|
| 19 |
+
theorem toLp_image_add_segment {ι : Type uι} [Fintype ι] (s : Set (ι → ℝ)) :
|
| 20 |
+
WithLp.toLp 2 '' (s + segment ℝ (0 : ι → ℝ) 1) =
|
| 21 |
+
WithLp.toLp 2 '' s + segment ℝ (0 : EuclideanSpace ℝ ι)
|
| 22 |
+
(WithLp.toLp 2 (1 : ι → ℝ)) := by
|
| 23 |
+
let e := (WithLp.linearEquiv 2 ℝ (ι → ℝ)).symm
|
| 24 |
+
have ha := Set.image_add (s := s) (t := segment ℝ (0 : ι → ℝ) 1) e.toAddEquiv
|
| 25 |
+
have hs := image_segment ℝ e.toAffineEquiv.toAffineMap (0 : ι → ℝ) 1
|
| 26 |
+
simpa [e] using ha.trans (congrArg (fun t => e '' s + t) hs)
|
| 27 |
+
|
| 28 |
+
theorem volume_euclidean_cube_add_diagonal (d : ℕ) (hd : 0 < d) :
|
| 29 |
+
volume ((WithLp.toLp 2 '' Icc (0 : Fin d → ℝ) 1) +
|
| 30 |
+
segment ℝ (0 : EuclideanSpace ℝ (Fin d)) (WithLp.toLp 2 (1 : Fin d → ℝ))) =
|
| 31 |
+
d + 1 := by
|
| 32 |
+
rw [← toLp_image_add_segment, volume_euclidean_image]
|
| 33 |
+
exact volume_Icc_add_segment_one d hd
|
| 34 |
+
|
| 35 |
+
end Paper092
|
| 36 |
+
|
| 37 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/ExposedBounds.lean
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ExposedProduct
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open Set
|
| 7 |
+
open scoped RealInnerProductSpace
|
| 8 |
+
|
| 9 |
+
namespace Paper092
|
| 10 |
+
|
| 11 |
+
theorem exposedFace_vectorSpan_le_normalHyperplane {n : ℕ}
|
| 12 |
+
(K : Set (Euclidean n)) (u : Euclidean n) :
|
| 13 |
+
vectorSpan ℝ (exposedFace K u) ≤ normalHyperplane u := by
|
| 14 |
+
rw [vectorSpan_def]
|
| 15 |
+
apply Submodule.span_le.mpr
|
| 16 |
+
rintro _ ⟨x, hx, y, hy, rfl⟩
|
| 17 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 18 |
+
change ⟪u, x - y⟫ = 0
|
| 19 |
+
rw [inner_sub_right]
|
| 20 |
+
exact sub_eq_zero.mpr (le_antisymm (hy.2 x hx.1) (hx.2 y hy.1))
|
| 21 |
+
|
| 22 |
+
theorem exposedFace_finrank_le {n : ℕ} (K : Set (Euclidean n))
|
| 23 |
+
{u : Euclidean n} (hu : u ≠ 0) :
|
| 24 |
+
Module.finrank ℝ (vectorSpan ℝ (exposedFace K u)) ≤ n - 1 := by
|
| 25 |
+
have h := Submodule.finrank_mono (exposedFace_vectorSpan_le_normalHyperplane K u)
|
| 26 |
+
rwa [normalHyperplane_finrank u hu] at h
|
| 27 |
+
|
| 28 |
+
theorem exposedFace_ssubset {n : ℕ} (K : Set (Euclidean n))
|
| 29 |
+
(hint : (interior K).Nonempty) {u : Euclidean n} (hu : u ≠ 0) :
|
| 30 |
+
exposedFace K u ⊂ K := by
|
| 31 |
+
refine ssubset_iff_subset_ne.mpr ⟨fun _ hx => hx.1, ?_⟩
|
| 32 |
+
intro heq
|
| 33 |
+
obtain ⟨x, hx⟩ := hint
|
| 34 |
+
obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hx)
|
| 35 |
+
have hnorm : 0 < ‖u‖ := norm_pos_iff.mpr hu
|
| 36 |
+
let t : ℝ := ε / (2 * ‖u‖)
|
| 37 |
+
have ht : 0 < t := div_pos hε (mul_pos (by norm_num) hnorm)
|
| 38 |
+
have hdist : dist (x + t • u) x < ε := by
|
| 39 |
+
rw [dist_eq_norm, add_sub_cancel_left, norm_smul, Real.norm_eq_abs, abs_of_pos ht]
|
| 40 |
+
dsimp [t]
|
| 41 |
+
field_simp
|
| 42 |
+
linarith
|
| 43 |
+
have hy := hball (Metric.mem_ball.mpr hdist)
|
| 44 |
+
have hface : x ∈ exposedFace K u := heq.symm ▸ interior_subset hx
|
| 45 |
+
have hle := hface.2 (x + t • u) hy
|
| 46 |
+
change ⟪u, x + t • u⟫ ≤ ⟪u, x⟫ at hle
|
| 47 |
+
rw [inner_add_right, real_inner_smul_right, real_inner_self_eq_norm_sq] at hle
|
| 48 |
+
have hpos := mul_pos ht (sq_pos_of_pos hnorm)
|
| 49 |
+
linarith
|
| 50 |
+
|
| 51 |
+
end Paper092
|
| 52 |
+
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/ExposedProduct.lean
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ProductPolytope
|
| 2 |
+
import Mathlib.Analysis.Convex.Exposed
|
| 3 |
+
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
noncomputable section
|
| 8 |
+
open Set MeasureTheory
|
| 9 |
+
open scoped RealInnerProductSpace
|
| 10 |
+
|
| 11 |
+
namespace Paper092
|
| 12 |
+
|
| 13 |
+
def exposedFace {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) : Set (Euclidean n) :=
|
| 14 |
+
(innerSL ℝ u).toExposed K
|
| 15 |
+
|
| 16 |
+
@[simp] theorem exposedFace_zero {n : ℕ} (K : Set (Euclidean n)) : exposedFace K 0 = K := by
|
| 17 |
+
ext x
|
| 18 |
+
simp [exposedFace, ContinuousLinearMap.toExposed]
|
| 19 |
+
|
| 20 |
+
theorem exposedFace_nonempty {n : ℕ} (K : Set (Euclidean n)) (hK : IsCompact K)
|
| 21 |
+
(hne : K.Nonempty) (u : Euclidean n) : (exposedFace K u).Nonempty := by
|
| 22 |
+
obtain ⟨x, hx, hmax⟩ := hK.exists_isMaxOn hne (innerSL ℝ u).continuous.continuousOn
|
| 23 |
+
exact ⟨x, hx, hmax⟩
|
| 24 |
+
|
| 25 |
+
theorem exposedFace_product {r s : ℕ} (A : Set (Euclidean r)) (B : Set (Euclidean s))
|
| 26 |
+
(w : Euclidean (r + s)) :
|
| 27 |
+
exposedFace (cartesianBody A B) w =
|
| 28 |
+
cartesianBody (exposedFace A (splitEuclideanProduct r s w).1)
|
| 29 |
+
(exposedFace B (splitEuclideanProduct r s w).2) := by
|
| 30 |
+
ext x
|
| 31 |
+
change (x ∈ cartesianBody A B ∧ ∀ y ∈ cartesianBody A B, ⟪w, y⟫ ≤ ⟪w, x⟫) ↔
|
| 32 |
+
(((splitEuclideanProduct r s x).1 ∈ A ∧
|
| 33 |
+
∀ a ∈ A, ⟪(splitEuclideanProduct r s w).1, a⟫ ≤
|
| 34 |
+
⟪(splitEuclideanProduct r s w).1, (splitEuclideanProduct r s x).1⟫) ∧
|
| 35 |
+
((splitEuclideanProduct r s x).2 ∈ B ∧
|
| 36 |
+
∀ b ∈ B, ⟪(splitEuclideanProduct r s w).2, b⟫ ≤
|
| 37 |
+
⟪(splitEuclideanProduct r s w).2, (splitEuclideanProduct r s x).2⟫))
|
| 38 |
+
constructor
|
| 39 |
+
· rintro ⟨⟨hA, hB⟩, hmax⟩
|
| 40 |
+
refine ⟨⟨hA, ?_⟩, ⟨hB, ?_⟩⟩
|
| 41 |
+
· intro a ha
|
| 42 |
+
have hm : (splitEuclideanProduct r s).symm (a, (splitEuclideanProduct r s x).2) ∈
|
| 43 |
+
cartesianBody A B := by
|
| 44 |
+
rw [cartesianBody_eq_preimage, Set.mem_preimage,
|
| 45 |
+
ContinuousLinearEquiv.apply_symm_apply]
|
| 46 |
+
exact ⟨ha, hB⟩
|
| 47 |
+
have h := hmax _ hm
|
| 48 |
+
rw [splitEuclideanProduct_inner r s, splitEuclideanProduct_inner r s,
|
| 49 |
+
ContinuousLinearEquiv.apply_symm_apply] at h
|
| 50 |
+
exact (add_le_add_iff_right _).mp h
|
| 51 |
+
· intro b hb
|
| 52 |
+
have hm : (splitEuclideanProduct r s).symm ((splitEuclideanProduct r s x).1, b) ∈
|
| 53 |
+
cartesianBody A B := by
|
| 54 |
+
rw [cartesianBody_eq_preimage, Set.mem_preimage,
|
| 55 |
+
ContinuousLinearEquiv.apply_symm_apply]
|
| 56 |
+
exact ⟨hA, hb⟩
|
| 57 |
+
have h := hmax _ hm
|
| 58 |
+
rw [splitEuclideanProduct_inner r s, splitEuclideanProduct_inner r s,
|
| 59 |
+
ContinuousLinearEquiv.apply_symm_apply] at h
|
| 60 |
+
exact (add_le_add_iff_left _).mp h
|
| 61 |
+
· rintro ⟨⟨hA, hmaxA⟩, ⟨hB, hmaxB⟩⟩
|
| 62 |
+
refine ⟨⟨hA, hB⟩, ?_⟩
|
| 63 |
+
intro y hy
|
| 64 |
+
rw [splitEuclideanProduct_inner r s, splitEuclideanProduct_inner r s]
|
| 65 |
+
exact add_le_add (hmaxA _ hy.1) (hmaxB _ hy.2)
|
| 66 |
+
|
| 67 |
+
theorem cartesianBody_eq_image {r s : ℕ} (A : Set (Euclidean r)) (B : Set (Euclidean s)) :
|
| 68 |
+
cartesianBody A B = (splitEuclideanProduct r s).symm '' (A ×ˢ B) := by
|
| 69 |
+
ext x
|
| 70 |
+
constructor
|
| 71 |
+
· intro hx
|
| 72 |
+
exact ⟨splitEuclideanProduct r s x, hx, (splitEuclideanProduct r s).symm_apply_apply x⟩
|
| 73 |
+
· rintro ⟨y, hy, rfl⟩
|
| 74 |
+
change splitEuclideanProduct r s ((splitEuclideanProduct r s).symm y) ∈ A ×ˢ B
|
| 75 |
+
simpa using hy
|
| 76 |
+
|
| 77 |
+
theorem submodule_prod_finrank {r s : ℕ} (P : Submodule ℝ (Euclidean r))
|
| 78 |
+
(Q : Submodule ℝ (Euclidean s)) :
|
| 79 |
+
Module.finrank ℝ (P.prod Q) = Module.finrank ℝ P + Module.finrank ℝ Q := by
|
| 80 |
+
let e : (P.prod Q) ≃ₗ[ℝ] P × Q :=
|
| 81 |
+
{ toFun := fun x => (⟨x.1.1, x.2.1⟩, ⟨x.1.2, x.2.2⟩)
|
| 82 |
+
invFun := fun x => ⟨(x.1, x.2), ⟨x.1.2, x.2.2⟩⟩
|
| 83 |
+
left_inv := fun _ => rfl
|
| 84 |
+
right_inv := fun _ => rfl
|
| 85 |
+
map_add' := fun _ _ => rfl
|
| 86 |
+
map_smul' := fun _ _ => rfl }
|
| 87 |
+
rw [e.finrank_eq, Module.finrank_prod]
|
| 88 |
+
|
| 89 |
+
theorem cartesianBody_affine_dimension {r s : ℕ} (A : Set (Euclidean r)) (B : Set (Euclidean s))
|
| 90 |
+
(hA : A.Nonempty) (hB : B.Nonempty) :
|
| 91 |
+
Module.finrank ℝ (vectorSpan ℝ (cartesianBody A B)) =
|
| 92 |
+
Module.finrank ℝ (vectorSpan ℝ A) + Module.finrank ℝ (vectorSpan ℝ B) := by
|
| 93 |
+
let e := (splitEuclideanProduct r s).symm.toLinearEquiv
|
| 94 |
+
rw [cartesianBody_eq_image]
|
| 95 |
+
change Module.finrank ℝ (vectorSpan ℝ (e.toLinearMap.toAffineMap '' (A ×ˢ B))) = _
|
| 96 |
+
rw [← AffineMap.map_vectorSpan]
|
| 97 |
+
change Module.finrank ℝ ((vectorSpan ℝ (A ×ˢ B)).map e.toLinearMap) = _
|
| 98 |
+
rw [e.finrank_map_eq, vectorSpan_prod_eq hA hB, submodule_prod_finrank]
|
| 99 |
+
|
| 100 |
+
end Paper092
|
| 101 |
+
|
| 102 |
+
end
|
| 103 |
+
|
| 104 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/Extrusion.lean
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
|
| 2 |
+
import Mathlib.Analysis.Convex.Segment
|
| 3 |
+
import Mathlib.Tactic.Linarith
|
| 4 |
+
import Mathlib.Tactic.NormNum
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
universe uι
|
| 9 |
+
|
| 10 |
+
open Set MeasureTheory
|
| 11 |
+
open scoped ENNReal Pointwise
|
| 12 |
+
|
| 13 |
+
namespace Paper092
|
| 14 |
+
|
| 15 |
+
variable {ι : Type uι} [Fintype ι] [DecidableEq ι]
|
| 16 |
+
|
| 17 |
+
def unitCube (ι : Type uι) : Set (ι → ℝ) := Icc 0 1
|
| 18 |
+
|
| 19 |
+
def extrusionCell (i : ι) : Set (ι → ℝ) :=
|
| 20 |
+
{x | (1 ≤ x i ∧ x i ≤ 2) ∧ ∀ j, j ≠ i → x i - 1 ≤ x j ∧ x j ≤ x i}
|
| 21 |
+
|
| 22 |
+
def shearMatrix (i : ι) : Matrix ι ι ℝ :=
|
| 23 |
+
(1 : Matrix ι ι ℝ).updateCol i (fun _ => 1)
|
| 24 |
+
|
| 25 |
+
theorem det_shearMatrix (i : ι) : (shearMatrix i).det = 1 := by
|
| 26 |
+
simpa [shearMatrix, Matrix.one_apply] using
|
| 27 |
+
Matrix.det_updateCol_sum (1 : Matrix ι ι ℝ) i (fun _ => (1 : ℝ))
|
| 28 |
+
|
| 29 |
+
def cellMap (i : ι) (x : ι → ℝ) : ι → ℝ :=
|
| 30 |
+
fun j => if j = i then 1 + x i else x i + x j
|
| 31 |
+
|
| 32 |
+
omit [Fintype ι] in
|
| 33 |
+
theorem cellMap_mem_iff (i : ι) (x : ι → ℝ) :
|
| 34 |
+
cellMap i x ∈ extrusionCell i ↔ x ∈ unitCube ι := by
|
| 35 |
+
simp only [extrusionCell, cellMap, unitCube, mem_ofPred_eq, mem_Icc, Pi.le_def,
|
| 36 |
+
Pi.zero_apply, Pi.one_apply, ite_true]
|
| 37 |
+
constructor
|
| 38 |
+
· rintro ⟨hi, h⟩
|
| 39 |
+
constructor <;> intro j
|
| 40 |
+
· by_cases hj : j = i
|
| 41 |
+
· subst j; linarith
|
| 42 |
+
· have := h j hj
|
| 43 |
+
simp only [ite_eq_right hj] at this
|
| 44 |
+
linarith
|
| 45 |
+
· by_cases hj : j = i
|
| 46 |
+
· subst j; linarith
|
| 47 |
+
· have := h j hj
|
| 48 |
+
simp only [ite_eq_right hj] at this
|
| 49 |
+
linarith
|
| 50 |
+
· rintro ⟨h0, h1⟩
|
| 51 |
+
refine ⟨⟨by linarith [h0 i], by linarith [h1 i]⟩, ?_⟩
|
| 52 |
+
intro j hj
|
| 53 |
+
simp only [ite_eq_right hj]
|
| 54 |
+
constructor <;> linarith [h0 j, h1 j]
|
| 55 |
+
|
| 56 |
+
theorem cellMap_eq_matrix (i : ι) (x : ι → ℝ) :
|
| 57 |
+
cellMap i x = Pi.single i 1 + Matrix.toLin' (shearMatrix i) x := by
|
| 58 |
+
funext j
|
| 59 |
+
simp only [cellMap, Pi.add_apply, Matrix.toLin'_apply, Matrix.mulVec, dotProduct,
|
| 60 |
+
shearMatrix, Matrix.updateCol_apply, Matrix.one_apply]
|
| 61 |
+
by_cases hj : j = i
|
| 62 |
+
· subst j
|
| 63 |
+
have hsum : ∀ k : ι,
|
| 64 |
+
(if k = i then 1 else if i = k then 1 else 0) * x k =
|
| 65 |
+
if k = i then x k else 0 := by
|
| 66 |
+
intro k
|
| 67 |
+
by_cases hk : k = i
|
| 68 |
+
· subst k; simp
|
| 69 |
+
· simp [hk, Ne.symm hk]
|
| 70 |
+
simp_rw [hsum]
|
| 71 |
+
simp
|
| 72 |
+
· have hsum : ∀ k : ι,
|
| 73 |
+
(if k = i then 1 else if j = k then 1 else 0) * x k =
|
| 74 |
+
(if k = i then x i else 0) + (if k = j then x j else 0) := by
|
| 75 |
+
intro k
|
| 76 |
+
by_cases hki : k = i
|
| 77 |
+
· subst k; simp [Ne.symm hj]
|
| 78 |
+
· by_cases hkj : k = j
|
| 79 |
+
· subst k; simp [hj]
|
| 80 |
+
· simp [hki, hkj, Ne.symm hkj]
|
| 81 |
+
simp_rw [hsum]
|
| 82 |
+
simp [hj, Finset.sum_add_distrib]
|
| 83 |
+
|
| 84 |
+
theorem cellMap_measurePreserving (i : ι) :
|
| 85 |
+
MeasurePreserving (cellMap i) volume volume := by
|
| 86 |
+
have hs : MeasurePreserving (Matrix.toLin' (shearMatrix i)) volume volume := by
|
| 87 |
+
refine ⟨(Matrix.toLin' (shearMatrix i)).continuous_of_finiteDimensional.measurable, ?_⟩
|
| 88 |
+
simpa [det_shearMatrix] using
|
| 89 |
+
Real.map_matrix_volume_pi_eq_smul_volume_pi
|
| 90 |
+
(M := shearMatrix i) (by rw [det_shearMatrix]; norm_num)
|
| 91 |
+
have h := (measurePreserving_add_left (volume : Measure (ι → ℝ)) (Pi.single i 1)).comp hs
|
| 92 |
+
simpa only [Function.comp_def, ← cellMap_eq_matrix] using h
|
| 93 |
+
|
| 94 |
+
omit [DecidableEq ι] in
|
| 95 |
+
theorem extrusionCell_measurable (i : ι) : MeasurableSet (extrusionCell i) := by
|
| 96 |
+
simp only [extrusionCell, ofPred_and, ofPred_forall]
|
| 97 |
+
exact ((measurableSet_le measurable_const (measurable_pi_apply i)).inter
|
| 98 |
+
(measurableSet_le (measurable_pi_apply i) measurable_const)).inter
|
| 99 |
+
(MeasurableSet.iInter fun j => MeasurableSet.iInter fun _ =>
|
| 100 |
+
(measurableSet_le ((measurable_pi_apply i).sub measurable_const)
|
| 101 |
+
(measurable_pi_apply j)).inter
|
| 102 |
+
(measurableSet_le (measurable_pi_apply j) (measurable_pi_apply i)))
|
| 103 |
+
|
| 104 |
+
omit [DecidableEq ι] in
|
| 105 |
+
theorem unitCube_volume : volume (unitCube ι) = 1 := by
|
| 106 |
+
simp [unitCube, Real.volume_Icc_pi]
|
| 107 |
+
|
| 108 |
+
theorem extrusionCell_volume (i : ι) : volume (extrusionCell i) = 1 := by
|
| 109 |
+
have hpre : cellMap i ⁻¹' extrusionCell i = unitCube ι :=
|
| 110 |
+
Set.ext (cellMap_mem_iff i)
|
| 111 |
+
rw [← (cellMap_measurePreserving i).measure_preimage
|
| 112 |
+
(extrusionCell_measurable i).nullMeasurableSet, hpre, unitCube_volume]
|
| 113 |
+
|
| 114 |
+
omit [DecidableEq ι] in
|
| 115 |
+
theorem coordinate_eq_null (i : ι) (c : ℝ) :
|
| 116 |
+
volume {x : ι → ℝ | x i = c} = 0 := by
|
| 117 |
+
simpa [volume_pi] using Measure.pi_hyperplane (fun _ : ι => (volume : Measure ℝ)) i c
|
| 118 |
+
|
| 119 |
+
theorem coordinates_eq_null (i j : ι) (hij : i ≠ j) :
|
| 120 |
+
volume {x : ι → ℝ | x i = x j} = 0 := by
|
| 121 |
+
let f : (ι → ℝ) →ₗ[ℝ] ℝ :=
|
| 122 |
+
(LinearMap.proj i : (ι → ℝ) →ₗ[ℝ] ℝ) - LinearMap.proj j
|
| 123 |
+
have hker : LinearMap.ker f ≠ ⊤ := by
|
| 124 |
+
intro h
|
| 125 |
+
have hz : f (Pi.single i 1) = 0 := by
|
| 126 |
+
apply LinearMap.mem_ker.mp
|
| 127 |
+
rw [h]
|
| 128 |
+
exact Submodule.mem_top
|
| 129 |
+
simp [f, Ne.symm hij] at hz
|
| 130 |
+
have hset : {x : ι → ℝ | x i = x j} = (LinearMap.ker f : Set (ι → ℝ)) := by
|
| 131 |
+
ext x
|
| 132 |
+
change x i = x j ↔ x i - x j = 0
|
| 133 |
+
exact sub_eq_zero.symm
|
| 134 |
+
rw [hset]
|
| 135 |
+
exact Measure.addHaar_submodule (volume : Measure (ι → ℝ)) (LinearMap.ker f) hker
|
| 136 |
+
|
| 137 |
+
omit [DecidableEq ι] in
|
| 138 |
+
theorem cube_cell_aedisjoint (i : ι) :
|
| 139 |
+
AEDisjoint volume (unitCube ι) (extrusionCell i) := by
|
| 140 |
+
apply measure_mono_null _ (coordinate_eq_null i 1)
|
| 141 |
+
rintro x ⟨hx, hi⟩
|
| 142 |
+
exact le_antisymm (hx.2 i) hi.1.1
|
| 143 |
+
|
| 144 |
+
theorem cells_aedisjoint : Pairwise (fun i j : ι =>
|
| 145 |
+
AEDisjoint volume (extrusionCell i) (extrusionCell j)) := by
|
| 146 |
+
intro i j hij
|
| 147 |
+
apply measure_mono_null _ (coordinates_eq_null i j hij)
|
| 148 |
+
rintro x ⟨hi, hj⟩
|
| 149 |
+
exact le_antisymm (hj.2 i hij).2 (hi.2 j hij.symm).2
|
| 150 |
+
|
| 151 |
+
theorem cube_add_diagonal_eq_union [Nonempty ι] :
|
| 152 |
+
unitCube ι + segment ℝ (0 : ι → ℝ) 1 =
|
| 153 |
+
unitCube ι ∪ ⋃ i, extrusionCell i := by
|
| 154 |
+
ext x
|
| 155 |
+
constructor
|
| 156 |
+
· rintro ⟨q, hq, z, hz, rfl⟩
|
| 157 |
+
change (∀ i, 0 ≤ q i) ∧ (∀ i, q i ≤ 1) at hq
|
| 158 |
+
rw [segment_eq_image] at hz
|
| 159 |
+
rcases hz with ⟨t, ht, rfl⟩
|
| 160 |
+
simp only [smul_zero, zero_add]
|
| 161 |
+
by_cases hmax : ∀ i, q i + t ≤ 1
|
| 162 |
+
· left
|
| 163 |
+
constructor <;> intro i
|
| 164 |
+
· simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.one_apply, mul_one]
|
| 165 |
+
exact add_nonneg (hq.1 i) ht.1
|
| 166 |
+
· simpa only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.one_apply, mul_one]
|
| 167 |
+
using hmax i
|
| 168 |
+
· right
|
| 169 |
+
obtain ⟨i, _, hi⟩ := Finset.exists_max_image Finset.univ q Finset.univ_nonempty
|
| 170 |
+
refine mem_iUnion.mpr ⟨i, ?_⟩
|
| 171 |
+
push Not at hmax
|
| 172 |
+
obtain ⟨j, hj⟩ := hmax
|
| 173 |
+
have hji := hi j (Finset.mem_univ j)
|
| 174 |
+
constructor
|
| 175 |
+
· constructor
|
| 176 |
+
· simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.one_apply, mul_one]
|
| 177 |
+
linarith
|
| 178 |
+
· simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.one_apply, mul_one]
|
| 179 |
+
linarith [hq.2 i, ht.2]
|
| 180 |
+
· intro k _
|
| 181 |
+
simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, Pi.one_apply, mul_one]
|
| 182 |
+
constructor
|
| 183 |
+
· linarith [hq.2 i, hq.1 k]
|
| 184 |
+
· linarith [hi k (Finset.mem_univ k)]
|
| 185 |
+
· rintro (hx | hx)
|
| 186 |
+
· exact ⟨x, hx, 0, left_mem_segment ℝ _ _, add_zero x⟩
|
| 187 |
+
· obtain ⟨i, hi⟩ := mem_iUnion.mp hx
|
| 188 |
+
refine ⟨fun j => x j - (x i - 1), ?_, (x i - 1) • (1 : ι → ℝ), ?_, ?_⟩
|
| 189 |
+
· constructor <;> intro j
|
| 190 |
+
· change 0 ≤ x j - (x i - 1)
|
| 191 |
+
by_cases hj : j = i
|
| 192 |
+
· subst j; linarith
|
| 193 |
+
· linarith [(hi.2 j hj).1]
|
| 194 |
+
· change x j - (x i - 1) ≤ 1
|
| 195 |
+
by_cases hj : j = i
|
| 196 |
+
· subst j; linarith
|
| 197 |
+
· linarith [(hi.2 j hj).2]
|
| 198 |
+
· rw [segment_eq_image]
|
| 199 |
+
refine ⟨x i - 1, ⟨by linarith [hi.1.1], by linarith [hi.1.2]⟩, ?_⟩
|
| 200 |
+
simp
|
| 201 |
+
· ext j
|
| 202 |
+
simp
|
| 203 |
+
|
| 204 |
+
theorem volume_cube_add_diagonal [Nonempty ι] :
|
| 205 |
+
volume (unitCube ι + segment ℝ (0 : ι → ℝ) 1) = Fintype.card ι + 1 := by
|
| 206 |
+
rw [cube_add_diagonal_eq_union,
|
| 207 |
+
measure_union₀ ((MeasurableSet.iUnion extrusionCell_measurable).nullMeasurableSet)
|
| 208 |
+
(AEDisjoint.iUnion_right_iff.mpr cube_cell_aedisjoint),
|
| 209 |
+
measure_iUnion₀ cells_aedisjoint (fun i => (extrusionCell_measurable i).nullMeasurableSet),
|
| 210 |
+
unitCube_volume]
|
| 211 |
+
simp [extrusionCell_volume, add_comm]
|
| 212 |
+
|
| 213 |
+
theorem volume_Icc_add_segment_one (d : ℕ) (hd : 0 < d) :
|
| 214 |
+
volume (Icc (0 : Fin d → ℝ) 1 + segment ℝ (0 : Fin d → ℝ) 1) = d + 1 := by
|
| 215 |
+
let : Nonempty (Fin d) := ⟨⟨0, hd⟩⟩
|
| 216 |
+
simpa [unitCube] using (volume_cube_add_diagonal (ι := Fin d))
|
| 217 |
+
|
| 218 |
+
end Paper092
|
| 219 |
+
|
| 220 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetAreas.lean
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ProductVolume
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SimplexProjection
|
| 3 |
+
import Mathlib.Analysis.InnerProductSpace.NormDet
|
| 4 |
+
import Mathlib.LinearAlgebra.Matrix.SchurComplement
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
noncomputable section
|
| 9 |
+
|
| 10 |
+
open Set MeasureTheory
|
| 11 |
+
open scoped BigOperators RealInnerProductSpace ENNReal
|
| 12 |
+
|
| 13 |
+
namespace Paper092
|
| 14 |
+
|
| 15 |
+
def facetEmbedding (n : ℕ) (i : Fin (n + 1)) (c : ℝ) :
|
| 16 |
+
Euclidean n →ₗ[ℝ] Euclidean (n + 1) where
|
| 17 |
+
toFun x := WithLp.toLp 2 (i.insertNth (c * ∑ j, x j) x)
|
| 18 |
+
map_add' x y := by
|
| 19 |
+
ext j
|
| 20 |
+
induction j using i.succAboveCases <;>
|
| 21 |
+
simp [PiLp.add_apply, Finset.sum_add_distrib, mul_add]
|
| 22 |
+
map_smul' a x := by
|
| 23 |
+
ext j
|
| 24 |
+
induction j using i.succAboveCases <;>
|
| 25 |
+
simp [PiLp.smul_apply, smul_eq_mul, Finset.mul_sum, mul_left_comm]
|
| 26 |
+
|
| 27 |
+
theorem facetEmbedding_apply_same (n : ℕ) (i : Fin (n + 1)) (c : ℝ) (x : Euclidean n) :
|
| 28 |
+
facetEmbedding n i c x i = c * ∑ j, x j := by
|
| 29 |
+
simp [facetEmbedding]
|
| 30 |
+
|
| 31 |
+
theorem facetEmbedding_apply_succAbove (n : ℕ) (i : Fin (n + 1)) (c : ℝ)
|
| 32 |
+
(x : Euclidean n) (j : Fin n) :
|
| 33 |
+
facetEmbedding n i c x (i.succAbove j) = x j := by
|
| 34 |
+
simp [facetEmbedding]
|
| 35 |
+
|
| 36 |
+
theorem facetEmbedding_inner (n : ℕ) (i : Fin (n + 1)) (c : ℝ) (x y : Euclidean n) :
|
| 37 |
+
⟪facetEmbedding n i c x, facetEmbedding n i c y⟫ =
|
| 38 |
+
⟪x, y⟫ + c ^ 2 * (∑ j, x j) * (∑ j, y j) := by
|
| 39 |
+
rw [PiLp.inner_apply, Fin.sum_univ_succAbove _ i]
|
| 40 |
+
simp only [facetEmbedding_apply_same, facetEmbedding_apply_succAbove, Real.inner_apply,
|
| 41 |
+
PiLp.inner_apply]
|
| 42 |
+
ring
|
| 43 |
+
|
| 44 |
+
theorem facetEmbedding_normDet_sq (n : ℕ) (i : Fin (n + 1)) (c : ℝ) :
|
| 45 |
+
(facetEmbedding n i c).normDet ^ 2 = 1 + (n : ℝ) * c ^ 2 := by
|
| 46 |
+
have hsq := (facetEmbedding n i c).normDet_sq_eq_det_gram (EuclideanSpace.basisFun (Fin n) ℝ)
|
| 47 |
+
simp only [RCLike.ofReal_real_eq_id, id_eq] at hsq
|
| 48 |
+
have hgram : Matrix.gram ℝ
|
| 49 |
+
(fun j => facetEmbedding n i c (EuclideanSpace.basisFun (Fin n) ℝ j)) =
|
| 50 |
+
1 + Matrix.replicateCol (Fin 1) (fun _ : Fin n => c) *
|
| 51 |
+
Matrix.replicateRow (Fin 1) (fun _ : Fin n => c) := by
|
| 52 |
+
ext j k
|
| 53 |
+
simp only [Matrix.gram_apply, facetEmbedding_inner,
|
| 54 |
+
(EuclideanSpace.basisFun (Fin n) ℝ).inner_eq_ite]
|
| 55 |
+
simp [EuclideanSpace.basisFun_apply, PiLp.single_apply, Matrix.one_apply,
|
| 56 |
+
Matrix.mul_apply, pow_two]
|
| 57 |
+
rw [hgram] at hsq
|
| 58 |
+
have hd := Matrix.det_one_add_replicateCol_mul_replicateRow (ι := Fin 1)
|
| 59 |
+
(fun _ : Fin n => c) (fun _ : Fin n => c)
|
| 60 |
+
simpa [dotProduct, pow_two, mul_assoc] using hsq.trans hd
|
| 61 |
+
|
| 62 |
+
theorem facetEmbedding_normDet_zero (n : ℕ) (i : Fin (n + 1)) :
|
| 63 |
+
(facetEmbedding n i 0).normDet = 1 := by
|
| 64 |
+
have h := facetEmbedding_normDet_sq n i 0
|
| 65 |
+
have hp := (facetEmbedding n i 0).normDet_nonneg
|
| 66 |
+
nlinarith
|
| 67 |
+
|
| 68 |
+
theorem facetEmbedding_normDet_neg_one (n : ℕ) (i : Fin (n + 1)) :
|
| 69 |
+
(facetEmbedding n i (-1)).normDet = Real.sqrt (n + 1) := by
|
| 70 |
+
have h := facetEmbedding_normDet_sq n i (-1)
|
| 71 |
+
have hp := (facetEmbedding n i (-1)).normDet_nonneg
|
| 72 |
+
have hs := Real.sq_sqrt (by positivity : (0 : ℝ) ≤ n + 1)
|
| 73 |
+
have hsp := Real.sqrt_nonneg ((n : ℝ) + 1)
|
| 74 |
+
nlinarith
|
| 75 |
+
|
| 76 |
+
theorem facetEmbedding_zero_image (n : ℕ) (i : Fin (n + 1)) :
|
| 77 |
+
facetEmbedding n i 0 '' standardSimplex n = simplexFacet (n + 1) (some i) := by
|
| 78 |
+
ext y
|
| 79 |
+
constructor
|
| 80 |
+
· rintro ⟨x, hx, rfl⟩
|
| 81 |
+
change facetEmbedding n i 0 x ∈ standardSimplex (n + 1) ∧
|
| 82 |
+
facetEmbedding n i 0 x i = 0
|
| 83 |
+
rw [mem_standardSimplex_iff] at hx ⊢
|
| 84 |
+
simp [facetEmbedding, Fin.forall_iff_succAbove i, hx]
|
| 85 |
+
· rintro ⟨hy, hi⟩
|
| 86 |
+
change y i = 0 at hi
|
| 87 |
+
refine ⟨WithLp.toLp 2 (i.removeNth y), ?_, ?_⟩
|
| 88 |
+
· rw [mem_standardSimplex_iff] at hy ⊢
|
| 89 |
+
refine ⟨fun j => hy.1 (i.succAbove j), ?_⟩
|
| 90 |
+
have hsum := Fin.add_sum_removeNth i (fun j => y j)
|
| 91 |
+
simpa [hi, Fin.removeNth] using hsum.trans_le hy.2
|
| 92 |
+
· ext j
|
| 93 |
+
induction j using i.succAboveCases <;> simp [facetEmbedding, hi]
|
| 94 |
+
|
| 95 |
+
theorem simplexFacet_coordinate_area (n : ℕ) (i : Fin (n + 1)) :
|
| 96 |
+
Measure.euclideanHausdorffMeasure n (simplexFacet (n + 1) (some i)) =
|
| 97 |
+
ENNReal.ofReal (1 / (Nat.factorial n : ℝ)) := by
|
| 98 |
+
rw [← facetEmbedding_zero_image n i]
|
| 99 |
+
have h := (facetEmbedding n i 0).euclideanHausdorffMeasure_image_eq_normDet_mul_volume
|
| 100 |
+
(standardSimplex n)
|
| 101 |
+
simpa only [finrank_euclideanSpace_fin, facetEmbedding_normDet_zero, ENNReal.ofReal_one,
|
| 102 |
+
one_mul, standardSimplex_volume] using h
|
| 103 |
+
|
| 104 |
+
def diagonalFacetChart (n : ℕ) (i : Fin (n + 1)) (x : Euclidean n) : Euclidean (n + 1) :=
|
| 105 |
+
WithLp.toLp 2 (i.insertNth (1 - ∑ j, x j) x)
|
| 106 |
+
|
| 107 |
+
theorem diagonalFacetChart_eq (n : ℕ) (i : Fin (n + 1)) (x : Euclidean n) :
|
| 108 |
+
diagonalFacetChart n i x = facetEmbedding n i (-1) x + EuclideanSpace.single i 1 := by
|
| 109 |
+
ext j
|
| 110 |
+
induction j using i.succAboveCases <;>
|
| 111 |
+
simp [diagonalFacetChart, facetEmbedding, sub_eq_add_neg, add_comm]
|
| 112 |
+
|
| 113 |
+
theorem diagonalFacetChart_image (n : ℕ) (i : Fin (n + 1)) :
|
| 114 |
+
diagonalFacetChart n i '' standardSimplex n = simplexFacet (n + 1) none := by
|
| 115 |
+
ext y
|
| 116 |
+
constructor
|
| 117 |
+
· rintro ⟨x, hx, rfl⟩
|
| 118 |
+
rw [mem_standardSimplex_iff] at hx
|
| 119 |
+
change diagonalFacetChart n i x ∈ standardSimplex (n + 1) ∧
|
| 120 |
+
1 - ∑ j, diagonalFacetChart n i x j = 0
|
| 121 |
+
rw [mem_standardSimplex_iff]
|
| 122 |
+
simp [diagonalFacetChart, Fin.forall_iff_succAbove i]
|
| 123 |
+
exact ⟨hx.2, hx.1⟩
|
| 124 |
+
· rintro ⟨hy, hi⟩
|
| 125 |
+
change 1 - ∑ j, y j = 0 at hi
|
| 126 |
+
have htotal : ∑ j, y j = 1 := by linarith
|
| 127 |
+
rw [mem_standardSimplex_iff] at hy
|
| 128 |
+
have hsum := Fin.add_sum_removeNth i (fun j => y j)
|
| 129 |
+
refine ⟨WithLp.toLp 2 (i.removeNth y), ?_, ?_⟩
|
| 130 |
+
· rw [mem_standardSimplex_iff]
|
| 131 |
+
refine ⟨fun j => hy.1 (i.succAbove j), ?_⟩
|
| 132 |
+
change ∑ j, i.removeNth (fun k => y k) j ≤ 1
|
| 133 |
+
linarith [hy.1 i]
|
| 134 |
+
· ext j
|
| 135 |
+
induction j using i.succAboveCases
|
| 136 |
+
· simp only [diagonalFacetChart, PiLp.toLp_apply, Fin.insertNth_apply_same]
|
| 137 |
+
change 1 - ∑ j, i.removeNth (fun k => y k) j = y i
|
| 138 |
+
linarith
|
| 139 |
+
· simp [diagonalFacetChart]
|
| 140 |
+
|
| 141 |
+
theorem simplexFacet_diagonal_area (n : ℕ) :
|
| 142 |
+
Measure.euclideanHausdorffMeasure n (simplexFacet (n + 1) none) =
|
| 143 |
+
ENNReal.ofReal (Real.sqrt (n + 1) / (Nat.factorial n : ℝ)) := by
|
| 144 |
+
let i : Fin (n + 1) := Fin.last n
|
| 145 |
+
rw [← diagonalFacetChart_image n i]
|
| 146 |
+
have hset : diagonalFacetChart n i '' standardSimplex n =
|
| 147 |
+
(IsometryEquiv.vaddConst (EuclideanSpace.single i (1 : ℝ))) ''
|
| 148 |
+
(facetEmbedding n i (-1) '' standardSimplex n) := by
|
| 149 |
+
rw [image_image]
|
| 150 |
+
congr 1
|
| 151 |
+
funext x
|
| 152 |
+
exact diagonalFacetChart_eq n i x
|
| 153 |
+
rw [hset, (IsometryEquiv.vaddConst (EuclideanSpace.single i (1 : ℝ))).isometry.euclideanHausdorffMeasure_image]
|
| 154 |
+
have h := (facetEmbedding n i (-1)).euclideanHausdorffMeasure_image_eq_normDet_mul_volume
|
| 155 |
+
(standardSimplex n)
|
| 156 |
+
simp only [finrank_euclideanSpace_fin, facetEmbedding_normDet_neg_one,
|
| 157 |
+
standardSimplex_volume] at h
|
| 158 |
+
rw [h, ← ENNReal.ofReal_mul (Real.sqrt_nonneg _)]
|
| 159 |
+
congr 1
|
| 160 |
+
ring
|
| 161 |
+
|
| 162 |
+
end Paper092
|
| 163 |
+
|
| 164 |
+
end
|
| 165 |
+
|
| 166 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetBijection.lean
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FacetExhaustiveness
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.FacetUniqueness
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.ProductFacetFamilies
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Set
|
| 11 |
+
open scoped RealInnerProductSpace
|
| 12 |
+
|
| 13 |
+
namespace Paper092.HPolytope
|
| 14 |
+
|
| 15 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 16 |
+
|
| 17 |
+
theorem face_eq_exposedFace (i : ι) (hne : (P.face i).Nonempty) :
|
| 18 |
+
P.face i = exposedFace P.body (P.normal i) := by
|
| 19 |
+
ext x
|
| 20 |
+
constructor
|
| 21 |
+
· rintro ⟨hx, hxi⟩
|
| 22 |
+
refine ⟨hx, ?_⟩
|
| 23 |
+
intro y hy
|
| 24 |
+
change ⟪P.normal i, y⟫ ≤ ⟪P.normal i, x⟫
|
| 25 |
+
rw [hxi]
|
| 26 |
+
exact hy i
|
| 27 |
+
· intro hx
|
| 28 |
+
obtain ⟨y, hy⟩ := hne
|
| 29 |
+
refine ⟨hx.1, le_antisymm (hx.1 i) ?_⟩
|
| 30 |
+
have h := hx.2 y hy.1
|
| 31 |
+
change ⟪P.normal i, y⟫ ≤ ⟪P.normal i, x⟫ at h
|
| 32 |
+
rwa [hy.2] at h
|
| 33 |
+
|
| 34 |
+
theorem face_isExposed (i : ι) : IsExposed ℝ P.body (P.face i) := by
|
| 35 |
+
intro hne
|
| 36 |
+
refine ⟨innerSL ℝ (P.normal i), ?_⟩
|
| 37 |
+
exact P.face_eq_exposedFace i hne
|
| 38 |
+
|
| 39 |
+
theorem exposed_facet_eq_unique_face (hd : 0 < d) (F : Set (Euclidean d))
|
| 40 |
+
(hF : IsExposed ℝ P.body F) (hne : F.Nonempty)
|
| 41 |
+
(hdim : Module.finrank ℝ (vectorSpan ℝ F) = d - 1) :
|
| 42 |
+
∃! i, F = P.face i := by
|
| 43 |
+
obtain ⟨u, rfl⟩ := eq_exposedFace_of_isExposed hF hne
|
| 44 |
+
have hu : u ≠ 0 := by
|
| 45 |
+
intro hzero
|
| 46 |
+
rw [hzero, exposedFace_zero,
|
| 47 |
+
vectorSpan_finrank_of_interior_nonempty P.body P.body_interior_nonempty] at hdim
|
| 48 |
+
omega
|
| 49 |
+
obtain ⟨i, hi⟩ := P.exposedFace_eq_face hu hdim
|
| 50 |
+
refine ⟨i, hi, ?_⟩
|
| 51 |
+
intro j hj
|
| 52 |
+
apply P.face_index_unique_of_finrank j i
|
| 53 |
+
· rwa [← hj]
|
| 54 |
+
· rwa [← hj]
|
| 55 |
+
· exact hj.symm.trans hi
|
| 56 |
+
|
| 57 |
+
theorem finite_exposed_facets (hd : 0 < d) :
|
| 58 |
+
{F : Set (Euclidean d) | IsExposed ℝ P.body F ∧ F.Nonempty ∧
|
| 59 |
+
Module.finrank ℝ (vectorSpan ℝ F) = d - 1}.Finite := by
|
| 60 |
+
apply (Set.finite_range P.face).subset
|
| 61 |
+
rintro F ⟨hF, hne, hdim⟩
|
| 62 |
+
obtain ⟨i, hi, _⟩ := P.exposed_facet_eq_unique_face hd F hF hne hdim
|
| 63 |
+
exact ⟨i, hi.symm⟩
|
| 64 |
+
|
| 65 |
+
end Paper092.HPolytope
|
| 66 |
+
|
| 67 |
+
end
|
| 68 |
+
|
| 69 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetDimension.lean
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FacetUniqueness
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.ProjectionNullity
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
universe uι
|
| 7 |
+
|
| 8 |
+
open Set MeasureTheory
|
| 9 |
+
open scoped RealInnerProductSpace Classical Pointwise
|
| 10 |
+
|
| 11 |
+
noncomputable section
|
| 12 |
+
|
| 13 |
+
namespace Paper092.HPolytope
|
| 14 |
+
|
| 15 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 16 |
+
|
| 17 |
+
theorem face_finrank_le (i : ι) :
|
| 18 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) ≤ d - 1 := by
|
| 19 |
+
have hn : P.normal i ≠ 0 := by
|
| 20 |
+
intro h
|
| 21 |
+
have := P.normal_unit i
|
| 22 |
+
simp only [h, norm_zero] at this
|
| 23 |
+
norm_num at this
|
| 24 |
+
have h := Submodule.finrank_mono (P.face_vectorSpan_le_normalHyperplane i)
|
| 25 |
+
rwa [normalHyperplane_finrank (P.normal i) hn] at h
|
| 26 |
+
|
| 27 |
+
theorem face_surface_zero_of_finrank_lt (i : ι)
|
| 28 |
+
(h : Module.finrank ℝ (vectorSpan ℝ (P.face i)) < d - 1) :
|
| 29 |
+
μHE[d - 1] (P.face i) = 0 := by
|
| 30 |
+
have hn : P.normal i ≠ 0 := by
|
| 31 |
+
intro h
|
| 32 |
+
have := P.normal_unit i
|
| 33 |
+
simp only [h, norm_zero] at this
|
| 34 |
+
norm_num at this
|
| 35 |
+
have hz := projectionVolume_eq_zero_of_finrank_lt (P.face i) hn h
|
| 36 |
+
rw [projectionVolume_of_subset_affine_hyperplane (P.normal i) (P.normal i)
|
| 37 |
+
(P.normal_unit i) (P.normal_unit i) (P.offset i) (P.face i) (fun _ hx => hx.2)] at hz
|
| 38 |
+
simpa only [real_inner_self_eq_norm_sq, P.normal_unit, one_pow, abs_one,
|
| 39 |
+
ENNReal.ofReal_one, one_mul] using hz
|
| 40 |
+
|
| 41 |
+
theorem faceArea_zero_of_not_facet (i : ι)
|
| 42 |
+
(h : ¬ ((P.face i).Nonempty ∧
|
| 43 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1)) : P.faceArea i = 0 := by
|
| 44 |
+
by_cases hne : (P.face i).Nonempty
|
| 45 |
+
· have hdim : Module.finrank ℝ (vectorSpan ℝ (P.face i)) ≠ d - 1 :=
|
| 46 |
+
fun heq => h ⟨hne, heq⟩
|
| 47 |
+
rw [faceArea, P.face_surface_zero_of_finrank_lt i (lt_of_le_of_ne (P.face_finrank_le i) hdim),
|
| 48 |
+
ENNReal.toReal_zero]
|
| 49 |
+
· have he : P.face i = ∅ := by
|
| 50 |
+
ext x
|
| 51 |
+
constructor
|
| 52 |
+
· intro hx
|
| 53 |
+
exact (hne ⟨x, hx⟩).elim
|
| 54 |
+
· intro hx
|
| 55 |
+
exact hx.elim
|
| 56 |
+
simp only [faceArea, he, measure_empty, ENNReal.toReal_zero]
|
| 57 |
+
|
| 58 |
+
theorem brightness_eq_facet_sum (u : Euclidean d) :
|
| 59 |
+
brightness P.body u = (1 / 2 : ℝ) *
|
| 60 |
+
∑ i ∈ Finset.univ.filter (fun i => (P.face i).Nonempty ∧
|
| 61 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1),
|
| 62 |
+
P.faceArea i * |⟪P.normal i, u⟫| := by
|
| 63 |
+
have hsum : (∑ i, P.faceArea i * |⟪u, P.normal i⟫|) =
|
| 64 |
+
∑ i ∈ Finset.univ.filter (fun i => (P.face i).Nonempty ∧
|
| 65 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1),
|
| 66 |
+
P.faceArea i * |⟪u, P.normal i⟫| := by
|
| 67 |
+
symm
|
| 68 |
+
apply Finset.sum_subset (Finset.filter_subset _ _)
|
| 69 |
+
intro i hi hni
|
| 70 |
+
have hn : ¬ ((P.face i).Nonempty ∧
|
| 71 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1) :=
|
| 72 |
+
fun hf => hni (Finset.mem_filter.mpr ⟨hi, hf⟩)
|
| 73 |
+
rw [P.faceArea_zero_of_not_facet i hn, zero_mul]
|
| 74 |
+
rw [P.brightness_eq_sum, hsum]
|
| 75 |
+
simp_rw [real_inner_comm u]
|
| 76 |
+
ring
|
| 77 |
+
|
| 78 |
+
theorem projectionBody_eq_facet_sum :
|
| 79 |
+
projectionBody P.body =
|
| 80 |
+
∑ i ∈ Finset.univ.filter (fun i => (P.face i).Nonempty ∧
|
| 81 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1),
|
| 82 |
+
segment ℝ (-(P.faceArea i / 2) • P.normal i) ((P.faceArea i / 2) • P.normal i) := by
|
| 83 |
+
rw [P.projectionBody_eq_facetZonotope]
|
| 84 |
+
unfold facetZonotope
|
| 85 |
+
symm
|
| 86 |
+
apply Finset.sum_subset (Finset.filter_subset _ _)
|
| 87 |
+
intro i hi hni
|
| 88 |
+
have hn : ¬ ((P.face i).Nonempty ∧
|
| 89 |
+
Module.finrank ℝ (vectorSpan ℝ (P.face i)) = d - 1) :=
|
| 90 |
+
fun hf => hni (Finset.mem_filter.mpr ⟨hi, hf⟩)
|
| 91 |
+
simp only [P.faceArea_zero_of_not_facet i hn, zero_div, neg_zero, zero_smul,
|
| 92 |
+
segment_same, Set.singleton_zero]
|
| 93 |
+
|
| 94 |
+
end Paper092.HPolytope
|
| 95 |
+
|
| 96 |
+
end
|
| 97 |
+
|
| 98 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetExhaustiveness.lean
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFront
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.ExposedBounds
|
| 3 |
+
import Mathlib.Analysis.Convex.Intrinsic
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
|
| 11 |
+
open Set MeasureTheory
|
| 12 |
+
open scoped RealInnerProductSpace Pointwise
|
| 13 |
+
|
| 14 |
+
namespace Paper092
|
| 15 |
+
|
| 16 |
+
theorem inner_eq_of_mem_intrinsicInterior {d : ℕ} {S : Set (Euclidean d)}
|
| 17 |
+
{x : Euclidean d} (hx : x ∈ intrinsicInterior ℝ S) (v : Euclidean d)
|
| 18 |
+
(hmax : ∀ z ∈ S, ⟪v, z⟫ ≤ ⟪v, x⟫) :
|
| 19 |
+
∀ z ∈ S, ⟪v, z⟫ = ⟪v, x⟫ := by
|
| 20 |
+
obtain ⟨xQ, hxQ, rfl⟩ := mem_intrinsicInterior.mp hx
|
| 21 |
+
obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hxQ)
|
| 22 |
+
intro z hz
|
| 23 |
+
by_cases hzx : z = xQ.val
|
| 24 |
+
· simp only [hzx]
|
| 25 |
+
let t : ℝ := ε / (2 * ‖xQ.val - z‖)
|
| 26 |
+
have hnorm : 0 < ‖xQ.val - z‖ := norm_pos_iff.mpr (sub_ne_zero.mpr (Ne.symm hzx))
|
| 27 |
+
have ht : 0 < t := div_pos hε (mul_pos (by norm_num) hnorm)
|
| 28 |
+
let y : affineSpan ℝ S := ⟨xQ.val + t • (xQ.val - z), by
|
| 29 |
+
simpa only [vsub_eq_sub, vadd_eq_add, add_comm] using
|
| 30 |
+
(affineSpan ℝ S).smul_vsub_vadd_mem t xQ.property
|
| 31 |
+
(subset_affineSpan ℝ S hz) xQ.property⟩
|
| 32 |
+
have hyball : y ∈ Metric.ball xQ ε := by
|
| 33 |
+
change dist (xQ.val + t • (xQ.val - z)) xQ.val < ε
|
| 34 |
+
rw [dist_eq_norm, add_sub_cancel_left, norm_smul, Real.norm_eq_abs, abs_of_pos ht]
|
| 35 |
+
have heq : t * ‖xQ.val - z‖ = ε / 2 := by
|
| 36 |
+
dsimp [t]
|
| 37 |
+
field_simp
|
| 38 |
+
rw [heq]
|
| 39 |
+
linarith
|
| 40 |
+
have hy : y.val ∈ S := hball hyball
|
| 41 |
+
have hle := hmax y.val hy
|
| 42 |
+
change ⟪v, xQ.val + t • (xQ.val - z)⟫ ≤ ⟪v, xQ.val⟫ at hle
|
| 43 |
+
rw [inner_add_right, real_inner_smul_right, inner_sub_right] at hle
|
| 44 |
+
exact le_antisymm (hmax z hz) (by nlinarith)
|
| 45 |
+
|
| 46 |
+
namespace HPolytope
|
| 47 |
+
|
| 48 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 49 |
+
|
| 50 |
+
theorem exists_active_of_mem_exposedFace {u x : Euclidean d} (hu : u ≠ 0)
|
| 51 |
+
(hx : x ∈ exposedFace P.body u) : ∃ i, x ∈ P.face i := by
|
| 52 |
+
obtain ⟨t, ht, hxt, i, _, hi⟩ := P.exists_front_point x u hu hx.1
|
| 53 |
+
have hmax := hx.2 (x + t • u) hxt
|
| 54 |
+
change ⟪u, x + t • u⟫ ≤ ⟪u, x⟫ at hmax
|
| 55 |
+
rw [inner_add_right, real_inner_smul_right] at hmax
|
| 56 |
+
have hpos := real_inner_self_pos.mpr hu
|
| 57 |
+
have ht0 : t = 0 := by nlinarith
|
| 58 |
+
refine ⟨i, hx.1, ?_⟩
|
| 59 |
+
change P.offset i - ⟪P.normal i, x + t • u⟫ = 0 at hi
|
| 60 |
+
simp only [ht0, zero_smul, add_zero] at hi
|
| 61 |
+
exact (sub_eq_zero.mp hi).symm
|
| 62 |
+
|
| 63 |
+
theorem exposedFace_eq_face {u : Euclidean d} (hu : u ≠ 0)
|
| 64 |
+
(hdim : Module.finrank ℝ (vectorSpan ℝ (exposedFace P.body u)) = d - 1) :
|
| 65 |
+
∃ i, exposedFace P.body u = P.face i := by
|
| 66 |
+
have hconv : Convex ℝ (exposedFace P.body u) :=
|
| 67 |
+
(show IsExposed ℝ P.body (exposedFace P.body u) from
|
| 68 |
+
ContinuousLinearMap.toExposed.isExposed).convex P.body_convex
|
| 69 |
+
have hne := exposedFace_nonempty P.body P.compact P.body_nonempty u
|
| 70 |
+
obtain ⟨x, hx⟩ := (intrinsicInterior_nonempty hconv).mpr hne
|
| 71 |
+
have hxF : x ∈ exposedFace P.body u := intrinsicInterior_subset hx
|
| 72 |
+
obtain ⟨i, hxi⟩ := P.exists_active_of_mem_exposedFace hu hxF
|
| 73 |
+
have hinner : ∀ z ∈ exposedFace P.body u, ⟪P.normal i, z⟫ = P.offset i := by
|
| 74 |
+
intro z hz
|
| 75 |
+
apply Eq.trans (inner_eq_of_mem_intrinsicInterior hx (P.normal i) ?_ z hz) hxi.2
|
| 76 |
+
intro y hy
|
| 77 |
+
rw [hxi.2]
|
| 78 |
+
exact hy.1 i
|
| 79 |
+
have hle : vectorSpan ℝ (exposedFace P.body u) ≤ normalHyperplane (P.normal i) := by
|
| 80 |
+
rw [vectorSpan_def]
|
| 81 |
+
apply Submodule.span_le.mpr
|
| 82 |
+
rintro _ ⟨a, ha, b, hb, rfl⟩
|
| 83 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 84 |
+
change ⟪P.normal i, a - b⟫ = 0
|
| 85 |
+
rw [inner_sub_right, hinner a ha, hinner b hb, sub_self]
|
| 86 |
+
have hn : P.normal i ≠ 0 := by
|
| 87 |
+
intro h
|
| 88 |
+
have hnorm := P.normal_unit i
|
| 89 |
+
rw [h, norm_zero] at hnorm
|
| 90 |
+
norm_num at hnorm
|
| 91 |
+
have hspan_i : vectorSpan ℝ (exposedFace P.body u) = normalHyperplane (P.normal i) :=
|
| 92 |
+
Submodule.eq_of_le_of_finrank_eq hle (hdim.trans (normalHyperplane_finrank _ hn).symm)
|
| 93 |
+
have hspan_u : vectorSpan ℝ (exposedFace P.body u) = normalHyperplane u :=
|
| 94 |
+
Submodule.eq_of_le_of_finrank_eq (exposedFace_vectorSpan_le_normalHyperplane P.body u)
|
| 95 |
+
(hdim.trans (normalHyperplane_finrank u hu).symm)
|
| 96 |
+
refine ⟨i, Subset.antisymm (fun z hz => ⟨hz.1, hinner z hz⟩) ?_⟩
|
| 97 |
+
intro y hy
|
| 98 |
+
have hyi : y - x ∈ normalHyperplane (P.normal i) := by
|
| 99 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 100 |
+
rw [inner_sub_right, hy.2, hxi.2, sub_self]
|
| 101 |
+
have hyu : y - x ∈ normalHyperplane u := by
|
| 102 |
+
rwa [← hspan_u, hspan_i]
|
| 103 |
+
have heq : ⟪u, y⟫ = ⟪u, x⟫ := by
|
| 104 |
+
have h := Submodule.mem_orthogonal_singleton_iff_inner_right.mp hyu
|
| 105 |
+
simpa only [inner_sub_right, sub_eq_zero] using h
|
| 106 |
+
refine ⟨hy.1, ?_⟩
|
| 107 |
+
intro z hz
|
| 108 |
+
change ⟪u, z⟫ ≤ ⟪u, y⟫
|
| 109 |
+
rw [heq]
|
| 110 |
+
exact hxF.2 z hz
|
| 111 |
+
|
| 112 |
+
end HPolytope
|
| 113 |
+
end Paper092
|
| 114 |
+
|
| 115 |
+
end
|
| 116 |
+
|
| 117 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetLinearImage.lean
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.AffineBrightness
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.ProjectionJacobian
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
def linearImageNormal {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 13 |
+
(v : Euclidean n) : Euclidean n :=
|
| 14 |
+
‖L.symm.toLinearMap.adjoint v‖⁻¹ • L.symm.toLinearMap.adjoint v
|
| 15 |
+
|
| 16 |
+
theorem inverseAdjoint_ne_zero {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 17 |
+
(v : Euclidean n) (hv : ‖v‖ = 1) : L.symm.toLinearMap.adjoint v ≠ 0 := by
|
| 18 |
+
intro h
|
| 19 |
+
have hh := L.symm.toLinearMap.adjoint_inner_left (L v) v
|
| 20 |
+
rw [h, inner_zero_left] at hh
|
| 21 |
+
change 0 = ⟪v, L.symm (L v)⟫ at hh
|
| 22 |
+
rw [L.symm_apply_apply, real_inner_self_eq_norm_sq, hv, one_pow] at hh
|
| 23 |
+
norm_num at hh
|
| 24 |
+
|
| 25 |
+
theorem linearImageNormal_norm {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 26 |
+
(v : Euclidean n) (hv : ‖v‖ = 1) : ‖linearImageNormal L v‖ = 1 := by
|
| 27 |
+
simp [linearImageNormal, norm_smul, inverseAdjoint_ne_zero L v hv]
|
| 28 |
+
|
| 29 |
+
theorem linearImageNormal_inner {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 30 |
+
(v x : Euclidean n) :
|
| 31 |
+
⟪linearImageNormal L v, L x⟫ = ⟪v, x⟫ / ‖L.symm.toLinearMap.adjoint v‖ := by
|
| 32 |
+
rw [linearImageNormal, real_inner_smul_left, LinearMap.adjoint_inner_left]
|
| 33 |
+
change ‖L.symm.toLinearMap.adjoint v‖⁻¹ * ⟪v, L.symm (L x)⟫ = _
|
| 34 |
+
rw [L.symm_apply_apply]
|
| 35 |
+
ring
|
| 36 |
+
|
| 37 |
+
theorem linearImageNormal_support_iff {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 38 |
+
(v x : Euclidean n) (hv : ‖v‖ = 1) (c : ℝ) :
|
| 39 |
+
⟪linearImageNormal L v, L x⟫ ≤ c / ‖L.symm.toLinearMap.adjoint v‖ ↔ ⟪v, x⟫ ≤ c := by
|
| 40 |
+
rw [linearImageNormal_inner, div_le_div_iff_of_pos_right
|
| 41 |
+
(norm_pos_iff.mpr (inverseAdjoint_ne_zero L v hv))]
|
| 42 |
+
|
| 43 |
+
theorem linearImageNormal_plane {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 44 |
+
(v : Euclidean n) (c : ℝ) (F : Set (Euclidean n))
|
| 45 |
+
(hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 46 |
+
∀ y ∈ L '' F, ⟪linearImageNormal L v, y⟫ = c / ‖L.symm.toLinearMap.adjoint v‖ := by
|
| 47 |
+
rintro y ⟨x, hx, rfl⟩
|
| 48 |
+
rw [linearImageNormal_inner, hplane x hx]
|
| 49 |
+
|
| 50 |
+
theorem affineHyperplane_area_lt_top {n : ℕ} (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 51 |
+
(c : ℝ) (F : Set (Euclidean n)) (hF : IsCompact F)
|
| 52 |
+
(hplane : ∀ x ∈ F, ⟪v, x⟫ = c) : μHE[n - 1] F < ⊤ := by
|
| 53 |
+
have h := projectionVolume_of_subset_affine_hyperplane v v hv hv c F hplane
|
| 54 |
+
simp only [real_inner_self_eq_norm_sq, hv, one_pow, abs_one, ENNReal.ofReal_one,
|
| 55 |
+
one_mul] at h
|
| 56 |
+
rw [← h]
|
| 57 |
+
exact (hF.image (normalHyperplane v).orthogonalProjectionOnto.continuous).measure_lt_top
|
| 58 |
+
|
| 59 |
+
theorem affineHyperplane_linearImage_area_real {n : ℕ}
|
| 60 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 61 |
+
(c : ℝ) (F : Set (Euclidean n)) (hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 62 |
+
(μHE[n - 1] (L '' F)).toReal =
|
| 63 |
+
|L.toLinearMap.det| * ‖L.symm.toLinearMap.adjoint v‖ * (μHE[n - 1] F).toReal := by
|
| 64 |
+
let w := linearImageNormal L v
|
| 65 |
+
have hw : ‖w‖ = 1 := linearImageNormal_norm L v hv
|
| 66 |
+
have hi := brightness_of_subset_affine_hyperplane w w hw
|
| 67 |
+
(c / ‖L.symm.toLinearMap.adjoint v‖) (L '' F) (linearImageNormal_plane L v c F hplane)
|
| 68 |
+
simp only [real_inner_self_eq_norm_sq, hw, one_pow, abs_one, one_mul] at hi
|
| 69 |
+
rw [← hi, brightness_linearEquiv_image,
|
| 70 |
+
brightness_of_subset_affine_hyperplane (L.symm w) v hv c F hplane]
|
| 71 |
+
have hin : ⟪L.symm w, v⟫ = ‖L.symm.toLinearMap.adjoint v‖ := by
|
| 72 |
+
change ⟪L.symm.toLinearMap w, v⟫ = _
|
| 73 |
+
rw [← LinearMap.adjoint_inner_right]
|
| 74 |
+
change ⟪linearImageNormal L v, L.symm.toLinearMap.adjoint v⟫ = _
|
| 75 |
+
rw [linearImageNormal, real_inner_smul_left, real_inner_self_eq_norm_sq]
|
| 76 |
+
field_simp [norm_ne_zero_iff.mpr (inverseAdjoint_ne_zero L v hv)]
|
| 77 |
+
rw [hin, abs_of_nonneg (norm_nonneg _)]
|
| 78 |
+
ring
|
| 79 |
+
|
| 80 |
+
theorem affineHyperplane_linearImage_area {n : ℕ}
|
| 81 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 82 |
+
(c : ℝ) (F : Set (Euclidean n)) (hF : IsCompact F)
|
| 83 |
+
(hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 84 |
+
μHE[n - 1] (L '' F) = ENNReal.ofReal
|
| 85 |
+
(|L.toLinearMap.det| * ‖L.symm.toLinearMap.adjoint v‖) * μHE[n - 1] F := by
|
| 86 |
+
have hfinite := affineHyperplane_area_lt_top v hv c F hF hplane
|
| 87 |
+
have hfinite' := affineHyperplane_area_lt_top (linearImageNormal L v)
|
| 88 |
+
(linearImageNormal_norm L v hv) (c / ‖L.symm.toLinearMap.adjoint v‖)
|
| 89 |
+
(L '' F) (hF.image L.toContinuousLinearEquiv.continuous)
|
| 90 |
+
(linearImageNormal_plane L v c F hplane)
|
| 91 |
+
apply (ENNReal.toReal_eq_toReal_iff' hfinite'.ne (ENNReal.mul_ne_top ENNReal.ofReal_ne_top hfinite.ne)).mp
|
| 92 |
+
rw [ENNReal.toReal_mul, ENNReal.toReal_ofReal (mul_nonneg (abs_nonneg _) (norm_nonneg _))]
|
| 93 |
+
exact affineHyperplane_linearImage_area_real L v hv c F hplane
|
| 94 |
+
|
| 95 |
+
end Paper092
|
| 96 |
+
|
| 97 |
+
end
|
| 98 |
+
|
| 99 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetPrism.lean
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PrismVolume
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
open Set MeasureTheory
|
| 7 |
+
open scoped RealInnerProductSpace Pointwise
|
| 8 |
+
|
| 9 |
+
namespace Paper092
|
| 10 |
+
|
| 11 |
+
theorem vadd_add_set {n : ℕ} (a : Euclidean n) (A B : Set (Euclidean n)) :
|
| 12 |
+
(a +ᵥ A) + B = a +ᵥ (A + B) := by
|
| 13 |
+
ext z
|
| 14 |
+
constructor
|
| 15 |
+
· rintro ⟨x, ⟨x₀, hx, rfl⟩, y, hy, rfl⟩
|
| 16 |
+
exact ⟨x₀ + y, ⟨x₀, hx, y, hy, rfl⟩, (add_assoc a x₀ y).symm⟩
|
| 17 |
+
· rintro ⟨z, ⟨x, hx, y, hy, rfl⟩, rfl⟩
|
| 18 |
+
exact ⟨a + x, ⟨x, hx, rfl⟩, y, hy, add_assoc a x y⟩
|
| 19 |
+
|
| 20 |
+
theorem affineHyperplane_unitPrism_volume {n : ℕ} (hn : 0 < n)
|
| 21 |
+
(v : Euclidean n) (hv : ‖v‖ = 1) (c : ℝ) (F : Set (Euclidean n))
|
| 22 |
+
(hF : IsCompact F) (hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 23 |
+
volume (F + segment ℝ 0 v) = μHE[n - 1] F := by
|
| 24 |
+
have hv0 : v ≠ 0 := by intro h; simp [h] at hv
|
| 25 |
+
let H := normalHyperplane v
|
| 26 |
+
let T : Set (Euclidean n) := (-c) • v +ᵥ F
|
| 27 |
+
have hT : T ⊆ (H : Set (Euclidean n)) := by
|
| 28 |
+
rintro x ⟨y, hy, rfl⟩
|
| 29 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 30 |
+
change ⟪v, (-c) • v + y⟫ = 0
|
| 31 |
+
simp [inner_add_right, inner_smul_right, hv, hplane y hy]
|
| 32 |
+
let b := stdOrthonormalBasis ℝ H
|
| 33 |
+
let f : Euclidean (Module.finrank ℝ H) →ₗᵢ[ℝ] Euclidean n :=
|
| 34 |
+
H.subtypeₗᵢ.comp b.repr.symm.toLinearIsometry
|
| 35 |
+
let A : Set (Euclidean (Module.finrank ℝ H)) := f ⁻¹' T
|
| 36 |
+
have hTcompact : IsCompact T := hF.image (continuous_const.add continuous_id)
|
| 37 |
+
have hA : MeasurableSet A := hTcompact.measurableSet.preimage f.continuous.measurable
|
| 38 |
+
have hfimage : f '' A = T := by
|
| 39 |
+
apply image_preimage_eq_of_subset
|
| 40 |
+
intro y hy
|
| 41 |
+
refine ⟨b.repr ⟨y, hT hy⟩, ?_⟩
|
| 42 |
+
change ((b.repr.symm (b.repr ⟨y, hT hy⟩) : H) : Euclidean n) = y
|
| 43 |
+
rw [LinearIsometryEquiv.symm_apply_apply]
|
| 44 |
+
have hrank : Module.finrank ℝ H = n - 1 := normalHyperplane_finrank v hv0
|
| 45 |
+
have hvolA : volume A = μHE[n - 1] F := by
|
| 46 |
+
have h := f.toLinearMap.euclideanHausdorffMeasure_image_eq_normDet_mul_volume A
|
| 47 |
+
simp only [finrank_euclideanSpace_fin, LinearIsometry.normDet_eq_one,
|
| 48 |
+
ENNReal.ofReal_one, one_mul] at h
|
| 49 |
+
change μHE[Module.finrank ℝ H] (f '' A) = volume A at h
|
| 50 |
+
rw [hfimage] at h
|
| 51 |
+
conv_lhs at h => rw [hrank]
|
| 52 |
+
change μHE[n - 1] ((-c) • v +ᵥ F) = volume A at h
|
| 53 |
+
rw [measure_vadd] at h
|
| 54 |
+
exact h.symm
|
| 55 |
+
have hfperp (x : Euclidean (Module.finrank ℝ H)) : ⟪v, f x⟫ = 0 :=
|
| 56 |
+
Submodule.mem_orthogonal_singleton_iff_inner_right.mp (b.repr.symm x).property
|
| 57 |
+
have h := orthogonalPrism_volume f v hv hfperp (by omega) A hA
|
| 58 |
+
rw [hfimage, hvolA] at h
|
| 59 |
+
change volume (((-c) • v +ᵥ F) + segment ℝ 0 v) = _ at h
|
| 60 |
+
rw [vadd_add_set, measure_vadd] at h
|
| 61 |
+
exact h
|
| 62 |
+
|
| 63 |
+
theorem linearImage_unitPrism {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 64 |
+
(v : Euclidean n) (F : Set (Euclidean n)) :
|
| 65 |
+
L '' (F + segment ℝ 0 v) = L '' F + segment ℝ 0 (L v) := by
|
| 66 |
+
rw [Set.image_add]
|
| 67 |
+
congr 1
|
| 68 |
+
simpa using (image_segment ℝ (L.toLinearMap.toAffineMap) (0 : Euclidean n) v)
|
| 69 |
+
|
| 70 |
+
theorem linearImage_unitPrism_volume {n : ℕ} (hn : 0 < n)
|
| 71 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 72 |
+
(c : ℝ) (F : Set (Euclidean n)) (hF : IsCompact F)
|
| 73 |
+
(hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 74 |
+
volume (L '' F + segment ℝ 0 (L v)) = ENNReal.ofReal |L.toLinearMap.det| * μHE[n - 1] F := by
|
| 75 |
+
rw [← linearImage_unitPrism]
|
| 76 |
+
change volume (L.toLinearMap '' (F + segment ℝ 0 v)) = _
|
| 77 |
+
rw [volume.addHaar_image_linearMap, affineHyperplane_unitPrism_volume hn v hv c F hF hplane]
|
| 78 |
+
|
| 79 |
+
theorem linearImage_unitPrism_height {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 80 |
+
(v : Euclidean n) (hv : ‖v‖ = 1) :
|
| 81 |
+
⟪linearImageNormal L v, L v⟫ = 1 / ‖L.symm.toLinearMap.adjoint v‖ := by
|
| 82 |
+
rw [linearImageNormal_inner, real_inner_self_eq_norm_sq, hv, one_pow]
|
| 83 |
+
|
| 84 |
+
theorem linearImage_unitPrism_offset {n : ℕ} (L : Euclidean n ≃ₗ[ℝ] Euclidean n)
|
| 85 |
+
(v : Euclidean n) (hv : ‖v‖ = 1) (c : ℝ) (x : Euclidean n)
|
| 86 |
+
(hx : ⟪v, x⟫ = c) (t : ℝ) :
|
| 87 |
+
⟪linearImageNormal L v, L (x + t • v)⟫ =
|
| 88 |
+
c / ‖L.symm.toLinearMap.adjoint v‖ + t / ‖L.symm.toLinearMap.adjoint v‖ := by
|
| 89 |
+
rw [linearImageNormal_inner, inner_add_right, real_inner_smul_right,
|
| 90 |
+
real_inner_self_eq_norm_sq, hv, one_pow, mul_one, hx, add_div]
|
| 91 |
+
|
| 92 |
+
theorem linearImage_unitPrism_volume_eq_area_mul_height {n : ℕ} (hn : 0 < n)
|
| 93 |
+
(L : Euclidean n ≃ₗ[ℝ] Euclidean n) (v : Euclidean n) (hv : ‖v‖ = 1)
|
| 94 |
+
(c : ℝ) (F : Set (Euclidean n)) (hF : IsCompact F)
|
| 95 |
+
(hplane : ∀ x ∈ F, ⟪v, x⟫ = c) :
|
| 96 |
+
(volume (L '' F + segment ℝ 0 (L v))).toReal =
|
| 97 |
+
(μHE[n - 1] (L '' F)).toReal * (1 / ‖L.symm.toLinearMap.adjoint v‖) := by
|
| 98 |
+
rw [linearImage_unitPrism_volume hn L v hv c F hF hplane, ENNReal.toReal_mul,
|
| 99 |
+
ENNReal.toReal_ofReal (abs_nonneg _), affineHyperplane_linearImage_area_real L v hv c F hplane]
|
| 100 |
+
field_simp [norm_ne_zero_iff.mpr (inverseAdjoint_ne_zero L v hv)]
|
| 101 |
+
|
| 102 |
+
end Paper092
|
| 103 |
+
|
| 104 |
+
end
|
| 105 |
+
|
| 106 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FacetUniqueness.lean
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFacets
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uι
|
| 6 |
+
|
| 7 |
+
open Set
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Paper092.HPolytope
|
| 13 |
+
|
| 14 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 15 |
+
|
| 16 |
+
theorem face_vectorSpan_le_normalHyperplane (a : ι) :
|
| 17 |
+
vectorSpan ℝ (P.face a) ≤ normalHyperplane (P.normal a) := by
|
| 18 |
+
rw [vectorSpan_def]
|
| 19 |
+
apply Submodule.span_le.mpr
|
| 20 |
+
rintro _ ⟨x, hx, y, hy, rfl⟩
|
| 21 |
+
apply Submodule.mem_orthogonal_singleton_iff_inner_right.mpr
|
| 22 |
+
change ⟪P.normal a, x - y⟫ = 0
|
| 23 |
+
rw [inner_sub_right, hx.2, hy.2, sub_self]
|
| 24 |
+
|
| 25 |
+
theorem face_index_unique_of_finrank (a b : ι) (hne : (P.face a).Nonempty)
|
| 26 |
+
(hdim : Module.finrank ℝ (vectorSpan ℝ (P.face a)) = d - 1)
|
| 27 |
+
(heq : P.face a = P.face b) : a = b := by
|
| 28 |
+
have han : P.normal a ≠ 0 := by
|
| 29 |
+
intro h
|
| 30 |
+
have := P.normal_unit a
|
| 31 |
+
simp only [h, norm_zero] at this
|
| 32 |
+
norm_num at this
|
| 33 |
+
have hbn : P.normal b ≠ 0 := by
|
| 34 |
+
intro h
|
| 35 |
+
have := P.normal_unit b
|
| 36 |
+
simp only [h, norm_zero] at this
|
| 37 |
+
norm_num at this
|
| 38 |
+
have hWa : vectorSpan ℝ (P.face a) = normalHyperplane (P.normal a) :=
|
| 39 |
+
Submodule.eq_of_le_of_finrank_eq (P.face_vectorSpan_le_normalHyperplane a)
|
| 40 |
+
(hdim.trans (normalHyperplane_finrank (P.normal a) han).symm)
|
| 41 |
+
have hWb : vectorSpan ℝ (P.face b) = normalHyperplane (P.normal b) :=
|
| 42 |
+
Submodule.eq_of_le_of_finrank_eq (P.face_vectorSpan_le_normalHyperplane b)
|
| 43 |
+
((heq ▸ hdim).trans (normalHyperplane_finrank (P.normal b) hbn).symm)
|
| 44 |
+
have hH : normalHyperplane (P.normal a) = normalHyperplane (P.normal b) := by
|
| 45 |
+
rw [← hWa, ← hWb, heq]
|
| 46 |
+
have hspan : Submodule.span ℝ {P.normal a} = Submodule.span ℝ {P.normal b} := by
|
| 47 |
+
have h := congrArg Submodule.orthogonal hH
|
| 48 |
+
simpa only [normalHyperplane, Submodule.orthogonal_orthogonal] using h
|
| 49 |
+
have hbspan : P.normal b ∈ Submodule.span ℝ {P.normal a} := by
|
| 50 |
+
rw [hspan]
|
| 51 |
+
exact Submodule.subset_span (mem_singleton _)
|
| 52 |
+
obtain ⟨c, hc⟩ := Submodule.mem_span_singleton.mp hbspan
|
| 53 |
+
have hnorm : |c| = 1 := by
|
| 54 |
+
have h := congrArg norm hc
|
| 55 |
+
simpa only [norm_smul, Real.norm_eq_abs, P.normal_unit, mul_one] using h
|
| 56 |
+
obtain ⟨x, hxa⟩ := hne
|
| 57 |
+
have hxb : x ∈ P.face b := heq ▸ hxa
|
| 58 |
+
have hoff : P.offset b = c * P.offset a := by
|
| 59 |
+
rw [← hxb.2, ← hc, real_inner_smul_left, hxa.2]
|
| 60 |
+
obtain ⟨p, hp⟩ := P.strict_feasible
|
| 61 |
+
have haPos : 0 < P.offset a - ⟪P.normal a, p⟫ := sub_pos.mpr (hp a)
|
| 62 |
+
have hbPos : 0 < c * (P.offset a - ⟪P.normal a, p⟫) := by
|
| 63 |
+
have h := sub_pos.mpr (hp b)
|
| 64 |
+
rwa [hoff, ← hc, real_inner_smul_left, ← mul_sub] at h
|
| 65 |
+
have hcPos : 0 < c := by
|
| 66 |
+
by_contra h
|
| 67 |
+
exact (not_lt_of_ge (mul_nonpos_of_nonpos_of_nonneg (le_of_not_gt h) haPos.le)) hbPos
|
| 68 |
+
have hcOne : c = 1 := by rwa [abs_of_pos hcPos] at hnorm
|
| 69 |
+
have hn : P.normal a = P.normal b := by simpa only [hcOne, one_smul] using hc
|
| 70 |
+
have ho : P.offset a = P.offset b := by simpa only [hcOne, one_mul] using hoff.symm
|
| 71 |
+
exact P.distinct (Prod.ext hn ho)
|
| 72 |
+
|
| 73 |
+
end Paper092.HPolytope
|
| 74 |
+
|
| 75 |
+
end
|
| 76 |
+
|
| 77 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FiniteApproximation.lean
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Basic
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SupportGeometry
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.Brightness
|
| 4 |
+
import Mathlib.Analysis.Normed.Affine.Convex
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
open Set Metric Filter
|
| 9 |
+
open scoped Pointwise Topology RealInnerProductSpace
|
| 10 |
+
|
| 11 |
+
namespace Paper092
|
| 12 |
+
|
| 13 |
+
theorem convex_smul_subset_interior {n : ℕ} {K : Set (Euclidean n)}
|
| 14 |
+
(hK : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K)
|
| 15 |
+
{r : ℝ} (hr : 0 ≤ r) (hr1 : r < 1) : r • K ⊆ interior K := by
|
| 16 |
+
rintro _ ⟨x, hx, rfl⟩
|
| 17 |
+
simpa only [smul_zero, add_zero] using
|
| 18 |
+
hK.combo_self_interior_mem_interior hx h0 hr (sub_pos.mpr hr1) (add_sub_cancel _ _)
|
| 19 |
+
|
| 20 |
+
theorem exists_inscribed_finset_sandwich {n : ℕ} {K : Set (Euclidean n)}
|
| 21 |
+
(hc : IsCompact K) (hv : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K)
|
| 22 |
+
{r : ℝ} (hr : 0 ≤ r) (hr1 : r < 1) :
|
| 23 |
+
∃ t : Finset (Euclidean n),
|
| 24 |
+
r • K ⊆ interior (convexHull ℝ (t : Set (Euclidean n))) ∧
|
| 25 |
+
convexHull ℝ (t : Set (Euclidean n)) ⊆ K ∧
|
| 26 |
+
(0 : Euclidean n) ∈ interior (convexHull ℝ (t : Set (Euclidean n))) := by
|
| 27 |
+
obtain ⟨t, ht, htK⟩ := (hv.smul r).exists_subset_interior_convexHull_finset_of_isCompact
|
| 28 |
+
(hc.smul r) (mem_nhdsSet_iff_exists.mpr
|
| 29 |
+
⟨interior K, isOpen_interior, convex_smul_subset_interior hv h0 hr hr1, interior_subset⟩)
|
| 30 |
+
refine ⟨t, ht, htK, ht ?_⟩
|
| 31 |
+
exact ⟨0, interior_subset h0, smul_zero r⟩
|
| 32 |
+
|
| 33 |
+
theorem support_mono {n : ℕ} {A B : Set (Euclidean n)}
|
| 34 |
+
(hne : A.Nonempty) (hc : IsCompact B) (h : A ⊆ B) (u : Euclidean n) :
|
| 35 |
+
SupportGeometry.support A (innerSL ℝ u) ≤
|
| 36 |
+
SupportGeometry.support B (innerSL ℝ u) :=
|
| 37 |
+
SupportGeometry.support_le hne _ fun _ hx => SupportGeometry.le_support hc _ (h hx)
|
| 38 |
+
|
| 39 |
+
theorem projectionBody_support_le {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) :
|
| 40 |
+
SupportGeometry.support (projectionBody K) (innerSL ℝ u) ≤ brightness K u :=
|
| 41 |
+
SupportGeometry.support_le ⟨0, zero_mem_projectionBody K⟩ _ fun _ hx => hx u
|
| 42 |
+
|
| 43 |
+
end Paper092
|
| 44 |
+
|
| 45 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/FiniteVertices.lean
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeDefinitions
|
| 2 |
+
import Mathlib.Analysis.Convex.KreinMilman
|
| 3 |
+
import Mathlib.Tactic.FunProp
|
| 4 |
+
import Mathlib.Tactic.Linarith
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
universe uι
|
| 9 |
+
|
| 10 |
+
open Set Filter Topology
|
| 11 |
+
open scoped RealInnerProductSpace
|
| 12 |
+
|
| 13 |
+
namespace Paper092
|
| 14 |
+
namespace HPolytope
|
| 15 |
+
|
| 16 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 17 |
+
|
| 18 |
+
theorem extreme_active_unique {x y : Euclidean d}
|
| 19 |
+
(hx : x ∈ P.body.extremePoints ℝ)
|
| 20 |
+
(ha : ∀ i, ⟪P.normal i, x⟫ = P.offset i → ⟪P.normal i, y⟫ = P.offset i) :
|
| 21 |
+
y = x := by
|
| 22 |
+
have hnear : ∀ᶠ t : ℝ in 𝓝 0, ∀ i,
|
| 23 |
+
⟪P.normal i, x⟫ < P.offset i →
|
| 24 |
+
⟪P.normal i, x + t • (y - x)⟫ < P.offset i := by
|
| 25 |
+
apply Filter.eventually_all.mpr
|
| 26 |
+
intro i
|
| 27 |
+
by_cases hi : ⟪P.normal i, x⟫ < P.offset i
|
| 28 |
+
· have h : ∀ᶠ t : ℝ in 𝓝 0,
|
| 29 |
+
⟪P.normal i, x + t • (y - x)⟫ < P.offset i :=
|
| 30 |
+
(isOpen_lt (by fun_prop) continuous_const).mem_nhds (by simpa using hi)
|
| 31 |
+
filter_upwards [h] with t ht
|
| 32 |
+
exact fun _ => ht
|
| 33 |
+
· exact Filter.Eventually.of_forall fun _ h => (hi h).elim
|
| 34 |
+
obtain ⟨ε, hε, hsmall⟩ := Metric.eventually_nhds_iff.mp hnear
|
| 35 |
+
have hpert (t : ℝ) (ht : dist t 0 < ε) : x + t • (y - x) ∈ P.body := by
|
| 36 |
+
intro i
|
| 37 |
+
rcases (hx.1 i).lt_or_eq with hi | hi
|
| 38 |
+
· exact (hsmall ht i hi).le
|
| 39 |
+
· simp [inner_add_right, inner_smul_right, inner_sub_right, hi, ha i hi]
|
| 40 |
+
have hp : dist (ε / 2) 0 < ε := by
|
| 41 |
+
rw [Real.dist_eq, sub_zero, abs_of_pos (half_pos hε)]
|
| 42 |
+
linarith
|
| 43 |
+
have hm : dist (-(ε / 2)) 0 < ε := by simpa using hp
|
| 44 |
+
have hxplus := hx.2 (hpert (ε / 2) hp)
|
| 45 |
+
(show x - (ε / 2) • (y - x) ∈ P.body by simpa only [neg_smul, ← sub_eq_add_neg] using hpert (-(ε / 2)) hm)
|
| 46 |
+
(mem_openSegment_add_sub (𝕜 := ℝ) x ((ε / 2) • (y - x)))
|
| 47 |
+
have hz : (ε / 2) • (y - x) = 0 := add_left_cancel (hxplus.trans (add_zero x).symm)
|
| 48 |
+
exact sub_eq_zero.mp ((smul_eq_zero.mp hz).resolve_left (ne_of_gt (half_pos hε)))
|
| 49 |
+
|
| 50 |
+
theorem finite_extremePoints : (P.body.extremePoints ℝ).Finite := by
|
| 51 |
+
classical
|
| 52 |
+
let active (x : Euclidean d) : Finset ι :=
|
| 53 |
+
Finset.univ.filter (fun i => ⟪P.normal i, x⟫ = P.offset i)
|
| 54 |
+
have hi : Set.InjOn active (P.body.extremePoints ℝ) := by
|
| 55 |
+
intro x hx y _ hxy
|
| 56 |
+
apply (P.extreme_active_unique hx ?_).symm
|
| 57 |
+
intro i hix
|
| 58 |
+
have hm : i ∈ active x := by simp [active, hix]
|
| 59 |
+
rw [hxy] at hm
|
| 60 |
+
exact (Finset.mem_filter.mp hm).2
|
| 61 |
+
exact (Set.toFinite (Set.univ : Set (Finset ι))).of_injOn
|
| 62 |
+
(fun _ _ => Set.mem_univ _) hi
|
| 63 |
+
|
| 64 |
+
theorem eq_convexHull_extremePoints : P.body = convexHull ℝ (P.body.extremePoints ℝ) := by
|
| 65 |
+
have hc : Convex ℝ P.body := by
|
| 66 |
+
change Convex ℝ {x : Euclidean d | ∀ i, ⟪P.normal i, x⟫ ≤ P.offset i}
|
| 67 |
+
simp only [Set.ofPred_forall]
|
| 68 |
+
exact convex_iInter fun i => (convex_Iic (P.offset i)).linear_preimage
|
| 69 |
+
(innerSL ℝ (P.normal i)).toLinearMap
|
| 70 |
+
have h := closure_convexHull_extremePoints P.compact hc
|
| 71 |
+
change closure (convexHull ℝ (P.body.extremePoints ℝ)) = P.body at h
|
| 72 |
+
rw [P.finite_extremePoints.isClosed_convexHull ℝ |>.closure_eq] at h
|
| 73 |
+
exact h.symm
|
| 74 |
+
|
| 75 |
+
end HPolytope
|
| 76 |
+
|
| 77 |
+
theorem halfspaces_are_finite_convex_hull {d : ℕ} {ι : Type uι} [Fintype ι]
|
| 78 |
+
(P : HPolytope d ι) :
|
| 79 |
+
∃ S : Finset (Euclidean d), P.body = convexHull ℝ (S : Set (Euclidean d)) := by
|
| 80 |
+
classical
|
| 81 |
+
exact ⟨P.finite_extremePoints.toFinset, by simpa using P.eq_convexHull_extremePoints⟩
|
| 82 |
+
end Paper092
|
| 83 |
+
|
| 84 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/GeneralProduct.lean
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.ProductArea
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.ProductReconstruction
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.PolytopeCauchy
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι uκ
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
open Set MeasureTheory
|
| 11 |
+
open scoped BigOperators RealInnerProductSpace Pointwise
|
| 12 |
+
|
| 13 |
+
namespace Paper092
|
| 14 |
+
|
| 15 |
+
namespace HPolytope
|
| 16 |
+
|
| 17 |
+
variable {r s : ℕ} {ι : Type uι} {κ : Type uκ} [Fintype ι] [Fintype κ]
|
| 18 |
+
|
| 19 |
+
theorem product_faceArea_inl (hr : 0 < r) (A : HPolytope r ι) (B : HPolytope s κ)
|
| 20 |
+
(i : ι) : (A.product B).faceArea (.inl i) =
|
| 21 |
+
A.faceArea i * (volume B.body).toReal := by
|
| 22 |
+
unfold faceArea
|
| 23 |
+
rw [product_face_inl, cartesianBody_eq_preimage,
|
| 24 |
+
affineHyperplane_product_area_left hr (A.normal i) (A.normal_unit i) (A.offset i)
|
| 25 |
+
(A.face i) (A.face_isCompact i) (fun _ hx => hx.2) B.body B.compact.measurableSet,
|
| 26 |
+
ENNReal.toReal_mul]
|
| 27 |
+
|
| 28 |
+
theorem product_faceArea_inr (hs : 0 < s) (A : HPolytope r ι) (B : HPolytope s κ)
|
| 29 |
+
(i : κ) : (A.product B).faceArea (.inr i) =
|
| 30 |
+
(volume A.body).toReal * B.faceArea i := by
|
| 31 |
+
unfold faceArea
|
| 32 |
+
rw [product_face_inr, cartesianBody_eq_preimage,
|
| 33 |
+
affineHyperplane_product_area_right hs (B.normal i) (B.normal_unit i) (B.offset i)
|
| 34 |
+
(B.face i) (B.face_isCompact i) (fun _ hx => hx.2) A.body A.compact.measurableSet,
|
| 35 |
+
ENNReal.toReal_mul]
|
| 36 |
+
|
| 37 |
+
theorem brightness_product (hr : 0 < r) (hs : 0 < s)
|
| 38 |
+
(A : HPolytope r ι) (B : HPolytope s κ) (w : Euclidean (r + s)) :
|
| 39 |
+
brightness (cartesianBody A.body B.body) w =
|
| 40 |
+
(volume B.body).toReal * brightness A.body (splitEuclideanProduct r s w).1 +
|
| 41 |
+
(volume A.body).toReal * brightness B.body (splitEuclideanProduct r s w).2 := by
|
| 42 |
+
classical
|
| 43 |
+
rw [← product_body A B, (A.product B).brightness_eq_sum,
|
| 44 |
+
A.brightness_eq_sum, B.brightness_eq_sum, Fintype.sum_sum_type]
|
| 45 |
+
have hleft (i : ι) : ⟪w, (A.product B).normal (.inl i)⟫ =
|
| 46 |
+
⟪(splitEuclideanProduct r s w).1, A.normal i⟫ := by
|
| 47 |
+
change ⟪w, productLiftLeft r s (A.normal i)⟫ = _
|
| 48 |
+
rw [real_inner_comm, inner_productLiftLeft, real_inner_comm]
|
| 49 |
+
have hright (i : κ) : ⟪w, (A.product B).normal (.inr i)⟫ =
|
| 50 |
+
⟪(splitEuclideanProduct r s w).2, B.normal i⟫ := by
|
| 51 |
+
change ⟪w, productLiftRight r s (B.normal i)⟫ = _
|
| 52 |
+
rw [real_inner_comm, inner_productLiftRight, real_inner_comm]
|
| 53 |
+
simp_rw [product_faceArea_inl hr, product_faceArea_inr hs, hleft, hright]
|
| 54 |
+
simp_rw [mul_assoc]
|
| 55 |
+
rw [← Finset.mul_sum]
|
| 56 |
+
have heq : (∑ i, A.faceArea i * ((volume B.body).toReal *
|
| 57 |
+
|⟪(splitEuclideanProduct r s w).1, A.normal i⟫|)) =
|
| 58 |
+
(volume B.body).toReal * ∑ i, A.faceArea i *
|
| 59 |
+
|⟪(splitEuclideanProduct r s w).1, A.normal i⟫| := by
|
| 60 |
+
rw [Finset.mul_sum]
|
| 61 |
+
apply Finset.sum_congr rfl
|
| 62 |
+
intro i _
|
| 63 |
+
ring
|
| 64 |
+
rw [heq]
|
| 65 |
+
ring
|
| 66 |
+
|
| 67 |
+
end HPolytope
|
| 68 |
+
|
| 69 |
+
theorem projectionBody_product {r s : ℕ} (hr : 2 ≤ r) (hs : 2 ≤ s)
|
| 70 |
+
{ι : Type uι} {κ : Type uκ} [Fintype ι] [Fintype κ] (A : HPolytope r ι) (B : HPolytope s κ) :
|
| 71 |
+
projectionBody (cartesianBody A.body B.body) =
|
| 72 |
+
cartesianBody ((volume B.body).toReal • projectionBody A.body)
|
| 73 |
+
((volume A.body).toReal • projectionBody B.body) :=
|
| 74 |
+
projectionBody_cartesian_of_brightness A.body B.body A.volume_pos B.volume_pos
|
| 75 |
+
(A.brightness_product (by omega) (by omega) B)
|
| 76 |
+
|
| 77 |
+
theorem normalizedProjectionVolume_product {r s : ℕ} (hr : 2 ≤ r) (hs : 2 ≤ s)
|
| 78 |
+
{ι : Type uι} {κ : Type uκ} [Fintype ι] [Fintype κ] (A : HPolytope r ι) (B : HPolytope s κ) :
|
| 79 |
+
normalizedProjectionVolume (cartesianBody A.body B.body) =
|
| 80 |
+
normalizedProjectionVolume A.body * normalizedProjectionVolume B.body :=
|
| 81 |
+
normalized_cartesian_of_projectionBody_eq (by omega) (by omega) A.body B.body
|
| 82 |
+
A.compact B.compact A.volume_pos B.volume_pos (projectionBody_product hr hs A B)
|
| 83 |
+
|
| 84 |
+
end Paper092
|
| 85 |
+
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/InnerSequence.lean
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FiniteApproximation
|
| 2 |
+
import Mathlib.Analysis.SpecificLimits.Basic
|
| 3 |
+
import Mathlib.Analysis.Normed.Module.Ball.Pointwise
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open Set Metric Filter
|
| 8 |
+
open scoped Pointwise Topology
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
noncomputable def inscribedScale (m : ℕ) : ℝ := 1 - 1 / ((m : ℝ) + 2)
|
| 13 |
+
|
| 14 |
+
theorem inscribedScale_nonneg (m : ℕ) : 0 ≤ inscribedScale m := by
|
| 15 |
+
unfold inscribedScale
|
| 16 |
+
apply sub_nonneg.mpr
|
| 17 |
+
apply (div_le_one (by positivity : 0 < (m : ℝ) + 2)).mpr
|
| 18 |
+
linarith [Nat.cast_nonneg (α := ℝ) m]
|
| 19 |
+
|
| 20 |
+
theorem inscribedScale_lt_one (m : ℕ) : inscribedScale m < 1 := by
|
| 21 |
+
unfold inscribedScale
|
| 22 |
+
exact sub_lt_self _ (by positivity)
|
| 23 |
+
|
| 24 |
+
theorem exists_increasing_inscribed_finsets {n : ℕ} {K : Set (Euclidean n)}
|
| 25 |
+
(hc : IsCompact K) (hv : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K) :
|
| 26 |
+
∃ V : ℕ → Finset (Euclidean n),
|
| 27 |
+
Monotone (fun m => convexHull ℝ (V m : Set (Euclidean n))) ∧
|
| 28 |
+
(∀ m, convexHull ℝ (V m : Set (Euclidean n)) ⊆ K) ∧
|
| 29 |
+
(∀ m, inscribedScale m • K ⊆ interior (convexHull ℝ (V m : Set (Euclidean n)))) ∧
|
| 30 |
+
(∀ m, (0 : Euclidean n) ∈ interior (convexHull ℝ (V m : Set (Euclidean n)))) := by
|
| 31 |
+
classical
|
| 32 |
+
have hex := fun m => exists_inscribed_finset_sandwich hc hv h0
|
| 33 |
+
(inscribedScale_nonneg m) (inscribedScale_lt_one m)
|
| 34 |
+
choose t ht htK ht0 using hex
|
| 35 |
+
let V : ℕ → Finset (Euclidean n) := fun m => (Finset.range (m + 1)).biUnion t
|
| 36 |
+
have htV (i m : ℕ) (hi : i ≤ m) : (t i : Set (Euclidean n)) ⊆ V m := by
|
| 37 |
+
intro x hx
|
| 38 |
+
exact Finset.mem_biUnion.mpr ⟨i, Finset.mem_range.mpr (by omega), hx⟩
|
| 39 |
+
refine ⟨V, ?_, ?_, ?_, ?_⟩
|
| 40 |
+
· intro i j hij
|
| 41 |
+
apply convexHull_mono
|
| 42 |
+
intro x hx
|
| 43 |
+
obtain ⟨k, hk, hx⟩ := Finset.mem_biUnion.mp hx
|
| 44 |
+
exact Finset.mem_biUnion.mpr ⟨k, Finset.mem_range.mpr
|
| 45 |
+
((Finset.mem_range.mp hk).trans_le (by omega)), hx⟩
|
| 46 |
+
· intro m
|
| 47 |
+
apply convexHull_min _ hv
|
| 48 |
+
intro x hx
|
| 49 |
+
obtain ⟨i, _, hx⟩ := Finset.mem_biUnion.mp hx
|
| 50 |
+
exact htK i (subset_convexHull ℝ (t i : Set (Euclidean n)) hx)
|
| 51 |
+
· intro m
|
| 52 |
+
exact (ht m).trans (interior_mono (convexHull_mono (htV m m le_rfl)))
|
| 53 |
+
· intro m
|
| 54 |
+
exact interior_mono (convexHull_mono (htV m m le_rfl)) (ht0 m)
|
| 55 |
+
|
| 56 |
+
theorem add_closedBall_subset_dilate {n : ℕ} {P : Set (Euclidean n)}
|
| 57 |
+
(hv : Convex ℝ P) {a ε : ℝ} (ha : 0 < a) (he : 0 ≤ ε)
|
| 58 |
+
(hball : closedBall (0 : Euclidean n) a ⊆ P) :
|
| 59 |
+
P + closedBall (0 : Euclidean n) ε ⊆ (1 + ε / a) • P := by
|
| 60 |
+
have heq : (ε / a) • closedBall (0 : Euclidean n) a = closedBall 0 ε := by
|
| 61 |
+
rw [smul_closedBall _ _ ha.le, smul_zero, Real.norm_eq_abs,
|
| 62 |
+
abs_of_nonneg (div_nonneg he ha.le), div_mul_cancel₀ _ ha.ne']
|
| 63 |
+
rw [← heq, hv.add_smul zero_le_one (div_nonneg he ha.le), one_smul]
|
| 64 |
+
exact add_subset_add subset_rfl (image_mono hball)
|
| 65 |
+
|
| 66 |
+
theorem inscribed_thickening {n : ℕ} {K P : Set (Euclidean n)} {R : ℝ}
|
| 67 |
+
(hR : ∀ x ∈ K, ‖x‖ ≤ R) (m : ℕ) (hP : inscribedScale m • K ⊆ P) :
|
| 68 |
+
K ⊆ P + closedBall (0 : Euclidean n) (R / ((m : ℝ) + 2)) := by
|
| 69 |
+
intro x hx
|
| 70 |
+
refine ⟨inscribedScale m • x, hP ⟨x, hx, rfl⟩,
|
| 71 |
+
(1 / ((m : ℝ) + 2)) • x, ?_, ?_⟩
|
| 72 |
+
· simp only [mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs,
|
| 73 |
+
abs_of_nonneg (by positivity : 0 ≤ 1 / ((m : ℝ) + 2))]
|
| 74 |
+
calc
|
| 75 |
+
1 / ((m : ℝ) + 2) * ‖x‖ ≤ 1 / ((m : ℝ) + 2) * R :=
|
| 76 |
+
mul_le_mul_of_nonneg_left (hR x hx) (by positivity)
|
| 77 |
+
_ = R / ((m : ℝ) + 2) := by ring
|
| 78 |
+
· change inscribedScale m • x + (1 / ((m : ℝ) + 2)) • x = x
|
| 79 |
+
rw [← add_smul]
|
| 80 |
+
simp [inscribedScale]
|
| 81 |
+
|
| 82 |
+
theorem tendsto_approximation_error (R : ℝ) :
|
| 83 |
+
Tendsto (fun m : ℕ => R / ((m : ℝ) + 2)) atTop (𝓝 0) := by
|
| 84 |
+
simpa only [Function.comp_def, Nat.cast_add, Nat.cast_ofNat] using
|
| 85 |
+
(tendsto_const_div_atTop_nhds_zero_nat R).comp (tendsto_add_atTop_nat 2)
|
| 86 |
+
|
| 87 |
+
theorem exists_inscribed_polytope_sequence {n : ℕ} {K : Set (Euclidean n)}
|
| 88 |
+
(hc : IsCompact K) (hv : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K) :
|
| 89 |
+
∃ (V : ℕ → Finset (Euclidean n)) (a R : ℝ),
|
| 90 |
+
0 < a ∧ 0 < R ∧ K ⊆ closedBall 0 R ∧
|
| 91 |
+
Monotone (fun m => convexHull ℝ (V m : Set (Euclidean n))) ∧
|
| 92 |
+
(∀ m, closedBall (0 : Euclidean n) a ⊆ convexHull ℝ (V m : Set (Euclidean n))) ∧
|
| 93 |
+
(∀ m, convexHull ℝ (V m : Set (Euclidean n)) ⊆ K ∧
|
| 94 |
+
K ⊆ convexHull ℝ (V m : Set (Euclidean n)) + closedBall 0 (R / ((m : ℝ) + 2)) ∧
|
| 95 |
+
convexHull ℝ (V m : Set (Euclidean n)) + closedBall 0 (R / ((m : ℝ) + 2)) ⊆
|
| 96 |
+
(1 + (R / ((m : ℝ) + 2)) / a) • convexHull ℝ (V m : Set (Euclidean n))) ∧
|
| 97 |
+
Tendsto (fun m : ℕ => R / ((m : ℝ) + 2)) atTop (𝓝 0) := by
|
| 98 |
+
obtain ⟨V, hmono, hVK, hscale, hzero⟩ := exists_increasing_inscribed_finsets hc hv h0
|
| 99 |
+
obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp (hzero 0))
|
| 100 |
+
obtain ⟨R, hRpos, hR⟩ := hc.isBounded.exists_pos_norm_le
|
| 101 |
+
have hball0 : closedBall (0 : Euclidean n) (r / 2) ⊆ convexHull ℝ (V 0 : Set (Euclidean n)) :=
|
| 102 |
+
(closedBall_subset_ball (by linarith)).trans hball
|
| 103 |
+
have hballm : ∀ m, closedBall (0 : Euclidean n) (r / 2) ⊆
|
| 104 |
+
convexHull ℝ (V m : Set (Euclidean n)) :=
|
| 105 |
+
fun m => hball0.trans (hmono (Nat.zero_le m))
|
| 106 |
+
refine ⟨V, r / 2, R, half_pos hr, hRpos, ?_, hmono, hballm, ?_,
|
| 107 |
+
tendsto_approximation_error R⟩
|
| 108 |
+
· intro x hx
|
| 109 |
+
simpa only [mem_closedBall, dist_zero_right] using hR x hx
|
| 110 |
+
· intro m
|
| 111 |
+
exact ⟨hVK m, inscribed_thickening hR m ((hscale m).trans interior_subset),
|
| 112 |
+
add_closedBall_subset_dilate (convex_convexHull ℝ _) (half_pos hr) (by positivity) (hballm m)⟩
|
| 113 |
+
|
| 114 |
+
end Paper092
|
| 115 |
+
|
| 116 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/LinearApproximation.lean
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.SequenceLimits
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open Set Metric Filter
|
| 6 |
+
open scoped Pointwise Topology RealInnerProductSpace
|
| 7 |
+
|
| 8 |
+
namespace Paper092
|
| 9 |
+
|
| 10 |
+
theorem approximation_linear_image_brightness_uniform {d : ℕ} (hd : 2 ≤ d)
|
| 11 |
+
{P : ℕ → Set (Euclidean d)} {K : Set (Euclidean d)}
|
| 12 |
+
(hP : ∀ m, IsCompact (P m)) (hK : IsCompact K)
|
| 13 |
+
{scale : ℕ → ℝ} (hscale : ∀ m, 1 ≤ scale m) (hscalelim : Tendsto scale atTop (𝓝 1))
|
| 14 |
+
(hPK : ∀ m, P m ⊆ K) (hKP : ∀ m, K ⊆ scale m • P m)
|
| 15 |
+
(L : Euclidean d ≃ₗ[ℝ] Euclidean d) :
|
| 16 |
+
TendstoUniformlyOn (fun m u => brightness (L '' P m) u) (brightness (L '' K))
|
| 17 |
+
atTop (sphere 0 1) := by
|
| 18 |
+
have hLK : IsCompact (L '' K) := hK.image L.toLinearMap.continuous_of_finiteDimensional
|
| 19 |
+
obtain ⟨R, hR, hbound⟩ := hLK.isBounded.exists_pos_norm_le
|
| 20 |
+
have hball : L '' K ⊆ closedBall 0 R := by
|
| 21 |
+
intro x hx
|
| 22 |
+
simpa only [mem_closedBall, dist_zero_right] using hbound x hx
|
| 23 |
+
apply approximation_brightness_uniform hd
|
| 24 |
+
(fun m => (hP m).image L.toLinearMap.continuous_of_finiteDimensional)
|
| 25 |
+
hLK hscale hscalelim hR.le hball
|
| 26 |
+
· exact fun m => image_mono (hPK m)
|
| 27 |
+
· intro m
|
| 28 |
+
rw [← image_smul_comm L.toLinearMap (scale m) (P m)
|
| 29 |
+
(fun x => L.toLinearMap.map_smul (scale m) x)]
|
| 30 |
+
exact image_mono (hKP m)
|
| 31 |
+
|
| 32 |
+
theorem approximation_linear_image_support_uniform {d : ℕ} (hd : 2 ≤ d)
|
| 33 |
+
{P : ℕ → Set (Euclidean d)} {K : Set (Euclidean d)}
|
| 34 |
+
(hP : ∀ m, IsCompact (P m)) (hv : ∀ m, Convex ℝ (P m))
|
| 35 |
+
(hi : ∀ m, (interior (P m)).Nonempty) (hK : IsCompact K)
|
| 36 |
+
{scale : ℕ → ℝ} (hscale : ∀ m, 1 ≤ scale m) (hscalelim : Tendsto scale atTop (𝓝 1))
|
| 37 |
+
(hPK : ∀ m, P m ⊆ K) (hKP : ∀ m, K ⊆ scale m • P m)
|
| 38 |
+
(L : Euclidean d ≃ₗ[ℝ] Euclidean d) :
|
| 39 |
+
TendstoUniformlyOn
|
| 40 |
+
(fun m u => SupportGeometry.support (projectionBody (L '' P m)) (innerSL ℝ u))
|
| 41 |
+
(brightness (L '' K)) atTop (sphere 0 1) := by
|
| 42 |
+
have hint : ∀ m, (interior (L '' P m)).Nonempty := by
|
| 43 |
+
intro m
|
| 44 |
+
change (interior (L.toContinuousLinearEquiv.toHomeomorph '' P m)).Nonempty
|
| 45 |
+
rw [← Homeomorph.image_interior]
|
| 46 |
+
exact (hi m).image _
|
| 47 |
+
have heq :
|
| 48 |
+
(fun m u => SupportGeometry.support (projectionBody (L '' P m)) (innerSL ℝ u)) =
|
| 49 |
+
(fun m u => brightness (L '' P m) u) := by
|
| 50 |
+
funext m u
|
| 51 |
+
exact projectionBody_support hd (L '' P m)
|
| 52 |
+
((hP m).image L.toLinearMap.continuous_of_finiteDimensional)
|
| 53 |
+
((hv m).linear_image L.toLinearMap) (hint m) u
|
| 54 |
+
rw [heq]
|
| 55 |
+
exact approximation_linear_image_brightness_uniform hd hP hK hscale hscalelim hPK hKP L
|
| 56 |
+
|
| 57 |
+
end Paper092
|
| 58 |
+
|
| 59 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/Main.lean
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.SimplexCounterexample
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.CounterexampleComparison
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.PolytopeTheorems
|
| 4 |
+
import OAI.Geometry.ProjectionVolume.SupportLimit
|
| 5 |
+
import OAI.Geometry.ProjectionVolume.ProjectionInterior
|
| 6 |
+
import OAI.Geometry.ProjectionVolume.SimplexProduct
|
| 7 |
+
import OAI.Geometry.ProjectionVolume.PolarRepresentation
|
| 8 |
+
import OAI.Geometry.ProjectionVolume.CubeBrightness
|
| 9 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFaceGeometry
|
| 10 |
+
import OAI.Geometry.ProjectionVolume.InnerSequence
|
| 11 |
+
|
| 12 |
+
import OAI.Geometry.ProjectionVolume.SequenceLimits
|
| 13 |
+
import OAI.Geometry.ProjectionVolume.LinearApproximation
|
| 14 |
+
import OAI.Geometry.ProjectionVolume.FacetLinearImage
|
| 15 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFacets
|
| 16 |
+
import OAI.Geometry.ProjectionVolume.SeparationIdentities
|
| 17 |
+
import OAI.Geometry.ProjectionVolume.ProductFacetFamilies
|
| 18 |
+
import OAI.Geometry.ProjectionVolume.CubeFibers
|
| 19 |
+
import OAI.Geometry.ProjectionVolume.CoordinateDrop
|
| 20 |
+
import OAI.Geometry.ProjectionVolume.AreaNormalVectors
|
| 21 |
+
import OAI.Geometry.ProjectionVolume.FacetPrism
|
| 22 |
+
import OAI.Geometry.ProjectionVolume.AugmentedDeterminant
|
| 23 |
+
import OAI.Geometry.ProjectionVolume.ProjectionNullity
|
| 24 |
+
import OAI.Geometry.ProjectionVolume.PolytopeIncidence
|
| 25 |
+
import OAI.Geometry.ProjectionVolume.FacetBijection
|
| 26 |
+
import OAI.Geometry.ProjectionVolume.FacetDimension
|
lean/OAI/Geometry/ProjectionVolume/Model.lean
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace Pointwise
|
| 9 |
+
|
| 10 |
+
namespace Paper092
|
| 11 |
+
|
| 12 |
+
noncomputable def simplexConstant (d : ℕ) : ℝ :=
|
| 13 |
+
(d + 1) * (d : ℝ) ^ d / d.factorial
|
| 14 |
+
|
| 15 |
+
abbrev Euclidean (n : ℕ) := EuclideanSpace ℝ (Fin n)
|
| 16 |
+
|
| 17 |
+
def normalHyperplane {n : ℕ} (u : Euclidean n) : Submodule ℝ (Euclidean n) :=
|
| 18 |
+
(Submodule.span ℝ ({u} : Set (Euclidean n)))ᗮ
|
| 19 |
+
|
| 20 |
+
def projectionVolume {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) : ENNReal :=
|
| 21 |
+
(volume : Measure (normalHyperplane u))
|
| 22 |
+
((normalHyperplane u).orthogonalProjectionOnto '' K)
|
| 23 |
+
|
| 24 |
+
def brightness {n : ℕ} (K : Set (Euclidean n)) (u : Euclidean n) : ℝ :=
|
| 25 |
+
‖u‖ * (projectionVolume K u).toReal
|
| 26 |
+
|
| 27 |
+
def projectionBody {n : ℕ} (K : Set (Euclidean n)) : Set (Euclidean n) :=
|
| 28 |
+
{y | ∀ u, ⟪u, y⟫ ≤ brightness K u}
|
| 29 |
+
|
| 30 |
+
def normalizedProjectionVolume {n : ℕ} (K : Set (Euclidean n)) : ℝ :=
|
| 31 |
+
(volume (projectionBody K)).toReal / (volume K).toReal ^ (n - 1)
|
| 32 |
+
|
| 33 |
+
def standardSimplex (n : ℕ) : Set (Euclidean n) :=
|
| 34 |
+
convexHull ℝ (insert 0 (Set.range fun i : Fin n => EuclideanSpace.single i (1 : ℝ)))
|
| 35 |
+
|
| 36 |
+
def firstBlock (x : Euclidean 20) : Euclidean 10 :=
|
| 37 |
+
WithLp.toLp 2 (fun i : Fin 10 => x (Fin.castAdd 10 i))
|
| 38 |
+
|
| 39 |
+
def secondBlock (x : Euclidean 20) : Euclidean 10 :=
|
| 40 |
+
WithLp.toLp 2 (fun i : Fin 10 => x (Fin.natAdd 10 i))
|
| 41 |
+
|
| 42 |
+
def productWitness : Set (Euclidean 20) :=
|
| 43 |
+
{x | firstBlock x ∈ standardSimplex 10 ∧ secondBlock x ∈ standardSimplex 10}
|
| 44 |
+
|
| 45 |
+
end Paper092
|
| 46 |
+
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/OuterApproximation.lean
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FiniteApproximation
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.PolytopeDefinitions
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
open Set Metric
|
| 7 |
+
open scoped Pointwise RealInnerProductSpace
|
| 8 |
+
|
| 9 |
+
namespace Paper092
|
| 10 |
+
|
| 11 |
+
theorem exists_unit_separating_support {n : ℕ} {K : Set (Euclidean n)}
|
| 12 |
+
(hc : IsCompact K) (hne : K.Nonempty) (hv : Convex ℝ K)
|
| 13 |
+
{x : Euclidean n} (hx : x ∉ K) :
|
| 14 |
+
∃ u : Euclidean n, ‖u‖ = 1 ∧
|
| 15 |
+
SupportGeometry.support K (innerSL ℝ u) < ⟪u, x⟫ := by
|
| 16 |
+
have hx' := (SupportGeometry.mem_iff_inner_le_support hc hne hv).not.mp hx
|
| 17 |
+
push Not at hx'
|
| 18 |
+
obtain ⟨u, hu⟩ := hx'
|
| 19 |
+
have hu0 : u ≠ 0 := by
|
| 20 |
+
intro h
|
| 21 |
+
have hh := (SupportGeometry.le_support hc (innerSL ℝ u) hne.choose_spec).trans_lt hu
|
| 22 |
+
simp [h] at hh
|
| 23 |
+
let v := ‖u‖⁻¹ • u
|
| 24 |
+
have hv1 : ‖v‖ = 1 := by simp [v, norm_smul, hu0]
|
| 25 |
+
obtain ⟨y, hy, hys⟩ := SupportGeometry.exists_support hc hne (innerSL ℝ v)
|
| 26 |
+
refine ⟨v, hv1, ?_⟩
|
| 27 |
+
rw [← hys]
|
| 28 |
+
change ⟪v, y⟫ < ⟪v, x⟫
|
| 29 |
+
simp only [v, real_inner_smul_left]
|
| 30 |
+
exact mul_lt_mul_of_pos_left ((SupportGeometry.le_support hc (innerSL ℝ u) hy).trans_lt hu)
|
| 31 |
+
(inv_pos.mpr (norm_pos_iff.mpr hu0))
|
| 32 |
+
|
| 33 |
+
theorem unit_support_pos_of_zero_mem_interior {n : ℕ} {K : Set (Euclidean n)}
|
| 34 |
+
(hc : IsCompact K) (h0 : (0 : Euclidean n) ∈ interior K)
|
| 35 |
+
(u : Euclidean n) (hu : ‖u‖ = 1) :
|
| 36 |
+
0 < SupportGeometry.support K (innerSL ℝ u) := by
|
| 37 |
+
obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp h0)
|
| 38 |
+
have hz : (r / 2) • u ∈ K := by
|
| 39 |
+
apply hball
|
| 40 |
+
simp only [mem_ball, dist_zero_right, norm_smul, Real.norm_eq_abs, hu, mul_one]
|
| 41 |
+
rw [abs_of_pos (half_pos hr)]
|
| 42 |
+
linarith
|
| 43 |
+
have hh := SupportGeometry.le_support hc (innerSL ℝ u) hz
|
| 44 |
+
simp only [innerSL_apply_apply, inner_smul_right, real_inner_self_eq_norm_sq, hu,
|
| 45 |
+
one_pow, mul_one] at hh
|
| 46 |
+
exact (half_pos hr).trans_le hh
|
| 47 |
+
|
| 48 |
+
theorem unit_support_le_of_norm_le {n : ℕ} {K : Set (Euclidean n)}
|
| 49 |
+
(hne : K.Nonempty) {R : ℝ} (hR : ∀ x ∈ K, ‖x‖ ≤ R)
|
| 50 |
+
(u : Euclidean n) (hu : ‖u‖ = 1) :
|
| 51 |
+
SupportGeometry.support K (innerSL ℝ u) ≤ R := by
|
| 52 |
+
apply SupportGeometry.support_le hne
|
| 53 |
+
intro x hx
|
| 54 |
+
exact (real_inner_le_norm u x).trans (by simpa [hu] using hR x hx)
|
| 55 |
+
|
| 56 |
+
theorem norm_le_of_basis_inner_le {n : ℕ} {x : Euclidean n} {R : ℝ}
|
| 57 |
+
(h : ∀ i : Fin n, |⟪EuclideanSpace.basisFun (Fin n) ℝ i, x⟫| ≤ R) :
|
| 58 |
+
‖x‖ ≤ n * R := by
|
| 59 |
+
let b := EuclideanSpace.basisFun (Fin n) ℝ
|
| 60 |
+
calc
|
| 61 |
+
‖x‖ = ‖∑ i : Fin n, ⟪b i, x⟫ • b i‖ := by rw [b.sum_repr']
|
| 62 |
+
_ ≤ ∑ i : Fin n, ‖⟪b i, x⟫ • b i‖ := norm_sum_le _ _
|
| 63 |
+
_ = ∑ i : Fin n, |⟪b i, x⟫| := by simp [norm_smul, Real.norm_eq_abs]
|
| 64 |
+
_ ≤ ∑ i : Fin n, R := Finset.sum_le_sum (fun i _ => h i)
|
| 65 |
+
_ = n * R := by simp
|
| 66 |
+
|
| 67 |
+
theorem subset_interior_smul_of_one_lt {n : ℕ} {K : Set (Euclidean n)}
|
| 68 |
+
(hv : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K)
|
| 69 |
+
{r : ℝ} (hr : 1 < r) : K ⊆ interior (r • K) := by
|
| 70 |
+
have heq : (AffineMap.homothety (0 : Euclidean n) r : Euclidean n → Euclidean n) =
|
| 71 |
+
(fun x => r • x) := by
|
| 72 |
+
funext x
|
| 73 |
+
simp [AffineMap.homothety_apply, vsub_eq_sub, vadd_eq_add]
|
| 74 |
+
change K ⊆ interior ((fun x : Euclidean n => r • x) '' K)
|
| 75 |
+
rw [← heq]
|
| 76 |
+
exact hv.subset_interior_image_homothety_of_one_lt h0 r hr
|
| 77 |
+
|
| 78 |
+
theorem exists_outer_hpolytope_sandwich {n : ℕ} {K : Set (Euclidean n)}
|
| 79 |
+
(hc : IsCompact K) (hv : Convex ℝ K) (h0 : (0 : Euclidean n) ∈ interior K)
|
| 80 |
+
{r : ℝ} (hr : 1 < r) :
|
| 81 |
+
∃ (F : Finset (Euclidean n)) (P : HPolytope n {u // u ∈ F}),
|
| 82 |
+
K ⊆ P.body ∧ P.body ⊆ r • K := by
|
| 83 |
+
classical
|
| 84 |
+
have hne : K.Nonempty := ⟨0, interior_subset h0⟩
|
| 85 |
+
obtain ⟨R, hRp, hR⟩ := hc.isBounded.exists_pos_norm_le
|
| 86 |
+
let b := EuclideanSpace.basisFun (Fin n) ℝ
|
| 87 |
+
let U := {u : Euclidean n // ‖u‖ = 1}
|
| 88 |
+
let V : U → Set (Euclidean n) := fun u =>
|
| 89 |
+
{x | SupportGeometry.support K (innerSL ℝ u.val) < ⟪u.val, x⟫}
|
| 90 |
+
have hKin := subset_interior_smul_of_one_lt hv h0 hr
|
| 91 |
+
have hcover : closedBall (0 : Euclidean n) (n * R) \ interior (r • K) ⊆ ⋃ u : U, V u := by
|
| 92 |
+
intro x hx
|
| 93 |
+
obtain ⟨u, hu, hsep⟩ := exists_unit_separating_support hc hne hv
|
| 94 |
+
(fun hxK => hx.2 (hKin hxK))
|
| 95 |
+
exact mem_iUnion.mpr ⟨⟨u, hu⟩, hsep⟩
|
| 96 |
+
obtain ⟨t, ht⟩ := ((isCompact_closedBall (0 : Euclidean n) (n * R)).diff
|
| 97 |
+
isOpen_interior).elim_finite_subcover V
|
| 98 |
+
(fun u => isOpen_lt continuous_const (innerSL ℝ u.val).continuous) hcover
|
| 99 |
+
let F := t.image Subtype.val ∪
|
| 100 |
+
(Finset.univ.image b ∪ Finset.univ.image (fun i : Fin n => -b i))
|
| 101 |
+
have htF (u : U) (hu : u ∈ t) : u.val ∈ F :=
|
| 102 |
+
Finset.mem_union_left _ (Finset.mem_image.mpr ⟨u, hu, rfl⟩)
|
| 103 |
+
have hpF (i : Fin n) : b i ∈ F := Finset.mem_union_right _
|
| 104 |
+
(Finset.mem_union_left _ (Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩))
|
| 105 |
+
have hnF (i : Fin n) : -b i ∈ F := Finset.mem_union_right _
|
| 106 |
+
(Finset.mem_union_right _ (Finset.mem_image.mpr ⟨i, Finset.mem_univ i, rfl⟩))
|
| 107 |
+
have hFunit : ∀ u ∈ F, ‖u‖ = 1 := by
|
| 108 |
+
intro u hu
|
| 109 |
+
rcases Finset.mem_union.mp hu with hu | hu
|
| 110 |
+
· obtain ⟨v, _, rfl⟩ := Finset.mem_image.mp hu
|
| 111 |
+
exact v.property
|
| 112 |
+
· rcases Finset.mem_union.mp hu with hu | hu
|
| 113 |
+
· obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hu
|
| 114 |
+
exact b.norm_eq_one i
|
| 115 |
+
· obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hu
|
| 116 |
+
simp
|
| 117 |
+
let H : Set (Euclidean n) := {x | ∀ u : {u // u ∈ F},
|
| 118 |
+
⟪u.val, x⟫ ≤ SupportGeometry.support K (innerSL ℝ u.val)}
|
| 119 |
+
have hKH : K ⊆ H := fun x hx u => SupportGeometry.le_support hc (innerSL ℝ u.val) hx
|
| 120 |
+
have hHbound : ∀ x ∈ H, ‖x‖ ≤ n * R := by
|
| 121 |
+
intro x hx
|
| 122 |
+
apply norm_le_of_basis_inner_le
|
| 123 |
+
intro i
|
| 124 |
+
have hp := (hx ⟨b i, hpF i⟩).trans
|
| 125 |
+
(unit_support_le_of_norm_le hne hR (b i) (b.norm_eq_one i))
|
| 126 |
+
have hn := (hx ⟨-b i, hnF i⟩).trans
|
| 127 |
+
(unit_support_le_of_norm_le hne hR (-b i) (by simp))
|
| 128 |
+
apply abs_le.mpr
|
| 129 |
+
refine ⟨?_, hp⟩
|
| 130 |
+
simpa only [inner_neg_left, neg_le] using hn
|
| 131 |
+
have hHr : H ⊆ r • K := by
|
| 132 |
+
intro x hx
|
| 133 |
+
by_contra hxout
|
| 134 |
+
have hxC : x ∈ closedBall (0 : Euclidean n) (n * R) \ interior (r • K) :=
|
| 135 |
+
⟨by simpa only [mem_closedBall, dist_zero_right] using hHbound x hx,
|
| 136 |
+
fun h => hxout (interior_subset h)⟩
|
| 137 |
+
obtain ⟨u, hut, hux⟩ := mem_iUnion₂.mp (ht hxC)
|
| 138 |
+
exact (not_lt_of_ge (hx ⟨u.val, htF u hut⟩)) hux
|
| 139 |
+
have hHclosed : IsClosed H := by
|
| 140 |
+
dsimp [H]
|
| 141 |
+
rw [ofPred_forall]
|
| 142 |
+
exact isClosed_iInter fun u => isClosed_le (innerSL ℝ u.val).continuous continuous_const
|
| 143 |
+
let P : HPolytope n {u // u ∈ F} := {
|
| 144 |
+
normal := Subtype.val
|
| 145 |
+
offset := fun u => SupportGeometry.support K (innerSL ℝ u.val)
|
| 146 |
+
normal_unit := fun u => hFunit u.val u.property
|
| 147 |
+
compact := (hc.smul r).of_isClosed_subset hHclosed hHr
|
| 148 |
+
strict_feasible := ⟨0, fun u => by
|
| 149 |
+
simpa only [inner_zero_right] using
|
| 150 |
+
unit_support_pos_of_zero_mem_interior hc h0 u.val (hFunit u.val u.property)⟩
|
| 151 |
+
distinct := fun i j hij => Subtype.ext (congrArg Prod.fst hij) }
|
| 152 |
+
exact ⟨F, P, hKH, hHr⟩
|
| 153 |
+
|
| 154 |
+
end Paper092
|
| 155 |
+
|
| 156 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolarRepresentation.lean
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.FiniteVertices
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.PolytopeOperations
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.SupportGeometry
|
| 4 |
+
import Mathlib.Tactic.FieldSimp
|
| 5 |
+
import Mathlib.Tactic.FunProp
|
| 6 |
+
import Mathlib.Tactic.Linarith
|
| 7 |
+
|
| 8 |
+
namespace OAI
|
| 9 |
+
|
| 10 |
+
open Set MeasureTheory
|
| 11 |
+
open scoped RealInnerProductSpace Pointwise
|
| 12 |
+
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace Paper092
|
| 15 |
+
|
| 16 |
+
def halfspacePolar {d : ℕ} (K : Set (Euclidean d)) : Set (Euclidean d) :=
|
| 17 |
+
{u | ∀ x ∈ K, ⟪u, x⟫ ≤ 1}
|
| 18 |
+
|
| 19 |
+
theorem halfspacePolar_convexHull {d : ℕ} (S : Set (Euclidean d)) :
|
| 20 |
+
halfspacePolar (convexHull ℝ S) = halfspacePolar S := by
|
| 21 |
+
ext u
|
| 22 |
+
constructor
|
| 23 |
+
· intro h x hx
|
| 24 |
+
exact h x (subset_convexHull ℝ S hx)
|
| 25 |
+
· intro h x hx
|
| 26 |
+
have hc : Convex ℝ {y : Euclidean d | ⟪u, y⟫ ≤ 1} :=
|
| 27 |
+
(convex_Iic (1 : ℝ)).linear_preimage (innerSL ℝ u).toLinearMap
|
| 28 |
+
exact convexHull_min h hc hx
|
| 29 |
+
|
| 30 |
+
theorem halfspacePolar_isClosed {d : ℕ} (K : Set (Euclidean d)) :
|
| 31 |
+
IsClosed (halfspacePolar K) := by
|
| 32 |
+
unfold halfspacePolar
|
| 33 |
+
simp only [Set.ofPred_forall]
|
| 34 |
+
exact isClosed_iInter fun x => isClosed_iInter fun _ =>
|
| 35 |
+
isClosed_le (by fun_prop) continuous_const
|
| 36 |
+
|
| 37 |
+
theorem halfspacePolar_bipolar {d : ℕ} {K : Set (Euclidean d)}
|
| 38 |
+
(hK : IsClosed K) (hc : Convex ℝ K) (h0 : (0 : Euclidean d) ∈ K) :
|
| 39 |
+
halfspacePolar (halfspacePolar K) = K := by
|
| 40 |
+
ext x
|
| 41 |
+
constructor
|
| 42 |
+
· intro hx
|
| 43 |
+
by_contra hnot
|
| 44 |
+
obtain ⟨f, r, hr, hxgt⟩ := geometric_hahn_banach_closed_point hc hK hnot
|
| 45 |
+
have hr0 : 0 < r := by simpa using hr 0 h0
|
| 46 |
+
obtain ⟨u, hu⟩ := (InnerProductSpace.toDual ℝ (Euclidean d)).surjective f
|
| 47 |
+
have hf (z : Euclidean d) : ⟪u, z⟫ = f z := by
|
| 48 |
+
exact congrArg (fun g : StrongDual ℝ (Euclidean d) => g z) hu
|
| 49 |
+
have hp : r⁻¹ • u ∈ halfspacePolar K := by
|
| 50 |
+
intro z hz
|
| 51 |
+
rw [real_inner_smul_left, hf]
|
| 52 |
+
have := mul_le_mul_of_nonneg_left (hr z hz).le (inv_nonneg.mpr hr0.le)
|
| 53 |
+
simpa [hr0.ne'] using this
|
| 54 |
+
have h := hx (r⁻¹ • u) hp
|
| 55 |
+
rw [real_inner_smul_right, real_inner_comm u x, hf] at h
|
| 56 |
+
have hh := mul_le_mul_of_nonneg_left h hr0.le
|
| 57 |
+
have hle : f x ≤ r := by simpa [← mul_assoc, hr0.ne'] using hh
|
| 58 |
+
exact (not_le_of_gt hxgt) hle
|
| 59 |
+
· intro hx u hu
|
| 60 |
+
simpa only [real_inner_comm] using hu x hx
|
| 61 |
+
|
| 62 |
+
theorem halfspacePolar_isCompact {d : ℕ} {K : Set (Euclidean d)}
|
| 63 |
+
(h0 : (0 : Euclidean d) ∈ interior K) : IsCompact (halfspacePolar K) := by
|
| 64 |
+
obtain ⟨r, hr, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp h0)
|
| 65 |
+
apply Metric.isCompact_iff_isClosed_bounded.mpr
|
| 66 |
+
refine ⟨halfspacePolar_isClosed K, isBounded_iff_forall_norm_le.mpr ⟨2 / r, ?_⟩⟩
|
| 67 |
+
intro y hy
|
| 68 |
+
by_cases hz : y = 0
|
| 69 |
+
· subst y
|
| 70 |
+
simp only [norm_zero]
|
| 71 |
+
positivity
|
| 72 |
+
have hn : 0 < ‖y‖ := norm_pos_iff.mpr hz
|
| 73 |
+
have hx : ((r / 2) / ‖y‖) • y ∈ K := by
|
| 74 |
+
apply hball
|
| 75 |
+
simp only [Metric.mem_ball, dist_zero_right, norm_smul, Real.norm_eq_abs]
|
| 76 |
+
rw [abs_of_pos (div_pos (half_pos hr) hn), div_mul_cancel₀ _ hn.ne']
|
| 77 |
+
linarith
|
| 78 |
+
have h := hy _ hx
|
| 79 |
+
rw [real_inner_smul_right, real_inner_self_eq_norm_sq] at h
|
| 80 |
+
have heq : (r / 2 / ‖y‖) * ‖y‖ ^ 2 = (r / 2) * ‖y‖ := by field_simp
|
| 81 |
+
rw [heq] at h
|
| 82 |
+
apply (le_div_iff₀ hr).mpr
|
| 83 |
+
nlinarith
|
| 84 |
+
|
| 85 |
+
theorem finite_polar_has_halfspaces {d : ℕ} (S : Finset (Euclidean d))
|
| 86 |
+
(hc : IsCompact (halfspacePolar (S : Set (Euclidean d)))) :
|
| 87 |
+
∃ (m : ℕ) (P : HPolytope d (Fin m)), P.body = halfspacePolar (S : Set (Euclidean d)) := by
|
| 88 |
+
classical
|
| 89 |
+
let T := S.filter (fun x => x ≠ 0)
|
| 90 |
+
let J := {x // x ∈ T}
|
| 91 |
+
have hn (i : J) : 0 < ‖(i : Euclidean d)‖ :=
|
| 92 |
+
norm_pos_iff.mpr (Finset.mem_filter.mp i.property).2
|
| 93 |
+
have heq : {x : Euclidean d | ∀ i : J,
|
| 94 |
+
⟪‖(i : Euclidean d)‖⁻¹ • (i : Euclidean d), x⟫ ≤ ‖(i : Euclidean d)‖⁻¹} =
|
| 95 |
+
halfspacePolar (S : Set (Euclidean d)) := by
|
| 96 |
+
ext x
|
| 97 |
+
constructor
|
| 98 |
+
· intro hx y hy
|
| 99 |
+
by_cases hy0 : y = 0
|
| 100 |
+
· simp [hy0]
|
| 101 |
+
let i : J := ⟨y, Finset.mem_filter.mpr ⟨hy, hy0⟩⟩
|
| 102 |
+
have h := mul_le_mul_of_nonneg_left (hx i) (hn i).le
|
| 103 |
+
rw [real_inner_smul_left] at h
|
| 104 |
+
dsimp only [i] at h
|
| 105 |
+
simpa only [← mul_assoc, mul_inv_cancel₀ (norm_ne_zero_iff.mpr hy0), one_mul, real_inner_comm] using h
|
| 106 |
+
· intro hx i
|
| 107 |
+
have h := mul_le_mul_of_nonneg_left (hx i (Finset.mem_filter.mp i.property).1)
|
| 108 |
+
(inv_nonneg.mpr (hn i).le)
|
| 109 |
+
rw [real_inner_smul_left]
|
| 110 |
+
simpa only [mul_one, real_inner_comm] using h
|
| 111 |
+
let P : HPolytope d J := {
|
| 112 |
+
normal := fun i => ‖(i : Euclidean d)‖⁻¹ • (i : Euclidean d)
|
| 113 |
+
offset := fun i => ‖(i : Euclidean d)‖⁻¹
|
| 114 |
+
normal_unit := fun i => by simp [norm_smul, (hn i).ne']
|
| 115 |
+
compact := by rw [heq]; exact hc
|
| 116 |
+
strict_feasible := ⟨0, fun i => by simpa using inv_pos.mpr (hn i)⟩
|
| 117 |
+
distinct := by
|
| 118 |
+
intro i j h
|
| 119 |
+
have hnorm : ‖(i : Euclidean d)‖ = ‖(j : Euclidean d)‖ :=
|
| 120 |
+
inv_inj.mp (congrArg Prod.snd h)
|
| 121 |
+
have hv := congrArg Prod.fst h
|
| 122 |
+
apply Subtype.ext
|
| 123 |
+
have hs := congrArg (fun v : Euclidean d => ‖(i : Euclidean d)‖ • v) hv
|
| 124 |
+
simpa only [smul_smul, ← hnorm, mul_inv_cancel₀ (hn i).ne', one_smul] using hs }
|
| 125 |
+
refine ⟨Fintype.card J, P.reindex (Fintype.equivFin J).symm, ?_⟩
|
| 126 |
+
rw [HPolytope.reindex_body]
|
| 127 |
+
exact heq
|
| 128 |
+
|
| 129 |
+
theorem finite_convex_hull_has_halfspaces_centered {d : ℕ} (S : Finset (Euclidean d))
|
| 130 |
+
(h0 : (0 : Euclidean d) ∈ interior (convexHull ℝ (S : Set (Euclidean d)))) :
|
| 131 |
+
∃ (m : ℕ) (P : HPolytope d (Fin m)), P.body = convexHull ℝ (S : Set (Euclidean d)) := by
|
| 132 |
+
have hc : IsCompact (halfspacePolar (S : Set (Euclidean d))) := by
|
| 133 |
+
rw [← halfspacePolar_convexHull]
|
| 134 |
+
exact halfspacePolar_isCompact h0
|
| 135 |
+
obtain ⟨m, P, hP⟩ := finite_polar_has_halfspaces S hc
|
| 136 |
+
obtain ⟨T, hT⟩ := halfspaces_are_finite_convex_hull P
|
| 137 |
+
have heq : halfspacePolar (T : Set (Euclidean d)) = convexHull ℝ (S : Set (Euclidean d)) := by
|
| 138 |
+
calc
|
| 139 |
+
halfspacePolar (T : Set (Euclidean d)) =
|
| 140 |
+
halfspacePolar (convexHull ℝ (T : Set (Euclidean d))) := (halfspacePolar_convexHull _).symm
|
| 141 |
+
_ = halfspacePolar P.body := by rw [hT]
|
| 142 |
+
_ = halfspacePolar (halfspacePolar (S : Set (Euclidean d))) := by rw [hP]
|
| 143 |
+
_ = halfspacePolar (halfspacePolar (convexHull ℝ (S : Set (Euclidean d)))) := by
|
| 144 |
+
rw [halfspacePolar_convexHull]
|
| 145 |
+
_ = convexHull ℝ (S : Set (Euclidean d)) := halfspacePolar_bipolar
|
| 146 |
+
(S.finite_toSet.isClosed_convexHull ℝ) (convex_convexHull ℝ _) (interior_subset h0)
|
| 147 |
+
obtain ⟨n, Q, hQ⟩ := finite_polar_has_halfspaces T
|
| 148 |
+
(by rw [heq]; exact S.finite_toSet.isCompact_convexHull ℝ)
|
| 149 |
+
exact ⟨n, Q, hQ.trans heq⟩
|
| 150 |
+
|
| 151 |
+
theorem finite_convex_hull_has_halfspaces {d : ℕ} (S : Finset (Euclidean d))
|
| 152 |
+
(hint : (interior (convexHull ℝ (S : Set (Euclidean d)))).Nonempty) :
|
| 153 |
+
∃ (m : ℕ) (P : HPolytope d (Fin m)), P.body = convexHull ℝ (S : Set (Euclidean d)) := by
|
| 154 |
+
classical
|
| 155 |
+
obtain ⟨v, hv⟩ := hint
|
| 156 |
+
let S₀ : Finset (Euclidean d) := S.image (fun x => x - v)
|
| 157 |
+
have hS₀ : convexHull ℝ (S₀ : Set (Euclidean d)) =
|
| 158 |
+
(-v) +ᵥ convexHull ℝ (S : Set (Euclidean d)) := by
|
| 159 |
+
dsimp [S₀]
|
| 160 |
+
rw [Finset.coe_image]
|
| 161 |
+
have himage : (fun x : Euclidean d => x - v) '' (S : Set (Euclidean d)) =
|
| 162 |
+
(-v) +ᵥ (S : Set (Euclidean d)) := by
|
| 163 |
+
change (fun x : Euclidean d => x - v) '' (S : Set (Euclidean d)) =
|
| 164 |
+
(fun x => -v + x) '' (S : Set (Euclidean d))
|
| 165 |
+
congr 1
|
| 166 |
+
funext x
|
| 167 |
+
abel
|
| 168 |
+
rw [himage, convexHull_vadd]
|
| 169 |
+
have h0 : (0 : Euclidean d) ∈ interior (convexHull ℝ (S₀ : Set (Euclidean d))) := by
|
| 170 |
+
rw [hS₀, interior_vadd]
|
| 171 |
+
exact ⟨v, hv, by simp⟩
|
| 172 |
+
obtain ⟨m, P, hP⟩ := finite_convex_hull_has_halfspaces_centered S₀ h0
|
| 173 |
+
refine ⟨m, P.translate v, ?_⟩
|
| 174 |
+
rw [HPolytope.translate_body, hP, hS₀]
|
| 175 |
+
simp
|
| 176 |
+
|
| 177 |
+
end Paper092
|
| 178 |
+
|
| 179 |
+
end
|
| 180 |
+
|
| 181 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolytopeCauchy.lean
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFront
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.Brightness
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.ProjectionReconstruction
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι
|
| 8 |
+
|
| 9 |
+
open Set MeasureTheory
|
| 10 |
+
open scoped RealInnerProductSpace Pointwise
|
| 11 |
+
|
| 12 |
+
noncomputable section
|
| 13 |
+
|
| 14 |
+
namespace Paper092.HPolytope
|
| 15 |
+
|
| 16 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 17 |
+
|
| 18 |
+
theorem velocity_neg (u : Euclidean d) (i : ι) :
|
| 19 |
+
P.velocity (-u) i = -P.velocity u i := by simp [velocity]
|
| 20 |
+
|
| 21 |
+
private theorem brightness_eq_filtered_sum (u : Euclidean d) (hu : u ≠ 0) :
|
| 22 |
+
brightness P.body u =
|
| 23 |
+
∑ i, if P.velocity u i < 0 then P.faceArea i * |⟪u, P.normal i⟫| else 0 := by
|
| 24 |
+
classical
|
| 25 |
+
rw [P.brightness_eq_front_sum u hu]
|
| 26 |
+
simp only [face_brightness]
|
| 27 |
+
rw [← Finset.sum_filter]
|
| 28 |
+
exact (Finset.sum_subtype (Finset.univ.filter (fun i => P.velocity u i < 0))
|
| 29 |
+
(by simp) (fun i => P.faceArea i * |⟪u, P.normal i⟫|)).symm
|
| 30 |
+
|
| 31 |
+
theorem brightness_eq_sum (u : Euclidean d) :
|
| 32 |
+
brightness P.body u = (∑ i, P.faceArea i * |⟪u, P.normal i⟫|) / 2 := by
|
| 33 |
+
classical
|
| 34 |
+
by_cases hu : u = 0
|
| 35 |
+
· simp [hu, brightness]
|
| 36 |
+
have hplus := P.brightness_eq_filtered_sum u hu
|
| 37 |
+
have hminus := P.brightness_eq_filtered_sum (-u) (neg_ne_zero.mpr hu)
|
| 38 |
+
simp only [brightness_neg, velocity_neg, neg_lt_zero, inner_neg_left, abs_neg] at hminus
|
| 39 |
+
have hpoint (i : ι) :
|
| 40 |
+
(if P.velocity u i < 0 then P.faceArea i * |⟪u, P.normal i⟫| else 0) +
|
| 41 |
+
(if 0 < P.velocity u i then P.faceArea i * |⟪u, P.normal i⟫| else 0) =
|
| 42 |
+
P.faceArea i * |⟪u, P.normal i⟫| := by
|
| 43 |
+
rcases lt_trichotomy (P.velocity u i) 0 with hi | hi | hi
|
| 44 |
+
· simp [hi, not_lt_of_gt hi]
|
| 45 |
+
· have hinner : ⟪u, P.normal i⟫ = 0 := by
|
| 46 |
+
simpa only [velocity, neg_eq_zero, real_inner_comm] using hi
|
| 47 |
+
simp [hi, hinner]
|
| 48 |
+
· simp [hi, not_lt_of_gt hi]
|
| 49 |
+
have hsum := congrArg (fun f : ι → ℝ => ∑ i, f i) (funext hpoint)
|
| 50 |
+
simp only [Finset.sum_add_distrib] at hsum
|
| 51 |
+
rw [← hplus, ← hminus] at hsum
|
| 52 |
+
linarith
|
| 53 |
+
|
| 54 |
+
theorem faceArea_nonneg (i : ι) : 0 ≤ P.faceArea i := ENNReal.toReal_nonneg
|
| 55 |
+
|
| 56 |
+
theorem facetZonotope_isCompact : IsCompact P.facetZonotope := by
|
| 57 |
+
classical
|
| 58 |
+
exact Finset.sum_induction _ IsCompact (fun _ _ ha hb => ha.add hb)
|
| 59 |
+
isCompact_singleton (fun _ _ => SupportGeometry.isCompact_segment _ _)
|
| 60 |
+
|
| 61 |
+
theorem facetZonotope_nonempty : P.facetZonotope.Nonempty := by
|
| 62 |
+
classical
|
| 63 |
+
exact Finset.sum_induction _ Set.Nonempty (fun _ _ ha hb => ha.add hb)
|
| 64 |
+
(singleton_nonempty 0) (fun _ _ => ⟨_, left_mem_segment ℝ _ _⟩)
|
| 65 |
+
|
| 66 |
+
theorem facetZonotope_convex : Convex ℝ P.facetZonotope := by
|
| 67 |
+
classical
|
| 68 |
+
exact Finset.sum_induction _ (Convex ℝ) (fun _ _ ha hb => ha.add hb)
|
| 69 |
+
(convex_singleton 0) (fun _ _ => convex_segment _ _)
|
| 70 |
+
|
| 71 |
+
theorem facetZonotope_support (u : Euclidean d) :
|
| 72 |
+
SupportGeometry.support P.facetZonotope (innerSL ℝ u) =
|
| 73 |
+
(∑ i, P.faceArea i * |⟪u, P.normal i⟫|) / 2 := by
|
| 74 |
+
classical
|
| 75 |
+
unfold facetZonotope
|
| 76 |
+
rw [SupportGeometry.support_sum _ _
|
| 77 |
+
(fun _ _ => SupportGeometry.isCompact_segment _ _)
|
| 78 |
+
(fun _ _ => ⟨_, left_mem_segment ℝ _ _⟩)]
|
| 79 |
+
have hseg (i : ι) : SupportGeometry.support
|
| 80 |
+
(segment ℝ (-(P.faceArea i / 2) • P.normal i)
|
| 81 |
+
((P.faceArea i / 2) • P.normal i)) (innerSL ℝ u) =
|
| 82 |
+
P.faceArea i * |⟪u, P.normal i⟫| / 2 := by
|
| 83 |
+
have heq : segment ℝ (-(P.faceArea i / 2) • P.normal i)
|
| 84 |
+
((P.faceArea i / 2) • P.normal i) =
|
| 85 |
+
segment ℝ (-(1 / 2 : ℝ) • (P.faceArea i • P.normal i))
|
| 86 |
+
((1 / 2 : ℝ) • (P.faceArea i • P.normal i)) := by
|
| 87 |
+
congr 1 <;> simp only [smul_smul] <;> congr 1 <;> ring
|
| 88 |
+
rw [heq, SupportGeometry.support_centered_segment]
|
| 89 |
+
change |⟪u, P.faceArea i • P.normal i⟫| / 2 = _
|
| 90 |
+
simp only [real_inner_smul_right, abs_mul,
|
| 91 |
+
abs_of_nonneg (P.faceArea_nonneg i)]
|
| 92 |
+
simp only [hseg]
|
| 93 |
+
exact (Finset.sum_div _ _ _).symm
|
| 94 |
+
|
| 95 |
+
theorem projectionBody_eq_facetZonotope : projectionBody P.body = P.facetZonotope :=
|
| 96 |
+
Paper092.projectionBody_eq_of_brightness_eq_support P.facetZonotope_isCompact
|
| 97 |
+
P.facetZonotope_nonempty P.facetZonotope_convex
|
| 98 |
+
(fun u => (P.brightness_eq_sum u).trans (P.facetZonotope_support u).symm)
|
| 99 |
+
|
| 100 |
+
theorem projectionBody_support (u : Euclidean d) :
|
| 101 |
+
SupportGeometry.support (projectionBody P.body) (innerSL ℝ u) = brightness P.body u := by
|
| 102 |
+
rw [P.projectionBody_eq_facetZonotope, P.facetZonotope_support, P.brightness_eq_sum]
|
| 103 |
+
|
| 104 |
+
end Paper092.HPolytope
|
| 105 |
+
|
| 106 |
+
end
|
| 107 |
+
|
| 108 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolytopeDefinitions.lean
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.Basic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uι
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace Pointwise
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Paper092
|
| 13 |
+
|
| 14 |
+
structure HPolytope (d : ℕ) (ι : Type uι) [Fintype ι] where
|
| 15 |
+
normal : ι → Euclidean d
|
| 16 |
+
offset : ι → ℝ
|
| 17 |
+
normal_unit : ∀ i, ‖normal i‖ = 1
|
| 18 |
+
compact : IsCompact {x : Euclidean d | ∀ i, ⟪normal i, x⟫ ≤ offset i}
|
| 19 |
+
strict_feasible : ∃ x : Euclidean d, ∀ i, ⟪normal i, x⟫ < offset i
|
| 20 |
+
distinct : Function.Injective (fun i => (normal i, offset i))
|
| 21 |
+
|
| 22 |
+
namespace HPolytope
|
| 23 |
+
|
| 24 |
+
def body {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι) : Set (Euclidean d) :=
|
| 25 |
+
{x | ∀ i, ⟪P.normal i, x⟫ ≤ P.offset i}
|
| 26 |
+
|
| 27 |
+
def face {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι) (i : ι) :
|
| 28 |
+
Set (Euclidean d) :=
|
| 29 |
+
{x | x ∈ P.body ∧ ⟪P.normal i, x⟫ = P.offset i}
|
| 30 |
+
|
| 31 |
+
def faceArea {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι) (i : ι) : ℝ :=
|
| 32 |
+
(μHE[d - 1] (P.face i)).toReal
|
| 33 |
+
|
| 34 |
+
def facetZonotope {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι) :
|
| 35 |
+
Set (Euclidean d) :=
|
| 36 |
+
∑ i, segment ℝ (-(P.faceArea i / 2) • P.normal i) ((P.faceArea i / 2) • P.normal i)
|
| 37 |
+
|
| 38 |
+
end HPolytope
|
| 39 |
+
end Paper092
|
| 40 |
+
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolytopeFaceGeometry.lean
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeCauchy
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uι
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Paper092.HPolytope
|
| 13 |
+
|
| 14 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 15 |
+
|
| 16 |
+
theorem projected_seam_null_left (u : Euclidean d) (a b : ι) (hab : a ≠ b)
|
| 17 |
+
(ha : P.velocity u a < 0) :
|
| 18 |
+
volume {y : normalHyperplane u |
|
| 19 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0} = 0 := by
|
| 20 |
+
by_cases hb : P.velocity u b < 0
|
| 21 |
+
· exact P.projected_seam_null u a b hab ha hb
|
| 22 |
+
let f : normalHyperplane u →ᵃ[ℝ] ℝ :=
|
| 23 |
+
P.velocity u b • ((P.slackAffine a).comp (normalHyperplane u).subtype.toAffineMap) -
|
| 24 |
+
P.velocity u a • ((P.slackAffine b).comp (normalHyperplane u).subtype.toAffineMap)
|
| 25 |
+
let S : AffineSubspace ℝ (normalHyperplane u) :=
|
| 26 |
+
(affineSpan ℝ ({0} : Set ℝ)).comap f
|
| 27 |
+
have hmem (y : normalHyperplane u) : y ∈ S ↔
|
| 28 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0 := by
|
| 29 |
+
simp [S, f, slackAffine_apply, smul_eq_mul]
|
| 30 |
+
have hproper : S ≠ ⊤ := by
|
| 31 |
+
intro htop
|
| 32 |
+
obtain ⟨x, hx⟩ := P.strict_feasible
|
| 33 |
+
have hq : ∀ i, 0 < P.slack x i := fun i => sub_pos.mpr (hx i)
|
| 34 |
+
have hy : (normalHyperplane u).orthogonalProjectionOnto x ∈ S := by
|
| 35 |
+
rw [htop]
|
| 36 |
+
exact AffineSubspace.mem_top ℝ _ _
|
| 37 |
+
have hz := (hmem _).mp hy
|
| 38 |
+
rw [seam_projection_invariant] at hz
|
| 39 |
+
have hpos := mul_nonneg (le_of_not_gt hb) (hq a).le
|
| 40 |
+
have hneg := mul_neg_of_neg_of_pos ha (hq b)
|
| 41 |
+
linarith
|
| 42 |
+
have hset : {y : normalHyperplane u |
|
| 43 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0} = S := by
|
| 44 |
+
ext y
|
| 45 |
+
exact (hmem y).symm
|
| 46 |
+
rw [hset]
|
| 47 |
+
exact Measure.addHaar_affineSubspace volume S hproper
|
| 48 |
+
|
| 49 |
+
theorem face_inter_surface_null (a b : ι) (hab : a ≠ b) :
|
| 50 |
+
μHE[d - 1] (P.face a ∩ P.face b) = 0 := by
|
| 51 |
+
have ha : P.velocity (P.normal a) a < 0 := by
|
| 52 |
+
simp [velocity, P.normal_unit]
|
| 53 |
+
have hp : projectionVolume (P.face a ∩ P.face b) (P.normal a) = 0 := by
|
| 54 |
+
unfold projectionVolume
|
| 55 |
+
apply measure_mono_null _ (P.projected_seam_null_left (P.normal a) a b hab ha)
|
| 56 |
+
rintro y ⟨x, hx, rfl⟩
|
| 57 |
+
change P.velocity (P.normal a) b *
|
| 58 |
+
P.slack ((normalHyperplane (P.normal a)).orthogonalProjectionOnto x) a -
|
| 59 |
+
P.velocity (P.normal a) a *
|
| 60 |
+
P.slack ((normalHyperplane (P.normal a)).orthogonalProjectionOnto x) b = 0
|
| 61 |
+
rw [seam_projection_invariant, ((P.mem_face_iff_slack a x).mp hx.1).2,
|
| 62 |
+
((P.mem_face_iff_slack b x).mp hx.2).2]
|
| 63 |
+
simp
|
| 64 |
+
have hv := Paper092.projectionVolume_of_subset_affine_hyperplane
|
| 65 |
+
(P.normal a) (P.normal a) (P.normal_unit a) (P.normal_unit a)
|
| 66 |
+
(P.offset a) (P.face a ∩ P.face b) (fun _ hx => hx.1.2)
|
| 67 |
+
simp only [real_inner_self_eq_norm_sq, P.normal_unit, one_pow, abs_one,
|
| 68 |
+
ENNReal.ofReal_one, one_mul] at hv
|
| 69 |
+
exact hv.symm.trans hp
|
| 70 |
+
|
| 71 |
+
theorem exists_other_active_of_redundant (i : ι)
|
| 72 |
+
(hred : ∀ x : Euclidean d,
|
| 73 |
+
(∀ j, j ≠ i → ⟪P.normal j, x⟫ ≤ P.offset j) → ⟪P.normal i, x⟫ ≤ P.offset i)
|
| 74 |
+
(x : Euclidean d) (hx : x ∈ P.face i) :
|
| 75 |
+
∃ j, j ≠ i ∧ ⟪P.normal j, x⟫ = P.offset j := by
|
| 76 |
+
classical
|
| 77 |
+
by_contra! hn
|
| 78 |
+
let S : Set (Euclidean d) := ⋂ j : {j : ι // j ≠ i},
|
| 79 |
+
{y | ⟪P.normal j.val, y⟫ < P.offset j.val}
|
| 80 |
+
have hopen : IsOpen S := isOpen_iInter_of_finite fun j =>
|
| 81 |
+
isOpen_lt (innerSL ℝ (P.normal j.val)).continuous continuous_const
|
| 82 |
+
have hxS : x ∈ S := by
|
| 83 |
+
apply mem_iInter.mpr
|
| 84 |
+
intro j
|
| 85 |
+
exact lt_of_le_of_ne (hx.1 j.val) (hn j.val j.property)
|
| 86 |
+
obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen x hxS
|
| 87 |
+
have hyball : x + (ε / 2) • P.normal i ∈ Metric.ball x ε := by
|
| 88 |
+
rw [Metric.mem_ball, dist_eq_norm]
|
| 89 |
+
simp only [add_sub_cancel_left, norm_smul, Real.norm_eq_abs, P.normal_unit,
|
| 90 |
+
mul_one, abs_of_pos (div_pos hε (by norm_num : (0 : ℝ) < 2))]
|
| 91 |
+
linarith
|
| 92 |
+
have hyS := hball hyball
|
| 93 |
+
have hy := hred (x + (ε / 2) • P.normal i) (fun j hji =>
|
| 94 |
+
(mem_iInter.mp hyS ⟨j, hji⟩).le)
|
| 95 |
+
rw [inner_add_right, real_inner_smul_right, real_inner_self_eq_norm_sq,
|
| 96 |
+
P.normal_unit, one_pow, mul_one, hx.2] at hy
|
| 97 |
+
linarith
|
| 98 |
+
|
| 99 |
+
theorem redundant_face_surface_null (i : ι)
|
| 100 |
+
(hred : ∀ x : Euclidean d,
|
| 101 |
+
(∀ j, j ≠ i → ⟪P.normal j, x⟫ ≤ P.offset j) → ⟪P.normal i, x⟫ ≤ P.offset i) :
|
| 102 |
+
μHE[d - 1] (P.face i) = 0 := by
|
| 103 |
+
classical
|
| 104 |
+
apply measure_mono_null (t := ⋃ j : {j : ι // j ≠ i}, P.face i ∩ P.face j.val)
|
| 105 |
+
· intro x hx
|
| 106 |
+
obtain ⟨j, hji, hj⟩ := P.exists_other_active_of_redundant i hred x hx
|
| 107 |
+
exact mem_iUnion.mpr ⟨⟨j, hji⟩, hx, hx.1, hj⟩
|
| 108 |
+
· apply measure_iUnion_null
|
| 109 |
+
intro j
|
| 110 |
+
exact P.face_inter_surface_null i j.val (Ne.symm j.property)
|
| 111 |
+
|
| 112 |
+
theorem redundant_faceArea_zero (i : ι)
|
| 113 |
+
(hred : ∀ x : Euclidean d,
|
| 114 |
+
(∀ j, j ≠ i → ⟪P.normal j, x⟫ ≤ P.offset j) → ⟪P.normal i, x⟫ ≤ P.offset i) :
|
| 115 |
+
P.faceArea i = 0 := by
|
| 116 |
+
rw [faceArea, P.redundant_face_surface_null i hred, ENNReal.toReal_zero]
|
| 117 |
+
|
| 118 |
+
theorem exists_strict_face_point_of_essential (i : ι)
|
| 119 |
+
(hessential : ¬ ∀ x : Euclidean d,
|
| 120 |
+
(∀ j, j ≠ i → ⟪P.normal j, x⟫ ≤ P.offset j) → ⟪P.normal i, x⟫ ≤ P.offset i) :
|
| 121 |
+
∃ x ∈ P.face i, ∀ j, j ≠ i → ⟪P.normal j, x⟫ < P.offset j := by
|
| 122 |
+
classical
|
| 123 |
+
push Not at hessential
|
| 124 |
+
obtain ⟨y, hy, hyi⟩ := hessential
|
| 125 |
+
obtain ⟨z, hz⟩ := P.strict_feasible
|
| 126 |
+
have hden : 0 < ⟪P.normal i, y⟫ - ⟪P.normal i, z⟫ := by linarith [hz i]
|
| 127 |
+
let t : ℝ := (P.offset i - ⟪P.normal i, z⟫) /
|
| 128 |
+
(⟪P.normal i, y⟫ - ⟪P.normal i, z⟫)
|
| 129 |
+
have ht0 : 0 < t := div_pos (sub_pos.mpr (hz i)) hden
|
| 130 |
+
have ht1 : t < 1 := (div_lt_one hden).mpr (by linarith)
|
| 131 |
+
have htmul : t * (⟪P.normal i, y⟫ - ⟪P.normal i, z⟫) =
|
| 132 |
+
P.offset i - ⟪P.normal i, z⟫ := div_mul_cancel₀ _ hden.ne'
|
| 133 |
+
let x := (1 - t) • z + t • y
|
| 134 |
+
have hxi : ⟪P.normal i, x⟫ = P.offset i := by
|
| 135 |
+
dsimp [x]
|
| 136 |
+
simp only [inner_add_right, real_inner_smul_right]
|
| 137 |
+
nlinarith
|
| 138 |
+
have hxj : ∀ j, j ≠ i → ⟪P.normal j, x⟫ < P.offset j := by
|
| 139 |
+
intro j hji
|
| 140 |
+
have hleft := mul_lt_mul_of_pos_left (hz j) (sub_pos.mpr ht1)
|
| 141 |
+
have hright := mul_le_mul_of_nonneg_left (hy j hji) ht0.le
|
| 142 |
+
dsimp [x]
|
| 143 |
+
simp only [inner_add_right, real_inner_smul_right]
|
| 144 |
+
nlinarith
|
| 145 |
+
refine ⟨x, ⟨?_, hxi⟩, hxj⟩
|
| 146 |
+
intro j
|
| 147 |
+
by_cases hji : j = i
|
| 148 |
+
· simpa only [hji, hxi] using le_refl (P.offset i)
|
| 149 |
+
· exact (hxj j hji).le
|
| 150 |
+
|
| 151 |
+
end Paper092.HPolytope
|
| 152 |
+
|
| 153 |
+
end
|
| 154 |
+
|
| 155 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolytopeFacets.lean
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeFaceGeometry
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uι
|
| 6 |
+
|
| 7 |
+
open Set MeasureTheory
|
| 8 |
+
open scoped RealInnerProductSpace
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
|
| 12 |
+
namespace Paper092.HPolytope
|
| 13 |
+
|
| 14 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 15 |
+
|
| 16 |
+
theorem affineSpan_face_of_essential (i : ι)
|
| 17 |
+
(hessential : ¬ ∀ x : Euclidean d,
|
| 18 |
+
(∀ j, j ≠ i → ⟪P.normal j, x⟫ ≤ P.offset j) → ⟪P.normal i, x⟫ ≤ P.offset i) :
|
| 19 |
+
(affineSpan ℝ (P.face i) : Set (Euclidean d)) =
|
| 20 |
+
{y | ⟪P.normal i, y⟫ = P.offset i} := by
|
| 21 |
+
classical
|
| 22 |
+
let Q : AffineSubspace ℝ (Euclidean d) :=
|
| 23 |
+
(affineSpan ℝ ({P.offset i} : Set ℝ)).comap (innerₛₗ ℝ (P.normal i)).toAffineMap
|
| 24 |
+
have hQ (y : Euclidean d) : y ∈ Q ↔ ⟪P.normal i, y⟫ = P.offset i := by
|
| 25 |
+
simp [Q]
|
| 26 |
+
have hle : affineSpan ℝ (P.face i) ≤ Q := by
|
| 27 |
+
apply affineSpan_le.mpr
|
| 28 |
+
intro y hy
|
| 29 |
+
exact (hQ y).mpr hy.2
|
| 30 |
+
ext y
|
| 31 |
+
constructor
|
| 32 |
+
· exact fun hy => (hQ y).mp (hle hy)
|
| 33 |
+
· intro hy
|
| 34 |
+
change ⟪P.normal i, y⟫ = P.offset i at hy
|
| 35 |
+
change y ∈ affineSpan ℝ (P.face i)
|
| 36 |
+
obtain ⟨x, hx, hxstrict⟩ := P.exists_strict_face_point_of_essential i hessential
|
| 37 |
+
have hxspan : x ∈ affineSpan ℝ (P.face i) := subset_affineSpan ℝ _ hx
|
| 38 |
+
by_cases hxy : y = x
|
| 39 |
+
· simpa only [hxy] using hxspan
|
| 40 |
+
let S : Set (Euclidean d) := ⋂ j : {j : ι // j ≠ i},
|
| 41 |
+
{z | ⟪P.normal j.val, z⟫ < P.offset j.val}
|
| 42 |
+
have hopen : IsOpen S := isOpen_iInter_of_finite fun j =>
|
| 43 |
+
isOpen_lt (innerSL ℝ (P.normal j.val)).continuous continuous_const
|
| 44 |
+
have hxS : x ∈ S := mem_iInter.mpr (fun j => hxstrict j.val j.property)
|
| 45 |
+
obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen x hxS
|
| 46 |
+
have hnorm : 0 < ‖y - x‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hxy)
|
| 47 |
+
let t : ℝ := ε / (2 * ‖y - x‖)
|
| 48 |
+
have ht : 0 < t := div_pos hε (mul_pos (by norm_num) hnorm)
|
| 49 |
+
let z := x + t • (y - x)
|
| 50 |
+
have hzball : z ∈ Metric.ball x ε := by
|
| 51 |
+
rw [Metric.mem_ball, dist_eq_norm]
|
| 52 |
+
change ‖x + t • (y - x) - x‖ < ε
|
| 53 |
+
rw [add_sub_cancel_left, norm_smul, Real.norm_eq_abs, abs_of_pos ht]
|
| 54 |
+
dsimp [t]
|
| 55 |
+
have heq : ε / (2 * ‖y - x‖) * ‖y - x‖ = ε / 2 := by field_simp
|
| 56 |
+
rw [heq]
|
| 57 |
+
linarith
|
| 58 |
+
have hzS := hball hzball
|
| 59 |
+
have hzi : ⟪P.normal i, z⟫ = P.offset i := by
|
| 60 |
+
dsimp [z]
|
| 61 |
+
simp only [inner_add_right, real_inner_smul_right, inner_sub_right, hy, hx.2,
|
| 62 |
+
sub_self, mul_zero, add_zero]
|
| 63 |
+
have hzface : z ∈ P.face i := by
|
| 64 |
+
refine ⟨?_, hzi⟩
|
| 65 |
+
intro j
|
| 66 |
+
by_cases hji : j = i
|
| 67 |
+
· simpa only [hji, hzi] using le_refl (P.offset i)
|
| 68 |
+
· exact (mem_iInter.mp hzS ⟨j, hji⟩).le
|
| 69 |
+
have hzspan := subset_affineSpan ℝ (P.face i) hzface
|
| 70 |
+
have hmem := (affineSpan ℝ (P.face i)).smul_vsub_vadd_mem t⁻¹ hzspan hxspan hxspan
|
| 71 |
+
have heq : t⁻¹ • (z - x) + x = y := by
|
| 72 |
+
dsimp [z]
|
| 73 |
+
rw [add_sub_cancel_left, smul_smul, inv_mul_cancel₀ ht.ne', one_smul, sub_add_cancel]
|
| 74 |
+
simpa only [vsub_eq_sub, vadd_eq_add, heq] using hmem
|
| 75 |
+
|
| 76 |
+
end Paper092.HPolytope
|
| 77 |
+
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
end OAI
|
lean/OAI/Geometry/ProjectionVolume/PolytopeFront.lean
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.Geometry.ProjectionVolume.PolytopeDefinitions
|
| 2 |
+
import OAI.Geometry.ProjectionVolume.SimplexProjection
|
| 3 |
+
import OAI.Geometry.ProjectionVolume.ProjectionJacobian
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
universe uι
|
| 8 |
+
|
| 9 |
+
open Set MeasureTheory
|
| 10 |
+
open scoped RealInnerProductSpace
|
| 11 |
+
|
| 12 |
+
noncomputable section
|
| 13 |
+
|
| 14 |
+
namespace Paper092.HPolytope
|
| 15 |
+
|
| 16 |
+
variable {d : ℕ} {ι : Type uι} [Fintype ι] (P : HPolytope d ι)
|
| 17 |
+
|
| 18 |
+
def slack (x : Euclidean d) (i : ι) : ℝ := P.offset i - ⟪P.normal i, x⟫
|
| 19 |
+
|
| 20 |
+
def velocity (u : Euclidean d) (i : ι) : ℝ := -⟪P.normal i, u⟫
|
| 21 |
+
|
| 22 |
+
theorem slack_add_smul (x u : Euclidean d) (t : ℝ) (i : ι) :
|
| 23 |
+
P.slack (x + t • u) i = P.slack x i + t * P.velocity u i := by
|
| 24 |
+
simp only [slack, velocity, inner_add_right, real_inner_smul_right]
|
| 25 |
+
ring
|
| 26 |
+
|
| 27 |
+
theorem mem_body_iff_slack (x : Euclidean d) :
|
| 28 |
+
x ∈ P.body ↔ ∀ i, 0 ≤ P.slack x i := by
|
| 29 |
+
simp only [body, mem_ofPred_eq, slack, sub_nonneg]
|
| 30 |
+
|
| 31 |
+
theorem mem_face_iff_slack (i : ι) (x : Euclidean d) :
|
| 32 |
+
x ∈ P.face i ↔ x ∈ P.body ∧ P.slack x i = 0 := by
|
| 33 |
+
change (x ∈ P.body ∧ ⟪P.normal i, x⟫ = P.offset i) ↔ _
|
| 34 |
+
constructor
|
| 35 |
+
· rintro ⟨hx, hi⟩
|
| 36 |
+
exact ⟨hx, by simp [slack, hi]⟩
|
| 37 |
+
· rintro ⟨hx, hi⟩
|
| 38 |
+
exact ⟨hx, (sub_eq_zero.mp hi).symm⟩
|
| 39 |
+
|
| 40 |
+
theorem body_nonempty : P.body.Nonempty := by
|
| 41 |
+
obtain ⟨x, hx⟩ := P.strict_feasible
|
| 42 |
+
exact ⟨x, fun i => (hx i).le⟩
|
| 43 |
+
|
| 44 |
+
theorem body_convex : Convex ℝ P.body := by
|
| 45 |
+
intro x hx y hy a b ha hb hab i
|
| 46 |
+
simp only [inner_add_right, real_inner_smul_right]
|
| 47 |
+
calc
|
| 48 |
+
a * ⟪P.normal i, x⟫ + b * ⟪P.normal i, y⟫ ≤
|
| 49 |
+
a * P.offset i + b * P.offset i :=
|
| 50 |
+
add_le_add (mul_le_mul_of_nonneg_left (hx i) ha)
|
| 51 |
+
(mul_le_mul_of_nonneg_left (hy i) hb)
|
| 52 |
+
_ = (a + b) * P.offset i := by ring
|
| 53 |
+
_ = P.offset i := by rw [hab, one_mul]
|
| 54 |
+
|
| 55 |
+
theorem velocity_neg_exists (u : Euclidean d) (hu : u ≠ 0) :
|
| 56 |
+
∃ i, P.velocity u i < 0 := by
|
| 57 |
+
by_contra! h
|
| 58 |
+
obtain ⟨x, hx, hmax⟩ := P.compact.exists_isMaxOn P.body_nonempty
|
| 59 |
+
(innerSL ℝ u).continuous.continuousOn
|
| 60 |
+
have hx' : x + u ∈ P.body := by
|
| 61 |
+
intro i
|
| 62 |
+
have hi := h i
|
| 63 |
+
dsimp only [velocity] at hi
|
| 64 |
+
simp only [inner_add_right]
|
| 65 |
+
linarith [hx i]
|
| 66 |
+
have hle := hmax hx'
|
| 67 |
+
change ⟪u, x + u⟫ ≤ ⟪u, x⟫ at hle
|
| 68 |
+
rw [inner_add_right] at hle
|
| 69 |
+
have hpos := real_inner_self_pos.mpr hu
|
| 70 |
+
linarith
|
| 71 |
+
|
| 72 |
+
theorem exists_front_point (x u : Euclidean d) (hu : u ≠ 0)
|
| 73 |
+
(hx : x ∈ P.body) :
|
| 74 |
+
∃ t : ℝ, 0 ≤ t ∧ x + t • u ∈ P.body ∧
|
| 75 |
+
∃ i, P.velocity u i < 0 ∧ P.slack (x + t • u) i = 0 := by
|
| 76 |
+
obtain ⟨t, ht, hq, i, hi, hqi⟩ := Paper092.exists_step_to_boundary
|
| 77 |
+
(P.slack x) (P.velocity u) ((P.mem_body_iff_slack x).mp hx)
|
| 78 |
+
(P.velocity_neg_exists u hu)
|
| 79 |
+
refine ⟨t, ht, ?_, i, hi, ?_⟩
|
| 80 |
+
· exact (P.mem_body_iff_slack _).mpr (fun j => by simpa only [slack_add_smul] using hq j)
|
| 81 |
+
· simpa only [slack_add_smul] using hqi
|
| 82 |
+
|
| 83 |
+
theorem projection_injective_on_front (u x z : Euclidean d)
|
| 84 |
+
(hx : x ∈ P.body) (hz : z ∈ P.body)
|
| 85 |
+
(hxf : ∃ i, P.velocity u i < 0 ∧ P.slack x i = 0)
|
| 86 |
+
(hzf : ∃ i, P.velocity u i < 0 ∧ P.slack z i = 0)
|
| 87 |
+
(hp : (normalHyperplane u).orthogonalProjectionOnto x =
|
| 88 |
+
(normalHyperplane u).orthogonalProjectionOnto z) : x = z := by
|
| 89 |
+
obtain ⟨t, rfl⟩ := (Paper092.projection_eq_iff_parallel u x z).mp hp
|
| 90 |
+
obtain ⟨a, ha, hxa⟩ := hxf
|
| 91 |
+
obtain ⟨b, hb, hzb⟩ := hzf
|
| 92 |
+
rw [slack_add_smul] at hxa
|
| 93 |
+
have ht0 : 0 ≤ t := by
|
| 94 |
+
by_contra ht
|
| 95 |
+
have hprod := mul_pos_of_neg_of_neg (lt_of_not_ge ht) ha
|
| 96 |
+
have hz' := (P.mem_body_iff_slack z).mp hz a
|
| 97 |
+
linarith
|
| 98 |
+
have ht1 : t ≤ 0 := by
|
| 99 |
+
by_contra ht
|
| 100 |
+
have hprod := mul_neg_of_pos_of_neg (lt_of_not_ge ht) hb
|
| 101 |
+
have hxb := (P.mem_body_iff_slack _).mp hx b
|
| 102 |
+
rw [slack_add_smul, hzb] at hxb
|
| 103 |
+
linarith
|
| 104 |
+
simp [le_antisymm ht1 ht0]
|
| 105 |
+
|
| 106 |
+
theorem projection_eq_front_cover (u : Euclidean d) (hu : u ≠ 0) :
|
| 107 |
+
(normalHyperplane u).orthogonalProjectionOnto '' P.body =
|
| 108 |
+
⋃ i : {i : ι // P.velocity u i < 0},
|
| 109 |
+
(normalHyperplane u).orthogonalProjectionOnto '' P.face i.val := by
|
| 110 |
+
ext y
|
| 111 |
+
constructor
|
| 112 |
+
· rintro ⟨x, hx, rfl⟩
|
| 113 |
+
obtain ⟨t, _, hq, i, hi, hqi⟩ := P.exists_front_point x u hu hx
|
| 114 |
+
refine mem_iUnion.mpr ⟨⟨i, hi⟩, x + t • u, ?_, ?_⟩
|
| 115 |
+
· exact (P.mem_face_iff_slack _ _).mpr ⟨hq, hqi⟩
|
| 116 |
+
· exact (Paper092.projection_eq_iff_parallel u (x + t • u) x).mpr ⟨t, rfl⟩
|
| 117 |
+
· intro hy
|
| 118 |
+
obtain ⟨i, x, hx, hpx⟩ := mem_iUnion.mp hy
|
| 119 |
+
exact ⟨x, hx.1, hpx⟩
|
| 120 |
+
|
| 121 |
+
theorem front_faces_projection_inter_eq (u : Euclidean d) (a b : ι)
|
| 122 |
+
(ha : P.velocity u a < 0) (hb : P.velocity u b < 0) :
|
| 123 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face a) ∩
|
| 124 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face b) =
|
| 125 |
+
(normalHyperplane u).orthogonalProjectionOnto '' (P.face a ∩ P.face b) := by
|
| 126 |
+
apply le_antisymm
|
| 127 |
+
· rintro y ⟨⟨x, hx, hpx⟩, ⟨z, hz, hpz⟩⟩
|
| 128 |
+
have hxa := (P.mem_face_iff_slack _ _).mp hx
|
| 129 |
+
have hzb := (P.mem_face_iff_slack _ _).mp hz
|
| 130 |
+
have heq : x = z := P.projection_injective_on_front u x z hxa.1 hzb.1
|
| 131 |
+
⟨a, ha, hxa.2⟩ ⟨b, hb, hzb.2⟩ (hpx.trans hpz.symm)
|
| 132 |
+
subst z
|
| 133 |
+
exact ⟨x, ⟨hx, hz⟩, hpx⟩
|
| 134 |
+
· exact image_inter_subset _ _ _
|
| 135 |
+
|
| 136 |
+
def slackAffine (i : ι) : Euclidean d →ᵃ[ℝ] ℝ :=
|
| 137 |
+
AffineMap.const ℝ (Euclidean d) (P.offset i) - (innerₛₗ ℝ (P.normal i)).toAffineMap
|
| 138 |
+
|
| 139 |
+
theorem slackAffine_apply (i : ι) (x : Euclidean d) : P.slackAffine i x = P.slack x i := rfl
|
| 140 |
+
|
| 141 |
+
theorem seam_projection_invariant (u x : Euclidean d) (a b : ι) :
|
| 142 |
+
P.velocity u b * P.slack ((normalHyperplane u).orthogonalProjectionOnto x) a -
|
| 143 |
+
P.velocity u a * P.slack ((normalHyperplane u).orthogonalProjectionOnto x) b =
|
| 144 |
+
P.velocity u b * P.slack x a - P.velocity u a * P.slack x b := by
|
| 145 |
+
obtain ⟨t, ht⟩ := (Paper092.projection_eq_iff_parallel u x
|
| 146 |
+
((normalHyperplane u).orthogonalProjectionOnto x)).mp
|
| 147 |
+
((normalHyperplane u).orthogonalProjectionOnto_mem_subspace_eq_self
|
| 148 |
+
((normalHyperplane u).orthogonalProjectionOnto x)).symm
|
| 149 |
+
conv_rhs => rw [ht, slack_add_smul, slack_add_smul]
|
| 150 |
+
ring
|
| 151 |
+
|
| 152 |
+
private theorem index_eq_of_weighted_slack_zero (a b : ι) (r s : ℝ)
|
| 153 |
+
(hr : r < 0) (hs : s < 0)
|
| 154 |
+
(h : ∀ x, r * P.slack x a - s * P.slack x b = 0) : a = b := by
|
| 155 |
+
have h0 := h 0
|
| 156 |
+
simp only [slack, inner_zero_right, sub_zero] at h0
|
| 157 |
+
have hn : r • P.normal a = s • P.normal b := by
|
| 158 |
+
apply ext_inner_right ℝ
|
| 159 |
+
intro x
|
| 160 |
+
simp only [real_inner_smul_left]
|
| 161 |
+
have hx := h x
|
| 162 |
+
dsimp only [slack] at hx
|
| 163 |
+
nlinarith
|
| 164 |
+
have hnorm := congrArg norm hn
|
| 165 |
+
simp only [norm_smul, Real.norm_eq_abs, P.normal_unit, mul_one,
|
| 166 |
+
abs_of_neg hr, abs_of_neg hs] at hnorm
|
| 167 |
+
have hrs : r = s := by linarith
|
| 168 |
+
rw [hrs] at hn h0
|
| 169 |
+
have hn' : P.normal a = P.normal b :=
|
| 170 |
+
smul_right_injective (Euclidean d) (ne_of_lt hs) hn
|
| 171 |
+
have hc : P.offset a = P.offset b :=
|
| 172 |
+
mul_left_cancel₀ (ne_of_lt hs) (sub_eq_zero.mp h0)
|
| 173 |
+
exact P.distinct (Prod.ext hn' hc)
|
| 174 |
+
|
| 175 |
+
theorem projected_seam_null (u : Euclidean d) (a b : ι) (hab : a ≠ b)
|
| 176 |
+
(ha : P.velocity u a < 0) (hb : P.velocity u b < 0) :
|
| 177 |
+
volume {y : normalHyperplane u |
|
| 178 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0} = 0 := by
|
| 179 |
+
let f : normalHyperplane u →ᵃ[ℝ] ℝ :=
|
| 180 |
+
P.velocity u b • ((P.slackAffine a).comp (normalHyperplane u).subtype.toAffineMap) -
|
| 181 |
+
P.velocity u a • ((P.slackAffine b).comp (normalHyperplane u).subtype.toAffineMap)
|
| 182 |
+
let S : AffineSubspace ℝ (normalHyperplane u) :=
|
| 183 |
+
(affineSpan ℝ ({0} : Set ℝ)).comap f
|
| 184 |
+
have hmem (y : normalHyperplane u) : y ∈ S ↔
|
| 185 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0 := by
|
| 186 |
+
simp [S, f, slackAffine_apply, smul_eq_mul]
|
| 187 |
+
have hproper : S ≠ ⊤ := by
|
| 188 |
+
intro htop
|
| 189 |
+
apply hab
|
| 190 |
+
apply P.index_eq_of_weighted_slack_zero a b (P.velocity u b) (P.velocity u a) hb ha
|
| 191 |
+
intro x
|
| 192 |
+
have hy : (normalHyperplane u).orthogonalProjectionOnto x ∈ S := by
|
| 193 |
+
rw [htop]
|
| 194 |
+
exact AffineSubspace.mem_top ℝ _ _
|
| 195 |
+
have hz := (hmem _).mp hy
|
| 196 |
+
rwa [seam_projection_invariant] at hz
|
| 197 |
+
have hset : {y : normalHyperplane u |
|
| 198 |
+
P.velocity u b * P.slack y.val a - P.velocity u a * P.slack y.val b = 0} = S := by
|
| 199 |
+
ext y
|
| 200 |
+
exact (hmem y).symm
|
| 201 |
+
rw [hset]
|
| 202 |
+
exact Measure.addHaar_affineSubspace volume S hproper
|
| 203 |
+
|
| 204 |
+
theorem projected_front_faces_aedisjoint (u : Euclidean d) (a b : ι) (hab : a ≠ b)
|
| 205 |
+
(ha : P.velocity u a < 0) (hb : P.velocity u b < 0) :
|
| 206 |
+
AEDisjoint volume
|
| 207 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face a)
|
| 208 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face b) := by
|
| 209 |
+
rw [AEDisjoint, P.front_faces_projection_inter_eq u a b ha hb]
|
| 210 |
+
apply measure_mono_null _ (P.projected_seam_null u a b hab ha hb)
|
| 211 |
+
rintro y ⟨x, hx, rfl⟩
|
| 212 |
+
change P.velocity u b * P.slack ((normalHyperplane u).orthogonalProjectionOnto x) a -
|
| 213 |
+
P.velocity u a * P.slack ((normalHyperplane u).orthogonalProjectionOnto x) b = 0
|
| 214 |
+
rw [seam_projection_invariant,
|
| 215 |
+
((P.mem_face_iff_slack a x).mp hx.1).2, ((P.mem_face_iff_slack b x).mp hx.2).2]
|
| 216 |
+
simp
|
| 217 |
+
|
| 218 |
+
theorem face_isCompact (i : ι) : IsCompact (P.face i) :=
|
| 219 |
+
P.compact.inter_right (isClosed_eq (innerSL ℝ (P.normal i)).continuous continuous_const)
|
| 220 |
+
|
| 221 |
+
theorem projected_face_isCompact (u : Euclidean d) (i : ι) :
|
| 222 |
+
IsCompact ((normalHyperplane u).orthogonalProjectionOnto '' P.face i) :=
|
| 223 |
+
(P.face_isCompact i).image (normalHyperplane u).orthogonalProjectionOnto.continuous
|
| 224 |
+
|
| 225 |
+
theorem projectionVolume_eq_front_sum (u : Euclidean d) (hu : u ≠ 0) :
|
| 226 |
+
projectionVolume P.body u =
|
| 227 |
+
∑ i : {i : ι // P.velocity u i < 0},
|
| 228 |
+
volume ((normalHyperplane u).orthogonalProjectionOnto '' P.face i.val) := by
|
| 229 |
+
classical
|
| 230 |
+
unfold projectionVolume
|
| 231 |
+
rw [P.projection_eq_front_cover u hu]
|
| 232 |
+
have hd : Pairwise (fun a b : {i : ι // P.velocity u i < 0} =>
|
| 233 |
+
AEDisjoint volume
|
| 234 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face a.val)
|
| 235 |
+
((normalHyperplane u).orthogonalProjectionOnto '' P.face b.val)) := by
|
| 236 |
+
intro a b hab
|
| 237 |
+
exact P.projected_front_faces_aedisjoint u a.val b.val (Subtype.coe_injective.ne hab)
|
| 238 |
+
a.property b.property
|
| 239 |
+
rw [measure_iUnion₀ hd (fun i =>
|
| 240 |
+
(P.projected_face_isCompact u i.val).measurableSet.nullMeasurableSet)]
|
| 241 |
+
exact tsum_fintype _
|
| 242 |
+
|
| 243 |
+
theorem brightness_eq_front_sum (u : Euclidean d) (hu : u ≠ 0) :
|
| 244 |
+
brightness P.body u =
|
| 245 |
+
∑ i : {i : ι // P.velocity u i < 0}, brightness (P.face i.val) u := by
|
| 246 |
+
classical
|
| 247 |
+
simp only [brightness]
|
| 248 |
+
rw [P.projectionVolume_eq_front_sum u hu, ENNReal.toReal_sum]
|
| 249 |
+
· exact Finset.mul_sum _ _ _
|
| 250 |
+
· intro i _
|
| 251 |
+
exact (P.projected_face_isCompact u i.val).measure_lt_top.ne
|
| 252 |
+
|
| 253 |
+
theorem face_brightness (i : ι) (u : Euclidean d) :
|
| 254 |
+
brightness (P.face i) u = P.faceArea i * |⟪u, P.normal i⟫| := by
|
| 255 |
+
have h := Paper092.brightness_of_subset_affine_hyperplane u (P.normal i)
|
| 256 |
+
(P.normal_unit i) (P.offset i) (P.face i) (fun _ hx => hx.2)
|
| 257 |
+
simpa only [faceArea, mul_comm] using h
|
| 258 |
+
|
| 259 |
+
end Paper092.HPolytope
|
| 260 |
+
|
| 261 |
+
end
|
| 262 |
+
|
| 263 |
+
end OAI
|