UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

70 lines (69 loc) 3.53 kB
import { Ternary } from '../../util/logic'; import { AbstractDomain } from './abstract-domain'; import { Bottom, Top } from './lattice'; import { type SatisfiableDomain, NumericalComparator } from './satisfiable-domain'; /** The Top element of the interval domain as interval [-∞, +∞] */ export declare const IntervalTop: IntervalValue; /** The type of the actual values of the interval domain as tuple of the lower and upper bound */ type IntervalValue = readonly [lower: number, upper: number]; /** The type of the Top element of the interval domain as interval [-∞, +∞] */ type IntervalTop = typeof IntervalTop; /** The type of the Bottom element of the interval domain as {@link Bottom} symbol */ type IntervalBottom = typeof Bottom; /** The type of the abstract values of the interval domain that are Top, Bottom, or actual values */ type IntervalLift = IntervalValue | IntervalBottom; /** * The interval abstract domain as intervals with possibly infinite bounds representing possible numeric values. * The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as the interval [-∞, +∞]. * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value) */ export declare class IntervalDomain<Value extends IntervalLift = IntervalLift> extends AbstractDomain<number, IntervalValue, IntervalTop, IntervalBottom, Value> implements SatisfiableDomain<number> { constructor(value: Value); create(value: IntervalLift): this; static top(): IntervalDomain<IntervalTop>; static bottom(): IntervalDomain<IntervalBottom>; static abstract(concrete: ReadonlySet<number> | typeof Top): IntervalDomain; top(): this & IntervalDomain<IntervalTop>; bottom(): this & IntervalDomain<IntervalBottom>; equals(other: this): boolean; leq(other: this): boolean; join(other: IntervalLift): this; join(other: this): this; meet(other: IntervalLift): this; meet(other: this): this; widen(other: this): this; narrow(other: this): this; concretize(limit: number): ReadonlySet<number> | typeof Top; abstract(concrete: ReadonlySet<number> | typeof Top): this; satisfies(value: number, comparator?: NumericalComparator): Ternary; /** * Adds another abstract value to the current abstract value by adding the two lower and upper bounds, respectively. */ add(other: this | IntervalLift): this; /** * Subtracts another abstract value from the current abstract value by subtracting the two lower and upper bounds from each other, respectively. */ subtract(other: this | IntervalLift): this; /** * Creates the minimum between the current abstract value and another abstract value by creating the minimum of the two lower and upper bounds, respectively. */ min(other: this | IntervalLift): this; /** * Creates the maximum between the current abstract value and another abstract value by creating the maximum of the two lower and upper bounds, respectively. */ max(other: this | IntervalLift): this; /** * Extends the lower bound of the current abstract value down to -∞. */ widenDown(): this; /** * Extends the upper bound of the current abstract value up to +∞. */ widenUp(): this; toJson(): unknown; toString(): string; isTop(): this is IntervalDomain<IntervalTop>; isBottom(): this is IntervalDomain<IntervalBottom>; isValue(): this is IntervalDomain<IntervalValue>; } export {};