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(Algebra/Order/AddGroupWithTop): lemmas about LinearOrderedAddCommGroupWithTop #18954

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Mathlib/Algebra/Order/AddGroupWithTop.lean
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,32 @@ instance (priority := 100) toSubtractionMonoid : SubtractionMonoid α where
intro v
simp [v] at h

lemma injective_add_ne_top (b : α) (h : b ≠ ⊤) : Function.Injective (fun x ↦ x + b) := by
intro x y h2
replace h2 : x + (b + -b) = y + (b + -b) := by simp [← add_assoc, h2]
simpa only [LinearOrderedAddCommGroupWithTop.add_neg_cancel _ h, add_zero] using h2

lemma strictMono_add_ne_top (b : α) (h : b ≠ ⊤) : StrictMono (fun x ↦ x + b) := by
Command-Master marked this conversation as resolved.
Show resolved Hide resolved
apply Monotone.strictMono_of_injective
· apply Monotone.add_const monotone_id
· apply injective_add_ne_top _ h

lemma sub_pos (a b : α) : 0 < a - b ↔ b < a ∨ b = ⊤ where
mp h := by
refine or_iff_not_imp_right.mpr fun h2 ↦ ?_
replace h := strictMono_add_ne_top _ h2 h
simp only [zero_add] at h
rw [sub_eq_add_neg, add_assoc, add_comm (-b),
add_neg_cancel_of_ne_top h2, add_zero] at h
exact h
mpr h := by
rcases h with h | h
· convert strictMono_add_ne_top (-b) (by simp [h.ne_top]) h using 1
· simp [add_neg_cancel_of_ne_top h.ne_top]
· simp [sub_eq_add_neg]
· rw [h]
simp only [sub_eq_add_neg, LinearOrderedAddCommGroupWithTop.neg_top, add_top]
apply lt_of_le_of_ne le_top
exact Ne.symm top_ne_zero

end LinearOrderedAddCommGroupWithTop
Loading