@informalsystems/quint
Version:
Core tool for the Quint specification language
63 lines (62 loc) • 2.07 kB
TypeScript
import { Either } from '@sweet-monads/either';
import { QuintEx } from './ir/quintIr';
/** The type of IFT traces.
* See https://github.com/apalache-mc/apalache/blob/main/docs/src/adr/015adr-trace.md */
export type ItfTrace = {
'#meta'?: any;
params?: string[];
vars: string[];
states: ItfState[];
loop?: number;
};
export declare const ACTION_TAKEN = "mbt::actionTaken";
export declare const NONDET_PICKS = "mbt::nondetPicks";
export type ItfState = {
'#meta'?: any;
[index: string]: ItfValue;
};
export type ItfValue = boolean | string | number | ItfValue[] | ItfBigint | ItfTup | ItfSet | ItfMap | ItfUnserializable | ItfRecord | ItfVariant;
type ItfBigint = {
'#bigint': string;
};
type ItfTup = {
'#tup': ItfValue[];
};
type ItfSet = {
'#set': ItfValue[];
};
type ItfMap = {
'#map': [ItfValue, ItfValue][];
};
type ItfUnserializable = {
'#unserializable': string;
};
type ItfRecord = {
[index: string]: ItfValue;
};
type ItfVariant = {
tag: ItfValue;
value: ItfValue;
};
/**
* Convert a list of Quint expressions into an object that matches the JSON
* representation of the ITF trace. This function does not add metadata
* to the trace. This should be done by the caller.
*
* @param vars variable names
* @param states an array of expressions that represent the states
* @returns an object that represent the trace in the ITF format
*/
export declare function toItf(vars: string[], states: QuintEx[], mbtMetadata?: boolean): Either<string, ItfTrace>;
export declare function ofItf(itf: ItfTrace): QuintEx[];
/**
* Normalizes the given ItfTrace by converting its state to runtime values and
* back to quint expressions. Note that this round trip results in normalized
* expression where, for example, maps and sets are sorted alphabetically.
* Usefull for pretty printing traces produced by Apalache.
*
* @param itf - The ItfTrace to normalize
* @returns An array of its states as normalized quint expressions
*/
export declare function ofItfNormalized(itf: ItfTrace): QuintEx[];
export {};