Move area related concepts into one-variable-calculus.
parent
35ebf79274
commit
1724adf00d
|
@ -1,2 +1,3 @@
|
||||||
import Apostol.Chapter_I_3
|
import Apostol.Chapters
|
||||||
import Apostol.Exercises
|
import Apostol.Exercises
|
||||||
|
import Apostol.Real
|
|
@ -0,0 +1 @@
|
||||||
|
import Apostol.Chapters.Chapter_I_3
|
|
@ -60,7 +60,7 @@ Exercises 1.7
|
||||||
-- Prove that a triangle whose vertices are lattice points cannot be
|
-- Prove that a triangle whose vertices are lattice points cannot be
|
||||||
-- equilateral.
|
-- equilateral.
|
||||||
--
|
--
|
||||||
-- [Hint: Assume there is such a triangle and ocmpute its area in two ways,
|
-- [Hint: Assume there is such a triangle and compute its area in two ways,
|
||||||
-- using exercises 2 and 4.]
|
-- using exercises 2 and 4.]
|
||||||
-- ----------------------------------------
|
-- ----------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Mathlib.Data.Real.Basic
|
||||||
import Mathlib.Data.Real.Sqrt
|
import Mathlib.Data.Real.Sqrt
|
||||||
import Mathlib.Tactic.LibrarySearch
|
import Mathlib.Tactic.LibrarySearch
|
||||||
|
|
||||||
import Apostol.Chapter_I_3
|
import Apostol.Chapters.Chapter_I_3
|
||||||
import Bookshelf.Real.Rational
|
import Bookshelf.Real.Rational
|
||||||
|
|
||||||
-- ========================================
|
-- ========================================
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import Apostol.Real.Function
|
||||||
|
import Apostol.Real.Geometry
|
||||||
|
import Apostol.Real.Set
|
|
@ -0,0 +1 @@
|
||||||
|
import Apostol.Real.Function.Step
|
|
@ -1,8 +1,8 @@
|
||||||
import Mathlib.Data.Fin.Basic
|
import Mathlib.Data.Fin.Basic
|
||||||
import Mathlib.Tactic.NormNum
|
import Mathlib.Tactic.NormNum
|
||||||
|
|
||||||
|
import Apostol.Real.Set.Partition
|
||||||
import Bookshelf.Real.Basic
|
import Bookshelf.Real.Basic
|
||||||
import Bookshelf.Real.Set.Partition
|
|
||||||
|
|
||||||
namespace Real.Function
|
namespace Real.Function
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import Apostol.Real.Geometry.Area
|
||||||
|
import Apostol.Real.Geometry.Basic
|
||||||
|
import Apostol.Real.Geometry.Rectangle
|
|
@ -3,10 +3,10 @@ Chapter 1.6
|
||||||
|
|
||||||
The concept of area as a set function
|
The concept of area as a set function
|
||||||
-/
|
-/
|
||||||
import Bookshelf.Real.Function.Step
|
import Apostol.Real.Function.Step
|
||||||
import Bookshelf.Real.Geometry.Rectangle
|
import Apostol.Real.Geometry.Rectangle
|
||||||
|
|
||||||
namespace Real
|
namespace Real.Geometry.Area
|
||||||
|
|
||||||
/--
|
/--
|
||||||
All *measurable sets*, i.e. sets in the plane to which an area can be assigned.
|
All *measurable sets*, i.e. sets in the plane to which an area can be assigned.
|
||||||
|
@ -153,4 +153,4 @@ axiom exhaustion_exists_unique_imp_area_eq (Q : Set ℝ²)
|
||||||
(∀ x : ℝ, forall_subset_between_step_imp_le_between_area x Q → x = k))
|
(∀ x : ℝ, forall_subset_between_step_imp_le_between_area x Q → x = k))
|
||||||
→ area (exhaustion_exists_unique_imp_measurable Q ⟨k, h⟩) = k
|
→ area (exhaustion_exists_unique_imp_measurable Q ⟨k, h⟩) = k
|
||||||
|
|
||||||
end Real
|
end Real.Geometry.Area
|
|
@ -5,13 +5,17 @@ import Bookshelf.Real.Basic
|
||||||
namespace Real
|
namespace Real
|
||||||
|
|
||||||
/--
|
/--
|
||||||
The undirected angle at `p2` between the line segments to `p1` and `p3`.
|
The undirected angle at `p₂` between the line segments to `p₁` and `p₃`. If
|
||||||
|
either of those points equals `p₂`, this is `π / 2`.
|
||||||
|
|
||||||
PORT: `geometry.euclidean.angle`
|
PORT: `geometry.euclidean.angle`
|
||||||
-/
|
-/
|
||||||
axiom angle (p₁ p₂ p₃ : ℝ²) (h : p₁ ≠ p₂ ∧ p₂ ≠ p₃ ∧ p₃ ≠ p₁): ℝ
|
axiom angle (p₁ p₂ p₃ : ℝ²) : ℝ
|
||||||
|
|
||||||
notation "∠" => angle
|
noncomputable def port_geometry_euclidean_angle (p₁ p₂ p₃ : ℝ²) :=
|
||||||
|
if p₁ = p₂ ∨ p₂ = p₃ then π / 2 else angle p₁ p₂ p₃
|
||||||
|
|
||||||
|
notation "∠" => port_geometry_euclidean_angle
|
||||||
|
|
||||||
/--
|
/--
|
||||||
Determine the distance between two points in `ℝ²`.
|
Determine the distance between two points in `ℝ²`.
|
|
@ -0,0 +1,126 @@
|
||||||
|
import Apostol.Real.Geometry.Basic
|
||||||
|
|
||||||
|
namespace Real
|
||||||
|
|
||||||
|
/--
|
||||||
|
A `Rectangle` is characterized by three distinct points and the angle formed
|
||||||
|
between line segments originating from the "bottom left" point.
|
||||||
|
-/
|
||||||
|
structure Rectangle where
|
||||||
|
top_left : ℝ²
|
||||||
|
bottom_left : ℝ²
|
||||||
|
bottom_right : ℝ²
|
||||||
|
forms_right_angle : ∠ top_left bottom_left bottom_right = π / 2
|
||||||
|
|
||||||
|
namespace Rectangle
|
||||||
|
|
||||||
|
/--
|
||||||
|
The top-right corner of the rectangle, oriented with respect to the other
|
||||||
|
vertices.
|
||||||
|
-/
|
||||||
|
def top_right (r : Rectangle) : ℝ² :=
|
||||||
|
( r.top_left.fst + r.bottom_right.fst - r.bottom_left.fst
|
||||||
|
, r.top_left.snd + r.bottom_right.snd - r.bottom_left.snd
|
||||||
|
)
|
||||||
|
|
||||||
|
/--
|
||||||
|
A `Rectangle` is the locus of points bounded by its edges.
|
||||||
|
-/
|
||||||
|
def set_def (r : Rectangle) : Set ℝ² :=
|
||||||
|
sorry
|
||||||
|
|
||||||
|
theorem dist_top_eq_dist_bottom (r : Rectangle)
|
||||||
|
: dist r.top_left r.top_right = dist r.bottom_left r.bottom_right := by
|
||||||
|
unfold top_right dist
|
||||||
|
repeat rw [add_comm, sub_right_comm, add_sub_cancel']
|
||||||
|
|
||||||
|
theorem dist_left_eq_dist_right (r : Rectangle)
|
||||||
|
: dist r.top_left r.bottom_left = dist r.top_right r.bottom_right := by
|
||||||
|
unfold top_right dist
|
||||||
|
repeat rw [
|
||||||
|
sub_sub_eq_add_sub,
|
||||||
|
add_comm,
|
||||||
|
sub_add_eq_sub_sub,
|
||||||
|
sub_right_comm,
|
||||||
|
add_sub_cancel'
|
||||||
|
]
|
||||||
|
|
||||||
|
/--
|
||||||
|
Computes the width of a `Rectangle`.
|
||||||
|
-/
|
||||||
|
noncomputable def width (r : Rectangle) : ℝ :=
|
||||||
|
dist r.bottom_left r.bottom_right
|
||||||
|
|
||||||
|
/--
|
||||||
|
Computes the height of a `Rectangle`.
|
||||||
|
-/
|
||||||
|
noncomputable def height (r : Rectangle) : ℝ :=
|
||||||
|
dist r.bottom_left r.top_left
|
||||||
|
|
||||||
|
end Rectangle
|
||||||
|
|
||||||
|
/--
|
||||||
|
A `Point` is a `Rectangle` in which all points coincide.
|
||||||
|
-/
|
||||||
|
abbrev Point := Subtype (fun r : Rectangle =>
|
||||||
|
r.top_left = r.bottom_left ∧ r.bottom_left = r.bottom_right)
|
||||||
|
|
||||||
|
namespace Point
|
||||||
|
|
||||||
|
/--
|
||||||
|
A `Point` is the set consisting of just itself.
|
||||||
|
-/
|
||||||
|
def set_def (p : Point) : Set ℝ² :=
|
||||||
|
{ x : ℝ² | x = p.val.top_left }
|
||||||
|
|
||||||
|
/--
|
||||||
|
The width of a `Point` is `0`.
|
||||||
|
-/
|
||||||
|
theorem width_eq_zero (p : Point) : p.val.width = 0 := by
|
||||||
|
unfold Rectangle.width
|
||||||
|
rw [p.property.right]
|
||||||
|
unfold dist
|
||||||
|
simp
|
||||||
|
|
||||||
|
/--
|
||||||
|
The height of a `Point` is `0`.
|
||||||
|
-/
|
||||||
|
theorem height_eq_zero (p : Point) : p.val.height = 0 := by
|
||||||
|
unfold Rectangle.height
|
||||||
|
rw [p.property.left]
|
||||||
|
unfold dist
|
||||||
|
simp
|
||||||
|
|
||||||
|
end Point
|
||||||
|
|
||||||
|
/--
|
||||||
|
A `LineSegment` is a `Rectangle` in which two of the three points coincide.
|
||||||
|
-/
|
||||||
|
abbrev LineSegment := Subtype (fun r : Rectangle =>
|
||||||
|
(r.top_left = r.bottom_left ∧ r.bottom_left ≠ r.bottom_right) ∨
|
||||||
|
(r.top_left ≠ r.bottom_left ∧ r.bottom_left = r.bottom_right))
|
||||||
|
|
||||||
|
namespace LineSegment
|
||||||
|
|
||||||
|
def set_def (s : LineSegment) : Set ℝ² :=
|
||||||
|
sorry
|
||||||
|
|
||||||
|
theorem width_or_height_eq_zero (s : LineSegment)
|
||||||
|
: s.val.width = 0 ∨ s.val.height = 0 := by
|
||||||
|
apply Or.elim s.property
|
||||||
|
· intro h
|
||||||
|
refine Or.inr ?_
|
||||||
|
unfold Rectangle.height
|
||||||
|
rw [h.left]
|
||||||
|
unfold dist
|
||||||
|
simp
|
||||||
|
· intro h
|
||||||
|
refine Or.inl ?_
|
||||||
|
unfold Rectangle.width
|
||||||
|
rw [h.right]
|
||||||
|
unfold dist
|
||||||
|
simp
|
||||||
|
|
||||||
|
end LineSegment
|
||||||
|
|
||||||
|
end Real
|
|
@ -0,0 +1 @@
|
||||||
|
import Apostol.Real.Set.Partition
|
|
@ -1,6 +1,4 @@
|
||||||
import Bookshelf.Real.Basic
|
import Bookshelf.Real.Basic
|
||||||
import Bookshelf.Real.Function
|
|
||||||
import Bookshelf.Real.Geometry
|
|
||||||
import Bookshelf.Real.Rational
|
import Bookshelf.Real.Rational
|
||||||
import Bookshelf.Real.Sequence
|
import Bookshelf.Real.Sequence
|
||||||
import Bookshelf.Real.Set
|
import Bookshelf.Real.Set
|
||||||
|
|
|
@ -3,3 +3,14 @@ import Mathlib.Data.Real.Basic
|
||||||
notation "ℝ²" => ℝ × ℝ
|
notation "ℝ²" => ℝ × ℝ
|
||||||
|
|
||||||
notation "ℝ³" => ℝ² × ℝ
|
notation "ℝ³" => ℝ² × ℝ
|
||||||
|
|
||||||
|
namespace Real
|
||||||
|
|
||||||
|
/--
|
||||||
|
The area of a unit circle.
|
||||||
|
-/
|
||||||
|
axiom pi : ℝ
|
||||||
|
|
||||||
|
notation "π" => pi
|
||||||
|
|
||||||
|
end Real
|
|
@ -1 +0,0 @@
|
||||||
import Bookshelf.Real.Function.Step
|
|
|
@ -1,2 +0,0 @@
|
||||||
import Bookshelf.Real.Geometry.Basic
|
|
||||||
import Bookshelf.Real.Geometry.Rectangle
|
|
|
@ -1,44 +0,0 @@
|
||||||
import Bookshelf.Real.Geometry.Basic
|
|
||||||
|
|
||||||
namespace Real
|
|
||||||
|
|
||||||
/--
|
|
||||||
A `Rectangle` is characterized by three distinct points and the angle formed
|
|
||||||
between line segments originating from the "bottom left" point.
|
|
||||||
-/
|
|
||||||
structure Rectangle where
|
|
||||||
top_left : ℝ²
|
|
||||||
bottom_left : ℝ²
|
|
||||||
bottom_right : ℝ²
|
|
||||||
distinct_vertices :
|
|
||||||
top_left ≠ bottom_left ∧ bottom_left ≠ bottom_right ∧ bottom_right ≠ top_left
|
|
||||||
forms_right_angle :
|
|
||||||
∠ top_left bottom_left bottom_right distinct_vertices = π / 2
|
|
||||||
|
|
||||||
namespace Rectangle
|
|
||||||
|
|
||||||
/--
|
|
||||||
A calculation of the missing point.
|
|
||||||
-/
|
|
||||||
def top_right (r : Rectangle) : ℝ² :=
|
|
||||||
sorry
|
|
||||||
|
|
||||||
/--
|
|
||||||
A `Rectangle` is the locus of points bounded by its edges.
|
|
||||||
-/
|
|
||||||
def set_def (r : Rectangle) : Set ℝ² :=
|
|
||||||
sorry
|
|
||||||
|
|
||||||
/--
|
|
||||||
Computes the width of a `Rectangle`.
|
|
||||||
-/
|
|
||||||
noncomputable def width (r : Rectangle) : ℝ :=
|
|
||||||
dist r.bottom_left r.top_left
|
|
||||||
|
|
||||||
/--
|
|
||||||
Computes the height of a `Rectangle`.
|
|
||||||
-/
|
|
||||||
noncomputable def height (r : Rectangle) : ℝ :=
|
|
||||||
dist r.bottom_left r.bottom_right
|
|
||||||
|
|
||||||
end Real.Rectangle
|
|
|
@ -4,7 +4,7 @@ import Bookshelf.Real.Basic
|
||||||
Assert that a real number is rational.
|
Assert that a real number is rational.
|
||||||
|
|
||||||
Note this does *not* require the found rational to be in reduced form. Members
|
Note this does *not* require the found rational to be in reduced form. Members
|
||||||
of `ℚ` expect this (by proving the numerator and denominator are coprime).
|
of `ℚ` expect this (by proving the numerator and denominator are co-prime).
|
||||||
-/
|
-/
|
||||||
def rational (x : ℝ) := ∃ a : ℤ, ∃ b : ℕ, b ≠ 0 ∧ x = a / b
|
def rational (x : ℝ) := ∃ a : ℤ, ∃ b : ℕ, b ≠ 0 ∧ x = a / b
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
import Bookshelf.Real.Set.Basic
|
import Bookshelf.Real.Set.Basic
|
||||||
import Bookshelf.Real.Set.Interval
|
import Bookshelf.Real.Set.Interval
|
||||||
import Bookshelf.Real.Set.Partition
|
|
||||||
|
|
Loading…
Reference in New Issue