# Path: calculus/symbol.py
# class Symbol:
# class StringSymbol(Symbol):
#   def __init__(self, type):
#   def _generate_id(self):
#   def __eq__(self, other):
#   def __ne__(self):
#   def __hash__(self):
#   def __repr__(self):
#   def __init__(self, s, type, infix = None):
#   def __repr__(self):
# 
# Path: ui/render/text/primitives.py
# def newTextStack(color, s):
# def wrapVariableInfix(s):
# def holds():
# def surroundWithNot(s):
# def solidSquare(color, widths):
# def identical(covariant):
# def iff():
# def _dimension_for_variance(covariant):
# def _dual_dimension(dimension):
# def andDivider(covariant):
#   def f(length):
# def orDivider(covariant):
#   def f(length):
# def quantifierDivider(covariant, length):
# def divider(color, dimension, length, width, special_character = None):
# 
# Path: ui/render/text/colors.py
# def productPairsColor(i):
# def exponentialColor(isAlways):
# 
# Path: ui/render/text/distances.py

# 
# Path: ui/stack/stack.py
# def stack(self, dimension, other, spacing = 0):
#   if self._backend.stacks():
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = spacing
#     coords = list(self._coords)
#     for i in range(len(coords)):
#       if i == dimension:
#         coords[i] += spacing + other._coords[i]
#       else:
#         coords[i] = max(coords[i], other._coords[i])
#     return Stack(coords, self._backend.stack(dimension, other._backend.shift(offset)))
#   else:
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = self.widths()[dimension] + spacing
#     return self.below(other.shift(offset))


from sets import Set
from calculus import symbol
from ui.render.text import primitives, colors, distances
from ui.stack import stack
    return result

  def __eq__(self, other):
    return (other.__class__ == ProductVariable
        and self.symbol_variable_pairs == other.symbol_variable_pairs)
  def __ne__(self, other):
    return not(self == other)
  def __repr__(self):
    return "{" + ", ".join([repr(s) + ": " + repr(v) for (s,v) in self.symbol_variable_pairs]) + "}"
  def updateVariables(self):
    return ProductVariable(
        symbol_variable_pairs = [(s, v.updateVariables()) for (s,v) in self.symbol_variable_pairs])
  def substituteVariable(self, a, b):
    return ProductVariable(
        symbol_variable_pairs = [(s, v.substituteVariable(a, b))
                                 for (s,v) in self.symbol_variable_pairs])
  def freeVariables(self):
    result = Set()
    for (s, v) in self.symbol_variable_pairs:
      result.union_update(v.freeVariables())
    return result

  def render(self):
    symbolVariablePairs = []
    for i in range(len(self.symbol_variable_pairs)):
      (s,v) = self.symbol_variable_pairs[i]
      (c0, c1) = colors.productPairsColor(i)
      symbolVariablePairs.append(renderSymbolVariablePair(renderSymbol(s),
        v.render(), c0, c1))
    return stack.stackAll(0, symbolVariablePairs,

# Path: calculus/symbol.py
# class Symbol:
# class StringSymbol(Symbol):
#   def __init__(self, type):
#   def _generate_id(self):
#   def __eq__(self, other):
#   def __ne__(self):
#   def __hash__(self):
#   def __repr__(self):
#   def __init__(self, s, type, infix = None):
#   def __repr__(self):
# 
# Path: ui/render/text/primitives.py
# def newTextStack(color, s):
# def wrapVariableInfix(s):
# def holds():
# def surroundWithNot(s):
# def solidSquare(color, widths):
# def identical(covariant):
# def iff():
# def _dimension_for_variance(covariant):
# def _dual_dimension(dimension):
# def andDivider(covariant):
#   def f(length):
# def orDivider(covariant):
#   def f(length):
# def quantifierDivider(covariant, length):
# def divider(color, dimension, length, width, special_character = None):
# 
# Path: ui/render/text/colors.py
# def productPairsColor(i):
# def exponentialColor(isAlways):
# 
# Path: ui/render/text/distances.py

# 
# Path: ui/stack/stack.py
# def stack(self, dimension, other, spacing = 0):
#   if self._backend.stacks():
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = spacing
#     coords = list(self._coords)
#     for i in range(len(coords)):
#       if i == dimension:
#         coords[i] += spacing + other._coords[i]
#       else:
#         coords[i] = max(coords[i], other._coords[i])
#     return Stack(coords, self._backend.stack(dimension, other._backend.shift(offset)))
#   else:
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = self.widths()[dimension] + spacing
#     return self.below(other.shift(offset))


# Path: calculus/variable.py
from sets import Set
from calculus import symbol
from ui.render.text import primitives, colors, distances
from ui.stack import stack

    return result

  def __eq__(self, other):
    return (other.__class__ == ProductVariable
        and self.symbol_variable_pairs == other.symbol_variable_pairs)
  def __ne__(self, other):
    return not(self == other)
  def __repr__(self):
    return "{" + ", ".join([repr(s) + ": " + repr(v) for (s,v) in self.symbol_variable_pairs]) + "}"
  def updateVariables(self):
    return ProductVariable(
        symbol_variable_pairs = [(s, v.updateVariables()) for (s,v) in self.symbol_variable_pairs])
  def substituteVariable(self, a, b):
    return ProductVariable(
        symbol_variable_pairs = [(s, v.substituteVariable(a, b))
                                 for (s,v) in self.symbol_variable_pairs])
  def freeVariables(self):
    result = Set()
    for (s, v) in self.symbol_variable_pairs:
      result.union_update(v.freeVariables())
    return result

  def render(self):
    symbolVariablePairs = []
    for i in range(len(self.symbol_variable_pairs)):
      (s,v) = self.symbol_variable_pairs[i]
      (c0, c1) = colors.productPairsColor(i)
      symbolVariablePairs.append(renderSymbolVariablePair(renderSymbol(s),
        v.render(), c0, c1))
    return stack.stackAll(0, symbolVariablePairs,

        spacing = distances.productVariableHorizontalSpacing)