Trait

inox.ast

ExprOps

Related Doc: package ast

Permalink

trait ExprOps extends GenTreeOps

Provides functions to manipulate Expressions.Expr.

This object provides a few generic operations on Inox expressions, as well as some common operations.

The generic operations lets you apply operations on a whole tree expression. You can look at:

These operations usually take a higher order function that gets applied to the expression tree in some strategy. They provide an expressive way to build complex operations on Inox expressions.

Linear Supertypes
GenTreeOps, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ExprOps
  2. GenTreeOps
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Source = Trees.Expr

    Permalink
    Definition Classes
    ExprOpsGenTreeOps
  2. type Target = Trees.Expr

    Permalink
    Definition Classes
    ExprOpsGenTreeOps

Abstract Value Members

  1. abstract val trees: Trees

    Permalink
    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. lazy val Deconstructor: Trees.Operator.type

    Permalink

    An extractor for Source

    An extractor for Source

    Definition Classes
    ExprOpsGenTreeOps
  5. object Same

    Permalink
    Definition Classes
    GenTreeOps
  6. object VariableExtractor

    Permalink
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def collect[T](matcher: (Source) ⇒ Set[T])(e: Source): Set[T]

    Permalink

    Collects a set of objects from all sub-expressions

    Collects a set of objects from all sub-expressions

    Definition Classes
    GenTreeOps
  10. def collectPreorder[T](matcher: (Source) ⇒ Seq[T])(e: Source): Seq[T]

    Permalink
    Definition Classes
    GenTreeOps
  11. def containsFunctionCalls(expr: Trees.Expr): Boolean

    Permalink

    Returns true if the expression contains a function call

  12. def count(matcher: (Source) ⇒ Int)(e: Source): Int

    Permalink

    Counts how many times the predicate holds in sub-expressions

    Counts how many times the predicate holds in sub-expressions

    Definition Classes
    GenTreeOps
  13. def depth(e: Source): Int

    Permalink

    Computes the depth of the tree

    Computes the depth of the tree

    Definition Classes
    GenTreeOps
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def exists(matcher: (Source) ⇒ Boolean)(e: Source): Boolean

    Permalink

    Checks if the predicate holds in some sub-expression

    Checks if the predicate holds in some sub-expression

    Definition Classes
    GenTreeOps
  17. def filter(matcher: (Source) ⇒ Boolean)(e: Source): Set[Source]

    Permalink

    Returns a set of all sub-expressions matching the predicate

    Returns a set of all sub-expressions matching the predicate

    Definition Classes
    GenTreeOps
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def floor(fl: Trees.FractionLiteral): Trees.FractionLiteral

    Permalink
  20. def fold[T](f: (Source, Seq[T]) ⇒ T)(e: Source): T

    Permalink

    Does a right tree fold

    Does a right tree fold

    A right tree fold applies the input function to the subnodes first (from left to right), and combine the results along with the current node value.

    f

    a function that takes the current node and the seq of results form the Sources.

    e

    The value on which to apply the fold.

    returns

    The expression after applying f on all Sources.

    Definition Classes
    GenTreeOps
    Note

    the computation is lazy, hence you should not rely on side-effects of f

  21. def formulaSize(t: Source): Int

    Permalink

    Computes the size of a tree

    Computes the size of a tree

    Definition Classes
    GenTreeOps
  22. def freshenLocals(expr: Trees.Expr): Trees.Expr

    Permalink

    Freshens all local variables

  23. def functionCallsOf(expr: Trees.Expr): Set[Trees.FunctionInvocation]

    Permalink

    Returns all Function calls found in the expression

  24. def genericTransform[C](pre: (Source, C) ⇒ (Source, C), post: (Target, C) ⇒ (Target, C), combiner: (Target, Seq[C]) ⇒ C)(init: C)(expr: Source): (Target, C)

    Permalink

    Applies functions and combines results in a generic way

    Applies functions and combines results in a generic way

    Start with an initial value, and apply functions to nodes before and after the recursion in the children. Combine the results of all children and apply a final function on the resulting node.

    pre

    a function applied on a node before doing a recursion in the children

    post

    a function applied to the node built from the recursive application to all children

    combiner

    a function to combine the resulting values from all children with the current node

    init

    the initial value

    expr

    the expression on which to apply the transform

    Definition Classes
    GenTreeOps
    See also

    simplePostTransform

    simplePreTransform

    simpleTransform

  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  27. def isGround(e: Trees.Expr): Boolean

    Permalink

    Returns true if the formula is Ground, which means that it does not contain any variables (variablesOf e is empty)

  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. def isRealExpr(v: Trees.Expr): Boolean

    Permalink
  30. def isSimple(e: Trees.Expr): Boolean

    Permalink

    Returns true if the formula is simple, which means that it requires no special encoding for an unrolling solver.

    Returns true if the formula is simple, which means that it requires no special encoding for an unrolling solver. See implementation for what this means exactly.

  31. def lookup[T](checker: (Source) ⇒ Boolean, toExtract: (Source) ⇒ T)(treeToLookInto: Source, treeToExtract: Source): Option[T]

    Permalink

    Given a tree toSearch present in treeToLookInto, if treeToLookInto has the same shape as treeToExtract, returns the matching expression in treeToExtract.

    Given a tree toSearch present in treeToLookInto, if treeToLookInto has the same shape as treeToExtract, returns the matching expression in treeToExtract.

    Definition Classes
    GenTreeOps
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. def negate(expr: Trees.Expr): Trees.Expr

    Permalink

    Computes the negation of a boolean formula, with some simplifications.

  34. def noCombiner(e: Target, subCs: Seq[Unit]): Unit

    Permalink
    Definition Classes
    GenTreeOps
  35. def noTransformer[C](e: Source, c: C): (Source, C)

    Permalink
    Definition Classes
    GenTreeOps
  36. def normalizeFraction(fl: Trees.FractionLiteral): Trees.FractionLiteral

    Permalink

    Some helper methods for FractionLiterals

  37. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. def postMap(f: (Target) ⇒ Option[Target], applyRec: Boolean = false)(e: Source): Target

    Permalink

    Post-transformation of the tree.

    Post-transformation of the tree.

    Takes a partial function of replacements. Substitutes after recurring down the trees.

    Supports two modes :

    • If applyRec is false (default), will only substitute once on each level. e.g.
    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> z, Minus(e,c) -> d, b -> e

    will yield:

    Add(a, Minus(e, c))
    • If applyRec is true, it will substitute multiple times on each level: e.g.
    Add(a, Minus(b, c)) with replacements: Minus(e,c) -> d, b -> e, d -> f

    will yield:

    Add(a, f)
    Definition Classes
    GenTreeOps
    Note

    The mode with applyRec true can diverge if f is not well formed (i.e. not convergent)

  40. def postTraversal(f: (Source) ⇒ Unit)(e: Source): Unit

    Permalink

    Post-traversal of the tree.

    Post-traversal of the tree.

    Invokes the input function on every node after visiting children.

    e.g.

    Add(a, Minus(b, c))

    will yield, in order:

    f(a), f(b), f(c), f(Minus(b, c)), f(Add(a, Minus(b, c)))
    f

    a function to apply on each node of the expression

    e

    the expression to traverse

    Definition Classes
    GenTreeOps
  41. def preFoldWithContext[C](f: (Source, C) ⇒ C, combiner: (Source, C, Seq[C]) ⇒ C)(e: Source, c: C): C

    Permalink
    Definition Classes
    GenTreeOps
  42. def preMap(f: (Source) ⇒ Option[Source], applyRec: Boolean = false)(e: Source): Target

    Permalink

    Pre-transformation of the tree.

    Pre-transformation of the tree.

    Takes a partial function of replacements and substitute before recursing down the trees.

    Supports two modes :

    • If applyRec is false (default), will only substitute once on each level.

    e.g.

    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> d, b -> e, d -> f

    will yield:

    Add(a, d)   // And not Add(a, f) because it only substitute once for each level.
    • If applyRec is true, it will substitute multiple times on each level:

    e.g.

    Add(a, Minus(b, c)) with replacements: Minus(b,c) -> d, b -> e, d -> f

    will yield:

    Add(a, f)
    Definition Classes
    GenTreeOps
    Note

    The mode with applyRec true can diverge if f is not well formed

  43. def preMapWithContext[C](f: (Source, C) ⇒ (Option[Source], C), applyRec: Boolean = false)(e: Source, c: C): Target

    Permalink

    Pre-transformation of the tree, with a context value from "top-down".

    Pre-transformation of the tree, with a context value from "top-down".

    Takes a partial function of replacements. Substitutes before recursing down the trees. The function returns an option of the new value, as well as the new context to be used for the recursion in its children. The context is "lost" when going back up, so changes made by one node will not be see by its siblings.

    Definition Classes
    GenTreeOps
  44. def preTraversal(f: (Source) ⇒ Unit)(e: Source): Unit

    Permalink

    Pre-traversal of the tree.

    Pre-traversal of the tree.

    Invokes the input function on every node before visiting children. Traverse children from left to right Sources.

    e.g.

    Add(a, Minus(b, c))

    will yield, in order:

    f(Add(a, Minus(b, c))); f(a); f(Minus(b, c)); f(b); f(c)
    f

    a function to apply on each node of the expression

    e

    the expression to traverse

    Definition Classes
    GenTreeOps
  45. def preTraversalWithParent(f: (Trees.Expr, Option[Tree]) ⇒ Unit, initParent: Option[Tree] = None)(e: Trees.Expr): Unit

    Permalink
  46. val realzero: Trees.FractionLiteral

    Permalink
  47. def replace(substs: Map[Target, Target], expr: Source): Target

    Permalink

    Replaces bottom-up sub-expressions by looking up for them in a map

    Replaces bottom-up sub-expressions by looking up for them in a map

    Definition Classes
    GenTreeOps
  48. def replaceFromSymbols(substs: Map[Trees.ValDef, Trees.Expr], expr: Trees.Expr): Trees.Expr

    Permalink

    Replaces bottom-up variables by looking them up in a map from ValDef to expressions

  49. def replaceFromSymbols[V <: Trees.VariableSymbol](substs: Map[V, Trees.Expr], expr: Trees.Expr)(implicit ev: Trees.VariableConverter[V]): Trees.Expr

    Permalink

    Replaces bottom-up variables by looking up for them in a map

  50. def simplePostTransform(post: (Target) ⇒ Target)(tree: Source): Target

    Permalink

    A simpleTransform without a pre-transformation

    A simpleTransform without a pre-transformation

    Definition Classes
    GenTreeOps
  51. def simplePreTransform(pre: (Source) ⇒ Source)(tree: Source): Target

    Permalink

    A simpleTransform without a post-transformation

    A simpleTransform without a post-transformation

    Definition Classes
    GenTreeOps
  52. def simpleTransform(pre: (Source) ⇒ Source, post: (Target) ⇒ Target)(tree: Source): Target

    Permalink

    A genericTransform with the trivial combiner that returns ()

    A genericTransform with the trivial combiner that returns ()

    Definition Classes
    GenTreeOps
  53. def simplifyArithmetic(expr: Trees.Expr): Trees.Expr

    Permalink

    Simple, local simplification on arithmetic

    Simple, local simplification on arithmetic

    You should not assume anything smarter than some constant folding and simple cancellation. To avoid infinite cycle we only apply simplification that reduce the size of the tree. The only guarantee from this function is to not augment the size of the expression and to be sound.

  54. def simplifyString(expr: Trees.Expr): Trees.Expr

    Permalink

    Simple, local optimization on string

  55. val sourceTrees: trees.type

    Permalink
    Definition Classes
    ExprOpsGenTreeOps
  56. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  57. val targetTrees: trees.type

    Permalink
    Definition Classes
    ExprOpsGenTreeOps
  58. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  59. def variablesOf(expr: Trees.Expr): Set[Trees.Variable]

    Permalink

    Returns the set of free variables in an expression

  60. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  62. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from GenTreeOps

Inherited from AnyRef

Inherited from Any

Ungrouped