module FormulaMap: sig
.. end
Maps, iterators and folds over formulas and real-valued expressions.
Basic maps - to literals and atoms.
val get_atoms : Formula.formula -> Formula.formula list
All atoms in a formula.
val get_relations_constants : Formula.formula -> (string * int) list * string list
All relations in a formula, with arities, and constants that appear.
val map_to_literals : ?save_rels:string list ->
?save_rvars:string list ->
(Formula.formula -> Formula.formula) ->
(Formula.real_expr -> Formula.real_expr) ->
(Formula.formula -> Formula.formula) -> Formula.formula -> Formula.formula
Map f
to all literals (i.e. atoms or not(atom)'s) in the given formula.
Do not touch save_rels
or save_rvars
. Preserves order of subformulas.
The last function is forced and applied to saved relations.
val map_to_literals_expr : ?save_rels:string list ->
?save_rvars:string list ->
(Formula.formula -> Formula.formula) ->
(Formula.real_expr -> Formula.real_expr) ->
(Formula.formula -> Formula.formula) ->
Formula.real_expr -> Formula.real_expr
val map_to_atoms_full : (Formula.formula -> Formula.formula) ->
(Formula.real_expr -> Formula.real_expr) ->
(Formula.formula -> Formula.formula) -> Formula.formula -> Formula.formula
Map f
to all atoms in the given formula.
val map_to_atoms_full_re : (Formula.formula -> Formula.formula) ->
(Formula.real_expr -> Formula.real_expr) ->
(Formula.formula -> Formula.formula) ->
Formula.real_expr -> Formula.real_expr
val map_to_atoms : (Formula.formula -> Formula.formula) -> Formula.formula -> Formula.formula
val map_to_atoms_expr : (Formula.formula -> Formula.formula) ->
Formula.real_expr -> Formula.real_expr
Generalized maps
type
formula_and_expr_map = {
}
Generalized map over formula and real expression types.
val identity_map : formula_and_expr_map
Identity map to be refined using the with
syntax.
val map_formula : formula_and_expr_map -> Formula.formula -> Formula.formula
Map through the structure adjusting subformulas/subexpressions.
val map_real_expr : formula_and_expr_map -> Formula.real_expr -> Formula.real_expr
type 'a
formula_and_expr_fold = {
}
Generalized fold over formula and real expression types.
val make_fold : ('a -> 'a -> 'a) -> 'a -> 'a formula_and_expr_fold
val fold_formula : 'a formula_and_expr_fold -> Formula.formula -> 'a
Fold the structure using the operations. (Not tail-recursive.)
val fold_real_expr : 'a formula_and_expr_fold -> Formula.real_expr -> 'a
val map_to_formulas_expr : (Formula.formula -> Formula.formula) ->
Formula.real_expr -> Formula.real_expr
Map f
to top-level formulas in the real expression (Char
s and
Sum
guards).
val fold_over_formulas_expr : (Formula.formula -> 'a -> 'a) -> Formula.real_expr -> 'a -> 'a
val fold_over_literals : (Formula.formula -> 'a -> 'a) -> Formula.formula -> 'a -> 'a
val fold_over_atoms : (Formula.formula -> 'a -> 'a) -> Formula.formula -> 'a -> 'a
val map_to_all_vars : (Formula.var -> Formula.var) -> Formula.formula -> Formula.formula
Map