import { CommitConfig, Expression, ObjectValue, ObjectValueWithVariables, Query, SplitMap, Value } from "../types";
/**
 * Summary
 *
 * Expression reduction takes a query and/or some arguments and applies
 * interpreter steps to reduce the expression as much as possible. It is
 * analogous to beta-reduction in the lambda calculus. If all function arguments
 * are supplied, we return a fully reduced expression in "normal form". Normal
 * form expressions can then be converted into JSON. Otherwise, we return a
 * partially reduced expression in "complex form" which requires further
 * reduction with additional arguments for the function expressions it contains.
 *
 * Each time we reduce an expression into a simpler form, we keep track of the
 * expressions we've needed to "evaluate" to compute the reduction. We track
 * this via "logs" which we attach to the result expression. This lets users
 * visualize how often different parts of the expression tree have been used.
 *
 * Partial Field Arguments
 *
 * When a query field has a partial field arguments object, we reduce the
 * expression tree as much as possible given the available fields within this
 * object and leave the function expression that references it intact so that on
 * a subsequent reduction, when the full field arguments object can be provided,
 * we can fully reduce the tree correctly. There are 3 changes to the main
 * reduction logic that allow for this:
 *
 * 1. We leave function expressions intact if any of the arguments passed to it
 * is a partial object.
 *
 * 2. We have a reduction flag that toggles partial object variable reduction.
 * If it's off (which it is by default), we do not reduce variable expressions
 * that reference partial objects.
 *
 * 3. The only time we enable partial object variable reduction is in the
 * (initial) object reduction in a get field expression when we check to see if
 * we can access the desired field. (And if we can't, we return the get field
 * expression with its object reduced but with partial object variable reduction
 * disabled.)
 *
 * Complexity and Logic
 *
 * For any expression, there are a finite number of reduction steps until it
 * cannot be reduced further. The reduction logic of each expression type
 * attempts to reduce the expression and its children as much as possible given
 * the current context. The logic for application and variable expressions is
 * especially prone to complexity blow-up. In particular, an application
 * argument should be reduced as much as possible before being passed to a
 * function expression reduction, where it becomes a variable, so that the
 * reduction isn't repeated for every variable expression in the function body
 * that references it.
 */
export default function reduce(splits: SplitMap, commitConfig: CommitConfig, query: Query<ObjectValueWithVariables> | null, variableValues: ObjectValue, rootExpression: Expression, allowMissingVariables: boolean): Expression;
export declare function areEqual(a: Value | null | undefined, b: Value | null | undefined): boolean;
//# sourceMappingURL=reduce.d.ts.map