New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(geometry/euclidean/ceva) : Ceva's Theorem, problem 61 on Freek's list #10632
base: master
Are you sure you want to change the base?
Conversation
Results in mathlib should generally be given in appropriately general form. Ceva's theorem (+ converse, which I'm generally considering together) is essentially an affine result; it should work in any affine space (for a vector space over any field), with no restriction to the reals, as long as you express things without involving the notion of "distance". Even with distance involved, nothing should depend on the space being Euclidean (that is, an inner product being involved); everything should work for an arbitrary real Then, there are n-dimensional versions of Ceva. So it would seem most appropriate to prove results in an n-dimensional case and only then deduce 2-dimensional versions. Note that the appropriate conditions may differ between the various general results and their converses. If you want to prove a converse (hypothesis on ratios, conclusion of lines being concurrent or parallel), you don't need the points given to be affinely independent; they can be an arbitrary indexed family of points (might need to be a finite indexed family until affine combinations are refactored to use For "concurrent or parallel implies weights consistent", it's also likely that things can be done over a ring (maybe needing commutativity, maybe not), but you do need affine independence. So I expect you get lots of different n-dimensional variants each with the weakest hypotheses that work for that result (and then some |
It's possible that structuring things like I suggest will mean some of your current lemmas are no longer used in the proof, but it's quite possible that such lemmas (in whatever their most general form is) are still mathlib-appropriate somewhere. |
Also note that any PR adding a result from Freek's list should make sure to update |
Thanks for the comments @jsm28 and for pointing out the shortcomings of my work. It seems like there's a hell of a lot more work to do and I cannot help but feel a bit lost while thinking about how to structure my work next. Perhaps there is a resource on Ceva's Theorem in its full generality somewhere? |
I don't know of such a resource. A lot of doing things for the weakest type classes is working out as you go along what the weakest type class some fragment of the result is true for is (and you might e.g. try proving for Note that this includes stating things in the way that's true most generally. Sometimes multiple statements may be obviously (to a human mathematician) equivalent for fields, but not equivalent for a weaker type class, in which case it's appropriate to give the statement in whichever form allows the weakest hypotheses, and then maybe deduce the other variants (where useful) that need stronger hypotheses. This is where my point about working with arbitrary indexed families of points comes in: some things don't need affine independence, and nothing needs the points to span the whole space. That in turn indicates that formulating lemmas and proofs to express things using affine combinations rather than barycentric coordinates is more appropriate: the two are very similar mathematically, but barycentric coordinates introduce both a requirement for affine independence (only needed for some results) and one for the points spanning the whole space (not needed for any results). (It's possible to use barycentric coordinates in a proof of a result that only requires the family of points to be independent but not necessarily spanning, by passing back and forth between the original space and the Similarly, the idiomatic way of talking about the line through two points is to talk about the Indeed, a fair number of lemmas involved in doing things in general would I think be lemmas about a single cevian, before you get onto configurations with multiple such lines: talking about when a point lies on such a cevian, before talking about when it lies on all cevians. And in turn those would likely be based on lemmas about the All those lemmas should be pretty trivial, with proofs of at most a few lines. But mathematically, Ceva's theorem itself is pretty trivial; in terms of affine combinations / barycentric coordinates, it's just talking about proportions among n-tuples of numbers, and if it takes more than a few lines of manipulation to translate between different forms of the result, that suggests some lemmas to help with that manipulation are missing. (Indeed, for the converse or |
…mmas Add lemmas about weighted sums of `-ᵥ` expressions in terms of `weighted_vsub_of_point`, `weighted_vsub` and `affine_combination`, with special cases where the points on one side of the subtractions are constant, and lemmas about those three functions for constant points used to prove those special cases. These were suggested by one of the lemmas in #10632; the lemma `affine_basis.vsub_eq_coord_smul_sum` is a very specific case, but showed up that these distributivity lemmas were missing (and should follow immediately from `sum_smul_vsub_const_eq_vsub_affine_combination` in this PR).
It might make sense to put this form of Ceva in |
lemma affine_span.simplex_eq_top [finite_dimensional ℝ V] {n : ℕ} (T : simplex ℝ V n) | ||
(hrank : finrank ℝ V = n): affine_span ℝ (set.range T.points) = ⊤ := | ||
begin | ||
rw [affine_independent.affine_span_eq_top_iff_card_eq_finrank_add_one T.independent, | ||
fintype.card_fin, hrank], | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one might be appropriate for mathlib more or less as is, when stated over an arbitrary field and put in linear_algebra.affine_space.finite_dimensional
. However, note that a name starting affine.simplex.
might be more useful than one starting affine_span.
because it would enable use of the lemma with dot notation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires linear_algebra.affine_space.finite_dimensional
and linear_algebra.affine_space.independent
, and neither imports the other. Is there a common child file close enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linear_algebra.affine_space.finite_dimensional
imports linear_algebra.affine_space.independent
.
Hey @jsm28! I've been super busy for the past two weeks, sorry for not responding to your suggestions. Unfortunately, the earliest I can come back to work on this properly will be by late January. I'm interested in formalizing the higher generality Ceva's theorems, as you've suggested, but that will of course take some time. In the meantime, I'd agree with putting the current version in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a full review, just some minor stylistic points.
…mmas (#10786) Add lemmas about weighted sums of `-ᵥ` expressions in terms of `weighted_vsub_of_point`, `weighted_vsub` and `affine_combination`, with special cases where the points on one side of the subtractions are constant, and lemmas about those three functions for constant points used to prove those special cases. These were suggested by one of the lemmas in #10632; the lemma `affine_basis.vsub_eq_coord_smul_sum` is a very specific case, but showed up that these distributivity lemmas were missing (and should follow immediately from `sum_smul_const_vsub_eq_vsub_affine_combination` in this PR).
For reference, as Yaël Dillies mentioned this PR in Zulip. I have tried to adapt the Ceva theorem proof from Metamath. Available at: https://gist.github.com/anders-was-here/d786450daba4c01e40bbc5f81c681feb The Metamath proof/formalization by Saveliy Skresanov: http://us.metamath.org/mpeuni/cevath.html (It's totally unpolished, it was mostly for learning Lean and Metamath and for fun. Maybe the sigar* lemmas could have some use elsewhere in Mathlib). |
Add lemmas about the `vector_span` and `affine_span of two points (analogous to `span_singleton` lemmas for `submodule`). --- Although I previously noted in review of #10632 that I expected such lemmas to be of relevance to proving Ceva's theorem in appropriate generality, my immediate motivation for this PR is various other geometrical uses.
…mbinations Add some lemmas about spans of two points expressed as affine combinations. --- Some of these are the sort of thing I suggested in #10632 as likely to be useful intermediate steps towards Ceva's theorem, though that's not what I'm aiming towards right now (rather, I'm aiming towards a statement along the lines of: if lines from two vertices of a triangle to interior points of the opposite sides meet, they do so inside the triangle).
This PR/issue depends on: |
@jsm28, could you state (in Lean, if possible!) the higher dimensional version you're thinking of? Also, should we use |
The following is for any affine space over a field, with no requirements for any order on the field (and thus not involving distance or interior), and some lemmas may well be true in more general contexts, such as rings or division rings, in which case they should be proved in such contexts. Appropriate nondegeneracy conditions will need to be added for each result. Results may be true in some form for infinite indexed families or they may require the families to be finite; they're probably simpler to state and prove in the finite case. It's never required for the families to span the whole space. Forward direction (concurrent or parallel implies ratios): consider some indexed affinely independent family of points ( Reverse direction (ratios imply concurrent or parallel): consider some indexed family of points, which doesn't need to be affinely independent. Suppose we are given some global allocation of weights to the points. (a) Suppose the sum of the weights is 1 (or more generally nonzero); then if we take lines through each point p in the family and some affine combination, sum of weights 1, weights on the other points proportional to the global weights, then those lines concur at the affine combination given by the global weights (scaled as necessary if we allow an arbitrary nonzero sum of weights). (b) Suppose the sum of the weights is 0; then those lines are parallel, in the direction spanned by the It should be clear how, with three points and appropriate nondegeneracy conditions, pairwise weights being proportional to a global choice of weights is equivalent to the product of three ratios being 1. (And as a further special case, in a real When you have an ordered field, positive weights would allow you to exclude the "parallel" case in the reverse direction, as a special case. The point of concurrence would indeed be in the intrinsic interior, if that's worth mentioning. I'm not sure you get anything much useful with (intrinsic) interior as a hypothesis in the forward direction, unless it's as a convenient alternative to other nondegeneracy conditions. |
Prove Ceva's Theorem in the interior case.
reindex
API #18190The exterior case can easily be stated and proved once we have signed distances and the biratio of three points.