Repository navigation
[Merged by Bors] - feat: same/opposite side of an affine subspace from scalar multiples of a common vector - #40245
Scarlett-le wants to merge 1 commit into
Conversation
…of a common vector
PR summary fa949d3193Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by jsm28. |
|
|
||
| /-- If `x` and `y` are displaced from points of `s` by multiples of a common vector whose | ||
| coefficients have nonnegative product, they are weakly on the same side of `s`. -/ | ||
| theorem wSameSide_of_vsub_eq_smul {s : AffineSubspace R P} {x y p₁ p₂ : P} {m : V} {c₁ c₂ : R} |
There was a problem hiding this comment.
our naming conventions dictate that ASDFqwerZXCV is lowerCamelCased as asdfqwerZXCV, i.e., all the capital letters at the beginning are lowercased, not only the first one. The same applies for WOppSide too throughout the PR.
| theorem wSameSide_of_vsub_eq_smul {s : AffineSubspace R P} {x y p₁ p₂ : P} {m : V} {c₁ c₂ : R} | |
| theorem wsameSide_of_vsub_eq_smul {s : AffineSubspace R P} {x y p₁ p₂ : P} {m : V} {c₁ c₂ : R} |
There was a problem hiding this comment.
https://loogle.lean-lang.org/?q=AffineSubspace.WSameSide
This clashes with existing naming though. I suggest follow the existing name and do a rename later
There was a problem hiding this comment.
I would also argue that wSameSide is the correct one, same way as "htmlRequest" is the lower camel case of "HTMLRequest". The "W" here is a word of uppercase letter cluster (of a single letter), and Same is the second word, so Same keeps its uppercase
There was a problem hiding this comment.
Following the existing convention here — as the loogle results show, all 43 existing declarations use wSameSide/wOppSide/sSameSide/sOppSide, so I'll keep those forms. I also think they're correct per the naming guide: the W/S prefix is a single-letter initialism and Same/Side are separate words, so it lowercases exactly like HTMLRequest → htmlRequest (initialism fully lowercased, following word keeps its capital). So there's no clash to rename later.
| theorem sSameSide_of_vsub_eq_smul {s : AffineSubspace R P} {x y p₁ p₂ : P} {m : V} {c₁ c₂ : R} | ||
| (hp₁ : p₁ ∈ s) (hp₂ : p₂ ∈ s) (h₁ : x -ᵥ p₁ = c₁ • m) (h₂ : y -ᵥ p₂ = c₂ • m) | ||
| (hc : 0 ≤ c₁ * c₂) (hx : x ∉ s) (hy : y ∉ s) : s.SSameSide x y := |
There was a problem hiding this comment.
I didn't think hard about this, so maybe it's wrong, but couldn't you take 0 < c₁ * c₂ as a hypothesis instead of x ∉ s and y ∉ s? That would be more natural to me (but again, maybe it's wrong).
There was a problem hiding this comment.
Thanks for raising this, but I think this doesn't work as stated. SSameSide unfolds to WSameSide ∧ x ∉ s ∧ y ∉ s by definition, so the conclusion needs hypotheses strong enough to give x ∉ s and y ∉ s, and 0 < c₁ * c₂ doesn't. Counterexample: take m = 0 (or any m ∈ s.direction); then x = p₁ ∈ s and y = p₂ ∈ s regardless, yet 0 < c₁ * c₂ still holds. 0 < c₁ c₂ only fixes the sign/ray relationship, not whether m points out of s.
|
-awaiting-author |
ocfnash
left a comment
There was a problem hiding this comment.
Thanks!
Lemmas like this do make me reflect on Mathlib's Affine and Euclidean geometry results. I've partly persuaded myself that our definitions are a real strength but that we are in dire need of better tactics and are using lemmas as a crutch.
These are certainly useful well thought out lemmas but I can imagine a world in which they don't need to exist because we have created sufficiently power "affine geometry" tactics that they are all trivial one-liners.
I encourage people generously contributing to this part of the library to think about this :-)
Anyway, for now:
bors merge
…of a common vector (#40245) Add `sameRay_smul_smul_of_mul_nonneg` to `Mathlib/LinearAlgebra/Ray.lean`: two scalar multiples `c₁ • v` and `c₂ • v` of a common vector lie on a common ray whenever `0 ≤ c₁ * c₂`. Using it, add four lemmas to `Mathlib/Analysis/Convex/Side.lean` giving sufficient conditions for a pair of points to be (weakly/strictly) on the same or opposite side of an affine subspace, from the displacements `x -ᵥ p₁ = c₁ • m` and `y -ᵥ p₂ = c₂ • m`. The sign of `c₁ * c₂` determines same vs opposite side: * `AffineSubspace.wSameSide_of_vsub_eq_smul` / `sSameSide_of_vsub_eq_smul` * `AffineSubspace.wOppSide_of_vsub_eq_smul` / `sOppSide_of_vsub_eq_smul` Co-authored-by: Scarlett-le <[email protected]>
|
Pull request successfully merged into master. Build succeeded: |
…of a common vector (leanprover-community#40245) Add `sameRay_smul_smul_of_mul_nonneg` to `Mathlib/LinearAlgebra/Ray.lean`: two scalar multiples `c₁ • v` and `c₂ • v` of a common vector lie on a common ray whenever `0 ≤ c₁ * c₂`. Using it, add four lemmas to `Mathlib/Analysis/Convex/Side.lean` giving sufficient conditions for a pair of points to be (weakly/strictly) on the same or opposite side of an affine subspace, from the displacements `x -ᵥ p₁ = c₁ • m` and `y -ᵥ p₂ = c₂ • m`. The sign of `c₁ * c₂` determines same vs opposite side: * `AffineSubspace.wSameSide_of_vsub_eq_smul` / `sSameSide_of_vsub_eq_smul` * `AffineSubspace.wOppSide_of_vsub_eq_smul` / `sOppSide_of_vsub_eq_smul` Co-authored-by: Scarlett-le <[email protected]>
…of a common vector (leanprover-community#40245) Add `sameRay_smul_smul_of_mul_nonneg` to `Mathlib/LinearAlgebra/Ray.lean`: two scalar multiples `c₁ • v` and `c₂ • v` of a common vector lie on a common ray whenever `0 ≤ c₁ * c₂`. Using it, add four lemmas to `Mathlib/Analysis/Convex/Side.lean` giving sufficient conditions for a pair of points to be (weakly/strictly) on the same or opposite side of an affine subspace, from the displacements `x -ᵥ p₁ = c₁ • m` and `y -ᵥ p₂ = c₂ • m`. The sign of `c₁ * c₂` determines same vs opposite side: * `AffineSubspace.wSameSide_of_vsub_eq_smul` / `sSameSide_of_vsub_eq_smul` * `AffineSubspace.wOppSide_of_vsub_eq_smul` / `sOppSide_of_vsub_eq_smul` Co-authored-by: Scarlett-le <[email protected]>
Add
sameRay_smul_smul_of_mul_nonnegtoMathlib/LinearAlgebra/Ray.lean: two scalar multiplesc₁ • vandc₂ • vof a common vector lie on a common ray whenever0 ≤ c₁ * c₂. Using it, add four lemmas toMathlib/Analysis/Convex/Side.leangiving sufficient conditions for a pair of points to be (weakly/strictly) on the same or opposite side of an affine subspace, from the displacementsx -ᵥ p₁ = c₁ • mandy -ᵥ p₂ = c₂ • m. The sign ofc₁ * c₂determines same vs opposite side:AffineSubspace.wSameSide_of_vsub_eq_smul/sSameSide_of_vsub_eq_smulAffineSubspace.wOppSide_of_vsub_eq_smul/sOppSide_of_vsub_eq_smulThis PR is a prerequisite for #34164 (feat(Geometry/Euclidean/Sphere): define arcs on spheres).