예제 #1
0
 def _formatted(self, format_type, **kwargs):
     '''
     Override Operation._formatted when formatting a conjunction
     of relations as a total ordering.
     '''
     if self.get_style('as_total_ordering', 'False') == 'True':
         self._check_total_ordering_applicability()
         relations = self.operands.entries
         operands = [rel.lhs for rel in relations] + [relations[-1].rhs]
         formatted_operators = [
             rel.operator.formatted(format_type) if rel.get_style(
                 'direction', 'normal') == 'normal' else
             rel.__class__.reversed_operator_str(format_type)
             for rel in relations
         ]
         return Operation._formattedOperation(
             format_type,
             formatted_operators,
             operands,
             wrap_positions=self.wrap_positions(),
             justification=self.get_style('justification'),
             **kwargs)
     else:
         # Just use the default Operation._formatted method.
         return Operation._formatted(self, format_type, **kwargs)
예제 #2
0
 def _formatted(self, format_type, **kwargs):
     '''
     Format the binary relation operation.  Note: it may
     be reversed if the "direction" style is "reversed".
     '''
     from proveit import ExprTuple
     wrap_positions=self.wrap_positions()
     justification=self.get_style('justification')
     fence =  kwargs.get('fence', False)
     subFence =  kwargs.get('subFence', True)
     operator_str = self.operator.formatted(format_type)
     operands = self.operands
     if self.is_reversed():
         operator_str = self.__class__.reversed_operator_str(format_type)
         operands = ExprTuple(*reversed(operands.entries))
     return Operation._formattedOperation(
             format_type, fence=fence, subFence=subFence, 
             operator_or_operators=operator_str, operands=operands,
             wrap_positions=wrap_positions, 
             justification=justification)