def example_nixon(): DEFAULT = cop.m_default() W = no.stringListToBasicLogic(['( quaker <- T )', ' ( republican <- T ) ']) #W = no.stringListToBasicLogic([' bird ', ' penguin ']) V = no.stringListToBasicLogic(['quaker', 'republican', 'pacifist']) #dParts = no.stringListToBasicLogic(['( bird <- T )', '( penguin <- F ) ', '( flies <- T )']) dParts = no.stringListToBasicLogic( ['( quaker <- T )', '( pacifist <- T ) ', '( pacifist <- T )']) default1 = basicLogic.operator_tritonic_defaultRule( dParts[0], [dParts[1]], dParts[2]) dParts2 = no.stringListToBasicLogic( ['( republican <- T )', '( pacifist <- F ) ', '( pacifist <- F )']) default2 = basicLogic.operator_tritonic_defaultRule( dParts2[0], [dParts2[1]], dParts2[2]) D = [default1, default2] basePoint = epistemicState.epistemicState('Bird Example') basePoint['D'] = D basePoint['W'] = W basePoint['V'] = V ctm_flight = CTM.CTM() ctm_flight.si = [basePoint] ctm_flight.appendm(DEFAULT) print(ctm_flight) print(ctm_flight.evaluate())
">>> 1) If she has an essay to write she will study late in the library (l|e)." ) print( ">>> 2) If the library is open she will study late in the library (l|o).") print(">>> 3) She has an essay to write (e <- T).") #STARTING VARIABLES # e: she has an essay to write e = basicLogic.atom('e', setValue=False) # l: she will study late in the library l = basicLogic.atom('l', setValue=False) # o: the library is open o = basicLogic.atom('o', setValue=False) # THE SET OF COGNITIVE OPERATIONS APPROPRIATE TO THE SUPPRESSION TASK ADDAB = CognitiveOperation.m_addAB() WC = CognitiveOperation.m_wc() SEMANTIC = CognitiveOperation.m_semantic() ABDUCIBLES = CognitiveOperation.m_addAbducibles(maxLength=4) DELETE = CognitiveOperation.m_deleteo() """ ================================================================================================== ================================EXTERNAL EVALUATION FUNCTIONS===================================== """ # Compares the subSCPs 'el' and 'elo' and if there is a response in 'el' that is # not in 'elo', then we have supressed an inference. def f_suppression_studyLate(pi): finalStructures = pi.evaluate() finalStates = StatePointOperations.flattenStatePoint(finalStructures)
# Code in this file is modified from the code available publicly at: #https://wilkelab.org/classes/SDS348/2019_spring/labs/lab13-solution.html import os os.chdir("../") from SCPFramework import CTM from SCPFramework import CognitiveOperation #the insertion operation. Only used in scoring and alignment NONE = CognitiveOperation.m_insertionOperation() # THE SET OF COGNITIVE OPERATIONS APPROPRIATE TO THE SUPPRESSION TASK ADDAB = CognitiveOperation.m_addAB() WC = CognitiveOperation.m_wc() SEMANTIC = CognitiveOperation.m_semantic() ABDUCIBLES = CognitiveOperation.m_addAbducibles(maxLength=4) DELETE = CognitiveOperation.m_deleteo() s_i = ['$s_\text{WST}$'] c = CTM.CTM() c.setSi(s_i) c.appendm(ADDAB) c.appendm(WC) c.appendm(SEMANTIC) d = CTM.CTM() d.setSi(s_i) d.appendm(ADDAB) d.appendm(ABDUCIBLES) d.appendm(WC) d.appendm(SEMANTIC)
from SCPFramework import CTM from SCPFramework import CognitiveOperation from SCPFramework import basicLogic from SCPFramework import epistemicState from SCPFramework import StatePointOperations else: import SCP_Task import scpNotationParser import CTM import CognitiveOperation import basicLogic import epistemicState import StatePointOperations #INSTANTIATE EACH <cognitiveOperation> object which might be used later ADDAB = CognitiveOperation.m_addAB() WC = CognitiveOperation.m_wc() SEMANTIC = CognitiveOperation.m_semantic() ABDUCIBLES = CognitiveOperation.m_addAbducibles(maxLength=2) WCS = CognitiveOperation.m_wcs() """ ================================================================================================== ==========================================TURN FUNCTION=========================================== """ #corresponds to f_WST in the thesis def f_turnFunction(pi, observations=['D', 'K', '3', '7']): decisions = {} for obs in observations: for i in obs:
sys.path.append("/SCPFramework") from SCPFramework import basicLogic from SCPFramework import scpNotationParser as no from SCPFramework import epistemicState from SCPFramework import CTM from SCPFramework import CognitiveOperation as cop else: import basicLogic import scpNotationParser as no import epistemicState import CTM import CognitiveOperation as cop #the operaton on a default theory <W,D> to find extensions DEFAULT = cop.m_default() """ A classical example for Reiter's default logic about whether a given bird flies, presented propositionally """ def example_birds(): W = no.stringListToBasicLogic(['( bird <- T )']) V = no.stringListToBasicLogic(['bird', 'flies', 'penguin']) dParts = no.stringListToBasicLogic( ['( bird <- T )', '( flies <- T ) ', '( flies <- T )']) default1 = basicLogic.operator_tritonic_defaultRule( dParts[0], [dParts[1]], dParts[2])