docs / tolk / api / Tolk / Op / Set
The named sets are the families that rewrites and checks match on, such as Set.alu or Set.movement ; the set operations combine them into new sets.
The type for sets of operations.
# val of_list : op list -> t of_list ops is the set of the operations in ops.
# val mem : op -> t -> boolmem o s is true iff o is in s.
union s0 s1 is the set of the operations in s0 or in s1.
diff s0 s1 is the set of the operations in s0 and not in s1.
# val to_list : t -> op listto_list s is the operations of s in declaration order.
# val equal : t -> t -> boolequal s0 s1 is true iff s0 and s1 have the same operations.
# val pp : Stdlib .Format.formatter -> t -> unitpp formats a set as its operations in declaration order, between braces and separated by commas: {Ops.ADD, Ops.MUL}. The empty set is {}.
Named sets binary is the operations of two operands: Add , Mul , Truncdiv , Max , Truncmod , Cmplt , Cmpne , Cmpeq , Xor , Shl , Shr , Or , And , Threefry , Sub , Fdiv , Pow , Div and Mod .
ternary is the operations of three operands: Where and Mulacc .
broadcastable is binary and ternary : the operations whose operands are brought to a common shape and type.
elementwise is alu , Cast and Bitcast : the operations applied element by element.
effectful is the operations that may act beyond their value each time they run: Store , Call and Barrier . A rewrite that changes how often one runs, or whether it runs, changes what the kernel does.
commutative is the binary operations f with f x y = f y x, whose operands rewrites may swap: Add , Mul , Max , Cmpne , Cmpeq , Xor , And and Or . For Max it holds up to which of two values neither less than the other it gives.
associative is the binary operations that rewrites may regroup, each satisfying f (f x y) z = f x (f y z): Add , Mul , And , Or , Max and Xor .
idempotent is the binary operations f with f x x = x: Or , And and Max .
comparison is the operations whose result is a boolean whatever the type of their operands: Cmplt , Cmpne and Cmpeq .