A PROGRAM MODEL AND KNOWLEDGE BASE FOR COMPUTER AIDED PROGRAM... Richard J. Wood Department of Computer Science

From: AAAI-80 Proceedings. Copyright © 1980, AAAI (www.aaai.org). All rights reserved.
A PROGRAM MODEL AND KNOWLEDGE BASE FOR COMPUTER AIDED PROGRAM SYNTHESIS'
Richard J. Wood
Department of Computer Science
University of Maryland
College Park, Maryland 20742
1
Utroductaon
Program synthesis is a complex task comprising
many interacting subactivities and requiring access
to a variety of
knowledge
sourcesr
Recent
investigations have discovered the inadequaciest;ef
current synthesis techniques to keep pace with
increasing difficulties of managing large intricate
problem solutions* An alternative approach to
software methodologies is the
development of
intelligent computer systems that mana e the vast
amount of information assimilated an% accessed
during this process= The system's ttintellience"
is characterized not by an innate ability to Pnvent
solutions, but by the incorporation of an internal
model of the problem domain and corresponding
program solution.
This renort focuses on the nature of the
program model and the pro rammi
successfu!? sy%h%?ed&~~~~
required for a
the architecture of the Interacti;;
Specificall
Program Syne'
hesizer, under current development,
described,
This project ex
called the uentdomain expert (the
programmer (the cons
casting this investigation in the
%?%%onsu Bf tant paradigm, *the. techniques and
knowleci$egeneral to pro rammln 1n y$~~ipy&
can
Isolated
5 exam2nedo
coo erative frameworkanof program s nthesis the
fol!?owing four major categories of acIivities have
been identified:
zk~ central datamE;gycture of the IPS system
which represents the
iS
program
The
during
synthesis.
developin
program
organizat2on of the program model must accommodate
operations that include the introduction of new
terms from the user's problem description, the
existing
refinement and further definition of
the detection of inconsistencies in the
&E%i! tion and the efficient retraction of the
incons!i
stent!assertions* These activities occur in
client-consultant programming and correspond to the
initial problem description by the client, the
explanations and clarifications required by the
consultant and the rejection of unfruitful partial
solutions* The program model is a record of all
the assertions, inferences, and deductions made
during the synthesis and the justifications for
each assertion*
domain from the client,
Formulation:
transformation,
completion,
%
refinement of the problem requirements
into terms recognized by the system=
.
tructu : the selection of
known techniques for solving a task's
subproblems and the combination of
these solution fragments to form an
overall task solution.
The IPS program model is encoded as a semantic
network.,a data structure which facilitates the
processing of synthesis activitiesi The nodes of
.
: the instantiationthztf
P-ludaan
language
construct
schemata
corres ond to ste s of the solution
and w ose execu ion will achieve the
overall program behavior,
!&&
R
oomplete process descriptions, but- at a cost of
additional processing for referent identificationD
e
A system capable of supporting computer aided
synthesis must have cornonents corresponding to
each of the above active
-&ies,
Additionally, an
automated consultant must access a rich knowledge
base of programming information in constructing a
model of the evolving
This model must
the-eF%%trnGf the activities
syn;t$sls and must be ;;;;;;ed and
consultant
the
he final program,
describe the
and the set
achievement.
The Interactive Pro ram Synthesizer (IPS) is a
system designed to fulfl
-f1 the role of a consultant
R
8
*The research described in this re ortu;;e;unded b
the Office
Naval
Researc
gran
N00014-76C-0471;: Their support and encouragement
are gratefully acknowledged+
cE'f'esi;;jE;ce between an ofg;ratiioz
requisite
When the sentence "The screen is thought of as
a 40 b 86 byte arrayi" is processed by the system
two 05jects are introduced into the model, 1) an
object whose name is "screen" and 2) an object
77
which is an instantiation of the two dimensional
frame with the information presented in the
ZZXnce
(e,ga3 the extents of*each dimension and
These two objects
the t p~~gdftSeiaarrayentries)
*DEF link* that reflects the
are 1.
client's decision ?o consider the abstract object
"screen', as a two dimensional array* Similarly,
the processing of the sentence "To clear the screen
store a blank in ever
position of the screenF,,
introduces two objezn;
e corre;;;;;;; to the d;;n;E
operation ,,clear,'
a
f-array
operation and links them via a *REF link, The *REP
and *RED links are used in a similar manner
represent s stem generated decisions (i.nferenfc!$
as opposed z0 user specificationss
The division of link types parallels the
distinction between the two domains of expertise of
the client and the consultant. Clarifvina reauests
to
the
user are expressed
" tZrmirio1;~~
identified by SDEF and *REF yi%E
(e.g
ob.iects "screenI,and "clear,'in the above e&&nnle)
;E;',,e
tk;E;ysi;; automatically infers information
*RED ObJeCtS (e@g., 2-D array and
array store), When an inimica~t~~;~;action between
two state in the model is
the system
unravels 9Rieger&London, 1977B the cu&ent solution
and selects alternative strategies for achievin
the *RED state before causing a retraction of thaf
state*
If the offender is a *REF state the system
must appeal to the user for a restatement of the
goal*
The system cannot jud e the soundness of a
user-supplied decom osition an% must turn to the
user for an alternaee decompositionr
the
instantiated with the data presented
*
sentence. Addit;onall , the array frame imovides
",;g$ult in;;;;;kon .aci
out some characteristics
indicies of the dimensions and
referencing
common?;' used
ferminology
for
components of the array (ergs, ,'rowland "column
for the dimensions), It also suggests queries to
the user about requisite information (e&g,, is the
is this a type description or a
size fixed?
individual?)
selectional queries
specific
., are the values cdnt%ied
in the
Features describing the ~%%ti%
kz%ted
at?)
uses of the'airay (e-.g., the ability to define
subregions of an array> are included in the frame
but not processed immediately. If later assertions
refer to these roles they can be retrieved from the
protytpical frame and instantiated,
The knowledge base contains frames for both
programming objects and operations, Object frames
potential
contain defining characteristics and
roles of an ob'ect, while o erations are described
by the set of siates requisite for their correct
execution and the post conditions and side-effects
of the action+
This note describes the
nature
of
two
cornonents of a computer aided program synthesis
and
the
?
the internal program model
%?w?fdge
base of programming information.
structures are part of a larger project C%Z"
towards the development of I
directed
19801
theoretical modekf of program synthesis and an
implementation
EodeP.
system ""2
incor orates
this
rogra%Y:ng project
inveseigating assembly language programming oth,a
particular
simple
microprocessor
activities and knowledge ?sed
by a co&ultant
during the construction of a software package that
manages a video dis lay buffer, By examinin
program synthesis in t e concrete and uncluttere%
realm of-assembl language prog ams (as contrasted
to abstract high-Peve1 languagesf progress towards
a successful cornuter aided programming system can
advance in much t e same manner that advances to
general
problem solvi
resulted from
Investigat!~%??%o the blocks-wor
T d domain.
Other link types exist in the program model
feature-description,
$Z$%dency) ~ZerZnce, beyond the scope of this
report.
The reader is directed to other projects
that investigate the foundation
semantic
networks (e*g,, [Bra&man,
19779 a:df [Fahlman,
1979115
R
R
The
program
model
is
constructed
by
instantiating schematic programming knowledge with
problem specific data presented by the user.
The
programming knowledge base consists of facts and
program
construction
considered
techniques
primi;;;; to
programming and employed during
This
collection
includes:
9r';descriptions of data types and rules for their
combination to
form
new
abstract
t pes;
(2) criteria
required
by .a. type descripI ion;
(3) techniques for dz;;mposltlon. of st$?s ,;zy
problem
solving
recognition
interactions: and (4) methods for construction of
expressions,* conditionals, input
and
out ut
statements, A fundamental characteristic of e
knowledge base is that the facts are applicable
",E
__
many programming domains,
Thanks to Chuck Rieger, Steve Small, and Randy
Trig for reading drafts of this paper and making
helpBul commentsI
The IPS kn;;;;zge base is organized in a
hierarchical
system,
efficient
iE0
s nthesis
or anization of knowledge
for
ac2 ivities: recogn;kcn and inference. % eatures
presented during
behavioral *task
user's
sugg;;; potential programming objects
~~crlpt=on
represent
abstract
domain
obJetts.
Identification of a particular programmin object
supplies information normally associated w!3
th the
object., but not stated in the user's discourse,
These inferences provide a basis for queries to the
user
requesting additional
information,
selection of a particular object from a set %
candidatess
[Br=$mhm;a'n197~lJ
A Structural
Paradigm
for
Represent!in'KAdwledge, Bolt Beranek and Newman,
Inc,, Repor& 3605, Many 1978.
[Fahlman, 19791
Fahlman,*S.Ei,NETL,:A n
?%!bri!!&'!%a%?$@'%!
fer
-,
B
.
M1T YPress'
Results in Knowledge Based
J?roc& a-I-79,
Tokoyo,
The programming frames contain information
describing defining characteristics and potential
roles of an object in a program, While processing
the sentence "The screen is thought of as a 40 by
86 byte array*", for example, the prototypical t..~
dimensional
array
frame
is
retrieved
[Rieger&London, 19771
Rleger, C, & London, Pa, Subgoal Protection
and
.
Unravellin during Plan S~;;~~;~7). pr0c.a
m,
fambridge, Mass.,
[Wood, 19801
*The IPS is designed to communicate with the user
in English.
Curre;;;xr the sentences
translated into
correspondingare rn:daZ!
manipulation functions. This transformation will
ultimately utilize a kevword narser built around a
dictionary of programming terminology,
78
;,oyf 9 R,J, t Computer Aided
Pro ram Synthesis,
. of Maryland, TR-861, Jan, $980.