예제 #1
0
def report(kbase, binding, query, pmode, proof):
    if not pmode:
        pmode = print_mode  # use current global mode
    else:
        pmode = pmode[0]
        if pmode == None:
            return binding  # return solns to caller
            # else use pmode passed
    if binding == {}:
        print 'yes: (no variables)'
    else:
        if pmode[0] == 'vars':
            print 'yes: ',
            for var in binding.keys():
                print var, '=', binding[var], ' ',
            print
        else:
            print 'yes: ' + external(substitute(query, binding))

    if pmode[1] == 'all':
        return
    else:
        print
        if input_yes(kbase, 'show proof ? '):
            ignore = trace_tree(proof, binding, 0)

        if input_yes(kbase, 'more solutions? '):
            print
            return
        else:
            raise stop_proof
예제 #2
0
def report(kbase, binding, query, pmode, proof):
    if not pmode:
        pmode = print_mode                         # use current global mode
    else:
        pmode = pmode[0]
        if pmode == None:
            return binding                         # return solns to caller
                                                   # else use pmode passed
    if binding == {}:
        print 'yes: (no variables)'
    else:
        if pmode[0] == 'vars':
            print 'yes: ', 
            for var in binding.keys():
                print var, '=', binding[var], ' ',
            print
        else:
            print 'yes: ' + external(substitute(query, binding))
    
    if pmode[1] == 'all':
        return
    else:
        print
        if input_yes(kbase, 'show proof ? '):
            ignore = trace_tree(proof, binding, 0)

        if input_yes(kbase, 'more solutions? '):
            print
            return
        else:
            raise stop_proof
예제 #3
0
def report(kbase, binding, query, pmode):
    if not pmode:
        pmode = print_mode  # use current global mode
    else:
        pmode = pmode[0]

    if binding == {}:
        print 'yes: (no variables)'
    else:
        if pmode[0] == 'vars':
            print 'yes: ',
            for var in binding.keys():
                print var, '=', binding[var], ' ',
            print
        else:
            print 'yes: ' + external(substitute(query, binding))

    if pmode[1] == 'all':
        return 1
    else:
        return input_yes(kbase, 'more solutions? ')
예제 #4
0
파일: backwrd3.py 프로젝트: liubiggun/PP4E
def report(binding, query, pmode):
    if not pmode:
        pmode = print_mode  # use current global mode
    else:
        pmode = pmode[0]

    if binding == {}:
        print "yes: (no variables)"
    else:
        if pmode[0] == "vars":
            print "yes: ",
            for var in binding.keys():
                print var, "=", binding[var], " ",
            print
        else:
            print "yes: " + external(substitute(query, binding))

    if pmode[1] == "all":
        return 1
    else:
        return input_yes("more solutions? ")
예제 #5
0
def report(kbase, binding, query, pmode):
    if not pmode:
        pmode = print_mode                         # use current global mode
    else:
        pmode = pmode[0]
    
    if binding == {}:
        print 'yes: (no variables)'
    else:
        if pmode[0] == 'vars':
            print 'yes: ', 
            for var in binding.keys():
                print var, '=', binding[var], ' ',
            print
        else:
            print 'yes: ' + external(substitute(query, binding))
    
    if pmode[1] == 'all':
        return 1
    else:
        return input_yes(kbase, 'more solutions? ')