UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

57 lines (56 loc) 3.23 kB
import { Ternary } from '../../util/logic'; import { AbstractDomain } from './abstract-domain'; import { Top } from './lattice'; import type { SatisfiableDomain } from './satisfiable-domain'; /** The Bottom element of the bounded set domain as empty set */ export declare const BoundedSetBottom: ReadonlySet<never>; /** The type of the actual values of the bounded set domain as set */ type BoundedSetValue<T> = ReadonlySet<T>; /** The type of the Top element of the bounded set domain as {@link Top} symbol */ type BoundedSetTop = typeof Top; /** The type of the Bottom element of the bounded set domain as empty set */ type BoundedSetBottom = typeof BoundedSetBottom; /** The type of the abstract values of the bounded set domain that are Top, Bottom, or actual values */ type BoundedSetLift<T> = BoundedSetValue<T> | BoundedSetTop | BoundedSetBottom; /** * The bounded set abstract domain as sets of possible values bounded by a `limit` indicating the maximum number of inferred values. * The Bottom element is defined as the empty set and the Top element is defined as {@link Top} symbol. * @template T - Type of the values in the abstract domain * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value) */ export declare class BoundedSetDomain<T, Value extends BoundedSetLift<T> = BoundedSetLift<T>> extends AbstractDomain<T, BoundedSetValue<T>, BoundedSetTop, BoundedSetBottom, Value> implements SatisfiableDomain<T> { readonly limit: number; private readonly setType; /** * @param limit - A limit for the maximum number of elements to store in the set * @param setType - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet */ constructor(value: Value | T[], limit?: number, setType?: typeof Set<T>); create(value: BoundedSetLift<T> | T[]): this; static top<T>(limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T, BoundedSetTop>; static bottom<T>(limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T, BoundedSetBottom>; static abstract<T>(concrete: ReadonlySet<T> | typeof Top, limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T>; top(): this & BoundedSetDomain<T, BoundedSetTop>; bottom(): this & BoundedSetDomain<T, BoundedSetBottom>; equals(other: this): boolean; leq(other: this): boolean; join(other: BoundedSetLift<T> | T[]): this; join(other: this): this; meet(other: BoundedSetLift<T> | T[]): this; meet(other: this): this; /** * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value. */ subtract(other: this | BoundedSetLift<T> | T[]): this; widen(other: this): this; narrow(other: this): this; concretize(limit: number): ReadonlySet<T> | typeof Top; abstract(concrete: ReadonlySet<T> | typeof Top): this; satisfies(value: T): Ternary; toJson(): unknown; toString(): string; isTop(): this is BoundedSetDomain<T, BoundedSetTop>; isBottom(): this is BoundedSetDomain<T, BoundedSetBottom>; isValue(): this is BoundedSetDomain<T, BoundedSetValue<T>>; } export {};