2023-05-15 14:00:01 +00:00
|
|
|
|
import Common.Finset
|
|
|
|
|
import Common.Geometry.Rectangle.Orthogonal
|
|
|
|
|
import Common.List.Basic
|
2023-05-15 01:32:18 +00:00
|
|
|
|
import Common.Set.Partition
|
|
|
|
|
|
|
|
|
|
/-! # Common.Geometry.StepFunction
|
|
|
|
|
|
|
|
|
|
Characterization of step functions.
|
|
|
|
|
-/
|
|
|
|
|
|
|
|
|
|
namespace Geometry
|
|
|
|
|
|
|
|
|
|
open Set Partition
|
|
|
|
|
|
|
|
|
|
/--
|
|
|
|
|
A function `f`, whose domain is a closed interval `[a, b]`, is a `StepFunction`
|
|
|
|
|
if there exists a `Partition` `P = {x₀, x₁, …, xₙ}` of `[a, b]` such that `f` is
|
|
|
|
|
constant on each open subinterval of `P`.
|
2023-05-15 14:00:01 +00:00
|
|
|
|
|
|
|
|
|
Instead of maintaining a function from `[a, b]` to `ℝ`, we instead maintain a
|
|
|
|
|
function that maps each `Partition` index to some constant value.
|
2023-05-15 01:32:18 +00:00
|
|
|
|
-/
|
|
|
|
|
structure StepFunction where
|
|
|
|
|
p : Partition ℝ
|
2023-05-15 14:00:01 +00:00
|
|
|
|
toFun : Fin p.ivls.length → ℝ
|
2023-05-15 01:32:18 +00:00
|
|
|
|
|
|
|
|
|
namespace StepFunction
|
|
|
|
|
|
|
|
|
|
/--
|
2023-05-15 14:00:01 +00:00
|
|
|
|
The ordinate set of the `StepFunction`.
|
2023-05-15 01:32:18 +00:00
|
|
|
|
-/
|
2023-05-15 14:00:01 +00:00
|
|
|
|
def toSet (sf : StepFunction) : Set Point :=
|
|
|
|
|
⋃ i ∈ Finset.finRange sf.p.ivls.length,
|
|
|
|
|
let I := sf.p.ivls[i]
|
|
|
|
|
Rectangle.Orthogonal.toSet
|
2023-05-15 20:07:42 +00:00
|
|
|
|
⟨
|
|
|
|
|
{
|
|
|
|
|
tl := ⟨I.left, sf.toFun i⟩,
|
|
|
|
|
bl := ⟨I.left, 0⟩,
|
|
|
|
|
br := ⟨I.right, 0⟩,
|
|
|
|
|
has_right_angle := sorry
|
|
|
|
|
},
|
|
|
|
|
by simp
|
|
|
|
|
⟩
|
2023-05-15 01:32:18 +00:00
|
|
|
|
|
|
|
|
|
end StepFunction
|
|
|
|
|
|
|
|
|
|
end Geometry
|