Skip to content
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

[Merged by Bors] - feat(linear_algebra/affine_space/ordered): define slope #4669

Closed
wants to merge 18 commits into from

Conversation

urkud
Copy link
Member

@urkud urkud commented Oct 18, 2020

  • Review API of ordered_semimodule:
    • replace lt_of_smul_lt_smul_of_nonneg with lt_of_smul_lt_smul_of_pos;
      it's equivalent but is easier to prove;
    • add more lemmas;
    • add a constructor for the special case of an ordered semimodule over
      a linearly ordered field; in this case it suffices to verify only
      a < b → 0 < c → c • a ≤ c • b;
    • use the new constructor in analysis/convex/cone;
  • Define units.smul_perm_hom, reroute mul_action.to_perm through it;
  • Add a few more lemmas unfolding affine_map.line_map in special cases;
  • Define slope f a b = (b - a)⁻¹ • (f b -ᵥ f a) and prove a handful
    of monotonicity properties.

These properties are not yet used in analysis/convex/basic, mostly
to keep this PR from becoming too large to review.

@urkud urkud added the awaiting-review The author would like community review of the PR label Oct 18, 2020
@PatrickMassot
Copy link
Member

@dupuisf could you have a look?

@@ -189,44 +189,20 @@ ext' $ preimage_comp.symm
@[simp] lemma mem_comap {f : E →ₗ[ℝ] F} {S : convex_cone F} {x : E} :
x ∈ S.comap f ↔ f x ∈ S := iff.rfl

-- We use `{ to_semimodule := ‹_›, .. }` to avoid making this definition noncomputable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems inscrutable to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can I improve it? If I write := ordered_semimodule.mk' _, then Lean thinks that the definition is noncomputable. We can avoid this by taking only proof fields from ordered_semimodule.mk' _. I'm not sure that it's worth it because there are no computable (in the sense "useful for computation", not in the sense computable) modules over real anyway.

def units.smul_perm_hom : units α →* equiv.perm β :=
{ to_fun := λ u, ⟨λ x, (u:α) • x, λ x, (↑u⁻¹:α) • x, u.inv_smul_smul, u.smul_inv_smul⟩,
map_one' := equiv.ext $ one_smul α,
map_mul' := λ u₁ u₂, equiv.ext $ mul_smul (u₁:α) u₂ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be used directly or only as in the following two lemmas? Should it have some @[simp] ..._apply lemma?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After pending improvements to @[simps], we'll be able to tell it to use _apply instead of to_fun, and the first person who'll need these simp lemmas will add @[simps]. I don't want to add unused code that will become obsolete in a few days.

left_inv := inv_smul_smul g,
right_inv := smul_inv_smul g }
def to_perm : α →* equiv.perm β :=
units.smul_perm_hom.comp to_units.to_monoid_hom
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question about a potentially missing simp lemma.

src/linear_algebra/affine_space/ordered.lean Outdated Show resolved Hide resolved
src/linear_algebra/affine_space/ordered.lean Outdated Show resolved Hide resolved
@PatrickMassot PatrickMassot added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Oct 18, 2020
@urkud urkud added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Oct 18, 2020
Copy link
Collaborator

@dupuisf dupuisf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me -- I just found this typo below.

src/linear_algebra/affine_space/ordered.lean Outdated Show resolved Hide resolved
Co-authored-by: Frédéric Dupuis <31101893+dupuisf@users.noreply.github.com>
@PatrickMassot
Copy link
Member

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Oct 20, 2020
bors bot pushed a commit that referenced this pull request Oct 20, 2020
* Review API of `ordered_semimodule`:
  - replace `lt_of_smul_lt_smul_of_nonneg` with `lt_of_smul_lt_smul_of_pos`;
    it's equivalent but is easier to prove;
  - add more lemmas;
  - add a constructor for the special case of an ordered semimodule over
	a linearly ordered field; in this case it suffices to verify only
	`a < b → 0 < c → c • a ≤ c • b`;
  - use the new constructor in `analysis/convex/cone`;
* Define `units.smul_perm_hom`, reroute `mul_action.to_perm` through it;
* Add a few more lemmas unfolding `affine_map.line_map` in special cases;
* Define `slope f a b = (b - a)⁻¹ • (f b -ᵥ f a)` and prove a handful
  of monotonicity properties.
@bors
Copy link

bors bot commented Oct 20, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(linear_algebra/affine_space/ordered): define slope [Merged by Bors] - feat(linear_algebra/affine_space/ordered): define slope Oct 20, 2020
@bors bors bot closed this Oct 20, 2020
@bors bors bot deleted the def-slope branch October 20, 2020 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants