@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
62 lines (61 loc) • 3.62 kB
TypeScript
import { Ternary } from '../../util/logic';
import { AbstractDomain } from './abstract-domain';
import { Bottom } from './lattice';
import { type NumericDomain, NumericalComparator } from './value-abstract-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 */
export type IntervalValue = readonly [lower: number, upper: number];
/** The type of the Top element of the interval domain as interval [-∞, +∞] */
export type IntervalTop = typeof IntervalTop;
/** 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 | IntervalBottom;
type IntervalBound<Value extends IntervalLift> = Value extends IntervalValue ? number : number | typeof Bottom;
/**
* 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<IntervalValue, IntervalTop, IntervalBottom, Value> implements NumericDomain {
constructor(value: Value);
create(value: IntervalLift): this;
get lower(): IntervalBound<Value>;
get upper(): IntervalBound<Value>;
from(...values: number[]): this;
static top(): IntervalDomain<IntervalTop>;
static bottom(): IntervalDomain<IntervalBottom>;
static from(...values: number[]): IntervalDomain;
top(): this & IntervalDomain<IntervalTop>;
bottom(): this & IntervalDomain<IntervalBottom>;
protected equalsValue(this: IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): boolean;
protected leqValue(this: IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): boolean;
protected joinValue(this: this & IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): this;
protected meetValue(this: this & IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): this;
protected widenValue(this: this & IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): this;
protected narrowValue(this: this & IntervalDomain<IntervalValue>, other: IntervalDomain<IntervalValue>): this;
satisfies(value: number, comparator?: NumericalComparator): Ternary;
negate(): this;
add(other: this | IntervalLift): this;
subtract(other: this | IntervalLift): this;
multiply(other: this | IntervalLift): this;
divide(other: this | IntervalLift): this;
min(other: this | IntervalLift): this;
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;
protected jsonify(): unknown;
protected stringify(this: IntervalDomain<IntervalValue>): string;
isTop(): this is this & IntervalDomain<IntervalTop>;
isBottom(): this is this & IntervalDomain<IntervalBottom>;
isValue(): this is this & IntervalDomain<IntervalValue>;
isFinite(): this is this & IntervalDomain<IntervalValue>;
}
export {};