import type { TBindingClassificationResult, TBindingPremiseUse, TRebaseDecisions } from "../../types/response.js"; import type { ArgumentEngine, TArgumentEngineSnapshot } from "../argument-engine.js"; export interface TClassifyBindingsOptions { /** * Snapshots of other arguments, each identified by its id and version. * When a bound expression references an element of another argument and * the two versions of the answered argument pin that reference to * different versions, the element is compared across the two versions * supplied here. Without them the binding is reported changed with reason * `outsideReferenceRepinned`. */ outsideSnapshots?: readonly TArgumentEngineSnapshot[]; } /** * The premises of a response that dropping a variable removes: every premise * using the variable, then every premise using a variable bound to a premise * already in the list, and so on, since removing a premise removes the * variables bound to it and every expression using them. */ export declare function premisesDroppedWith(response: ArgumentEngine, variableId: string): TBindingPremiseUse[]; /** * Classifies what happened to each expression binding of a response between * two versions of the argument it answers, before the response is moved * from `targetFrom` to `targetTo`. * * Nothing here compares the two version numbers: `targetTo` may be older * than `targetFrom`, for example to show what a response pinned to a newer * version would see on the older one. Every label is then read in that * direction — `removed` means absent from `targetTo`. * * Each expression-bound variable is judged against the snapshot of the * version it is bound to. One already bound to `targetTo` is * `alreadyRebased` when its expression is there and `removed` when it is * not. Every other one must be bound to `targetFrom`, and is: * - `removed` when its expression id is absent from `targetTo`; * - `changed` when the expression's structure (`content`) or position * (`position`: its position class, or, for a nested expression, whether its * premise is the conclusion) differs, or when something it references in another * argument is pinned to a different version that differs (`content`) or * cannot be compared because a snapshot was not supplied * (`outsideReferenceRepinned`); * - `unchanged` otherwise. * * Each entry lists the premises dropping the variable would remove. The * response's claim-bound variables are not classified: a claim it shares with * either version means the same proposition in both, and rebasing never * touches it. * * @throws When the response is not a response, when the two snapshots are * not versions of one argument, when the response answers neither version, * or when a binding names any other version. */ export declare function classifyBindings(response: ArgumentEngine, targetFrom: TArgumentEngineSnapshot, targetTo: TArgumentEngineSnapshot, options?: TClassifyBindingsOptions): TBindingClassificationResult; /** What a rebase does, worked out and checked before anything changes. */ export interface TResolvedRebase { classification: TBindingClassificationResult; /** Expression-bound variables to bind to `targetTo`, with their new expression. */ repoint: Map; /** Premises to remove, in the order listed. */ dropPremiseIds: string[]; /** Variables to remove after their premises. */ dropVariableIds: string[]; } /** * Works out what a rebase does from the classification and the caller's * decisions, refusing every decision that cannot be carried out before * anything changes. * * @throws When a changed or removed binding has no decision; when a decision names a variable that needs none; when a * removed binding is to be kept; when a retarget names an expression absent * from `targetTo`; when a keep or retarget would bind an expression another * variable already binds in the same aspect. */ export declare function resolveRebase(response: ArgumentEngine, targetFrom: TArgumentEngineSnapshot, targetTo: TArgumentEngineSnapshot, decisions: TRebaseDecisions, options?: TClassifyBindingsOptions): TResolvedRebase; /** * The link faults `validateLinks` reports of severity `"error"`, each keyed * by its code, variable id and expression id, so that the faults before and * after a rebase can be compared. */ export declare function linkFaultKeys(response: ArgumentEngine, targetSnapshot: TArgumentEngineSnapshot): Set; /** * Throws unless every expression-bound variable of the response is bound to * `targetTo` and names an expression present there, and `validateLinks` * against `targetTo` reports no fault that `faultsBefore` lacks. */ export declare function assertRebased(response: ArgumentEngine, targetTo: TArgumentEngineSnapshot, faultsBefore: ReadonlySet): void; //# sourceMappingURL=rebase.d.ts.map