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 #
@[instance 100]
instance
instRightCommutativeOfLeftCommutative
{α : Sort u}
{β : Sort v}
{f : α → β → β}
[h : LeftCommutative f]
:
RightCommutative fun (x : β) (y : α) => f y x
instance
instLeftCommutativeOfRightCommutative
{α : Sort u}
{β : Sort v}
{f : β → α → β}
[h : RightCommutative f]
:
LeftCommutative fun (x : α) (y : β) => f y x
instance
instLeftCommutativeOfCommutativeOfAssociative
{α : Sort u}
{f : α → α → α}
[hc : Std.Commutative f]
[ha : Std.Associative f]
:
instance
instRightCommutativeOfCommutativeOfAssociative
{α : Sort u}
{f : α → α → α}
[hc : Std.Commutative f]
[ha : Std.Associative f]
: