bookshelf/shared/Bookshelf/Real/Geometry/Basic.lean

51 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Mathlib.Data.Real.Sqrt
import Bookshelf.Real.Basic
namespace Real
/--
The undirected angle at `p2` between the line segments to `p1` and `p3`.
PORT: `geometry.euclidean.angle`
-/
axiom angle (p₁ p₂ p₃ : ℝ²) (h : p₁ ≠ p₂ ∧ p₂ ≠ p₃ ∧ p₃ ≠ p₁):
notation "∠" => angle
/--
Determine the distance between two points in `ℝ²`.
-/
noncomputable def dist (x y : ℝ²) :=
Real.sqrt ((abs (y.1 - x.1)) ^ 2 + (abs (y.2 - x.2)) ^ 2)
/--
Two sets `S` and `T` are `similar` iff there exists a one-to-one correspondence
between `S` and `T` such that the distance between any two points `P, Q ∈ S` and
corresponding points `P', Q' ∈ T` differ by some constant `α`. In other words,
`α|PQ| = |P'Q'|`.
-/
def similar (S T : Set ℝ²) : Prop :=
∃ f : ℝ² → ℝ², Function.Bijective f ∧
∃ s : , ∀ x y : ℝ², x ∈ S ∧ y ∈ T →
s * dist x y = dist (f x) (f y)
/--
Two sets are congruent if they are similar with a scaling factor of `1`.
-/
def congruent (S T : Set ( × )) : Prop :=
∃ f : ℝ² → ℝ², Function.Bijective f ∧
∀ x y : ℝ², x ∈ S ∧ y ∈ T →
dist x y = dist (f x) (f y)
/--
Any two congruent sets must be similar to one another.
-/
theorem congruent_similar {S T : Set ℝ²} : congruent S T → similar S T := by
intro hc
let ⟨f, ⟨hf, hs⟩⟩ := hc
conv at hs => intro x y hxy; arg 1; rw [← one_mul (dist x y)]
exact ⟨f, ⟨hf, ⟨1, hs⟩⟩⟩
end Real