UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

63 lines (62 loc) 2.97 kB
/** * The Top symbol to represent the Top element of complete lattices (e.g. of abstract domains). */ export declare const Top: unique symbol; /** * The Bottom symbol to represent the Bottom element of complete lattices (e.g. of abstract domains). */ export declare const Bottom: unique symbol; /** * A complete lattice with a partially ordered set, join operator (LUB), meet operator (GLB), top element, and bottom element (e.g. for abstract domains). * @template Value - Type of a lattice element representing a value (may exclude `Top` and `Bot`) * @template Top - Type of the Top element (greatest element) of the complete lattice (defaults to {@link Top}) * @template Bot - Type of the Bottom element (least element) of the complete lattice (defaults to {@link Bottom}) * @template Lift - Type of the lattice elements (defaults to `Value` or `Top` or `Bot`) */ export interface Lattice<Value, Top = typeof Top, Bot = typeof Bottom, Lift extends Value | Top | Bot = Value | Top | Bot> { /** * The current abstract value of the lattice. */ get value(): Lift; /** * Gets the Top element (greatest element) of the complete lattice (should additionally be provided as static function). */ top(): Lattice<Value, Top, Bot, Top>; /** * Gets the Bottom element (least element) of the complete lattice (should additionally be provided as static function). */ bottom(): Lattice<Value, Top, Bot, Bot>; /** * Checks whether the current abstract value equals to another abstract value. */ equals(other: Lattice<Value, Top, Bot>): boolean; /** * Checks whether the current abstract value is less than or equal to another abstract value with respect to the partial order of the lattice. */ leq(other: Lattice<Value, Top, Bot>): boolean; /** * Joins the current abstract value with other abstract values by creating the least upper bound (LUB) in the lattice. */ join(...values: Lattice<Value, Top, Bot>[]): Lattice<Value, Top, Bot>; /** * Meets the current abstract value with other abstract values by creating the greatest lower bound (GLB) in the lattice. */ meet(...values: Lattice<Value, Top, Bot>[]): Lattice<Value, Top, Bot>; /** * Converts the lattice into a human-readable string. */ toString(): string; /** * Checks whether the current abstract value is the Top element of the complete lattice. */ isTop(): this is Lattice<Value, Top, Bot, Top>; /** * Checks whether the current abstract value is the Bottom element of the complete lattice. */ isBottom(): this is Lattice<Value, Top, Bot, Bot>; /** * Checks whether the current abstract value is an actual value of the complete lattice * (this may include the Top or Bottom element if they are also values and no separate symbols, for example). */ isValue(): this is Lattice<Value, Top, Bot, Value>; }