trycommand inps[ if command ="quit"going false elif command ="ask"proof prove_atom(kbinps[ ]if proof ="fail"print("fail"elseprint("yes"elif command ="how"if proof=="fail"print("there is no proof"elif len(inps)== print_rule(proofelsetryups append(proofproof proof[ ][int(inps[ ])#nth argument of rule print_rule(proofexceptprint('in "how " must be number between and',len(proof[ ])- ,"inclusive "elif command ="up"if upsproof ups pop(elseprint("no rule to go up to "print_rule(proofelif command ="kb"print(kbelif command ="help"print(helptextelseprint("unknown command:"inpprint("use help for help"exceptprint("unknown command:"inpprint("use help for help" def print_rule(proof)(head,bodyproof if body ="answered"print(head,"was answered yes"elif body =[]print(head,"is fact"elseprint(head,"<-"for , in enumerate(body)print( ,":", [ ]version june