Minor reformatting

This commit is contained in:
Patrick Lühne 2020-05-11 03:18:11 +02:00
parent ee1539e2ab
commit 7832f18ffd
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -225,23 +225,23 @@ where
display_variable_declaration(variable_declaration, self.context); display_variable_declaration(variable_declaration, self.context);
let display_term = |term| display_term(term, self.context); let display_term = |term| display_term(term, self.context);
use foliage::*;
match &self.term match &self.term
{ {
foliage::Term::Boolean(true) => write!(formatter, "$true"), Term::Boolean(true) => write!(formatter, "$true"),
foliage::Term::Boolean(false) => write!(formatter, "$false"), Term::Boolean(false) => write!(formatter, "$false"),
foliage::Term::SpecialInteger(foliage::SpecialInteger::Infimum) => Term::SpecialInteger(SpecialInteger::Infimum) => write!(formatter, "c__infimum__"),
write!(formatter, "c__infimum__"), Term::SpecialInteger(SpecialInteger::Supremum) => write!(formatter, "c__supremum__"),
foliage::Term::SpecialInteger(foliage::SpecialInteger::Supremum) => Term::Integer(value) => match value.is_negative()
write!(formatter, "c__supremum__"),
foliage::Term::Integer(value) => match value.is_negative()
{ {
true => write!(formatter, "$uminus({})", -value), true => write!(formatter, "$uminus({})", -value),
false => write!(formatter, "{}", value), false => write!(formatter, "{}", value),
}, },
foliage::Term::String(_) => panic!("strings not supported in TPTP"), Term::String(_) => panic!("strings not supported in TPTP"),
foliage::Term::Variable(variable) => Term::Variable(variable) =>
write!(formatter, "{:?}", display_variable_declaration(&variable.declaration)), write!(formatter, "{:?}", display_variable_declaration(&variable.declaration)),
foliage::Term::Function(function) => Term::Function(function) =>
{ {
write!(formatter, "{}", function.declaration.name)?; write!(formatter, "{}", function.declaration.name)?;
@ -267,30 +267,24 @@ where
Ok(()) Ok(())
}, },
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Add, left, right}) =>
operator: foliage::BinaryOperator::Add, left, right}) =>
write!(formatter, "$sum({:?}, {:?})", display_term(left), display_term(right)), write!(formatter, "$sum({:?}, {:?})", display_term(left), display_term(right)),
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Subtract, left, right})
operator: foliage::BinaryOperator::Subtract, left, right}) => =>
write!(formatter, "$difference({:?}, {:?})", display_term(left), write!(formatter, "$difference({:?}, {:?})", display_term(left),
display_term(right)), display_term(right)),
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Multiply, left, right})
operator: foliage::BinaryOperator::Multiply, left, right}) => =>
write!(formatter, "$product({:?}, {:?})", display_term(left), display_term(right)), write!(formatter, "$product({:?}, {:?})", display_term(left), display_term(right)),
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Divide, ..}) =>
operator: foliage::BinaryOperator::Divide, ..}) =>
panic!("division not supported with TPTP output"), panic!("division not supported with TPTP output"),
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Modulo, ..}) =>
operator: foliage::BinaryOperator::Modulo, ..}) =>
panic!("modulo not supported with TPTP output"), panic!("modulo not supported with TPTP output"),
foliage::Term::BinaryOperation(foliage::BinaryOperation{ Term::BinaryOperation(BinaryOperation{operator: BinaryOperator::Exponentiate, ..}) =>
operator: foliage::BinaryOperator::Exponentiate, ..}) =>
panic!("exponentiation not supported with TPTP output"), panic!("exponentiation not supported with TPTP output"),
foliage::Term::UnaryOperation(foliage::UnaryOperation{ Term::UnaryOperation(UnaryOperation{operator: UnaryOperator::Negative, argument}) =>
operator: foliage::UnaryOperator::Negative, argument}) =>
write!(formatter, "$uminus({:?})", display_term(argument)), write!(formatter, "$uminus({:?})", display_term(argument)),
foliage::Term::UnaryOperation(foliage::UnaryOperation{ Term::UnaryOperation(UnaryOperation{operator: UnaryOperator::AbsoluteValue, ..}) =>
operator: foliage::UnaryOperator::AbsoluteValue, ..}) =>
panic!("absolute value not supported with TPTP output"), panic!("absolute value not supported with TPTP output"),
} }
} }