@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
62 lines (61 loc) • 3.3 kB
TypeScript
import { type AbstractDomain } from './abstract-domain';
import { Bottom, Top } from './lattice';
/** The type of the actual values of the interval domain as tuple of the lower and upper bound */
export type IntervalValue = readonly [number, number];
/** The type of the Top element of the interval domain as interval [-∞, +∞] from -∞ to +∞ */
export type IntervalTop = readonly [typeof Infinity, typeof Infinity];
/** The type of the Bottom element of the interval domain as {@link Bottom} symbol */
export type IntervalBottom = typeof Bottom;
/** The type of the abstract values of the interval domain that are Top, Bottom, or actual values */
export type IntervalLift = IntervalValue | IntervalTop | 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> implements AbstractDomain<number, IntervalValue, IntervalTop, IntervalBottom, Value> {
private _value;
constructor(value: Value);
get value(): Value;
static top(): IntervalDomain<IntervalTop>;
static bottom(): IntervalDomain<IntervalBottom>;
static abstract(concrete: ReadonlySet<number> | typeof Top): IntervalDomain;
top(): IntervalDomain<IntervalTop>;
bottom(): IntervalDomain<IntervalBottom>;
equals(other: IntervalDomain): boolean;
leq(other: IntervalDomain): boolean;
join(...values: IntervalDomain[]): IntervalDomain;
meet(...values: IntervalDomain[]): IntervalDomain;
widen(other: IntervalDomain): IntervalDomain;
narrow(other: IntervalDomain): IntervalDomain;
concretize(limit?: number): ReadonlySet<number> | typeof Top;
abstract(concrete: ReadonlySet<number> | typeof Top): IntervalDomain;
/**
* Adds another abstract value to the current abstract value by adding the two lower and upper bounds, respectively.
*/
add(other: IntervalDomain): IntervalDomain;
/**
* Subtracts another abstract value from the current abstract value by subtracting the two lower and upper bounds from each other, respectively.
*/
subtract(other: IntervalDomain): IntervalDomain;
/**
* 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: IntervalDomain): IntervalDomain;
/**
* 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: IntervalDomain): IntervalDomain;
/**
* Extends the lower bound of the current abstract value down to -∞.
*/
extendDown(): IntervalDomain;
/**
* Extends the upper bound of the current abstract value up to +∞.
*/
extendUp(): IntervalDomain;
toString(): string;
isTop(): this is IntervalDomain<IntervalTop>;
isBottom(): this is IntervalDomain<IntervalBottom>;
isValue(): this is IntervalDomain<IntervalValue>;
}