HepLean Documentation

Mathlib.Logic.OpClass

Typeclasses for commuting heterogeneous operations #

The three classes in this file are for two-argument functions where one input is of type α, the output is of type β and the other input is of type α or β. They express the property that permuting arguments of type α does not change the result.

Main definitions #

class IsSymmOp {α : Sort u} {β : Sort v} (op : ααβ) :

IsSymmOp op where op : α → α → β says that op is a symmetric operation, i.e. op a b = op b a. It is the natural generalisation of Std.Commutative (β = α) and IsSymm (β = Prop).

  • symm_op : ∀ (a b : α), op a b = op b a

    A symmetric operation satisfies op a b = op b a.

Instances
    class LeftCommutative {α : Sort u} {β : Sort v} (op : αββ) :

    LeftCommutative op where op : α → β → β says that op is a left-commutative operation, i.e. op a₁ (op a₂ b) = op a₂ (op a₁ b).

    • left_comm : ∀ (a₁ a₂ : α) (b : β), op a₁ (op a₂ b) = op a₂ (op a₁ b)

      A left-commutative operation satisfies op a₁ (op a₂ b) = op a₂ (op a₁ b).

    Instances
      class RightCommutative {α : Sort u} {β : Sort v} (op : βαβ) :

      RightCommutative op where op : β → α → β says that op is a right-commutative operation, i.e. op (op b a₁) a₂ = op (op b a₂) a₁.

      • right_comm : ∀ (b : β) (a₁ a₂ : α), op (op b a₁) a₂ = op (op b a₂) a₁

        A right-commutative operation satisfies op (op b a₁) a₂ = op (op b a₂) a₁.

      Instances
        @[instance 100]
        instance isSymmOp_of_isCommutative (α : Sort u) (op : ααα) [Std.Commutative op] :
        Equations
        • =
        theorem IsSymmOp.flip_eq {α : Sort u} {β : Sort v} (op : ααβ) [IsSymmOp op] :
        flip op = op
        instance instRightCommutativeOfLeftCommutative {α : Sort u} {β : Sort v} {f : αββ} [h : LeftCommutative f] :
        RightCommutative fun (x : β) (y : α) => f y x
        Equations
        • =
        instance instLeftCommutativeOfRightCommutative {α : Sort u} {β : Sort v} {f : βαβ} [h : RightCommutative f] :
        LeftCommutative fun (x : α) (y : β) => f y x
        Equations
        • =
        instance instLeftCommutativeOfCommutativeOfAssociative {α : Sort u} {f : ααα} [hc : Std.Commutative f] [ha : Std.Associative f] :
        Equations
        • =
        instance instRightCommutativeOfCommutativeOfAssociative {α : Sort u} {f : ααα} [hc : Std.Commutative f] [ha : Std.Associative f] :
        Equations
        • =