Class SubContext

java.lang.Object
edu.udel.cis.vsl.sarl.simplify.simplifier.Context
edu.udel.cis.vsl.sarl.simplify.simplifier.SubContext
All Implemented Interfaces:
ContextIF

public class SubContext extends Context
A sub-context represents a boolean expression that holds within the context of some other assumption. Hence everything in the super-context is assumed to hold, in addition to everything in the sub-context. This is used to provide scoping to contexts.
  • Field Details

    • debug

      public static boolean debug
      Should we print debugging information?
    • out

      public static final PrintStream out
      Where the debugging output goes.
  • Constructor Details

    • SubContext

      public SubContext(Context superContext, Set<SymbolicExpression> simplificationStack)
      New empty sub-context (equivalent to assumption true).
      Parameters:
      superContext - the (non-null) context containing this one
      simplificationStack - the symbolic expressions that have already been seen; used to prevent cycles (currently only in debug mode)
    • SubContext

      public SubContext(Context superContext, Set<SymbolicExpression> simplificationStack, BooleanExpression assumption)
      Creates new sub-context and initializes it using the given assumption.
      Parameters:
      superContext - the (non-null) context containing this one
      simplificationStack - the symbolic expressions that have already been seen; used to prevent cycles (currently only in debug mode)
      assumption - the boolean expression to be represented by this sub-context
  • Method Details

    • getSub

      Looks up an entry in the substitution map of this context. This method is overridden in the SubContext class.

      Looks first in this sub-context for an entry in the sub map for the given key. If none is found, then looks in the super-context.

      Overrides:
      getSub in class Context
      Parameters:
      key - the key to look up
      Returns:
      the simplified expression that should replace key, or null
    • getLinearSolver

      public LinearSolver getLinearSolver()
      Constructs an instance of LinearSolver that can be used to simplify the Context.subMap of this Context.

      For this sub-context, a form of "relative" Gaussian elimination is performed. The linear equalities of this sub-context are simplified using the information from the super-context before ordinary Gaussian elimination is performed.

      Overrides:
      getLinearSolver in class Context
      Returns:
      a linear solver based on relative Gaussian elimination that can be used to simplify the substitution map of this sub-context assuming all substitutions in the super context
    • simplify

      public SymbolicExpression simplify(SymbolicExpression expr)
      Description copied from class: Context
      Simplifies a symbolic expression using the current state of this Context.
      Overrides:
      simplify in class Context
      Parameters:
      expr - the expression to simplify
      Returns:
      the simplified expression
    • getGlobalContext

      public Context getGlobalContext()
      Overrides:
      getGlobalContext in class Context