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._formatted_operation( 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)
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._formatted_operation(format_type, operator_str, operands, fence=fence, subFence=subFence, wrap_positions=wrap_positions, justification=justification)