Skip to content

Commit

Permalink
Trigger CI for leanprover/lean4#2930
Browse files Browse the repository at this point in the history
  • Loading branch information
leanprover-community-mathlib4-bot committed Nov 27, 2023
2 parents 40fa9c2 + 80d7d87 commit 62bfe76
Show file tree
Hide file tree
Showing 211 changed files with 6,807 additions and 1,919 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/nightly_detect_failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,29 @@ jobs:
toolchain=$(<lean-toolchain)
if [[ $toolchain =~ leanprover/lean4:nightly-([a-zA-Z0-9_-]+) ]]; then
version=${BASH_REMATCH[1]}
echo "NIGHTLY=$version" >> $GITHUB_ENV
git push origin refs/heads/nightly-testing:refs/heads/nightly-testing-$version
else
echo "Error: The file lean-toolchain does not contain the expected pattern."
exit 1
fi
# Next, we'll update the `nightly-with-mathlib` branch at Lean.
- name: Cleanup workspace
run: |
sudo rm -rf *
# Checkout the Lean repository on 'nightly-with-mathlib'
- name: Checkout Lean repository
uses: actions/checkout@v3
with:
repository: leanprover/lean4
token: ${{ secrets.LEAN_PR_TESTING }}
ref: nightly-with-mathlib
# Merge the relevant nightly.
- name: Fetch tags from 'lean4-nightly', and merge relevant nightly into 'nightly-with-mathlib'
run: |
git remote add nightly https://github.com/leanprover/lean4-nightly.git
git fetch nightly --tags
# Note: old jobs may run out of order, but it is safe to merge an older `nightly-YYYY-MM-DD`.
git merge nightly-${NIGHTLY} --strategy-option ours --allow-unrelated-histories || true
git push origin
11 changes: 6 additions & 5 deletions .github/workflows/nightly_merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
name: Merge master to nightly

on:
push:
branches:
- master
schedule:
- cron: '30 */3 * * *' # 8AM CET/11PM PT

jobs:
merge-to-nightly:
Expand All @@ -25,9 +24,11 @@ jobs:
- name: Merge master to nightly favoring nightly changes
run: |
git checkout nightly-testing
# If the merge goes badly, we proceed anyway via '|| true'
# If the merge goes badly, we proceed anyway via '|| true'.
# CI will report failures on the 'nightly-testing' branch direct to Zulip.
git merge master --strategy-option ours --no-commit --allow-unrelated-histories || true
git add .
git commit -m "Merge master into nightly-testing"
# If there's nothing to do (because there are no new commits from master),
# that's okay, hence the '|| true'.
git commit -m "Merge master into nightly-testing" || true
git push origin nightly-testing
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"githubPullRequests.ignoredPullRequestBranches": ["master"]
"githubPullRequests.ignoredPullRequestBranches": [
"master"
],
"git.ignoreLimitWarning": true
}
2 changes: 1 addition & 1 deletion Archive/Imo/Imo1981Q3.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Lacker
-/
import Mathlib.Data.Int.Lemmas
import Mathlib.Data.Nat.Fib
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.LinearCombination

Expand Down
4 changes: 2 additions & 2 deletions Archive/Wiedijk100Theorems/SumOfPrimeReciprocalsDiverges.lean
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ theorem card_le_two_pow {x k : ℕ} :
exact
⟨p.pred, (Nat.pred_lt (Nat.Prime.ne_zero hp.1)).trans_le ((hmp p) hp),
Nat.succ_pred_eq_of_pos (Nat.Prime.pos hp.1)⟩
· simp [Nat.prod_factors m.succ_ne_zero, m.succ_sub_one]
· simp [Nat.prod_factors m.succ_ne_zero, m.add_one_sub_one]
-- The number of elements of `M x k` with `e + 1` squarefree is bounded by the number of subsets
-- of `[1, k]`.
calc
Expand Down Expand Up @@ -191,7 +191,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
obtain ⟨a, b, hab₁, hab₂⟩ := Nat.sq_mul_squarefree_of_pos' hm'
obtain ⟨ham, hbm⟩ := Dvd.intro_left _ hab₁, Dvd.intro _ hab₁
refine'
⟨a, b, ⟨⟨⟨_, fun p hp => _⟩, hab₂⟩, ⟨_, fun p hp => _⟩⟩, by simp_rw [hab₁, m.succ_sub_one]⟩
⟨a, b, ⟨⟨⟨_, fun p hp => _⟩, hab₂⟩, ⟨_, fun p hp => _⟩⟩, by simp_rw [hab₁, m.add_one_sub_one]⟩
· exact (Nat.succ_le_succ_iff.mp (Nat.le_of_dvd hm' ham)).trans_lt hm.1
· exact hm.2 p ⟨hp.1, hp.2.trans ham⟩
· calc
Expand Down
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test/%.run: build
@if [ -s test/$*.log ]; then \
echo "Error: Test output is not empty"; \
cat test/$*.log; \
rm -f test/$*.log \
rm -f test/$*.log; \
exit 1; \
fi
@rm -f test/$*.log
Expand Down
18 changes: 15 additions & 3 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.Algebra.Homology.Flip
import Mathlib.Algebra.Homology.Functor
import Mathlib.Algebra.Homology.HomologicalComplex
import Mathlib.Algebra.Homology.HomologicalComplexLimits
import Mathlib.Algebra.Homology.Homology
import Mathlib.Algebra.Homology.Homotopy
import Mathlib.Algebra.Homology.HomotopyCategory
Expand Down Expand Up @@ -498,6 +499,7 @@ import Mathlib.AlgebraicGeometry.Properties
import Mathlib.AlgebraicGeometry.Pullbacks
import Mathlib.AlgebraicGeometry.Restrict
import Mathlib.AlgebraicGeometry.Scheme
import Mathlib.AlgebraicGeometry.Sites.BigZariski
import Mathlib.AlgebraicGeometry.Spec
import Mathlib.AlgebraicGeometry.StructureSheaf
import Mathlib.AlgebraicTopology.AlternatingFaceMapComplex
Expand Down Expand Up @@ -678,6 +680,7 @@ import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Join
import Mathlib.Analysis.Convex.KreinMilman
import Mathlib.Analysis.Convex.Measure
import Mathlib.Analysis.Convex.Mul
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.Convex.PartitionOfUnity
import Mathlib.Analysis.Convex.Quasiconvex
Expand Down Expand Up @@ -1081,6 +1084,7 @@ import Mathlib.CategoryTheory.Limits.Presheaf
import Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts
import Mathlib.CategoryTheory.Limits.Shapes.Biproducts
import Mathlib.CategoryTheory.Limits.Shapes.CommSq
import Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory
import Mathlib.CategoryTheory.Limits.Shapes.Diagonal
import Mathlib.CategoryTheory.Limits.Shapes.DisjointCoproduct
import Mathlib.CategoryTheory.Limits.Shapes.Equalizers
Expand Down Expand Up @@ -1240,7 +1244,7 @@ import Mathlib.CategoryTheory.Sites.Over
import Mathlib.CategoryTheory.Sites.Plus
import Mathlib.CategoryTheory.Sites.Preserves
import Mathlib.CategoryTheory.Sites.Pretopology
import Mathlib.CategoryTheory.Sites.Pushforward
import Mathlib.CategoryTheory.Sites.Pullback
import Mathlib.CategoryTheory.Sites.RegularExtensive
import Mathlib.CategoryTheory.Sites.Sheaf
import Mathlib.CategoryTheory.Sites.SheafOfTypes
Expand Down Expand Up @@ -1351,6 +1355,8 @@ import Mathlib.Combinatorics.SimpleGraph.Triangle.Basic
import Mathlib.Combinatorics.Young.SemistandardTableau
import Mathlib.Combinatorics.Young.YoungDiagram
import Mathlib.Computability.Ackermann
import Mathlib.Computability.AkraBazzi.AkraBazzi
import Mathlib.Computability.AkraBazzi.GrowsPolynomially
import Mathlib.Computability.ContextFreeGrammar
import Mathlib.Computability.DFA
import Mathlib.Computability.Encoding
Expand Down Expand Up @@ -1717,7 +1723,7 @@ import Mathlib.Data.Nat.Factorial.SuperFactorial
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.Nat.Factorization.PrimePow
import Mathlib.Data.Nat.Factors
import Mathlib.Data.Nat.Fib
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Data.Nat.Fib.Zeckendorf
import Mathlib.Data.Nat.ForSqrt
import Mathlib.Data.Nat.GCD.Basic
Expand Down Expand Up @@ -2254,6 +2260,7 @@ import Mathlib.Lean.EnvExtension
import Mathlib.Lean.Exception
import Mathlib.Lean.Expr
import Mathlib.Lean.Expr.Basic
import Mathlib.Lean.Expr.ExtraRecognizers
import Mathlib.Lean.Expr.ReplaceRec
import Mathlib.Lean.Expr.Traverse
import Mathlib.Lean.IO.Process
Expand Down Expand Up @@ -2468,6 +2475,7 @@ import Mathlib.Logic.Pairwise
import Mathlib.Logic.Relation
import Mathlib.Logic.Relator
import Mathlib.Logic.Small.Basic
import Mathlib.Logic.Small.Defs
import Mathlib.Logic.Small.Group
import Mathlib.Logic.Small.List
import Mathlib.Logic.Small.Module
Expand Down Expand Up @@ -2880,6 +2888,7 @@ import Mathlib.Probability.CondCount
import Mathlib.Probability.ConditionalExpectation
import Mathlib.Probability.ConditionalProbability
import Mathlib.Probability.Density
import Mathlib.Probability.Distributions.Exponential
import Mathlib.Probability.Distributions.Gaussian
import Mathlib.Probability.IdentDistrib
import Mathlib.Probability.Independence.Basic
Expand Down Expand Up @@ -3124,6 +3133,7 @@ import Mathlib.SetTheory.Cardinal.Divisibility
import Mathlib.SetTheory.Cardinal.Finite
import Mathlib.SetTheory.Cardinal.Ordinal
import Mathlib.SetTheory.Cardinal.SchroederBernstein
import Mathlib.SetTheory.Cardinal.UnivLE
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Game.Domineering
Expand Down Expand Up @@ -3247,13 +3257,13 @@ import Mathlib.Tactic.NormNum
import Mathlib.Tactic.NormNum.Basic
import Mathlib.Tactic.NormNum.BigOperators
import Mathlib.Tactic.NormNum.Core
import Mathlib.Tactic.NormNum.DivMod
import Mathlib.Tactic.NormNum.Eq
import Mathlib.Tactic.NormNum.GCD
import Mathlib.Tactic.NormNum.Ineq
import Mathlib.Tactic.NormNum.Inv
import Mathlib.Tactic.NormNum.IsCoprime
import Mathlib.Tactic.NormNum.LegendreSymbol
import Mathlib.Tactic.NormNum.Mod
import Mathlib.Tactic.NormNum.NatFib
import Mathlib.Tactic.NormNum.NatSqrt
import Mathlib.Tactic.NormNum.OfScientific
Expand All @@ -3269,6 +3279,7 @@ import Mathlib.Tactic.Polyrith
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Positivity.Basic
import Mathlib.Tactic.Positivity.Core
import Mathlib.Tactic.ProdAssoc
import Mathlib.Tactic.ProjectionNotation
import Mathlib.Tactic.Propose
import Mathlib.Tactic.ProxyType
Expand Down Expand Up @@ -3501,6 +3512,7 @@ import Mathlib.Topology.Homotopy.HSpaces
import Mathlib.Topology.Homotopy.HomotopyGroup
import Mathlib.Topology.Homotopy.Path
import Mathlib.Topology.Homotopy.Product
import Mathlib.Topology.IndicatorConstPointwise
import Mathlib.Topology.Inseparable
import Mathlib.Topology.Instances.AddCircle
import Mathlib.Topology.Instances.Complex
Expand Down
9 changes: 4 additions & 5 deletions Mathlib/Algebra/AddTorsor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ by the `+ᵥ` operation and a corresponding subtraction given by the
space. -/
class AddTorsor (G : outParam (Type*)) (P : Type*) [outParam <| AddGroup G] extends AddAction G P,
VSub G P where
[Nonempty : Nonempty P]
[nonempty : Nonempty P]
/-- Torsor subtraction and addition with the same element cancels out. -/
vsub_vadd' : ∀ p1 p2 : P, (p1 -ᵥ p2 : G) +ᵥ p2 = p1
/-- Torsor addition and subtraction with the same element cancels out. -/
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor

attribute [instance 100] AddTorsor.Nonempty -- porting note: removers `nolint instance_priority`
attribute [instance 100] AddTorsor.nonempty -- porting note: removers `nolint instance_priority`

--Porting note: removed
--attribute [nolint dangerous_instance] AddTorsor.toVSub
Expand Down Expand Up @@ -287,7 +287,7 @@ instance instAddTorsor : AddTorsor (G × G') (P × P') where
zero_vadd _ := Prod.ext (zero_vadd _ _) (zero_vadd _ _)
add_vadd _ _ _ := Prod.ext (add_vadd _ _ _) (add_vadd _ _ _)
vsub p₁ p₂ := (p₁.1 -ᵥ p₂.1, p₁.2 -ᵥ p₂.2)
Nonempty := Prod.Nonempty
nonempty := Prod.Nonempty
vsub_vadd' _ _ := Prod.ext (vsub_vadd _ _) (vsub_vadd _ _)
vadd_vsub' _ _ := Prod.ext (vadd_vsub _ _) (vadd_vsub _ _)

Expand Down Expand Up @@ -342,12 +342,11 @@ variable {I : Type u} {fg : I → Type v} [∀ i, AddGroup (fg i)] {fp : I → T
open AddAction AddTorsor

/-- A product of `AddTorsor`s is an `AddTorsor`. -/
instance instAddTorsor [T : ∀ i, AddTorsor (fg i) (fp i)] : AddTorsor (∀ i, fg i) (∀ i, fp i) where
instance instAddTorsor [∀ i, AddTorsor (fg i) (fp i)] : AddTorsor (∀ i, fg i) (∀ i, fp i) where
vadd g p i := g i +ᵥ p i
zero_vadd p := funext fun i => zero_vadd (fg i) (p i)
add_vadd g₁ g₂ p := funext fun i => add_vadd (g₁ i) (g₂ i) (p i)
vsub p₁ p₂ i := p₁ i -ᵥ p₂ i
Nonempty := ⟨fun i => Classical.choice (T i).Nonempty⟩
vsub_vadd' p₁ p₂ := funext fun i => vsub_vadd (p₁ i) (p₂ i)
vadd_vsub' g p := funext fun i => vadd_vsub (g i) (p i)

Expand Down
15 changes: 9 additions & 6 deletions Mathlib/Algebra/BigOperators/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2005,13 +2005,13 @@ namespace Fintype

open Finset

/-- `Fintype.prod_bijective` is a variant of `Finset.prod_bij` that accepts `Function.bijective`.
/-- `Fintype.prod_bijective` is a variant of `Finset.prod_bij` that accepts `Function.Bijective`.
See `Function.bijective.prod_comp` for a version without `h`. -/
@[to_additive "`Fintype.sum_equiv` is a variant of `Finset.sum_bij` that accepts
`Function.bijective`.
See `Function.Bijective.prod_comp` for a version without `h`. -/
@[to_additive "`Fintype.sum_bijective` is a variant of `Finset.sum_bij` that accepts
`Function.Bijective`.
See `Function.bijective.sum_comp` for a version without `h`. "]
See `Function.Bijective.sum_comp` for a version without `h`. "]
theorem prod_bijective {α β M : Type*} [Fintype α] [Fintype β] [CommMonoid M] (e : α → β)
(he : Function.Bijective e) (f : α → M) (g : β → M) (h : ∀ x, f x = g (e x)) :
∏ x : α, f x = ∏ x : β, g x :=
Expand All @@ -2021,6 +2021,9 @@ theorem prod_bijective {α β M : Type*} [Fintype α] [Fintype β] [CommMonoid M
#align fintype.prod_bijective Fintype.prod_bijective
#align fintype.sum_bijective Fintype.sum_bijective

alias _root_.Function.Bijective.finset_prod := prod_bijective
attribute [to_additive] Function.Bijective.finset_prod

/-- `Fintype.prod_equiv` is a specialization of `Finset.prod_bij` that
automatically fills in most arguments.
Expand All @@ -2032,7 +2035,7 @@ automatically fills in most arguments.
See `Equiv.sum_comp` for a version without `h`."]
theorem prod_equiv {α β M : Type*} [Fintype α] [Fintype β] [CommMonoid M] (e : α ≃ β) (f : α → M)
(g : β → M) (h : ∀ x, f x = g (e x)) : ∏ x : α, f x = ∏ x : β, g x :=
prod_bijective e e.bijective f g h
e.bijective.finset_prod _ f g h
#align fintype.prod_equiv Fintype.prod_equiv
#align fintype.sum_equiv Fintype.sum_equiv

Expand Down
12 changes: 12 additions & 0 deletions Mathlib/Algebra/BigOperators/Order.lean
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,18 @@ theorem prod_eq_prod_iff_of_le {f g : ι → M} (h : ∀ i ∈ s, f i ≤ g i) :
#align finset.prod_eq_prod_iff_of_le Finset.prod_eq_prod_iff_of_le
#align finset.sum_eq_sum_iff_of_le Finset.sum_eq_sum_iff_of_le

variable [DecidableEq ι]

@[to_additive] lemma prod_sdiff_le_prod_sdiff :
∏ i in s \ t, f i ≤ ∏ i in t \ s, f i ↔ ∏ i in s, f i ≤ ∏ i in t, f i := by
rw [←mul_le_mul_iff_right, ←prod_union (disjoint_sdiff_inter _ _), sdiff_union_inter, ←prod_union,
inter_comm, sdiff_union_inter]; simpa only [inter_comm] using disjoint_sdiff_inter t s

@[to_additive] lemma prod_sdiff_lt_prod_sdiff :
∏ i in s \ t, f i < ∏ i in t \ s, f i ↔ ∏ i in s, f i < ∏ i in t, f i := by
rw [←mul_lt_mul_iff_right, ←prod_union (disjoint_sdiff_inter _ _), sdiff_union_inter, ←prod_union,
inter_comm, sdiff_union_inter]; simpa only [inter_comm] using disjoint_sdiff_inter t s

end OrderedCancelCommMonoid

section LinearOrderedCancelCommMonoid
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Category/ModuleCat/FilteredColimits.lean
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ instance colimitMulAction : MulAction R (M F) where
instance colimitSMulWithZero : SMulWithZero R (M F) :=
{ colimitMulAction F with
smul_zero := fun r => by
erw [colimit_zero_eq _ (IsFiltered.Nonempty.some : J), colimit_smul_mk_eq, smul_zero]
erw [colimit_zero_eq _ (IsFiltered.nonempty.some : J), colimit_smul_mk_eq, smul_zero]
rfl
zero_smul := fun x => by
refine' Quot.inductionOn x _; clear x; intro x; cases' x with j x
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Category/MonCat/FilteredColimits.lean
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ variable [IsFiltered J]
"As `J` is nonempty, we can pick an arbitrary object `j₀ : J`. We use this object to
define the \"zero\" in the colimit as the equivalence class of `⟨j₀, 0 : F.obj j₀⟩`."]
noncomputable instance colimitOne :
One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.Nonempty.some,1
One (M.{v, u} F) where one := M.mk F ⟨IsFiltered.nonempty.some,1
#align Mon.filtered_colimits.colimit_has_one MonCat.FilteredColimits.colimitOne
#align AddMon.filtered_colimits.colimit_has_zero AddMonCat.FilteredColimits.colimitZero

Expand Down Expand Up @@ -301,7 +301,7 @@ The only thing left to see is that it is a monoid homomorphism.
def colimitDesc (t : Cocone F) : colimit.{v, u} F ⟶ t.pt where
toFun := (Types.colimitCoconeIsColimit (F ⋙ forget MonCat)).desc ((forget MonCat).mapCocone t)
map_one' := by
rw [colimit_one_eq F IsFiltered.Nonempty.some]
rw [colimit_one_eq F IsFiltered.nonempty.some]
exact MonoidHom.map_one _
map_mul' x y := by
refine Quot.induction_on₂ x y ?_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
-/
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Data.Nat.Fib
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
import Mathlib.Tactic.SolveByElim

Expand Down
14 changes: 7 additions & 7 deletions Mathlib/Algebra/CovariantAndContravariant.lean
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ relation (typically `(≤)` or `(<)`), these are the only two typeclasses that I
The general approach is to formulate the lemma that you are interested in and prove it, with the
`Ordered[...]` typeclass of your liking. After that, you convert the single typeclass,
say `[OrderedCancelMonoid M]`, into three typeclasses, e.g.
`[LeftCancelSemigroup M] [PartialOrder M] [CovariantClass M M (Function.swap (*)) (≤)]`
`[CancelMonoid M] [PartialOrder M] [CovariantClass M M (Function.swap (*)) (≤)]`
and have a go at seeing if the proof still works!
Note that it is possible to combine several `Co(ntra)variantClass` assumptions together.
Expand Down Expand Up @@ -362,27 +362,27 @@ theorem contravariant_le_of_contravariant_eq_and_lt [PartialOrder N]
then the following four instances (actually eight) can be removed in favor of the above two. -/

@[to_additive]
instance LeftCancelSemigroup.covariant_mul_lt_of_covariant_mul_le [LeftCancelSemigroup N]
instance IsLeftCancelMul.covariant_mul_lt_of_covariant_mul_le [Mul N] [IsLeftCancelMul N]
[PartialOrder N] [CovariantClass N N (· * ·) (· ≤ ·)] :
CovariantClass N N (· * ·) (· < ·) where
elim a _ _ bc := (CovariantClass.elim a bc.le).lt_of_ne ((mul_ne_mul_right a).mpr bc.ne)

@[to_additive]
instance RightCancelSemigroup.covariant_swap_mul_lt_of_covariant_swap_mul_le
[RightCancelSemigroup N] [PartialOrder N] [CovariantClass N N (swap (· * ·)) (· ≤ ·)] :
instance IsRightCancelMul.covariant_swap_mul_lt_of_covariant_swap_mul_le
[Mul N] [IsRightCancelMul N] [PartialOrder N] [CovariantClass N N (swap (· * ·)) (· ≤ ·)] :
CovariantClass N N (swap (· * ·)) (· < ·) where
elim a _ _ bc := (CovariantClass.elim a bc.le).lt_of_ne ((mul_ne_mul_left a).mpr bc.ne)

@[to_additive]
instance LeftCancelSemigroup.contravariant_mul_le_of_contravariant_mul_lt [LeftCancelSemigroup N]
instance IsLeftCancelMul.contravariant_mul_le_of_contravariant_mul_lt [Mul N] [IsLeftCancelMul N]
[PartialOrder N] [ContravariantClass N N (· * ·) (· < ·)] :
ContravariantClass N N (· * ·) (· ≤ ·) where
elim := (contravariant_le_iff_contravariant_lt_and_eq N N _).mpr
⟨ContravariantClass.elim, fun _ ↦ mul_left_cancel⟩

@[to_additive]
instance RightCancelSemigroup.contravariant_swap_mul_le_of_contravariant_swap_mul_lt
[RightCancelSemigroup N] [PartialOrder N] [ContravariantClass N N (swap (· * ·)) (· < ·)] :
instance IsRightCancelMul.contravariant_swap_mul_le_of_contravariant_swap_mul_lt
[Mul N] [IsRightCancelMul N] [PartialOrder N] [ContravariantClass N N (swap (· * ·)) (· < ·)] :
ContravariantClass N N (swap (· * ·)) (· ≤ ·) where
elim := (contravariant_le_iff_contravariant_lt_and_eq N N _).mpr
⟨ContravariantClass.elim, fun _ ↦ mul_right_cancel⟩
Expand Down
Loading

0 comments on commit 62bfe76

Please sign in to comment.