コード例 #1
0
ファイル: __main__.py プロジェクト: fritzo/pomagma
def load_theory(filename):
    theory = parser.parse_theory_file(filename)
    theory = desugar_theory(theory)
    theory['rules'].sort()
    theory['facts'].sort()
    return theory
コード例 #2
0
import os
from pomagma.compiler import sequents
from pomagma.compiler import parser
from pomagma.compiler.util import find_theories
from pomagma.compiler.sugar import desugar_theory

RULE_SETS = {
    os.path.basename(f): desugar_theory(parser.parse_theory_file(f))['rules']
    for f in find_theories()
}


def _test_contrapositives(name):
    print '# contrapositives'
    print
    for rule in RULE_SETS[name]:
        print rule.ascii()
        print
        if len(rule.succedents) != 1:
            print '    TODO'
            print
            continue
        for seq in sequents.get_contrapositives(rule):
            print seq.ascii(indent=4)
            print


def test_contrapositives():
    for name in RULE_SETS:
        yield _test_contrapositives, name