Dual α reverses the Append (semigroup) operation:
$$\text{Dual}(a) \mathbin{++} \text{Dual}(b) = \text{Dual}(b \mathbin{++} a)$$
If $(S, \diamond)$ is a semigroup, then $(\text{Dual}\;S,\, \diamond^{\text{op}})$ is the opposite semigroup where $a \diamond^{\text{op}} b = b \diamond a$.
- getDual : α
Instances For
Equations
- Data.instBEqDual = { beq := Data.instBEqDual.beq }
Equations
- Data.instOrdDual = { compare := Data.instOrdDual.ord }
Equations
- Data.instReprDual = { reprPrec := Data.instReprDual.repr }
Equations
- Data.instReprDual.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "getDual" ++ Std.Format.text " := " ++ (Std.Format.nest 11 (repr x✝.getDual)).group) " }"
Instances For
Equations
Associativity of the dual semigroup. Given associativity of $(++)$ on $\alpha$:
$$(\text{Dual}\;a \mathbin{++} \text{Dual}\;b) \mathbin{++} \text{Dual}\;c = \text{Dual}\;a \mathbin{++} (\text{Dual}\;b \mathbin{++} \text{Dual}\;c)$$
Endo α wraps endomorphisms $\alpha \to \alpha$. Forms a monoid under function composition:
- Operation: $\text{Endo}(f) \mathbin{++} \text{Endo}(g) = \text{Endo}(f \circ g)$
- Identity: $\text{Endo}(\text{id})$
$$(\text{Endo}\;f \mathbin{++} \text{Endo}\;g)(x) = f(g(x))$$
- appEndo : α → α
Instances For
First α keeps the leftmost some value under Append:
$$\text{First}(x) \mathbin{++} \text{First}(y) = \text{First}(x \mathbin{<|>} y)$$
- $\text{First}(\text{some}\;a) \mathbin{++} \_ = \text{First}(\text{some}\;a)$
- $\text{First}(\text{none}) \mathbin{++} y = y$
Identity element: $\text{First}(\text{none})$.
- getFirst : Option α
Instances For
Equations
- Data.instBEqFirst = { beq := Data.instBEqFirst.beq }
Equations
- Data.instReprFirst = { reprPrec := Data.instReprFirst.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Last α keeps the rightmost some value under Append:
$$\text{Last}(x) \mathbin{++} \text{Last}(y) = \text{Last}(y \mathbin{<|>} x)$$
- $\_ \mathbin{++} \text{Last}(\text{some}\;b) = \text{Last}(\text{some}\;b)$
- $x \mathbin{++} \text{Last}(\text{none}) = x$
Identity element: $\text{Last}(\text{none})$.
- getLast : Option α
Instances For
Equations
- Data.instBEqLast = { beq := Data.instBEqLast.beq }
Equations
- Data.instReprLast = { reprPrec := Data.instReprLast.repr }
Equations
- Data.instReprLast.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "getLast" ++ Std.Format.text " := " ++ (Std.Format.nest 11 (repr x✝.getLast)).group) " }"
Instances For
Equations
- Data.instBEqSum = { beq := Data.instBEqSum.beq }
Equations
- Data.instOrdSum = { compare := Data.instOrdSum.ord }
Equations
- Data.instReprSum = { reprPrec := Data.instReprSum.repr }
Equations
- Data.instReprSum.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "getSum" ++ Std.Format.text " := " ++ (Std.Format.nest 10 (repr x✝.getSum)).group) " }"
Instances For
Equations
- Data.instHashableSum = { hash := Data.instHashableSum.hash }
Associativity of Sum, given associativity of $(+)$ on $\alpha$:
$$(a + b) + c = a + (b + c) \;\implies\; \text{Sum}(a) \mathbin{++} \text{Sum}(b) \mathbin{++} \text{Sum}(c) = \text{Sum}(a) \mathbin{++} (\text{Sum}(b) \mathbin{++} \text{Sum}(c))$$
Product α is a monoid wrapper under multiplication:
- Operation: $\text{Product}(a) \mathbin{++} \text{Product}(b) = \text{Product}(a \times b)$
- Identity: $\text{Product}(1)$
$$\text{Product}(a) \mathbin{++} \text{Product}(b) = \text{Product}(a \times b)$$
- getProduct : α
Instances For
Equations
Equations
- Data.instOrdProduct = { compare := Data.instOrdProduct.ord }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Data.instReprProduct = { reprPrec := Data.instReprProduct.repr }
Equations
ToString instance for Product α, displaying as Product(...).
Equations
- Data.instToStringProduct = { toString := fun (p : Data.Product α) => toString "Product(" ++ toString p.getProduct ++ toString ")" }
Append instance for Product α — delegates to Mul:
$\text{Product}(a) \mathbin{++} \text{Product}(b) = \text{Product}(a \times b)$.
Equations
- Data.instAppendProductOfMul = { append := fun (a b : Data.Product α) => { getProduct := a.getProduct * b.getProduct } }
Associativity of Product, given associativity of $(\times)$ on $\alpha$:
$$(a \times b) \times c = a \times (b \times c) \;\implies\; \text{Product}(a) \mathbin{++} \text{Product}(b) \mathbin{++} \text{Product}(c) = \text{Product}(a) \mathbin{++} (\text{Product}(b) \mathbin{++} \text{Product}(c))$$
Equations
- Data.instBEqAll.beq { getAll := a } { getAll := b } = (a == b)
- Data.instBEqAll.beq x✝¹ x✝ = false
Instances For
Equations
- Data.instBEqAll = { beq := Data.instBEqAll.beq }
Equations
- Data.instOrdAll = { compare := Data.instOrdAll.ord }
Equations
- Data.instOrdAll.ord { getAll := a } { getAll := b } = (compare a b).then Ordering.eq
Instances For
Equations
- Data.instReprAll = { reprPrec := Data.instReprAll.repr }
Equations
- Data.instReprAll.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "getAll" ++ Std.Format.text " := " ++ (Std.Format.nest 10 (repr x✝.getAll)).group) " }"
Instances For
Instances For
Equations
- Data.instHashableAll = { hash := Data.instHashableAll.hash }
Equations
- Data.instBEqAny = { beq := Data.instBEqAny.beq }
Equations
- Data.instBEqAny.beq { getAny := a } { getAny := b } = (a == b)
- Data.instBEqAny.beq x✝¹ x✝ = false
Instances For
Equations
- Data.instOrdAny = { compare := Data.instOrdAny.ord }
Equations
- Data.instOrdAny.ord { getAny := a } { getAny := b } = (compare a b).then Ordering.eq
Instances For
Equations
- Data.instReprAny = { reprPrec := Data.instReprAny.repr }
Equations
- Data.instReprAny.repr x✝ prec✝ = Std.Format.bracket "{ " (Std.Format.nil ++ Std.Format.text "getAny" ++ Std.Format.text " := " ++ (Std.Format.nest 10 (repr x✝.getAny)).group) " }"
Instances For
Equations
- Data.instHashableAny = { hash := Data.instHashableAny.hash }