Repository navigation
feat(Geometry/Euclidean/Sphere): define arcs on spheres - #34164
Scarlett-le wants to merge 22 commits into
Conversation
PR summary b3084c7b64
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Geometry.Euclidean.Sphere.OrthRadius | 2188 | 2191 | +3 (+0.14%) |
Import changes for all files
| Files | Import difference |
|---|---|
6 filesMathlib.Geometry.Euclidean.Angle.Incenter Mathlib.Geometry.Euclidean.Angle.Sphere Mathlib.Geometry.Euclidean.Incenter Mathlib.Geometry.Euclidean.NinePointCircle Mathlib.Geometry.Euclidean.Sphere.Power Mathlib.Geometry.Euclidean.Sphere.Ptolemy |
2 |
Mathlib.Geometry.Euclidean.Sphere.OrthRadius Mathlib.Geometry.Euclidean.Sphere.Tangent |
3 |
Mathlib.Geometry.Euclidean.Sphere.Arc.Basic (new file) |
2287 |
Declarations diff (regex)
+ Arc
+ Sphere.radius_ne_zero_of_mem_of_mem_of_ne
+ avoiding
+ avoiding_left
+ avoiding_mid
+ avoiding_opposite
+ avoiding_right
+ coe_eq_interior_union_endpoints
+ coe_eq_singleton_iff_mid_eq_left
+ eq_minor_or_eq_major_of_ne
+ eq_of_left_eq_of_right_eq_of_sSameSide_mid
+ eq_or_eq_opposite_of_left_eq_of_right_eq
+ inner_mid_vsub_center_right_vsub_left
+ instance : CoeTC (Arc s) (Set P)
+ instance : Membership P (Arc s)
+ interior
+ interior_eq_empty_of_mid_eq_left
+ interior_subset
+ left_eq_right_iff_mem_line
+ left_eq_right_of_left_eq_mid
+ left_eq_right_of_mid_eq_right
+ left_mem_arc
+ left_mem_lineOrOrthRadius
+ lineOrOrthRadius
+ lineOrOrthRadius_comm
+ lineOrOrthRadius_of_eq
+ lineOrOrthRadius_of_ne
+ line_center_mid_le_perpBisector
+ line_center_opposite_mid
+ major
+ major_left
+ major_mid
+ major_opposite_eq_minor
+ major_right
+ mem_iff
+ mem_iff_wSameSide
+ mem_interior_iff
+ mem_interior_iff_mem_and_ne
+ mem_interior_of_mem_of_ne_left_of_ne_right
+ mem_interior_through
+ mem_lineOrOrthRadius_iff_of_mem_sphere
+ mem_of_mem_interior
+ mem_sphere_of_mem_interior
+ mem_through
+ mid_eq_pointReflection_center_left_of_left_eq_right_of_mid_ne_left
+ mid_mem_arc
+ mid_mem_interior
+ mid_notMem_line
+ mid_notMem_lineOrOrthRadius
+ midpoint_mid_opposite_mid
+ minor
+ minorMidpoint
+ minorMidpoint_comm
+ minorMidpoint_mem
+ minorMidpoint_self
+ minor_left
+ minor_mid
+ minor_ne_major
+ minor_opposite_eq_major
+ minor_right
+ ne_left_of_mem_interior
+ ne_right_of_mem_interior
+ notMem_avoiding
+ notMem_lineOrOrthRadius_of_mem_interior
+ notMem_lineOrOrthRadius_of_mem_sphere
+ not_wSameSide_mid_of_mem_sphere_of_notMem
+ opposite
+ opposite_involutive
+ opposite_left
+ opposite_mid_notMem_line
+ opposite_mid_vsub_center
+ opposite_opposite
+ opposite_right
+ pointReflection_center_mem
+ right
+ right_eq_reflection
+ right_mem
+ right_mem_arc
+ right_mem_lineOrOrthRadius
+ sOppSide_mid_opposite_mid
+ sOppSide_mid_opposite_mid_line
+ sSameSide_of_mem_interior
+ sSameSide_opposite_mid_iff
+ sbtw_mid_midpoint_opposite_mid
+ sum_vsub_center_ne_zero_of_not_isDiameter
+ through
+ throughMidpoint
+ throughMidpoint_eq_antipodal_of_eq
+ throughMidpoint_mem
+ through_left
+ through_mid
+ through_opposite
+ through_right
+ through_self_eq_major_self
You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.
Declarations diff (Lean)
✅ Lean-aware diff — post-build, computed from the Lean environment (commit
b3084c7).
- +115 new declarations
- −0 removed declarations
+EuclideanGeometry.Sphere.Arc
+EuclideanGeometry.Sphere.Arc.avoiding
+EuclideanGeometry.Sphere.Arc.avoiding.congr_simp
+EuclideanGeometry.Sphere.Arc.avoiding_left
+EuclideanGeometry.Sphere.Arc.avoiding_mid
+EuclideanGeometry.Sphere.Arc.avoiding_opposite
+EuclideanGeometry.Sphere.Arc.avoiding_right
+EuclideanGeometry.Sphere.Arc.casesOn
+EuclideanGeometry.Sphere.Arc.coe_eq_interior_union_endpoints
+EuclideanGeometry.Sphere.Arc.coe_eq_singleton_iff_mid_eq_left
+EuclideanGeometry.Sphere.Arc.ctorIdx
+EuclideanGeometry.Sphere.Arc.eq_minor_or_eq_major_of_ne
+EuclideanGeometry.Sphere.Arc.eq_of_left_eq_of_right_eq_of_sSameSide_mid
+EuclideanGeometry.Sphere.Arc.eq_or_eq_opposite_of_left_eq_of_right_eq
+EuclideanGeometry.Sphere.Arc.ext
+EuclideanGeometry.Sphere.Arc.ext_iff
+EuclideanGeometry.Sphere.Arc.inner_mid_vsub_center_right_vsub_left
+EuclideanGeometry.Sphere.Arc.instCoeTCSet
+EuclideanGeometry.Sphere.Arc.instMembership
+EuclideanGeometry.Sphere.Arc.interior
+EuclideanGeometry.Sphere.Arc.interior_eq_empty_of_mid_eq_left
+EuclideanGeometry.Sphere.Arc.interior_subset
+EuclideanGeometry.Sphere.Arc.left
+EuclideanGeometry.Sphere.Arc.left_eq_right_iff_mem_line
+EuclideanGeometry.Sphere.Arc.left_eq_right_of_left_eq_mid
+EuclideanGeometry.Sphere.Arc.left_eq_right_of_mid_eq_right
+EuclideanGeometry.Sphere.Arc.left_mem
+EuclideanGeometry.Sphere.Arc.left_mem_arc
+EuclideanGeometry.Sphere.Arc.line_center_mid_le_perpBisector
+EuclideanGeometry.Sphere.Arc.line_center_opposite_mid
+EuclideanGeometry.Sphere.Arc.major
+EuclideanGeometry.Sphere.Arc.major_left
+EuclideanGeometry.Sphere.Arc.major_mid
+EuclideanGeometry.Sphere.Arc.major_opposite_eq_minor
+EuclideanGeometry.Sphere.Arc.major_right
+EuclideanGeometry.Sphere.Arc.mem_iff
+EuclideanGeometry.Sphere.Arc.mem_iff_wSameSide
+EuclideanGeometry.Sphere.Arc.mem_interior_iff
+EuclideanGeometry.Sphere.Arc.mem_interior_iff_mem_and_ne
+EuclideanGeometry.Sphere.Arc.mem_interior_of_mem_of_ne_left_of_ne_right
+EuclideanGeometry.Sphere.Arc.mem_interior_through
+EuclideanGeometry.Sphere.Arc.mem_of_mem_interior
+EuclideanGeometry.Sphere.Arc.mem_sphere_of_mem_interior
+EuclideanGeometry.Sphere.Arc.mem_through
+EuclideanGeometry.Sphere.Arc.mid
+EuclideanGeometry.Sphere.Arc.mid_eq_pointReflection_center_left_of_left_eq_right_of_mid_ne_left
+EuclideanGeometry.Sphere.Arc.mid_mem
+EuclideanGeometry.Sphere.Arc.mid_mem_arc
+EuclideanGeometry.Sphere.Arc.mid_mem_interior
+EuclideanGeometry.Sphere.Arc.mid_notMem_line
+EuclideanGeometry.Sphere.Arc.mid_notMem_lineOrOrthRadius
+EuclideanGeometry.Sphere.Arc.midpoint_mid_opposite_mid
+EuclideanGeometry.Sphere.Arc.minor
+EuclideanGeometry.Sphere.Arc.minor.congr_simp
+EuclideanGeometry.Sphere.Arc.minorMidpoint
+EuclideanGeometry.Sphere.Arc.minorMidpoint_comm
+EuclideanGeometry.Sphere.Arc.minorMidpoint_mem
+EuclideanGeometry.Sphere.Arc.minorMidpoint_self
+EuclideanGeometry.Sphere.Arc.minor_left
+EuclideanGeometry.Sphere.Arc.minor_mid
+EuclideanGeometry.Sphere.Arc.minor_ne_major
+EuclideanGeometry.Sphere.Arc.minor_opposite_eq_major
+EuclideanGeometry.Sphere.Arc.minor_right
+EuclideanGeometry.Sphere.Arc.mk
+EuclideanGeometry.Sphere.Arc.mk.congr_simp
+EuclideanGeometry.Sphere.Arc.mk.inj
+EuclideanGeometry.Sphere.Arc.mk.injEq
+EuclideanGeometry.Sphere.Arc.mk.noConfusion
+EuclideanGeometry.Sphere.Arc.mk.sizeOf_spec
+EuclideanGeometry.Sphere.Arc.ne_left_of_mem_interior
+EuclideanGeometry.Sphere.Arc.ne_right_of_mem_interior
+EuclideanGeometry.Sphere.Arc.noConfusion
+EuclideanGeometry.Sphere.Arc.noConfusionType
+EuclideanGeometry.Sphere.Arc.notMem_avoiding
+EuclideanGeometry.Sphere.Arc.notMem_lineOrOrthRadius_of_mem_interior
+EuclideanGeometry.Sphere.Arc.not_wSameSide_mid_of_mem_sphere_of_notMem
+EuclideanGeometry.Sphere.Arc.opposite
+EuclideanGeometry.Sphere.Arc.opposite_involutive
+EuclideanGeometry.Sphere.Arc.opposite_left
+EuclideanGeometry.Sphere.Arc.opposite_mid_notMem_line
+EuclideanGeometry.Sphere.Arc.opposite_mid_vsub_center
+EuclideanGeometry.Sphere.Arc.opposite_opposite
+EuclideanGeometry.Sphere.Arc.opposite_right
+EuclideanGeometry.Sphere.Arc.rec
+EuclideanGeometry.Sphere.Arc.recOn
+EuclideanGeometry.Sphere.Arc.right
+EuclideanGeometry.Sphere.Arc.right_eq_reflection
+EuclideanGeometry.Sphere.Arc.right_mem
+EuclideanGeometry.Sphere.Arc.right_mem_arc
+EuclideanGeometry.Sphere.Arc.sOppSide_mid_opposite_mid
+EuclideanGeometry.Sphere.Arc.sOppSide_mid_opposite_mid_line
+EuclideanGeometry.Sphere.Arc.sSameSide_of_mem_interior
+EuclideanGeometry.Sphere.Arc.sSameSide_opposite_mid_iff
+EuclideanGeometry.Sphere.Arc.sbtw_mid_midpoint_opposite_mid
+EuclideanGeometry.Sphere.Arc.sum_vsub_center_ne_zero_of_not_isDiameter
+EuclideanGeometry.Sphere.Arc.through
+EuclideanGeometry.Sphere.Arc.through.congr_simp
+EuclideanGeometry.Sphere.Arc.throughMidpoint
+EuclideanGeometry.Sphere.Arc.throughMidpoint_eq_antipodal_of_eq
+EuclideanGeometry.Sphere.Arc.throughMidpoint_mem
+EuclideanGeometry.Sphere.Arc.through_left
+EuclideanGeometry.Sphere.Arc.through_mid
+EuclideanGeometry.Sphere.Arc.through_opposite
+EuclideanGeometry.Sphere.Arc.through_right
+EuclideanGeometry.Sphere.Arc.through_self_eq_major_self
+EuclideanGeometry.Sphere.left_mem_lineOrOrthRadius
+EuclideanGeometry.Sphere.lineOrOrthRadius
+EuclideanGeometry.Sphere.lineOrOrthRadius_comm
+EuclideanGeometry.Sphere.lineOrOrthRadius_of_eq
+EuclideanGeometry.Sphere.lineOrOrthRadius_of_ne
+EuclideanGeometry.Sphere.mem_lineOrOrthRadius_iff_of_mem_sphere
+EuclideanGeometry.Sphere.notMem_lineOrOrthRadius_of_mem_sphere
+EuclideanGeometry.Sphere.pointReflection_center_mem
+EuclideanGeometry.Sphere.radius_ne_zero_of_mem_of_mem_of_ne
+EuclideanGeometry.Sphere.right_mem_lineOrOrthRadiusNo changes to strong technical debt.
Increase in weak tech debt: (relative, absolute) = (1.00, 0.00)
| Current number | Change | Type (weak) |
|---|---|---|
| 4934 | 1 | exposed public sections |
Current commit b3084c7b64
Reference commit 3a2e014f23
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
I don't think this is the right way to set up arcs. Most importantly, I think the choice between two possible arcs between two points should be part of the data included in an There are four common ways to construct an arc between A and C in geometry problems, each of which should have a corresponding definition to construct an As for how to express that in Lean: I think the Then for membership of an arc, don't define it with angles (probably wouldn't work for arcs on a diameter). Rather, define membership ( For these definitions, "line" is normally |
|
I think the only case where my suggested approach behaves suboptimally is the degenerate one when |
Thank you for the detailed and thoughtful review. I agree with your analysis—the current design has several issues, particularly with diameter cases and the separation of arc selection from the data structure. I understand the suggested approach:
I've drafted a rough sketch of the new design below. Could you take a look and let me know if I'm on the right track? structure Arc (s : Sphere Pt) where
left : Pt
midpoint : Pt
left_mem : left ∈ s
midpoint_mem : midpoint ∈ s
-- Helper definition: chord or tangent line
def lineOrOrthRadius (s : Sphere Pt) (P Q : Pt) : AffineSubspace ℝ Pt :=
if P = Q then s.orthRadius P else affineSpan ℝ {P, Q}
variable {s : Sphere Pt}
-- right is computed via reflection of left across the line through center and midpoint
def Arc.right (a : Arc s) : Pt :=
reflection (line[ℝ, s.center, a.midpoint]) a.left
instance (s : Sphere Pt) : Membership Pt (Arc s) where
mem := fun (P : Pt) (a : Arc s) => P ∈ s ∧ (lineOrOrthRadius s a.left a.right).WSameSide a.midpoint P
instance (s : Sphere Pt) : CoeTC (Arc s) (Set Pt) where
coe := fun (a : Arc s) => { P : Pt | P ∈ a }
-- Interior of an arc (using sSameSide)
def Arc.interior (a : Arc s) : Set Pt :=
{ P | P ∈ s ∧ (s.lineOrOrthRadius a.left a.right).SSameSide a.midpoint P }
-- Predicate for non-degenerate arcs
def Arc.Nontrivial (a : Arc s) : Prop := a.midpoint ≠ a.left
-- Four standard constructors
-- Major arc from A to C (requires AC is not a diameter)
def Arc.major (s : Sphere Pt) (A C : Pt) (hA : A ∈ s) (hC : C ∈ s)
(hne : A ≠ C) (hNotDiam : ¬s.IsDiameter A C) : Arc s := sorry
-- Minor arc from A to C (requires AC is not a diameter)
def Arc.minor (s : Sphere Pt) (A C : Pt) (hA : A ∈ s) (hC : C ∈ s)
(hne : A ≠ C) (hNotDiam : ¬s.IsDiameter A C) : Arc s := sorry
-- Arc from A to C passing through B (requires B ≠ A and B ≠ C)
def Arc.through (s : Sphere Pt) (A B C : Pt) (hA : A ∈ s) (hB : B ∈ s) (hC : C ∈ s)
(hBA : B ≠ A) (hBC : B ≠ C) : Arc s := sorry
-- Arc from A to C avoiding B (requires B ≠ A and B ≠ C)
def Arc.avoiding (s : Sphere Pt) (A C B : Pt) (hA : A ∈ s) (hB : B ∈ s) (hC : C ∈ s)
(hBA : B ≠ A) (hBC : B ≠ C) : Arc s := sorry
-- Involution: opposite arc between the same endpoints
-- Uses the antipodal point of midpoint (point reflection through center)
def Arc.opposite (a : Arc s) : Arc s where
left := a.left
midpoint := AffineEquiv.pointReflection ℝ s.center a.midpoint -- antipodal point
left_mem := a.left_mem
midpoint_mem := sorry -- needs proof that antipodal point is on sphere
-- Bundled equivalence
def Arc.oppositeEquiv : Arc s ≃ Arc s where
toFun := Arc.opposite
invFun := Arc.opposite
left_inv := sorry
right_inv := sorryI'll continue working on this and appreciate any feedback on the overall direction. |
|
Yes, that seems along the right lines. I'd be inclined to put |
|
The original design of I'm not entirely sure if the current design of I plan to add the following lemmas in a future PR to properly utilize these conditions:
These lemmas require some key supporting results (likely about |
|
The problem with your definitions of Suggested approach for finding |
|
Thanks for the review! I've redesigned
|
|
I'd say that The main |
f724766 to
d5306ed
Compare
|
Thanks for the guidance. For |
|
This pull request has conflicts, please merge |
d5306ed to
8552bf6
Compare
46fd210 to
7235ddb
Compare
7235ddb to
cce0c19
Compare
|
-awaiting-author |
|
There is a specific way to list dependencies in the PR description. Could you check the PR template that explains it? |
…nner_self_eq_zero
…nrank-1 submodules
…/avoiding_right and rename mid
…vsub_vsub_center_lt_zero
Add: - `Arc.inner_mid_vsub_center_right_vsub_left`: the vector from `s.center` to `a.mid` is orthogonal to the chord `a.right -ᵥ a.left`. - `Arc.sOppSide_mid_opposite_mid`: in 2D, an arc's mid and the opposite arc's mid lie on strictly opposite sides of the chord. - `Arc.sSameSide_opposite_mid_iff`: in 2D, `a.opposite.mid` lies strictly on the same side of the chord as `s.center` iff `a.mid` does not. Refactor `mem_interior_through` and `not_mem_avoiding` to use `real_inner_sub_smul_div_inner_self_eq_zero`, `inner_vsub_vsub_center_lt_zero`, and `AffineSubspace.sSameSide_of_vsub_eq_smul` / `sOppSide_of_vsub_eq_smul`.
…neg with push Not
a3f05e3 to
4ce18c5
Compare
|
Please resolve the warnings shown by CI. |
|
-awaiting-author |
This PR defines arcs on spheres and proves basic properties.
Main definitions
EuclideanGeometry.Sphere.Arc: An arc on a sphere, defined by a leftendpoint and a midpoint on the sphere. The right endpoint is computed as
the reflection of left across the line through the center and mid.
Arc.opposite: The opposite arc (same endpoints, antipodal mid).Arc.oppositeEquiv: The involution given byopposite.Arc.minor/Arc.major: The minor/major arc between twonon-diametrically-opposite points.
Arc.through: The arc fromAtoCpassing throughB.Arc.avoiding: The arc fromAtoCnot passing throughB.Main results
through_right/avoiding_right: The right endpoint equalsC.mem_interior_through/mem_through:Blies in thethrougharc.not_mem_avoiding:Bdoes not lie in theavoidingarc (whenA ≠ C).Dependencies