Skip to content

Instantly share code, notes, and snippets.

@russjohnson09
Created November 6, 2012 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russjohnson09/4022375 to your computer and use it in GitHub Desktop.
Save russjohnson09/4022375 to your computer and use it in GitHub Desktop.
Generalized Rules of Inferance
def confirm(forms, rule):
wtup = rule[0]
maintup = rule[1]
if len(forms) != len(wtup):
return False
dict1 = {}
for index,form in enumerate(forms):
if maintup[index]:
splitform = split(form)
if splitform[-1] != maintup[index]:
return False
else:
for m,wff in enumerate(wtup[index]):
if dict1.has_key(wff):
if dict1[wff] != splitform[m]:
return False
else:
dict1[wff] = splitform[m]
else:
stripform = strip(form)
if dict1.has_key(wtup[index][0]):
x = dict1[wtup[index][0]]
if x != stripform:
return False
else:
dict1[wtup[index][0]] = stripform
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment