Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 63 lines (56 sloc) 1.994 kb
9477395 Updates and stuff
Marco Ziener authored
1 #!/usr/bin/env python3
2 import parser as tptp
3 import argparse as a
dca6466 added operations import for parsing stuff
Marco Ziener authored
4 import operations as o
aa19127 @slomo working resolution
authored
5 import resolution as r
6 import fofTypes as f
a679963 @Sh4kE unification update
Sh4kE authored
7 import unification as u
08e46d5 @slomo add json loader
authored
8 import loader as l
65a165c @slomo fix annoying bug, and refector some more
authored
9
9477395 Updates and stuff
Marco Ziener authored
10 def from_file(file):
11 return tptp.parse_file(file)
65a165c @slomo fix annoying bug, and refector some more
authored
12
5bc0066 @Sh4kE transformation is now done on every input and the correct functions are ...
Sh4kE authored
13 def from_string(string):
14 return tptp.parse_string(string)
9477395 Updates and stuff
Marco Ziener authored
15
16 if __name__ == '__main__':
17
18 parser = a.ArgumentParser(description='A simple fof solver using tptp syntax')
19 parser.add_argument('--file', action='store')
08e46d5 @slomo add json loader
authored
20 parser.add_argument('--jsonfile', action='store')
b3f66ec @slomo add new parameter to input fromular directly
authored
21 parser.add_argument('--formula', action='store')
22
9477395 Updates and stuff
Marco Ziener authored
23 args = vars(parser.parse_args())
24 if args['file']:
f6abf04 @slomo working
authored
25 fof_data = l.parse_and_load(args['file'])
26 #fof_data = from_file(args['file'])
b3f66ec @slomo add new parameter to input fromular directly
authored
27 elif args['formula']:
3b0ffc7 @slomo fix a lot of stuff
authored
28 fof_data = from_string("fof(ax,axiom," + args['formula'] + ").")
08e46d5 @slomo add json loader
authored
29 elif args['jsonfile']:
30 fof_data = l.load_file(args['jsonfile'])
5bc0066 @Sh4kE transformation is now done on every input and the correct functions are ...
Sh4kE authored
31 else :
95f0a54 can work on difficult formulas
Marco Ziener authored
32 string = "fof(ax, axiom, ![X]: r(X) => ?[Y]:r(Y) ).fof(ax, conjecture, ![X]: r(X) => ?[Y]:r(Y) )."
b3f66ec @slomo add new parameter to input fromular directly
authored
33 fof_data = from_string(string)
3b0ffc7 @slomo fix a lot of stuff
authored
34
95f0a54 can work on difficult formulas
Marco Ziener authored
35 print("input formula:",fof_data)
36 conjectures = []
37 axioms = []
38 for formula in fof_data:
39 if formula['type'] in ('axiom', 'theorem'):
40 formula = o.transform(formula['formula'])
41 axioms.append(formula)
42 elif formula['type'] in ('conjecture'):
43 f = formula['formula'].negate()
44 f = o.transform(f)
45 conjectures.append(f)
46 print('axioms: ', axioms)
47 print('conjectures: ', conjectures)
48 for conjecture in conjectures:
49 print("working on: ", conjecture)
50 stuff = []
51 stuff.append(conjecture)
52 stuff += axioms
53 print(type(stuff))
54 result = r.proof(stuff)
55 if result:
56 print("formula is theorem")
3b0ffc7 @slomo fix a lot of stuff
authored
57 else:
95f0a54 can work on difficult formulas
Marco Ziener authored
58 stuff[0] = o.transform(conjecture.negate())
59 if r.proof(stuff):
60 print("formula is counter theorem")
61 else:
62 print("Unable")
Something went wrong with that request. Please try again.