File: Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean

full_name: Covariant
code: /-- `Covariant` is useful to formulate succinctly statements about the interactions between an
action of a Type on another one and a relation on the acted-upon Type.

See the `CovariantClass` doc-string for its meaning. -/
def Covariant : Prop 
goal: Prop

full_name: Contravariant
code: /-- `Contravariant` is useful to formulate succinctly statements about the interactions between an
action of a Type on another one and a relation on the acted-upon Type.

See the `ContravariantClass` doc-string for its meaning. -/
def Contravariant : Prop 
goal: Prop

full_name: CovariantClass.elim
code: /-- Given an action `μ` of a Type `M` on a Type `N` and a relation `r` on `N`, informally, the
`CovariantClass` says that "the action `μ` preserves the relation `r`."

More precisely, the `CovariantClass` is a class taking two Types `M N`, together with an "action"
`μ : M → N → N` and a relation `r : N → N → Prop`.  Its unique field `elim` is the assertion that
for all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the pair
`(n₁, n₂)`, then, the relation `r` also holds for the pair `(μ m n₁, μ m n₂)`,
obtained from `(n₁, n₂)` by acting upon it by `m`.

If `m : M` and `h : r n₁ n₂`, then `CovariantClass.elim m h : r (μ m n₁) (μ m n₂)`.
-/
class CovariantClass : Prop where
  /-- For all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the pair
  `(n₁, n₂)`, then, the relation `r` also holds for the pair `(μ m n₁, μ m n₂)` -/
  protected elim : Covariant M N μ r
goal: Covariant M N μ r

full_name: CovariantClass
code: /-- Given an action `μ` of a Type `M` on a Type `N` and a relation `r` on `N`, informally, the
`CovariantClass` says that "the action `μ` preserves the relation `r`."

More precisely, the `CovariantClass` is a class taking two Types `M N`, together with an "action"
`μ : M → N → N` and a relation `r : N → N → Prop`.  Its unique field `elim` is the assertion that
for all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the pair
`(n₁, n₂)`, then, the relation `r` also holds for the pair `(μ m n₁, μ m n₂)`,
obtained from `(n₁, n₂)` by acting upon it by `m`.

If `m : M` and `h : r n₁ n₂`, then `CovariantClass.elim m h : r (μ m n₁) (μ m n₂)`.
-/
class CovariantClass : Prop where
  /-- For all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the pair
  `(n₁, n₂)`, then, the relation `r` also holds for the pair `(μ m n₁, μ m n₂)` -/
  protected elim : Covariant M N μ r
goal: Prop

full_name: ContravariantClass
code: /-- Given an action `μ` of a Type `M` on a Type `N` and a relation `r` on `N`, informally, the
`ContravariantClass` says that "if the result of the action `μ` on a pair satisfies the
relation `r`, then the initial pair satisfied the relation `r`."

More precisely, the `ContravariantClass` is a class taking two Types `M N`, together with an
"action" `μ : M → N → N` and a relation `r : N → N → Prop`.  Its unique field `elim` is the
assertion that for all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the
pair `(μ m n₁, μ m n₂)` obtained from `(n₁, n₂)` by acting upon it by `m`, then, the relation
`r` also holds for the pair `(n₁, n₂)`.

If `m : M` and `h : r (μ m n₁) (μ m n₂)`, then `ContravariantClass.elim m h : r n₁ n₂`.
-/
class ContravariantClass : Prop where
  /-- For all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the
  pair `(μ m n₁, μ m n₂)` obtained from `(n₁, n₂)` by acting upon it by `m`, then, the relation
  `r` also holds for the pair `(n₁, n₂)`. -/
  protected elim : Contravariant M N μ r
goal: Prop

full_name: ContravariantClass.elim
code: /-- Given an action `μ` of a Type `M` on a Type `N` and a relation `r` on `N`, informally, the
`ContravariantClass` says that "if the result of the action `μ` on a pair satisfies the
relation `r`, then the initial pair satisfied the relation `r`."

More precisely, the `ContravariantClass` is a class taking two Types `M N`, together with an
"action" `μ : M → N → N` and a relation `r : N → N → Prop`.  Its unique field `elim` is the
assertion that for all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the
pair `(μ m n₁, μ m n₂)` obtained from `(n₁, n₂)` by acting upon it by `m`, then, the relation
`r` also holds for the pair `(n₁, n₂)`.

If `m : M` and `h : r (μ m n₁) (μ m n₂)`, then `ContravariantClass.elim m h : r n₁ n₂`.
-/
class ContravariantClass : Prop where
  /-- For all `m ∈ M` and all elements `n₁, n₂ ∈ N`, if the relation `r` holds for the
  pair `(μ m n₁, μ m n₂)` obtained from `(n₁, n₂)` by acting upon it by `m`, then, the relation
  `r` also holds for the pair `(n₁, n₂)`. -/
  protected elim : Contravariant M N μ r
goal: Contravariant M N μ r

full_name: rel_iff_cov
code: theorem rel_iff_cov [CovariantClass M N μ r] [ContravariantClass M N μ r] (m : M) {a b : N} :
    r (μ m a) (μ m b) ↔ r a b 
goal: r (μ m a) (μ m b) ↔ r a b

full_name: Covariant.flip
code: theorem Covariant.flip (h : Covariant M N μ r) : Covariant M N μ (flip r) 
goal: Covariant M N μ (flip r)

full_name: Contravariant.flip
code: theorem Contravariant.flip (h : Contravariant M N μ r) : Contravariant M N μ (flip r) 
goal: Contravariant M N μ (flip r)

full_name: act_rel_act_of_rel
code: theorem act_rel_act_of_rel (m : M) {a b : N} (ab : r a b) : r (μ m a) (μ m b) 
goal: r (μ m a) (μ m b)

full_name: Group.covariant_iff_contravariant
code: @[to_additive]
theorem Group.covariant_iff_contravariant [Group N] :
    Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r 
goal: Covariant N N (fun x x_1 => x * x_1) r ↔ Contravariant N N (fun x x_1 => x * x_1) r

full_name: AddGroup.covariant_iff_contravariant
code: @[to_additive]
theorem Group.covariant_iff_contravariant [Group N] :
    Covariant N N (· * ·) r ↔ Contravariant N N (· * ·) r 
goal: Covariant N N (fun x x_1 => x + x_1) r ↔ Contravariant N N (fun x x_1 => x + x_1) r

full_name: AddGroup.covconv
code: @[to_additive]
instance (priority := 100) Group.covconv [Group N] [CovariantClass N N (· * ·) r] :
    ContravariantClass N N (· * ·) r 
goal: ContravariantClass N N (fun x x_1 => x + x_1) r

full_name: Group.covconv
code: @[to_additive]
instance (priority := 100) Group.covconv [Group N] [CovariantClass N N (· * ·) r] :
    ContravariantClass N N (· * ·) r 
goal: ContravariantClass N N (fun x x_1 => x * x_1) r

full_name: AddGroup.covariant_swap_iff_contravariant_swap
code: @[to_additive]
theorem Group.covariant_swap_iff_contravariant_swap [Group N] :
    Covariant N N (swap (· * ·)) r ↔ Contravariant N N (swap (· * ·)) r 
goal: Covariant N N (Function.swap fun x x_1 => x + x_1) r ↔ Contravariant N N (Function.swap fun x x_1 => x + x_1) r

full_name: Group.covariant_swap_iff_contravariant_swap
code: @[to_additive]
theorem Group.covariant_swap_iff_contravariant_swap [Group N] :
    Covariant N N (swap (· * ·)) r ↔ Contravariant N N (swap (· * ·)) r 
goal: Covariant N N (Function.swap fun x x_1 => x * x_1) r ↔ Contravariant N N (Function.swap fun x x_1 => x * x_1) r

full_name: Group.covconv_swap
code: @[to_additive]
instance (priority := 100) Group.covconv_swap [Group N] [CovariantClass N N (swap (· * ·)) r] :
    ContravariantClass N N (swap (· * ·)) r 
goal: ContravariantClass N N (Function.swap fun x x_1 => x * x_1) r

full_name: AddGroup.covconv_swap
code: @[to_additive]
instance (priority := 100) Group.covconv_swap [Group N] [CovariantClass N N (swap (· * ·)) r] :
    ContravariantClass N N (swap (· * ·)) r 
goal: ContravariantClass N N (Function.swap fun x x_1 => x + x_1) r

full_name: act_rel_of_rel_of_act_rel
code: theorem act_rel_of_rel_of_act_rel (ab : r a b) (rl : r (μ m b) c) : r (μ m a) c 
goal: r (μ m a) c

full_name: rel_act_of_rel_of_rel_act
code: theorem rel_act_of_rel_of_rel_act (ab : r a b) (rr : r c (μ m a)) : r c (μ m b) 
goal: r c (μ m b)

full_name: act_rel_act_of_rel_of_rel
code: theorem act_rel_act_of_rel_of_rel (ab : r a b) (cd : r c d) : r (mu a c) (mu b d) 
goal: r (mu a c) (mu b d)

full_name: rel_of_act_rel_act
code: theorem rel_of_act_rel_act (m : M) {a b : N} (ab : r (μ m a) (μ m b)) : r a b 
goal: r a b

full_name: act_rel_of_act_rel_of_rel_act_rel
code: theorem act_rel_of_act_rel_of_rel_act_rel (ab : r (μ m a) b) (rl : r (μ m b) (μ m c)) :
    r (μ m a) c 
goal: r (μ m a) c

full_name: rel_act_of_act_rel_act_of_rel_act
code: theorem rel_act_of_act_rel_act_of_rel_act (ab : r (μ m a) (μ m b)) (rr : r b (μ m c)) :
    r a (μ m c) 
goal: r a (μ m c)

full_name: Covariant.monotone_of_const
code: /-- The partial application of a constant to a covariant operator is monotone. -/
theorem Covariant.monotone_of_const [CovariantClass M N μ (· ≤ ·)] (m : M) : Monotone (μ m) 
goal: Monotone (μ m)

full_name: Monotone.covariant_of_const
code: /-- A monotone function remains monotone when composed with the partial application
of a covariant operator. E.g., `∀ (m : ℕ), Monotone f → Monotone (fun n ↦ f (m + n))`. -/
theorem Monotone.covariant_of_const [CovariantClass M N μ (· ≤ ·)] (hf : Monotone f) (m : M) :
    Monotone (f <| μ m ·) 
goal: Monotone fun x => f (μ m x)

full_name: Monotone.covariant_of_const'
code: /-- Same as `Monotone.covariant_of_const`, but with the constant on the other side of
the operator.  E.g., `∀ (m : ℕ), Monotone f → Monotone (fun n ↦ f (n + m))`. -/
theorem Monotone.covariant_of_const' {μ : N → N → N} [CovariantClass N N (swap μ) (· ≤ ·)]
    (hf : Monotone f) (m : N) : Monotone (f <| μ · m) 
goal: Monotone fun x => f (μ x m)

full_name: Antitone.covariant_of_const
code: /-- Dual of `Monotone.covariant_of_const` -/
theorem Antitone.covariant_of_const [CovariantClass M N μ (· ≤ ·)] (hf : Antitone f) (m : M) :
    Antitone (f <| μ m ·) 
goal: Antitone fun x => f (μ m x)

full_name: Antitone.covariant_of_const'
code: /-- Dual of `Monotone.covariant_of_const'` -/
theorem Antitone.covariant_of_const' {μ : N → N → N} [CovariantClass N N (swap μ) (· ≤ ·)]
    (hf : Antitone f) (m : N) : Antitone (f <| μ · m) 
goal: Antitone fun x => f (μ x m)

full_name: covariant_le_of_covariant_lt
code: theorem covariant_le_of_covariant_lt [PartialOrder N] :
    Covariant M N μ (· < ·) → Covariant M N μ (· ≤ ·) 
goal: (Covariant M N μ fun x x_1 => x < x_1) → Covariant M N μ fun x x_1 => x ≤ x_1

full_name: covariantClass_le_of_lt
code: theorem covariantClass_le_of_lt [PartialOrder N] [CovariantClass M N μ (· < ·)] :
    CovariantClass M N μ (· ≤ ·) 
goal: CovariantClass M N μ fun x x_1 => x ≤ x_1

full_name: contravariant_le_iff_contravariant_lt_and_eq
code: theorem contravariant_le_iff_contravariant_lt_and_eq [PartialOrder N] :
    Contravariant M N μ (· ≤ ·) ↔ Contravariant M N μ (· < ·) ∧ Contravariant M N μ (· = ·) 
goal: (Contravariant M N μ fun x x_1 => x ≤ x_1) ↔
  (Contravariant M N μ fun x x_1 => x < x_1) ∧ Contravariant M N μ fun x x_1 => x = x_1

full_name: contravariant_lt_of_contravariant_le
code: theorem contravariant_lt_of_contravariant_le [PartialOrder N] :
    Contravariant M N μ (· ≤ ·) → Contravariant M N μ (· < ·) 
goal: (Contravariant M N μ fun x x_1 => x ≤ x_1) → Contravariant M N μ fun x x_1 => x < x_1

full_name: covariant_le_iff_contravariant_lt
code: theorem covariant_le_iff_contravariant_lt [LinearOrder N] :
    Covariant M N μ (· ≤ ·) ↔ Contravariant M N μ (· < ·) 
goal: (Covariant M N μ fun x x_1 => x ≤ x_1) ↔ Contravariant M N μ fun x x_1 => x < x_1

full_name: covariant_lt_iff_contravariant_le
code: theorem covariant_lt_iff_contravariant_le [LinearOrder N] :
    Covariant M N μ (· < ·) ↔ Contravariant M N μ (· ≤ ·) 
goal: (Covariant M N μ fun x x_1 => x < x_1) ↔ Contravariant M N μ fun x x_1 => x ≤ x_1

full_name: covariant_flip_iff
code: theorem covariant_flip_iff [IsSymmOp N N mu] :
    Covariant N N (flip mu) r ↔ Covariant N N mu r 
goal: Covariant N N (flip mu) r ↔ Covariant N N mu r

full_name: contravariant_flip_iff
code: theorem contravariant_flip_iff [IsSymmOp N N mu] :
    Contravariant N N (flip mu) r ↔ Contravariant N N mu r 
goal: Contravariant N N (flip mu) r ↔ Contravariant N N mu r

full_name: contravariant_lt_of_covariant_le
code: instance contravariant_lt_of_covariant_le [LinearOrder N]
    [CovariantClass N N mu (· ≤ ·)] : ContravariantClass N N mu (· < ·) 
goal: ContravariantClass N N mu fun x x_1 => x < x_1

full_name: covariant_lt_of_contravariant_le
code: instance covariant_lt_of_contravariant_le [LinearOrder N]
    [ContravariantClass N N mu (· ≤ ·)] : CovariantClass N N mu (· < ·) 
goal: CovariantClass N N mu fun x x_1 => x < x_1

full_name: covariant_swap_add_of_covariant_add
code: @[to_additive]
instance covariant_swap_mul_of_covariant_mul [CommSemigroup N]
    [CovariantClass N N (· * ·) r] : CovariantClass N N (swap (· * ·)) r 
goal: CovariantClass N N (Function.swap fun x x_1 => x + x_1) r

full_name: covariant_swap_mul_of_covariant_mul
code: @[to_additive]
instance covariant_swap_mul_of_covariant_mul [CommSemigroup N]
    [CovariantClass N N (· * ·) r] : CovariantClass N N (swap (· * ·)) r 
goal: CovariantClass N N (Function.swap fun x x_1 => x * x_1) r

full_name: contravariant_swap_add_of_contravariant_add
code: @[to_additive]
instance contravariant_swap_mul_of_contravariant_mul [CommSemigroup N]
    [ContravariantClass N N (· * ·) r] : ContravariantClass N N (swap (· * ·)) r 
goal: ContravariantClass N N (Function.swap fun x x_1 => x + x_1) r

full_name: contravariant_swap_mul_of_contravariant_mul
code: @[to_additive]
instance contravariant_swap_mul_of_contravariant_mul [CommSemigroup N]
    [ContravariantClass N N (· * ·) r] : ContravariantClass N N (swap (· * ·)) r 
goal: ContravariantClass N N (Function.swap fun x x_1 => x * x_1) r

full_name: covariant_lt_of_covariant_le_of_contravariant_eq
code: theorem covariant_lt_of_covariant_le_of_contravariant_eq [ContravariantClass M N μ (· = ·)]
    [PartialOrder N] [CovariantClass M N μ (· ≤ ·)] : CovariantClass M N μ (· < ·) 
goal: CovariantClass M N μ fun x x_1 => x < x_1

full_name: contravariant_le_of_contravariant_eq_and_lt
code: theorem contravariant_le_of_contravariant_eq_and_lt [PartialOrder N]
    [ContravariantClass M N μ (· = ·)] [ContravariantClass M N μ (· < ·)] :
    ContravariantClass M N μ (· ≤ ·) 
goal: ContravariantClass M N μ fun x x_1 => x ≤ x_1

full_name: IsLeftCancelAdd.covariant_add_lt_of_covariant_add_le
code: @[to_additive]
instance IsLeftCancelMul.covariant_mul_lt_of_covariant_mul_le [Mul N] [IsLeftCancelMul N]
    [PartialOrder N] [CovariantClass N N (· * ·) (· ≤ ·)] :
    CovariantClass N N (· * ·) (· < ·) 
goal: CovariantClass N N (fun x x_1 => x + x_1) fun x x_1 => x < x_1

full_name: IsLeftCancelMul.covariant_mul_lt_of_covariant_mul_le
code: @[to_additive]
instance IsLeftCancelMul.covariant_mul_lt_of_covariant_mul_le [Mul N] [IsLeftCancelMul N]
    [PartialOrder N] [CovariantClass N N (· * ·) (· ≤ ·)] :
    CovariantClass N N (· * ·) (· < ·) 
goal: CovariantClass N N (fun x x_1 => x * x_1) fun x x_1 => x < x_1

full_name: IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le
code: @[to_additive]
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 (· * ·)) (· < ·) 
goal: CovariantClass N N (Function.swap fun x x_1 => x + x_1) fun x x_1 => x < x_1

full_name: IsRightCancelMul.covariant_swap_mul_lt_of_covariant_swap_mul_le
code: @[to_additive]
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 (· * ·)) (· < ·) 
goal: CovariantClass N N (Function.swap fun x x_1 => x * x_1) fun x x_1 => x < x_1

full_name: IsLeftCancelMul.contravariant_mul_le_of_contravariant_mul_lt
code: @[to_additive]
instance IsLeftCancelMul.contravariant_mul_le_of_contravariant_mul_lt [Mul N] [IsLeftCancelMul N]
    [PartialOrder N] [ContravariantClass N N (· * ·) (· < ·)] :
    ContravariantClass N N (· * ·) (· ≤ ·) 
goal: ContravariantClass N N (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1

full_name: IsLeftCancelAdd.contravariant_add_le_of_contravariant_add_lt
code: @[to_additive]
instance IsLeftCancelMul.contravariant_mul_le_of_contravariant_mul_lt [Mul N] [IsLeftCancelMul N]
    [PartialOrder N] [ContravariantClass N N (· * ·) (· < ·)] :
    ContravariantClass N N (· * ·) (· ≤ ·) 
goal: ContravariantClass N N (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1

full_name: IsRightCancelAdd.contravariant_swap_add_le_of_contravariant_swap_add_lt
code: @[to_additive]
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 (· * ·)) (· ≤ ·) 
goal: ContravariantClass N N (Function.swap fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1

full_name: IsRightCancelMul.contravariant_swap_mul_le_of_contravariant_swap_mul_lt
code: @[to_additive]
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 (· * ·)) (· ≤ ·) 
goal: ContravariantClass N N (Function.swap fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1