feat(Relativity): reverse Cauchy-Schwarz and triangle inequalities, twin paradox age gap nonnegative - #1642
Conversation
…win paradox age gap nonnegative Adds Physlib/Relativity/Tensors/RealTensor/Vector/Causality/ReverseTriangle.lean with IsFutureCausal, isFutureCausal_of_causallyFollows, the elementary inequality sqrt_mul_sqrt_le, norm_spatialPart_le_timeComponent, the reverse Cauchy-Schwarz inequality sqrt_mul_sqrt_le_minkowskiProduct, minkowskiProduct_add_self, the reverse triangle inequality sqrt_add_sqrt_le_sqrt_add and isFutureCausal_add. In Physlib/Relativity/Special/TwinParadox/Basic.lean, replaces the informal lemma ageGap_nonneg (tag 7ROVE) by a proof. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
|
Thank you for this pull-request (PR). If this is your first PR, welcome to the community! Below is what will happen next. Please read carefully if you are not familiar with the process. You may open other PRs while this one is being reviewed, and can stack PRs on top of each other, so don't let these steps slow you down.
Tip: The easiest way to get have a fast review is to submit a PR that is small and self-contained, and has clear documentation explaining why things are the way they are in your chages. If you have any problems or questions, please reach out to the community on the Zulip. |
jstoobysmith
left a comment
There was a problem hiding this comment.
Some comments here are specific to this pull request but probably extend throughout all of the pull requests that you've made. Could you make sure that these are addressed in all of them, because it would make the review process a lot quicker or easier? If you have any ideas of how you can make the review process easier for us, that would also be great.
|
|
||
| /-- For `0 ≤ c ≤ a` and `0 ≤ d ≤ b`, `√(a² - c²) √(b² - d²) ≤ a b - c d`: indeed | ||
| `(a b - c d)² - (a² - c²)(b² - d²) = (a d - b c)²`. -/ | ||
| lemma sqrt_mul_sqrt_le {a b c d : ℝ} (hc : 0 ≤ c) (hca : c ≤ a) (hd : 0 ≤ d) (hdb : d ≤ b) : |
There was a problem hiding this comment.
If possible, we shouldn't include lemmas like this. It's best just to include them in the proofs of our results because they mess up the code.
| -/ | ||
|
|
||
| /-- `⟪u, u⟫ₘ = (u⁰)² - ‖u_spatial‖²`. -/ | ||
| lemma minkowskiProduct_self_eq_sq_sub {d : ℕ} (u : Vector d) : |
There was a problem hiding this comment.
This should go near the definition of Minkowski products.
There was a problem hiding this comment.
Likewise with some of the other definitions in this file.
There was a problem hiding this comment.
I would rename this file "IsFutureCausal" because that is the data structure that the results in this file are about, rather than naming it after the lemma or the property.
There was a problem hiding this comment.
Or if it's just the same as "causally follows" with one of the vectors zero, we should just use that instead.
|
Should have also said: many thanks for these. They look, in general, very good. Just one or two things probably need changing with each of them. |
…cture, lemmas next to their definitions Applies the review remarks of leanprover-community#1642: the predicate IsFutureCausal is replaced by causallyFollows 0 u (equivalent), the file is renamed Causality/CausallyFollows.lean, the Minkowski product lemmas move to MinkowskiProduct.lean, the component lemmas to Vector/Basic.lean, and the elementary inequality is inlined in the proofs that use it. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…cture, lemmas next to their definitions Applies the review remarks of leanprover-community#1642: the predicate IsFutureCausal is replaced by causallyFollows 0 u (equivalent), the file is renamed Causality/CausallyFollows.lean, the Minkowski product lemmas move to MinkowskiProduct.lean, the component lemmas to Vector/Basic.lean, and the elementary inequality is inlined in the proofs that use it. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
|
Thank you for the review. The four points are now applied across all my open PRs (one extra commit per branch, no force-push): no isolated general-purpose lemma, lemmas next to the definition of their object, files named after the structure, and -awaiting-author |
jstoobysmith
left a comment
There was a problem hiding this comment.
Looks and sounds good to me. I've added one more comment here, but otherwise this pull request looks good.
|
|
||
| /-- For a vector in the causal future of the origin, the Euclidean norm of the spatial part is at | ||
| most the time component. -/ | ||
| lemma norm_spatialPart_le_timeComponent {d : ℕ} {u : Vector d} (hu : causallyFollows 0 u) : |
There was a problem hiding this comment.
This lemma and the ones that follow it should end with _of_causallyFollows
…esis As requested in the review of leanprover-community#1642: the lemmas of CausallyFollows.lean whose hypotheses are causallyFollows 0 u end with _of_causallyFollows. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…esis As requested in the review of leanprover-community#1642: the lemmas of CausallyFollows.lean whose hypotheses are causallyFollows 0 u end with _of_causallyFollows. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
jstoobysmith
left a comment
There was a problem hiding this comment.
Approved. This now looks good to me. I will merge it shortly. Could you update the pull requests that depend on this after this merger has gone through. I think you're probably aware of this already, but PhyslibAlpha has a much quicker process to get stuff in, where we don't have to go through quite as detailed a review process. If you want to skip that phase and put stuff straight into PhyslibAlpha, that's fine. Obviously, we appreciate you taking the time to go through these reviews.
|
Thank you. The dependent pull requests are updated: master merged into #1643 and into the cosmology stack #1633 to #1641 (no force-push). Since #1632 was merged before its review fixes were pushed, #1633 now carries those fixes for the de Sitter part; this is noted in its body. I will keep the series that fill Physlib TODO items under the full review, and use PhyslibAlpha for material outside the TODO list. |
…win paradox age gap zero (#1643) * feat(Relativity): reverse Cauchy-Schwarz and triangle inequalities, twin paradox age gap nonnegative Adds Physlib/Relativity/Tensors/RealTensor/Vector/Causality/ReverseTriangle.lean with IsFutureCausal, isFutureCausal_of_causallyFollows, the elementary inequality sqrt_mul_sqrt_le, norm_spatialPart_le_timeComponent, the reverse Cauchy-Schwarz inequality sqrt_mul_sqrt_le_minkowskiProduct, minkowskiProduct_add_self, the reverse triangle inequality sqrt_add_sqrt_le_sqrt_add and isFutureCausal_add. In Physlib/Relativity/Special/TwinParadox/Basic.lean, replaces the informal lemma ageGap_nonneg (tag 7ROVE) by a proof. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * feat(Relativity): equality case of the reverse triangle inequality, twin paradox age gap zero Adds to Physlib/Relativity/Tensors/RealTensor/Vector/Causality/ReverseTriangle.lean the equality cases minkowskiProduct_eq_iff (equality in the reverse Cauchy-Schwarz inequality iff the vectors are proportional with a nonnegative factor) and sqrt_add_eq_iff, with the helpers eq_zero_of_timeComponent_of_spatialPart, apply_inr_eq_zero_of_norm_spatialPart, minkowskiProduct_smul_self and sqrt_minkowskiProduct_smul_self; and to Physlib/Relativity/Special/TwinParadox/Basic.lean the lemma ageGap_eq_zero_iff (the age gap vanishes iff the turning point of Twin B lies on the worldline of Twin A) and example1_ageGap_ne_zero, resolving the TODO on the vanishing age gap. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Relativity): use causallyFollows 0 u, file named after the structure, lemmas next to their definitions Applies the review remarks of #1642: the predicate IsFutureCausal is replaced by causallyFollows 0 u (equivalent), the file is renamed Causality/CausallyFollows.lean, the Minkowski product lemmas move to MinkowskiProduct.lean, the component lemmas to Vector/Basic.lean, and the elementary inequality is inlined in the proofs that use it. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Relativity): name the lemmas after their causallyFollows hypothesis As requested in the review of #1642: the lemmas of CausallyFollows.lean whose hypotheses are causallyFollows 0 u end with _of_causallyFollows. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Relativity): extract ageGap_eq, the age gap in terms of the two legs of Twin B As suggested in the review of #1643; used by ageGap_eq_zero_iff and ageGap_nonneg. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Relativity): indent the statement of ageGap_eq Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Philippe Kevorkian <philippe@hotelrelaisduloir.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…(radiation, Einstein-de Sitter) (#1633) * feat(Cosmology): de Sitter solution of the Friedmann equations Adds to Physlib/Cosmology/FLRW/Solutions.lean the de Sitter scale factor deSitterScaleFactor, its time derivatives, and the lemmas deSitterScaleFactor_firstOrderFriedmann, deSitterScaleFactor_secondOrderFriedmann, hubbleConstant_deSitterScaleFactor and decelerationParameter_deSitterScaleFactor, resolving the first TODO of the file. Also deriv_comp_val, the time derivative of a curve given as a function of the time coordinate. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * feat(Cosmology): flat power-law solutions of the Friedmann equations Adds to Physlib/Cosmology/FLRW/Solutions.lean the power-law scale factor powerLawScaleFactor with its derivatives, Hubble and deceleration parameters, the density powerLawDensity it imposes, and the radiation-dominated (radiationScaleFactor, radiationDensity, radiationPressure) and Einstein-de Sitter (einsteinDeSitterScaleFactor, einsteinDeSitterDensity) instances with their Friedmann lemmas, q and H(t0), resolving two TODOs of the file. Also deriv_eq_of_hasDerivAt. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * chore(Cosmology): order authors alphabetically by last name Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Cosmology): inline one-off helper lemmas, move the Time derivative bridges next to their definition Applies the review remarks of #1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Cosmology): inline the power-law scaffolding of the flat solutions The general power-law solution a = (t / t0) ^ n is stated inline in the lemmas, quantified over n; the defs powerLawScaleFactor, powerLawDensity, radiationDensity, radiationPressure and einsteinDeSitterDensity and the two _eq glue lemmas are removed, the densities and the pressure now appear in the theorem statements, and radiationScaleFactor and einsteinDeSitterScaleFactor are defined directly. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Cosmology): the normalisation epoch of the power-law solutions is a Time t0 : Time instead of a real number in the power-law, radiation-dominated and Einstein-de Sitter solutions (so H(t0) is stated at t0 itself), and docstrings saying that t0 is the normalisation epoch a(t0) = 1, that the Big Bang sits at the origin t.val = 0 of the time chart, and that the values for t.val <= 0 are junk. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Philippe Kevorkian <philippe@hotelrelaisduloir.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
#1634) * feat(Cosmology): de Sitter solution of the Friedmann equations Adds to Physlib/Cosmology/FLRW/Solutions.lean the de Sitter scale factor deSitterScaleFactor, its time derivatives, and the lemmas deSitterScaleFactor_firstOrderFriedmann, deSitterScaleFactor_secondOrderFriedmann, hubbleConstant_deSitterScaleFactor and decelerationParameter_deSitterScaleFactor, resolving the first TODO of the file. Also deriv_comp_val, the time derivative of a curve given as a function of the time coordinate. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * feat(Cosmology): flat power-law solutions of the Friedmann equations Adds to Physlib/Cosmology/FLRW/Solutions.lean the power-law scale factor powerLawScaleFactor with its derivatives, Hubble and deceleration parameters, the density powerLawDensity it imposes, and the radiation-dominated (radiationScaleFactor, radiationDensity, radiationPressure) and Einstein-de Sitter (einsteinDeSitterScaleFactor, einsteinDeSitterDensity) instances with their Friedmann lemmas, q and H(t0), resolving two TODOs of the file. Also deriv_eq_of_hasDerivAt. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * feat(Cosmology): Milne solution and Einstein static universe relations Adds to Physlib/Cosmology/FLRW/Solutions.lean the Milne scale factor milneScaleFactor with its Friedmann lemmas (k = -1, empty universe) and q = 0, the density cosmologicalConstantDensity, and the equilibrium relations of the Einstein static universe: einsteinStatic_density (rho = 2 rho_Lambda), einsteinStatic_curvature (k c^2 / a^2 = 4 pi G rho) and einsteinStatic_curvature_pos. The curvature of the Milne model and the instability of the static universe stay as narrowed TODOs. Generated with Claude Code under human supervision (see AI-POLICY.md). Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * chore(Cosmology): order authors alphabetically by last name Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * chore(Cosmology): order authors alphabetically by last name Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Cosmology): inline one-off helper lemmas, move the Time derivative bridges next to their definition Applies the review remarks of #1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * style(Cosmology): inline one-off helper lemmas, move the Time derivative bridges next to their definition Applies the review remarks of #1642 across the series: no isolated general-purpose lemma, and lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Cosmology): inline the power-law scaffolding of the flat solutions The general power-law solution a = (t / t0) ^ n is stated inline in the lemmas, quantified over n; the defs powerLawScaleFactor, powerLawDensity, radiationDensity, radiationPressure and einsteinDeSitterDensity and the two _eq glue lemmas are removed, the densities and the pressure now appear in the theorem statements, and radiationScaleFactor and einsteinDeSitterScaleFactor are defined directly. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Cosmology): the normalisation epoch of the power-law solutions is a Time t0 : Time instead of a real number in the power-law, radiation-dominated and Einstein-de Sitter solutions (so H(t0) is stated at t0 itself), and docstrings saying that t0 is the normalisation epoch a(t0) = 1, that the Big Bang sits at the origin t.val = 0 of the time chart, and that the values for t.val <= 0 are junk. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * docs(Cosmology): the Milne scale factor puts the Big Bang at the origin of the time chart Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> * refactor(Cosmology): state the Einstein static density directly The density of the Einstein static universe is stated as rho = Lambda c^2 / (4 pi G); the def cosmologicalConstantDensity is dropped from this file, the cosmological constant as a w = -1 fluid being the matter-content TODO of Physlib.Cosmology.FLRW.MatterContent. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Philippe Kevorkian <philippe@hotelrelaisduloir.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
AI disclosure
AI disclosure. This PR was generated with Claude Fable 5.1 (Claude Code) under my
supervision, following
AI-POLICY.mdandAGENTS.md. I have read every definition and lemmastatement and vouch that they state what the docstrings say. The statements were fixed before
the proofs were written; the elementary inequality at the core was checked symbolically.
Turns the informal lemma
ageGap_nonneg(tag 7ROVE) ofPhyslib/Relativity/Special/TwinParadox/Basic.leaninto a proved lemma, through the reversetriangle inequality of Minkowski space, which was not in Physlib.
New file
Physlib/Relativity/Tensors/RealTensor/Vector/Causality/CausallyFollows.lean(namespace
Lorentz.Vector), about vectors in the causal future of the origin,causallyFollows 0 u:causallyFollows_zero_iff:causallyFollows 0 u ↔ 0 ≤ ⟪u, u⟫ₘ ∧ 0 ≤ u.timeComponent;causallyFollows_zero_sub:causallyFollows p q → causallyFollows 0 (q - p).norm_spatialPart_le_timeComponent_of_causallyFollows:‖u_spatial‖ ≤ u⁰.sqrt_mul_sqrt_le_minkowskiProduct_of_causallyFollows: the reverse Cauchy-Schwarz inequality√⟪u, u⟫ₘ √⟪v, v⟫ₘ ≤ ⟪u, v⟫ₘforu,vin the causal future of the origin (EuclideanCauchy-Schwarz on the spatial parts plus the elementary inequality
√(a² - c²) √(b² - d²) ≤ a b - c dfor0 ≤ c ≤ a,0 ≤ d ≤ b, inlined in the proof).sqrt_add_sqrt_le_sqrt_add_of_causallyFollows: the reverse triangle inequality√⟪u, u⟫ₘ + √⟪v, v⟫ₘ ≤ √⟪u + v, u + v⟫ₘ;causallyFollows_zero_add_of_causallyFollows.Added to
MinkowskiProduct.lean, next tominkowskiProduct_self_eq_timeComponent_spatialPart:minkowskiProduct_self_eq_sq_sub(⟪u, u⟫ₘ = (u⁰)² - ‖u_spatial‖²) andminkowskiProduct_add_self.TwinParadox/Basic.lean:informal_lemma ageGap_nonnegreplaced bylemma ageGap_nonneg : 0 ≤ T.ageGap.Physlib.lean: the new file registered.Reviewer map:
CausallyFollows.leansections B (reverse Cauchy-Schwarz, with the elementaryinequality inlined) and C; then the four-line proof of
ageGap_nonneg.Update (Sept 11). Review remarks applied (second commit): no separate predicate, everything is
stated with
causallyFollows 0 u; the file is named after that structure; the Minkowski productlemmas moved next to the definition of the product; the elementary inequality is inlined. The same
rules were applied to the other open PRs of mine.
Update (Sept 11, later). Second review remark applied: the lemmas whose hypotheses are
causallyFollows 0 unow end with_of_causallyFollows.🤖 Generated with Claude Code