def test_string_to_sequent(self): string = "Predicate(alpha), (Relation(alpha; beta) and Relation(beta; delta)) " \ "|~ (Relation(beta; gamma) implies Predicate(delta)), Predicate(delta) or Predicate(zeta)" sequent = String(string).to_sequent() self.assertEqual( Sequent( [ Atom("Predicate", ("alpha",)), Conjunction( Atom("Relation", ("alpha", "beta")), Atom("Relation", ("beta", "delta")) ) ], [ Conditional( Atom("Relation", ("beta", "gamma")), Atom("Predicate", ("delta",)) ), Disjunction( Atom("Predicate", ("delta",)), Atom("Predicate", ("zeta",)) ) ] ), sequent )
def test_inv_left_conditional(self): """Predicate(alpha) implies Predicate(beta) |~ """ sequent = Sequent([Conditional(self.alpha, self.beta)], []) decomp = sequent.decompose()[0] self.assertEqual(Sequent([], [self.alpha]), decomp[0]) self.assertEqual(Sequent([self.beta], []), decomp[1])
def test_inv_right_conditional(self): """|~ Predicate(alpha) implies Predicate(beta)""" sequent = Sequent([], [Conditional(self.alpha, self.beta)]) decomp = sequent.decompose()[0][0] self.assertEqual(Sequent([self.alpha], [self.beta]), decomp)
import os import json from Objects.Sequents import Sequent # Propositions from Propositions.BaseClasses import Atom from Propositions.Propositions import Negation, Conditional, Conjunction, Disjunction atom = Atom('Proposition') negation = Negation(atom) conditional = Conditional(atom, atom) conjunction = Conjunction(atom, atom) disjunction = Disjunction(atom, atom) propositions_list = [atom, negation, conditional, conjunction, disjunction] # Proposition Strings atom_str = 'Proposition' neg_str = '(not Proposition)' cond_str = '(Proposition implies Proposition)' conj_str = '(Proposition and Proposition)' disj_str = '(Proposition or Proposition)' proposition_strings_list = [atom_str, neg_str, cond_str, conj_str, disj_str] # Reflexive Sequents # Note: do not attempt to decompose universal sequents non-invertibly. empty_sequent = Sequent([], []) reflexive_atomic_sequent = Sequent([atom], [atom]) reflexive_negation_sequent = Sequent([negation], [negation]) reflexive_conditional_sequent = Sequent([conditional], [conditional])