Page Numbers: Yes  First Page: 1Heading:z18697x2e8qk72(635)November 23, 1976  9:27 AM					[IVY]<KRL>document>match-eng-old-impz18697y774x2e8qk72Units for the KRL1 interpreterz18697x2e12ck72\ubUnits having to do with the general interpreter environmentz18697x2e12k72\ub# Environment	entities: SetOf(An EntityRecord)	maps: SetOf(A MapRecord)	goals: SetOf(A Goal)	hypotheses: SetOf(A Hypothesis)z18697x2e12k72\2b22B25b5B20b7B15b12BUnits having to do with existence of mappings, submaps, and entitiesz18697x2e12k72\ub# EntityRecord	superEntity:^1 An EntityRecord					1: A ChangingValue with intialValue = My self						Comment ("this is the largest equivalence class of entities containing									this one found so far")	coReferences: SetOf (A Linkage)	nonCoReferences: SetOf(An EntityRecord)	anchor: A Description; MemberOf (My descriptions)	identityPointer: Or(A Unit, A LispEntity, A Number, A String)	maps: SetOf(A MapRecord with instance = My self)	nonMaps: SetOf(A MapRecord with instance = My self)	unanalyzedDescriptions:^2 SetOf (A Description)				2: WhenAugmented(NewDescriptionForEntity(This newElement, My self))	descriptions: SetOf (A Description)	nonDescriptions: SetOf (A Description)	categories: SetOf (A @^3)					3: Comment ("this needs to be filled in depending on the details of how										categories are stored for efficient searching")	spaces:  SetOf(A DescriptionSpace)z18697x2e12k72\2b26f1o4 2f0o0B22f1b2B153f0 1b14B18b18B24b8B43b17B47b5B45b8B45b23f1o4 2f0o0B23f1 4b2B66f0 1b13B24b16B24b11B11f1o4b2f0o0B7f1b2B127f0 2b9B# SetRecord	setEntity: An EntityRecord	members: SetOf(An EntityRecord)	nonMembers: SetOf(An EntityRecord)	status: Or(Complete, Incomplete, Unknown)	supersets:^1 SetOf (An EntityRecord)					1: Comment ("Each of these is known to be a superset of the desired set.									They are used for finding all members by elimination.  In									general it is impossible to find all members of a set unless									listings of known supersets are available.")	definingDescription:^2 A Description							2: Comment ("this record describes the											SetOfAll(DescribedBy(My definingDescription))")z18697x2e12k72\2b21B18b8B25b11B25b7B36b10f1o4 2f0o0B30f1b2B261f0 2b20f1o4 2f0o0B22f1b2B# MapRecord	superMap:^1 A MapRecord					1: A ChangingValue with intialValue = My self						Comment ("this is the largest equivalence class of mapRecords									containing this one found so far")	template: A Unit	instance: An EntityRecord with baseSpace = My space	subMaps: SetOf(A SubMapRecord)	spaces:  SetOf(A DescriptionSpace)z18697x2e12k72\2b20f1o4 2f0o0B18f1b2B155f0 2b9B8b10B43b9B24b9B# DescribeMapRecord^1		1: HasFunctional (record, MapRecordFor, mapDescriptor)	mapDescriptor: A MapDescriptor	record:^2 A^3 mapRecord with					template = The templateUnit from ... My mapDescriptor					instance = An EntityRecord								 DescribedBy (The selfDescriptor from ...															My mapDescriptor)					submaps = SetMap(The fillerPairs from ... My mapDescriptor,											\A SubMapRecord with 												mapping = My record												slot = The slot from a fillerPair thatIs																				This element												filler = An EntityRecord														 DescribedBy(The filler from																			a fillerPair thatIs																				This element))				2: ToFind(CreateAnchor(My mapDesc))				3: My mapDesc	   z18697x2e12k72\2b17f1o4 2o0 4B24b12B16f0b17B15b9f1o4 2f0o0 1B1f1o4b2f0o0B559f1 5b2B38b2B11f0# SubMapRecord	mapping: A MapRecord with space = My space	instance: An EntityRecord with baseSpace = My space	slot: SlotOf(The template from ... My mapping)	spaces:  SetOf(A DescriptionSpace)z18697x2e12k72\2b22B35b10B43b6B43b9B# Closure^1    1: Comment ("?")	self: A Description	form: A Description^2					2: Comment ("can contain references to prototype anchors ")	context: A Mapping^3					3: Comment ("the template will be used to make substitutions for										prototype appearances in the form")z18697x2e12k72\2b7f1o4 2o0B4b2B14f0b1B1b5B15b6B14f1o4b2f0o0B6f1b2B57f0 2b8B10f1o4b2f0o0B6f1b2B# Anchor^1		1: Comment ("Declares that this will be used as the primary place									for keeping descriptions of the entity which is its									referent")	self: A Description	entity: An Entity			DescribedBy(My self)			Not(DescribedBy ([A PrimaryDescription; Not (My self)]))z18697x2e12k72\2b6f1o4 2o0B2b2B144f0 2b5B16b7B# # # # # # # # # # # # # # #z18697x2e12ck72Units having to do with hypothesesz18697x2e12k72\ub# Hypothesis^1					1: Comment ("contains an arbitrary conjunction of positive													and negative conditions.  Disjunction is													handled by a separate hypothesis form. 													Supporters are hypotheses which are													necessary for this one, dependesrs are													those for whom it is necessary. 													These links are used for propagating the													results of confirming or denying a													hypothesis.")	conditions: SetOf (A Condition)	notConditions: SetOf (A Condition)	supporters: SetOf(A Hypothesis)	notSupporters: SetOf(A Hypothesis)	dependers: SetOf(A Hypothesis)	notDependers: SetOf(A Hypothesis)	spaces: SetOf(	A DescriptionSpace					A HypotheticalSpace with								hypotheses = HasElement (My Self))	status:^2 Or(Confirmed, Rejected, Unknown)				2: A ChangingValue with initalValue = Unknownz18697x2e12k72\2b10f1o4 2o0B5b2B439f0b1B1b11B21b15B22b11B22b14B22b10B22b13B22b7B101b7f1o4 2f0o0B33f1 5b2B# ConditionType^1    1: Comment ("?")	arguments: SequenceOf (A Description)	quickConfirmers: SetOf(A Strategy)	quickConfirmers: SetOf(A Strategy)	confirmers: SetOf(A Strategy)	deniers: SetOf(A Strategy)	doWhenConfirmed: SetOf(An Action)	doWhenDenied: SetOf(An Action)	strategies: SetOf(A Strategy)z18697x2e12k72\2b13f1o4 2o0B4b2B14f0b1B1b11B28b16B20b16B20b11B20b8B20b16B19b13B19b11B# HypotheticalSpace^1    1: Comment ("?")	self: A DescriptionSpace	basis: SetOf(A Hypothesis)	includedSpaces: SetOf(A HypotheticalSpace with										basis = Superset (My basis))	includingSpaces: SetOf(A HypotheticalSpace with										basis = Subset (My basis))z18697x2e12k72\2b17f1o4 2o0B4b2B14f0b1B1b5B21b6B22b15B72b16B# Disjunction^1    1:	Comment ("The hypothesis that one of its hypotheses holds")							HasFunctional (self, AnyOf, hypotheses)	self: A ConditionType with arguments = </My hypotheses>	hypotheses: SetOf(A Hypothesis)z18697x2e12k72\2b11f1o4 2o0B4b2B89b5B13f0b1B1b5B51b12B# Incompatibility^1    1: HasFunctional (hyp1, IncompatibleWith, hyp2)	hyp1: A Hypothesis	hyp2: A Hypothesisz18697x2e12k72\2b15f1o4 2o0B4b2B22b16B7f0b1B1b5B14b6B# Necessity^1    1: HasFunctional (hyp1, NecessaryFor, hyp2)	hyp1: A Hypothesis	hyp2: A Hypothesisz18697x2e12k72\2b9f1o4 2o0B4b2B22b12B7f0b1B1b5B14b6B# Sufficiency^1    1: HasFunctional (hyp1, SufficientFor, hyp2)	hyp1: A Hypothesis	hyp2: A Hypothesisz18697x2e12k72\2b11f1o4 2o0B4b2B22b13B7f0b1B1b5B14b6B# # # # # # # # # # # # # # #z18697x2e12ck72# MappingExists^1  	  1: Comment ("?") 	self: A Condition with				strategies = GetMapInfo ???	mapDescription: A MapRecord	space:  A DescriptionSpacez18697x2e12k72\2b13f1o4 2o0B5b2B15f0b1B1b5B51b15B14b8B# SubMapExists^1  	  1: Comment ("?") 	self/Instance: A ConditionType with							arguments = <\My subMapDescription, My space> 	subMapDescription: A SubMapRecord	space:  A DescriptionSpacez18697x2e12k72\2b12f1o4 2o0B5b2B15f0b1B1b14B77b18B17b8B# EntityExists^1  	  1: Comment ("?") 	self/Instance: A ConditionType with arguments = <\My entity, \My space>	entity: An EntityRecord	space:  A DescriptionSpacez18697x2e12k72\2b12f1o4 2o0B5b2B15f0b1B1b14B59b7B18b8B# ValidDescription^1  	  1: FurtherSpecified (\Condition) 	self: A Condition with				deniers = {CategoryConflict(My entity, My description)}				confirmers = Using My knowledgeType									A CanMatch _ {HypothesizeAndPropagate																(My self)}				strategies = {A GetAnchor with knownDesc = My description}								 	entity: An EntityRecord	description:	A Description with baseSpace = My space	space:  A DescriptionSpacez18697x2e12k72\2b16f1o4 2o0B5b2B31f0b1B1b5B138f3 1f0 127b7B17b13B42b8B# HypothesizeAndPropagate^1			1: Comment ("When should a new space be created, and when should an existing							one be looked for and used (for example if it contains other							hypotheses as well)?") 	self: A SystemEvent with			action = @^2			2: Comment ("Assert that the description does apply, in the hypothetical space,							and let the mechanisms for describe follow the consequences, with							conflicts propagating back to here")	hypothesis: A Hypothesis	hypotheticalSpace: A HypotheticalSpace with							hypotheses = HasMember(My hypothesis)z18697x2e12k72\2b23f1o4 2o0B4b2B173f0b1B1b5B33f1o4b2f0o0B1f1 3b2B195f0 1b11B14b19B# SameEntity^1  	  1: Comment ("?") 	self/Instance: A ConditionType with arguments = <\My entity1, \My entity2>					WhenConfirmed(EquateEntities(My entity1, My entity2))	entity1: An EntityRecord	entity2: An EntityRecordz18697x2e12k72\2b10f1o4 2o0B5b2B15f0b1B1b14B62b4B55b8B17b9B# SameMap^1  	  1: Comment ("there needs to be a MergeMap which takes the intersection										of the hypotheses made in asserting each one") 	self/Instance: A ConditionType with arguments = <\My map1, \My map2>					 WhenConfirmed(MergeMaps(My map1, My map2))	map1: A MapRecord with					template = My sharedTemplate					instance = My sharedInstance	map2: A MapRecord with					template = My sharedTemplate					instance = My sharedInstance	sharedInstance:  An EntityRecord	sharedTemplate:  A Unitz18697x2e12k72\2b7f1o4 2o0B5b2B126f0b1B1b14B56b4B45b5B86b6B87b17B17b17B# DescriptionImplication^1  	  1: Comment ("Any entity described by desc1 is														also described by desc2") 	self/Instance: A ConditionType with arguments = <\My desc1, \My desc2>	desc1: A  Description with baseSpace = My space	desc2: A  Description with baseSpace = My spacez18697x2e12k72\2b22f1o4 2o0B5b2B84f0b1B1b14B58b6B42b7B# # # # # # # # # # # # # # #z18697x2e12ck72Units having to do with Operations and Processesz18697x2e12k72\ub# Process^1    1: Comment ("?")	agenda: SequenceOf(A Process)	callers: SetOf(A Process)	resources: An  Integer	context: A DescriptionSpace	status: A ProcessStatus; Or (A Wait, A Run, A Termination)z18697x2e12k72\2b7f1o4 2o0B4b2B14f0b1B1b7B24b8B19b9B15b8B21b8B# OperationType^1    1: Comment ("?")	methods: SetOf(A Description)	inputs: SequenceOf(A Description)	outputs: SequenceOf(A Description)	strategies: SetOf(A Strategy)z18697x2e12k72\2b13f1o4 2o0B4b2B14f0b1B1b8B23b7B28b8B28b11B# PrimitiveOperationType^1    1: FurtherSpecified (\OperationType)	code: Describes (A LispExpression)^2    2: Comment ("In terms of inputs")	interpretationOfResult: Describes (A LispExpression)^3								3: Comment ("In terms of outputs")	inputs: ; outputs:z18697x2e12k72\2b22f1o4 2o0B4b2B34f0b1B1b5B29f1o4b2o0B4b2B31f0 2b23B29f1o4b2o0B9b2B32f0b9B1b1B1b# # # # # # # # # # # # # # #z18697x2e12ck72# DoSequence^1    1: Comment ("Normal program sequencer")	self/Instance:			A PrimitiveOperationType with					inputs = <\My operations>	operations: SequenceOf(Which Describes An Operation)z18697x2e12k72\2b10f1o4 2o0B4b2B37f0b1B1b14B66b11B# DoParallelOr^1    1: Comment ("Needs to be interfaced with strategies somehow")	self/Instance:			A PrimitiveOperationType with					inputs = <\My operations>	operations: SequenceOf(Which Describes An Operation)	strategy: A ?z18697x2e12k72\2b12f1o4 2o0B4b2B59f0b1B1b14B66b11B43b9B# DoParallelAnd^1    1: Comment ("Needs to be interfaced with strategies somehow")	self/Instance:			A PrimitiveOperationType with					inputs = <\My operations>	operations: SequenceOf(Which Describes An Operation)	strategy: A ?z18697x2e12k72\2b13f1o4 2o0B4b2B59f0b1B1b14B66b11B43b9B# # # # # # # # # # # # # # #z18697x2e12ck72Units having to do with goalsz18697x2e12k72\ub# Goal	superGoals: SetOf(A Goal)	goalStatus:^1 Or(Active, Succeeded, Failed, Aborted)			1: A ChangingValue				WhenChanged(Using My goalStatus									Active -> ChooseStrategies(My self)									Succeeded -> GoalCompleted(My self)									Failed -> GoalCompleted(My self)									Aborted -> GoalAborted(My self))z18697x2e12k72\2b17B16b11f1o4 2f0o0B39f1b6B# AddGoal^1    1: Comment ("Needs to be interfaced with strategies somehow")	self/Instance:			A SystemEvent with				action =				  DoSequence(SetMap(The goals from ... My entity,											  \TryToMergeGoal(My goal, This element)))								 Using The goalStatus from ... My goal									Not(Aborted) _ AddElement(The goals from																				... My entity,																	My goal)	goal: A Goal	entity: An EntityRecordz18697x2e12k72\2b7f1o4 2o0B4b2B59f0b1B1b14B213f3 1f0 89b5B9b7B# TryToMergeGoal^1    1: Comment ("This should use information associated with												the specific goal types")	self/Instance:			A SystemEvent with				action = ???	newGoal: A Goal	oldGoal: A Goal	entity: An EntityRecordz18697x2e12k72\2b14f1o4 2o0B4b2B92f0b1B1b14B41b8B9b8B9b7B# GoalType	strategies: SetOf (A Strategy)z18697x2e12k72\2b21B# ConfirmHypothesis^1    1: Comment ("Needs more filled in")	self/Instance: A GoalType with					inputs = <My hypothesis>	hypothesis: A Hypothesisz18697x2e12k72\2b17f1o4 2o0B4b2B33f0b1B1b14B48b11B# DisconfirmHypothesis^1    1: Comment ("Needs more filled in")	self/Instance: A GoalType with					inputs = <My hypothesis>	hypothesis: A Hypothesisz18697x2e12k72\2b20f1o4 2o0B4b2B33f0b1B1b14B48b11B# GetAnchor^1									1: An Instance														Comment ("one form of Seek")	self: A GoalType with				inputs = <My entity>				strategy =					Using Present(The anchor from an EntityRecord															thatIs My entity)						yes _ Succeed(My self)						no _  DoParallel(SetMap											   (The unanalyzedDescriptions from														an EntityRecord thatIs My entity,											   \ApplyDescriptionToGoal(This element,																				My self,																				My entity)))  	entity: An EntityRecordz18697x2e12k72\2b9f1o4 2o0B9b2B55f0b1B1b5B151f3 1f0 27f3 1f0 232b7B# GetIdentity^1									1: Comment ("one form of Seek")	self/Instance: A GoalType with inputs = <My entity>	entity: An EntityRecordz18697x2e12k72\2b11f1o4 2o0B9b2B29f0b1B1b14B39b7B# GetMapInfo^1				1: Comment ("used in seeking info for other entities")	self: A GoalType with				inputs = <My mapRecord>				strategy =					DoParallel(SetMap (The unanalyzedDescriptions from														an EntityRecord thatIs My entity,											 \ApplyDescriptionToGoal(This element,																				My self,																				My entity)))  	mapRecord: A MapRecordz18697x2e12k72\2b10f1o4 2o0B4b2B52f0b1B1b5B279b10B# GetAnchorSet^1    		1: Comment ("Seek the SetOfAll(Described in my set record)")	self/Instance: A GoalType with inputs = <My set>	set: A SetRecordz18697x2e12k72\2b12f1o4 2o0B6b2B58f0b1B1b14B36b4B# GetPointerSet^1    		1: Comment ("Seek the SetOfAll(Described in my set record)")	self/Instance: A GoalType with inputs = <My set>	set: A SetRecordz18697x2e12k72\2b13f1o4 2o0B6b2B58f0b1B1b14B36b4B# # # # # # # # # # # # # # #z18697x2e12ck72Units having to do with strategiesz18697x2e12k72\ub# Strategy^1  						  1: HasFunctional (self, StragegyFor, situation)	situation: A Situation	action: An Operation	difficultyEstimate:  A Description; Which Describes An Integerz18697x2e12k72\2b8f1o4 2o0B10b2B22b11B12f0b1B1b11B12b8B15b21B# FollowLinkage^1  						  1: Comment ("called in strategies")	self: A SystemEvent with			action =			  Using My linkDesc				Not(MemberOf(The coReferences from an Entity thatIs My entity))					_ ProgSequence(AddElement(My linkDesc,														  The coReferences from														  	 an entity thatIs My entity),										 AddElement(The unanalyzedDescriptions from														  		an Entity thatis My entity,														  GetDescription(My linkDesc)) 	linkDesc: A LinkageDescriptor	entity: An Entity  z18697x2e12k72\2b13f1o4 2o0B10b2B33f0b1B1b5B128f3 1f0 270b9B20b9B# FollowSlotPerspective^1  						  1: Comment ("called in strategies")	self: A SystemEvent with			action = DoSequence(AssertMap(My newMap),									 NewGoal(A GetMapInfo with														mapping = My newMap))	entity: An Entity	perspective: A SlotPerspective	newMap: MapRecordFor(My perspective)z18697x2e12k72\2b21f1o4 2o0B10b2B33f0b1B1b5B138b7B12b12B18b9B# # # # # # # # # # # # # # #z18697x2e12ck72Units having to do with user-level functionsz18697x2e12k72\ub# Seek^1    1: Comment ("?")	self: A Process with			inputs = {My knownDesc, My specifier, My processDesc}			outputs = <My result>	knownDesc: A^2 Description			2: Comment ("Describes the object being sought")	specifier: Or(Anchor, Pointer, SetOfDescriptions, SetOfPointers)	result: Using My specifier				Anchor ~ An Anchor with entity = DescribedBy(My knownDesc)				Pointer ~ Or (	A Unit with											associatedEntity = DescribedBy																		(My knownDesc),									[	Or (A Number, A String, A LispEntity);										DescribedBy (My knownDesc)])				SetOfDescriptions						~ SetOf (An Anchor with entity = DescribedBy																		(My knownDesc))				SetOfPointers						~ SetOf (Or (	A Unit with											associatedEntity = DescribedBy																		(My knownDesc),									[	Or (A Number, A String, A LispEntity);										DescribedBy (My knownDesc)]))	processDescription: A^3 Description			3: Comment ("Details need working out, but one thing it can do is say whether								it is to accumulate a set all at once, or act as a generator")z18697x2e12k72\2b4f1o4 2o0B4b2B14f0b1B1b5B99b10B2f1o4b2f0o0B16f1b2B46f0 2b10B56b7B603b19B2f1o4b2f0o0B16f1b2B# Describe^1    1: Comment ("?")	self: A Process with			inputs = {My knownDesc, My newDesc, My specifier, My processDesc}	knownDesc: A^2 Description			2: Comment ("Describes the object being further described")	newDesc: A Description	specifier: Or(AddDescription, Replace, AddElement, Update)	processDescription: A^3 Description			3: Comment ("Details need working out.")z18697x2e12k72\2b8f1o4 2o0B4b2B14f0b1B1b5B86b10B2f1o4b2f0o0B16f1b2B57f0 2b8B16b10B50b19B2f1o4b2f0o0B16f1b2B# Match^1    1: Comment ("?")	self: A Process with			inputs = {My knownDesc, My pattern, My specifier, My processDesc}	knownDesc: A^2 Description			2: Comment ("known description of the datum")	pattern: A Description	specifier: Or(Intensional, Extensional)	processDescription: A^3 Description			3: Comment ("Details need working out. including stuff for best-match, etc.")z18697x2e12k72\2b5f1o4 2o0B4b2B14f0b1B1b5B86b10B2f1o4b2f0o0B16f1b2B43f0 2b8B16b10B31b19B2f1o4b2f0o0B16f1b2B# # # # # # # # # # # # # # #z18697x2e12ck72Actions for top level callsz18697x2e12k72\b# TopLevelCall^1			1: Comment ("This is the top level for the commands which can be given to							the interpreter")	self: A SystemEvent with		  action = 			\Using My operationType				Seek _					Using Its specifier						Anchor _ TopLevelGoal(A GetAnchor with															entity = My entityRecord)						Pointer _ TopLevelGoal(A GetIdentity with															entity = My entityRecord)						PointerSet _ TopLevelGoal(A GetPointerSet with															set = My setRecord)						AnchorSet _ TopLevelGoal(A GetAnchorSet with															set = My setRecord)				Match _					Using Its specifier						Extensional _ DoParallel											(NewGoal(A GetAnchor with																entity = My entityRecord,											 NewGoal(An EstablishHypothesis with															hypothesis = My hypothesis))				Describe _					Using Its specifier						AddDescription _ ???						AddElement _ ???						Update _ ???						Replace _ ???	operationType: An OperationType	knownDesc: A Description	entityRecord:^2 An EntityRecord with							unprocessedDescriptions = <My knownDesc>			2: ToFind(CreateEntity(My knownDesc)) 	setRecord:^3 A SetRecord with							definingDescription = <My knownDesc>			3: ToFind(CreateSet(My knownDesc)) 	hypothesis:^4 A^5 ValidDescription with					entity = My entityRecord					description = My pattern	4: ToFind(CreateHypothesis(My hypDesc))													5: My hypDesc 	outcome: Or(Success, Failure, Aborted)				The goalStatus from a Goal thatIs My subgoalz18697x2e12k54\2b12f1o4 2o0B4b2B96f0b1B1b5B70f3 1f0 39f3 1f0 86f3 1f0 91f3 1f0 86f3 1f0 79f3 1f0 241f3 1f0 47f3 1f0 22f3 1f0 18f3 1f0 19f3 1f0 6b14B19b10B16b13f1o4 2f0o0B73f1b3B34f0 3b10f1o4 2f0o0B65f1b3B31f0 3b11f1o4 2f0o0B2f1o4b2f0o0B83f1b3B37f0 10f1 3b2B11f0 3b8B# # # # # # # # # # # # # # #z18697x2e12ck72Actions associated with adding new descriptions to an entity or mappingz18697x2e12k72\b# NewDescriptionForEntity^1			1: Comment ("This is triggered by adding something to the list of unanalyzed							descriptions")	self: A SystemEvent			with action =				\Using My info					An ImplicitAndDescriptor _											AddDescriptions(My entity, Its components)					A Selector _ EvaluateSelector(Its terms, My entity)					Or(A Linkage, A MapDescriptor) _ 							DoParallel(SetMap											(The goals from ... My entity,											  \A NewDescriptionToApplyToGoalForEntity														with goal = This element																info = My info))	entity: An EntityRecord	info: A Descriptionz18697x2e12k54\2b23f1o4 2o0B4b2B96f0b1B1b5B81f3 1f0 71f3 1f0 76f3 1f0 196b7B18b5B# NewDescriptionToApplyToGoalForEntity^1			1: HasFunctional (self, ApplyDescriptionToGoal, info, goal, entity)	self: A SystemEvent			with action =			  \Using My info				A Linkage _ FollowLinkage(My info, My entity)				Not(A Linkage) _				  Using My goal						A GetAnchor with entity = My entity _						Using My info							An Anchor _ Success(My goal, My info)							A Pointer _ Success(My goal, AnchorFor(My info))							A SlotPerspective _ FollowSlotPerspective															(My info, My entity)					A GetIdentity with entity = My entity _ 						Using My info							A Pointer _ Success(My goal, My info)							An Anchor _ ??					A GetMapInfo with instance = My entity _						Using My info							A UnitPerspective with											template = The template from a GetMapInfo																			thatIs My goal 									_ AddMap(MapRecordFor(My info, My entity)					A CheckConsistency with entity = My entity _						Using My info							A Pointer _ Check for conflict, expand							An Anchor _ Check for conflict, expand							A MapDescriptor _ Check categories,														hypothesize mapping	entity: An EntityRecord	info: A Description	goal: A Goalz18697x2e12k54\2b36f1o4 2o0B4b2B22b22f0B20f1 1f0b1B1b5B66f3 1f0 54f3 1f0 63f3 1f0 38f3 1f0 44f3 1f0 63f3 1f0 102f3 1f0 39f3 1f0 44f3 1f0 48f3 1f0 148f3 1f0 89f3 1f0 40i26I20i26I26i51I2b7B18b5B16b5B# NewDescriptionToApplyToHypothesisForEntity^1			1: Comment ("Hypotheses and goals are treated separately")	self: A SystemEvent with		  action = 			\Using My hypothesis				A SameEntity _					Using Filled(My anchor) 						yes _							Using My info								A Pointer _ 									Using My info										My Anchor _ Confirm(My hypothesis)										otherwise _ Reject(My hypothesis)						no _ CheckCategory(My info, My entity) 	entity: An EntityRecord	info: A Description	hypothesis: A Hypothesis	anchor:^2	An EntityRecord				The anchor from an Entity thatIs						The otherEntity from a SameEntity thatIs My hypothesis			2: WhichIs NotAlwaysFilledz18697x2e12k54\2b42f1o4 2o0B4b2B56f0b1B1b5B75f3 1f0 41f3 1f0 40f3 1f0 45f3 1f0 44f3 1f0 32f3 1f0 37b7B18b5B16b11B15b7f1o4 2f0o0B118f1b2B# AddMap^1			1: Comment ("This is called for each potentially new mapRecord")	self: A SystemEvent with		  action = 			DoSequence( <DoParallel(SetSelectAndMap											(My oldMaps,											 \A MapRecord with template = My template						 					 \A MapAddedWithSameTemplate with 														oldMap = This element														newMap = My newMap>,							<AddElement(My oldMaps, My newMap>))	oldMaps: The mappings from This environment	newMap: A MapRecord with template = My template	template: A Unit; The template from ... My newMapz18697x2e12k54\2b6f1o4 2o0B4b2B62f0b1B1b5B317b8B37b7B42b9B# MapAddedWithSameTemplate^1			1: Comment ("This is triggered by an AddMap")	self: A SystemEvent with		  action = 			\Using TestEntityIdentity(My newInstance, My oldInstance)				no _ AssertUniqueMaps(My oldMap, My newMap)				yes _ 					Using The uniquenessCondition from a Unit thatIs My template						Unique _ MergeMaps(My oldMap, My newMap)						A Dependency _ CheckMaps(My oldMap,																My newMap,																Its slots)				unknown _ Hypothesize (My samenessHypothesis)	oldMap: A MapRecord with template = My template	newMap: A MapRecord with template = My template	template: A Unit; The template from ... My newMap	oldInstance: The instance from ... My oldMap	newInstance: The instance from ... My newMap	samenessHypothesis:			A Hypothesis with					conditions = {A SameEntity with entity1 = My oldInstance															  entity2 = My newIstance,									A sameMap with map1 = My oldMap														  map2 = My newMap}z18697x2e12k54\2b24f1o4 2o0B4b2B43f0b1B1b5B102f3 1f0 48f3 1f0 81f3 1f0 52f3 1f0 88f3 1f0 38b7B42b7B42b9B42b12B34b12B34b19B# TestEntityIdentity^1			1: Comment ("This is used by various other actions, it takes care of all the quick check cases, but does not trigger more complex strategies")	self: A Test with		  action = 			\Using My superEntity1				My superEntity2 _ Result(yes)				MemberOf(The nonCoReferences from ... My entity2) _ Result(no)				An EntityRecord with					nonCoReferences = HasMember(My superEntity2) _ Result(no)				otherwise _					Using CategoryConflict(The categories from ... My superEntity1,												 The categories from ... My superEntity2)						yes _ Result(no)	entity1: An EntityRecord	entity2: An EntityRecord	superEntity1: An EntityRecord; The superEntity from ... My entity1	superEntity2: An EntityRecord; The superEntity from ... My entity2z18697x2e12k54\2b18f1o4 2o0B4b2B140f0b1B1b5B73f3 1f0 67f3 1f0 87f3 1f0 26f3 1f0 134f3 1f0 13b8B18b8B18b13B55b13B# CategoryConflict^1			1: Comment ("This depends on the exact form of category records.  The initial							idea is that each sequence represents a chain up to the top of							the relevant piece of the hierarchy, with different chains							representing independent hierarchies")	self: A Test with		  action = LispApply('TestCategories, My categories1, My categories2)	categories1: SetOf(SequenceOf(A Unit))	categories2: SetOf(SequenceOf(A Unit))z18697x2e12k54\2b16f1o4 2o0B4b2B257f0b1B1b5B86b12B28b12B# EquateEntities^1			1: Comment ("This is used after determining that because of uniqueness							conditions, the two entities must be the same.  The basic strategy							is to create a new EntityRecord, and add the information from each							of the old ones, propagating the name of this new superRecord							down through the others, seeing if any of the information stored							by one can be used to satisfy a goal of the other, and equating							the mappings in which they form the instance.  If the entities							are in hypothetical spaces, the resulting entity is in							the space with the intersection of their hypotheses, which may							have some affect on outstanding ConfirmHypothesis goals")	self: A Test with		  action = 			\Using My superEntity1				???	entity1: An EntityRecord	entity2: An EntityRecord	superEntity1: An EntityRecord; The superEntity from ... My entity1	superEntity2: An EntityRecord; The superEntity from ... My entity2z18697x2e12k54\2b14f1o4 2o0B4b2B695f0b1B1b5B62b8B18b8B18b13B55b13B# MergeMaps^1			1: Comment ("This is used after determining that because of uniqueness							conditions, the two maps must be the same.  The basic strategy							is to create a new mapRecord, and add the information from each							of the old ones, propagating the name of this new superRecord							down through the others, seeing if any of the information stored							by one can be used to satisfy a goal of the other, and equating							the instance entities that appear in corresponding filler pairs. 							If the maps are in hypothetical spaces, the resulting map is in							the space with the intersection of their hypotheses, which may							have some affect on outstanding ConfirmHypothesis goals")	self: A SystemEvent with		  action = 			\Using My superMap1				My superMap2 _ A NoOp				???)	map1: A MapRecord	map2: A MapRecord	superMap1: A MapRecord; The superMap from ... My map1	superMap2: A MapRecord; The superMap from ... My map2z18697x2e12k54\2b9f1o4 2o0B4b2B700f0b1B1b5B74f3 1f0 18b5B14b5B14b10B45b10B# # # # # # # # # # # # # # #z18697x2e12ck72Actions associated with establishing and working with goalsz18697x2e12k72\b# ChooseStrategy^1			1: Comment ("If there are no strategies for a goal, it can sit around, hoping that someone will come around and satisify it bottom-up")	self: A SystemEvent with		  action = 			\Using The cardinality from a Set thatIs My strategies				0 _ NoStrategies(My goal)				1 _ ApplyStrategy(TheOne(MemberOf(My strategies)),										 My goal)				GreaterThan(1) _ ResolveMultipleStrategies(My strategies, My goal)	goal: A Goal	strategies: SetOf(A Strategy)z18697x2e12k54\2b14f1o4 2o0B4b2B133f0b1B1b5B98f3 1f0 29f3 1f0 87f3 1f0 52b5B9b11B# GoalCompleted^1			1: Comment ("This is an experiment in notation for discrimination networks")	self: A SystemEvent with		  action = 			\Using My outcome				Success _					Using My goal						A ConfirmHypothesis _ AssertHypothesis(Its hypothesis)						A DisconfirmHypothesis _ AssertNegation(Its hypothesis)						GetAnchor _ ApplyNet ???	goal: A Goal	outcome: Or(Success, Failure); The goalStatus from a Goal thatIs My goalz18697x2e12k54\2b13f1o4 2o0B4b2B74f0b1B1b5B67f3 1f0 46f3 1f0 63f3 1f0 48f3 1f0 15b5B9b8B# SubGoalCompleted^1			1: Comment ("This is an experiment in notation for discrimination networks")	self: A SystemEvent with		  action = 			\Using My outcome				Success _					Using My supergoal						An AndGoal _ RemoveSubGoal(My subgoal, My supergoal)						An OrGoal _ Succeed(My supergoal)				Failure _					Using My supergoal						An OrGoal _ RemoveSubGoal(My subgoal, My supergoal)						An AndGoal _ Fail(My supergoal)				Aborted _					Using My supergoal						An OrGoal _ RemoveSubGoal(My subgoal, My supergoal)						An AndGoal _ Abort(My supergoal)	subgoal: A Goal	supergoal: A Goal	outcome: Or(Success, Failure, Aborted)				The goalStatus from a Goal thatIs My subgoalz18697x2e12k54\2b16f1o4 2o0B4b2B74f0b1B1b5B67f3 1f0 42f3 1f0 57f3 1f0 35f3 1f0 41f3 1f0 58f3 1f0 32f3 1f0 41f3 1f0 58f3 1f0 22b8B9b10B9b8B# # # # # # # # # # # # # # #z18697x2e12ck72Actions associated with establishing and working with hypothesesz18697x2e12k72\bz18697x2e12ck72Code for the KRL1 matcherz18697x2e12ck72\ub(Function (args)  (* comment)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b8B3bi3BI8bi6BI11bi7BI5bi4BI3bi8BITop-level functionsz18697x2e12k72\ubDEFINEQ(z18697x2e12k72(TopLevelGoal (goalDesc)  (* "sets up the general environment, and starts off the goal.  the free variable 'environment' is used throughout the system")  (PROG(environment goal)	(environment _(CreateEnvironment))	(goal _ (Seek goalDesc 'Anchor 'Direct))	(Describe goal \A Goal with dependers = {TopLevel} 										status = Active/)	(Schedule \This agenda/)))z18697x2e12k72\1b12B(Seek2 (knownDesc specifier processDesc)  (* "the free variable 'environment' is used throughout the system)  (PROG(environment entity)	(environment _(CreateEnvironment))	(SELECTQ specifier		(entity _(CreateEntityRecord knownDesc))		(AddEntity entity)	(AddGoal (SELECTQ specifier					(Anchor \A GetAnchor with entity = This entity/)					(Identity \A GetIdentity with entity = This entity/)					(HELP "Illegal specifier for Seek"))	(MatchCases knownDesc		(\$A PureSlotPerspective/			(newEntity _ (CreateEntityRecord \Its selfDescription/))			(map _(CreateMap \A MapRecord with 											template = Its template											instance = This newEntity											submaps = {A SubMapRecord with															slot = Its focusSlot															instance = This entity}/))			(AddMap map)			(AddGoal \A GetMapInfo with map = This map/))			more cases)more body))z18697x2e12k72\1b5B847bi9BI3bi8BI(FollowSlotPerspective (perspective entity)  (* comment)  (PROG(newEntity map selfDesc template)		(Context \A SlotPerspective thatIs This perspective/			(newEntity _ (CreateEntityRecord \Its selfDescription/))			(map _(CreateMap perspective entity))			(AddMap map)			(AddGoal \A GetMapInfo with map = This map/))more body))z18697x2e12k72\1b21B28bi6BI265bi8BI(GetDescriptionFromUnit (entity unit)  (* gets the description from the self slot and adds it to the entity, possibly triggering other useful stuff.  It assumes this is an instance unit)  (PROG(selfSlot)		(if (selfSlot _ (Seek3 'SelfSlot Unit unit))			then (AddElement \The unanalyzedDescriptions from									an Entity Record thatIs This entity/							(Seek3 'filler 'Slot selfSlot)))	(first)more body))z18697x2e12k72\1b22B372bi4BI3bi8BI(TryToUseNewDescription (description entity)  (* When a new description is added to an existing entity record, the system checks to see if it satisfies any of the associated goals.)	(for goal in (Seek3 'goals 'EntityRecord entity)		when (EQ \$Active (Seek3 'goalStatus 'Goal goal))		do (TryToUse description goal entity))more body)z18697x2e12k72\1b22B304bi8BI(CheckNewGoal (description entity)  (* When a new goal is about to be added to an entity record, the existing descriptions and mappings are checked to see if it is already satisfied, or if there are unprocessed descriptions lying around which might satisfy it)more body)z18697x2e12k72\1b12B250bi8BI(GoalCompleted (goal)  (* when a goal is satisfied, things depending on it are checked)  (if (Match \A TopLevelGoal/ \This goal/)	then (ReturnAnswer goal)	else  (ApplyNet \A GoalCompleted with goal = This goal/)		  (for supporter in (Seek3 'supporters 'Goal goal)				do (RemoveRequest goal supporter)) 		  (for depender in (Seek3 'dependers 'Goal goal)				do (ApplyNet \A SubGoalCompleted with											subgoal = This goal											supergoal = This depender/)))z18697x2e12k72\1b13B(TryToUse (description goal entity)  (* comment)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b8B33bi6BI11bi7BI5bi4BI3bi8BI(Seek3 (slotName template instance)  (* "quick compiler equivalent, (using only immediate access)		for (Seek \The slotName from a template thatIs instance/)")  (PROG(bindings)	(first)more body))z18697x2e12k72\1b5B164bi7BI5bi4BI3bi8BI(SeekSet (knownDesc specifier processDesc)  (* comment)  (PROG(environment setRecord)	(environment _(CreateEnvironment))	(setRecord _ (CreateSetRecord \A SetRecord with												definingDescription = This knownDesc/))	(AddGoal (SELECTQ specifier					(FullSet \A GetFullSet with set = This setRecord)					(HELP "Illegal specifier for Seek")))more body))z18697x2e12k72\1b7B41bi6BI298bi8BI(CreateEnvironment ()  (* creates a new instance of an entire environment. done only at top level of a call to matching, seeking, etc routines, including the fact that there is only one such environment shared by all of the subgoals in a BestMatch)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b17B241bi7BI5bi4BI2bi9BI(CreateEntityRecord (description)  (* comment)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b18B21bi6BI29bi9BI(AddEntity (entity)  (* adds the new entity to the current environment, as an existing entity)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b9B95bi7BI5bi4BI2bi9BI(AddMap (mapRecord)  (* adds it to the global environment)  (PROG(bindings)	(first)more body))z18697x2e12k72\1b6B62bi7BI5bi4BI3bi8BI(CreateMap (descriptor focus)  (* comment)  (PROG(template slot filler)    (template _ (Seek3 'templateUnit 'MapDescriptor descriptor))	(for pair		inSet (Seek3 'fillerPairs 'MapDescriptor descriptor)		do  slot _(GetSlot template (Seek3 'slotDescriptor 'fillerPair pair))			filler _ (GetEntity (Seek3 'filler'fillerPair pair))(Context \A Mapdescriptor thatIs This descriptor/ 	(Describe (NewAnchor)				(Eval?? \A MapRecord with									template = Its templateUnit									submaps = The rangeSet from a SetMapping with														base = Its fillerPairs														rangeDesc =															\A SubMapRecord with																mapping = This map																instance = EntityFor(.........	thatIs This descriptor)more body))z18697x2e12k72\1b9B26bi6BI697bi8BIMore definitions  )z18697x2e12k72\bi18BI