当前位置: 首页>>代码示例>>Python>>正文


Python PE.prove方法代码示例

本文整理汇总了Python中PE.prove方法的典型用法代码示例。如果您正苦于以下问题:Python PE.prove方法的具体用法?Python PE.prove怎么用?Python PE.prove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PE的用法示例。


在下文中一共展示了PE.prove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: saveDistinctElements

# 需要导入模块: import PE [as 别名]
# 或者: from PE import prove [as 别名]
def saveDistinctElements(C6, arraymap, indexpe) :
    """retains within  arraymay  only those elements provably
       distinct from  indexpe
    """
    akeys = arraymap.keys()
    for key in akeys :
        elempe = PE.tupleToPe(key)  # get pe-value of element-index
        # is the following good enough?  Or will we need theorem proving?
        distinct = PE.prove(C6["rels"], ["!=", elempe, indexpe])
        if not distinct :
            del arraymap[key]
开发者ID:amgregoi,项目名称:School,代码行数:13,代码来源:Tables.py

示例2: verifyRelation

# 需要导入模块: import PE [as 别名]
# 或者: from PE import prove [as 别名]
def verifyRelation(C6, bfactlist, bgoal) :
    """attempts to verify  bgoal,  which is a primitive (relop or forall)
       
       params: C6 table
               bfactlist: a list of facts of form
                  [relop, e1, e2]  or  [forall/exists, lo, i, hi, e]
               bgoal: a single fact of form [relop, e1, e2]
                                         or [forall/exists, lo, i, hi, e]

       returns : True, if  bfactlist |- bgoal  is proved
                 False, if not
    """
    #print "verifyRelation: C6"#, C6
    #print "bfactlist:",  bfactlist
    #print "bgoal:", bgoal
    #raw_input("press Enter")

    if (bgoal[0] in RELOPS) :   # [relop, e1, e2]
        # eval goal:
        pe1 = PE.evall(C6, bgoal[1])
        pe2 = PE.evall(C6, bgoal[2])
        goal = [bgoal[0], pe1, pe2]

        # eval all facts in the bfactlist:
        factlist = []
        for f in list(bfactlist) :
            if f[0] in RELOPS :
                pe1 = PE.evall(C6, f[1])
                pe2 = PE.evall(C6, f[2])
                factlist.append([f[0], pe1, pe2])
            elif f[0] in ("forall", "exists") :
                 pass # can't handle quantified phrases (yet) in PE!
                 # If I am brave, I might try to evaluate lower and upper
                 # bounds of quantification and enumerate the facts therein.
                 # But this is high overhead....
        # send off the PE-valued facts and goal to the prover:
        #print "In verifyrelation; ready to call PE.prove:"
        #print "all facts=", factlist + C6["rels"]
        #print "goal=", goal
        return PE.prove(factlist + C6["rels"], goal)
    elif bgoal[0] == "forall" :
        return proveUniversal(C6, bfactlist, bgoal)
    else :  # ["exists", lo, i, hi, e] ???
        return False
开发者ID:amgregoi,项目名称:School,代码行数:46,代码来源:Tables.py


注:本文中的PE.prove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。