def checkRandomImplication(cogstate): # generate a random law and update with it: law="("+choice(alphabet)+")>("+choice(alphabet)+")" #print " updating with the law "+law cogstate = updateLaw(cogstate,law) # generate a random fact and update with it: fact=choice(alphabet) #print " updating with the fact "+fact cogstate = updateFormula(cogstate,fact) # generate a random non-trivial implication and check it: imantecedent=choice(alphabet) restralph=list(alphabet) restralph.remove(imantecedent) imconsequent=choice(restralph) #print " checking the implication "imantecedent+"->"imconsequent+":" cogstateNew = updateLaw(cogstate, imantecedent) result = supports(cogstateNew,imconsequent)
def checkRandomCounterfactual(cogstate): # generate a random law and update with it: law="("+choice(alphabet)+")>("+choice(alphabet)+")" #print " updating with the law "+law cogstate = updateLaw(cogstate,law) # generate a random fact and update with it: fact=choice(alphabet) #print " updating with the fact "+fact cogstate = updateFormula(cogstate,fact) # generate a random non-trivial counterfactual and check it: cfantecedent=choice(alphabet) restralph=list(alphabet) restralph.remove(cfantecedent) cfconsequent=choice(restralph) #print " checking the counterfactual "+cfantecedent+"~>"+cfconsequent+":" cogstateNew = ifItHadBeenTheCase(cogstate, cfantecedent) result=supports(cogstateNew,cfconsequent)