Page Numbers: Yes First Page: 1
Heading:
November 23, 1976 9:27 AM[IVY]<KRL>document>match-eng-old-imp
Units for the KRL1 interpreter
Units having to do with the general interpreter environment
# Environment
entities: SetOf(An EntityRecord)
maps: SetOf(A MapRecord)
goals: SetOf(A Goal)
hypotheses: SetOf(A Hypothesis)
Units having to do with existence of mappings, submaps, and entities
# 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)
# 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))")
# 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)
# DescribeMapRecord↑11: 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
# 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)
# 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")
# Anchor↑11: 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)]))
# # # # # # # # # # # # # # #
Units having to do with hypotheses
# Hypothesis↑11: 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
# 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)
# 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))
# 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)
# Incompatibility↑1 1: HasFunctional (hyp1, IncompatibleWith, hyp2)
hyp1: A Hypothesis
hyp2: A Hypothesis
# Necessity↑1 1: HasFunctional (hyp1, NecessaryFor, hyp2)
hyp1: A Hypothesis
hyp2: A Hypothesis
# Sufficiency↑1 1: HasFunctional (hyp1, SufficientFor, hyp2)
hyp1: A Hypothesis
hyp2: A Hypothesis
# # # # # # # # # # # # # # #
# MappingExists↑1 1: Comment ("?")
self: A Condition with
strategies = GetMapInfo ???
mapDescription: A MapRecord
space: A DescriptionSpace
# SubMapExists↑1 1: Comment ("?")
self/Instance: A ConditionType with
arguments = <\My subMapDescription, My space>
subMapDescription: A SubMapRecord
space: A DescriptionSpace
# EntityExists↑1 1: Comment ("?")
self/Instance: A ConditionType with arguments = <\My entity, \My space>
entity: An EntityRecord
space: A DescriptionSpace
# 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
# 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)
# 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
# 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
# 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
# # # # # # # # # # # # # # #
Units having to do with Operations and Processes
# 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)
# OperationType↑1 1: Comment ("?")
methods: SetOf(A Description)
inputs: SequenceOf(A Description)
outputs: SequenceOf(A Description)
strategies: SetOf(A Strategy)
# 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:
# # # # # # # # # # # # # # #
# DoSequence↑1 1: Comment ("Normal program sequencer")
self/Instance:
A PrimitiveOperationType with
inputs = <\My operations>
operations: SequenceOf(Which Describes An Operation)
# 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 ?
# 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 ?
# # # # # # # # # # # # # # #
Units having to do with goals
# 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))
# 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
# 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
# GoalType
strategies: SetOf (A Strategy)
# ConfirmHypothesis↑1 1: Comment ("Needs more filled in")
self/Instance: A GoalType with
inputs = <My hypothesis>
hypothesis: A Hypothesis
# DisconfirmHypothesis↑1 1: Comment ("Needs more filled in")
self/Instance: A GoalType with
inputs = <My hypothesis>
hypothesis: A Hypothesis
# GetAnchor↑11: 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
# GetIdentity↑11: Comment ("one form of Seek")
self/Instance: A GoalType with inputs = <My entity>
entity: An EntityRecord
# GetMapInfo↑11: 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
# GetAnchorSet↑1 1: Comment ("Seek the SetOfAll(Described in my set record)")
self/Instance: A GoalType with inputs = <My set>
set: A SetRecord
# GetPointerSet↑1 1: Comment ("Seek the SetOfAll(Described in my set record)")
self/Instance: A GoalType with inputs = <My set>
set: A SetRecord
# # # # # # # # # # # # # # #
Units having to do with strategies
# Strategy↑1 1: HasFunctional (self, StragegyFor, situation)
situation: A Situation
action: An Operation
difficultyEstimate: A Description; Which Describes An Integer
# 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
# 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)
# # # # # # # # # # # # # # #
Units having to do with user-level functions
# 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")
# 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.")
# 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.")
# # # # # # # # # # # # # # #
Actions for top level calls
# 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 pattern4: ToFind(CreateHypothesis(My hypDesc))
5: My hypDesc
outcome: Or(Success, Failure, Aborted)
The goalStatus from a Goal thatIs My subgoal
# # # # # # # # # # # # # # #
Actions associated with adding new descriptions to an entity or mapping
# 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
# 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
# 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:↑2An EntityRecord
The anchor from an Entity thatIs
The otherEntity from a SameEntity thatIs My hypothesis
2: WhichIs NotAlwaysFilled
# 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
# 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}
# 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
# 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))
# 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
# 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
# # # # # # # # # # # # # # #
Actions associated with establishing and working with goals
# 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)
# 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
# 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
# # # # # # # # # # # # # # #
Actions associated with establishing and working with hypotheses
Code for the KRL1 matcher
(Function (args)
(* c
omment)
(PROG(b
indings)
(first)
m
ore body))
Top-level functions
DEFINEQ(
(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/)))
(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)
m
ore body))
(FollowSlotPerspective (perspective entity)
(* c
omment)
(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/))
m
ore body))
(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)
m
ore body))
(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))
m
ore body)
(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)
m
ore body)
(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/)))
(TryToUse (description goal entity)
(* c
omment)
(PROG(b
indings)
(first)
m
ore body))
(Seek3 (slotName template instance)
(* "quick compiler equivalent, (using only immediate access)
for (Seek \The slotName from a template thatIs instance/)")
(PROG(b
indings)
(first)
m
ore body))
(SeekSet (knownDesc specifier processDesc)
(* c
omment)
(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")))
m
ore body))
(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(b
indings)
(first)
more body))
(CreateEntityRecord (description)
(* c
omment)
(PROG(bindings)
(first)
more body))
(AddEntity (entity)
(* adds the new entity to the current environment, as an existing entity)
(PROG(b
indings)
(first)
more body))
(AddMap (mapRecord)
(* adds it to the global environment)
(PROG(b
indings)
(first)
m
ore body))
(CreateMap (descriptor focus)
(* c
omment)
(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
)
m
ore body))
More definitions )