19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

trait ApproximatelyHasInverses T extends ApproximatelyHasInversesT, ⊙, ⊘, ≈,<br />

opr ⊙,opr ⊘,opr ≈<br />

extends { HasIdentityT, ⊙, UnaryOperatorT, ⊘, BinaryOperatorT, ⊘ }<br />

property ∀(a:T) (a ⊙ (⊘ a)) :≈: Identity⊙<br />

property ∀(a:T) ((⊘ a) ⊙ a) :≈: Identity⊙<br />

property ∀(a:T, b: T) (a ⊘ b) :≈: (a ⊙ (⊘ b))<br />

end<br />

A set of values with a binary operator ⊙ has approximate inverses if and only if the operator has an identity and<br />

for every value a there is another value a ′ such that the result of applying ⊙ to a and a ′ (in either order) is<br />

“close enough” to the identity. <strong>The</strong> unary operator ⊘ returns the approximate inverse of its argument; as a notational<br />

convenience, it may also be used as a binary operator.<br />

trait HasInversesT extends HasInversesT, ⊙, ⊘,opr ⊙,opr ⊘<br />

extends { ApproximatelyHasInversesT, ⊙, ⊘, = }<br />

end<br />

A set of values with a binary operator ⊙ has inverses if and only if the operator has an identity and for every value<br />

a there is another value a ′ such that the result of applying ⊙ to a and a ′ (in either order) equals the identity. <strong>The</strong><br />

unary operator ⊘ returns the inverse of its argument; as a notational convenience, it may also be used as a binary<br />

operator. A standard example is the operator + on integers; the identity is 0 , and the unary operator − returns the<br />

additive inverse of its argument, such that a + (−a) = 0 and (−a) + a = 0 . Moreover, − may be used as a binary<br />

operator: a − b means a + (−b) .<br />

trait ApproximateGroupT extends ApproximateGroupT, ⊙, ⊘, ≈,opr ⊙,opr ⊘,opr ≈<br />

extends { ApproximateMonoidT, ⊙, ≈, ApproximatelyHasInversesT, ⊙, ⊘, ≈ }<br />

end<br />

An approximate group is an approximate monoid that has approximate inverses. For example, a floating-point representation<br />

of quaternions with multiplication as the binary operator would form an approximate group.<br />

trait GroupT extends GroupT, ⊙, ⊘,opr ⊙,opr ⊘<br />

extends { ApproximateGroupT, ⊙, ⊘, =, MonoidT, ⊙, HasInversesT, ⊙, ⊘ }<br />

end<br />

A group is monoid that has inverses.<br />

trait ApproximateAbelianGroup T extends ApproximateAbelianGroupT, ⊕, ⊖, ≈,<br />

opr ⊕,opr ⊖,opr ≈<br />

extends { ApproximateGroupT, ⊕, ⊖, ≈,<br />

ApproximateCommutativeMonoidT, ⊕, ≈ }<br />

end<br />

An approximate Abelian group is an approximate group whose binary operator is also approximately commutative.<br />

trait AbelianGroupT extends AbelianGroupT, ⊕, ⊖,opr ⊕,opr ⊖<br />

extends { ApproximateAbelianGroupT, ⊕, ⊖, =,<br />

GroupT, ⊕, ⊖, CommutativeMonoidT, ⊕ }<br />

end<br />

An Abelian group is group whose binary operator is also commutative. (<strong>The</strong> term “Abelian” is traditionally used<br />

instead of “commutative” when discussing groups, in tribute to mathematician Niels Henrik Abel.) For example, the<br />

integers with the binary addition operator + , unary negation operator − , and identity 0 form an Abelian group. As<br />

another example, the boolean values with the binary exclusive OR operator ⊕ and unary negation operator IDENTITY<br />

form an Abelian group; the value false is the identity for ⊕ .<br />

257

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!