~
FIFTH GENERATION
COMPUTER SYSTEMS 1992
Edited by
Institute for New Generation Computer Technology (ICOT) Volume 2
Ohmsha, Ltd. IDS Press
Copyright
©
1992 by Institute for New Generation Computer Technology All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, electronic, mechanical, recording or otherwise, without the prior permission of the copyright owner.ISBN 4-274-07724-1 (Ohmsha) ISBN 90-5199-099-5 (lOS Press)
Library of Congress Catalog Card Number: 92-073166 Published and distributed in Japan by
Ohmsha, Ltd.
3-\ Kanda Nishiki-cho, Chiyoda-ku, Tokyo 101, Japan Distributed in North America by
lOS Press, Inc.
Postal Drawer 10558, Burke, V A 22009-0558, U. S. A.
United Kingdom by lOS Press
73 Lime Walk, Headington, Oxford OX3 7AD, England Europe and the rest of the world by
lOS Press
Van Diemenstraat 94, 10 13 CN Amsterdam, Netherlands Far East jointly by
Ohmsha, Ltd., lOS Press Printed in Japan
111
CONTENTS OF VOLUME 1
PLENARY SESSIONS
Keynote Speech Launching the New Era
Kazuhiro Fuchi
. . . 3General Report on ICOT Research and Development Overview of the Ten Years of the FGCS Project
Takashi K urozumi . . . .
Summary of Basic Resear.ch Activities of the FGCS ProjectKoichi
Furukawa . . . . Summary of the Parallel Inference Machine and its Basic SoftwareShunichi Uchida . . . .
Report on ICOT Research ResultsParallel Inference Machine PIM
Kazuo Taki . . . .
Operating System PIMOS and Kernel Language KL1Takashi Chikayama . . . .
Towards an Integrated Knowledge-Base Management System: Overview of R&D on Databases and Knowledge-Bases in the FGCS ProjectKazumasa
Yokota
andHideki
Yasukawa . . . . Constraint Logic Programming System: CAL, GDCC and Their Constraint SolversAkira Aiba
andRyuzo
Hasegawa . . . . Parallel Theorem Provers .and Their ApplicationsRyuzo
Hasegawa andMasayuki Fujita
Natural Language Processing SoftwareYuichi
Tanaka . . . ..Experimental Parallel Inference Software
Katsumi Nitta, Kazuo Taki
andNobuyuki Ichiyoshi . . . .
Invited LecturesFormalism vs. Conceptualism: Interfaces between Classical Software Development Techniques and Knowledge Engineering
Dines Bj¢rner . . . ..
The Role of Logic in Computer Science and Artificial Intelligence J. A. Robinson . . .
Programs are Predicates C.
A.
R. HoarePanel Discussion: A Springboard for Information Processing in the 21st Century PANEL: A Springboard for Information Processing in the 21st Century
Robert A. Kowalski (Chairman) . . . .
Finding the Best Route for Logic ProgrammingHerve Gallaire . . . .
The Role of Logic Programming in the 21st CenturyRoss Overbeek . . . .
Object-Based Versus Logic ProgrammingPeter
Wegner . . . .
. . . .Concurrent Logic Programming as a Basis for Large-Scale Knowledge Information Processing
Koichi Furukawa . . . .
. 9
.20 .33.50 .73
· .89
· 113
· 132
· 155 . 166
· 191 .199 .211
.219 .220 .223 .225 .230
Shunichi Uchida . . . 232
ICOT SESSIONS
Parallel VLSI-CAD and KBM Systems LSI-CAD Programs on Parallel Inference Machine
Hiroshi Date, Yukinori Matsumoto, Kouichi Kimura,
KazuoTaki, Hiroo
Katoand
lvlasahiro Hoshi . . .
. 237 Parallel Database Management System: Kappa-PMoto
Kawamura,Hiroyuki Sato, Kazutomo Naganuma and
KazumasaYokota . . .
248 Objects, Properties, and Modules in QUIXOTeHideki Yasukawa, Hiroshi Tsuda and
KazumasaYokota . . . 257
Parallel Operating System, PIMOSResource Management Mechanism of PIM OS
Hiroshi Yashiro, Tetsuro Fujise, Takashi Chikayama, Masahiro Matsuo, Atsushi Hori
and
Kumiko
Wada . . . . . . . 269 The Design of the PIMOS File SystemFumihide Itoh, Takashi Chikayama, Takeshi Mori, Masaki Sato, Tatsuo
Katoand
Tadashi Sato . . . . . . .
. . . . . 278 ParaGraph: A Graphical Tuning Tool for Multiprocessor SystemsSeiichi Aikawa, Mayumi Kamiko, Hideyuki
Kubo,Fumiko Matsuzawa and
Takashi Chikayama .. . . . .
286 Genetic Information ProcessingProtein Sequence Analysis by Parallel Infere?ce Machine
Masato
Ishikawa, Masaki Hoshida, Makoto Hirosawa, Tomoyuki
Toya, KentaroOnizuka
and Katsumi Nitta . . .
294 Folding Simulation using Temperature Parallel Simulated AnnealingMakoto Hirosawa, Richard J. Feldmann, David Rawn, Masato Ishikawa, Masaki Hoshida
and George Michaels . . . . . . . ". . . .
.. 300 Toward a Human Genome EncyclopediaKaoru
Yoshida, Cassandra Smith, Toni
Kazic,George Michaels, Ron Taylor,
David
Zawada,Ray Hagstrom
andRoss Overbeek . . . . 307
Integrated System for Protein Information ProcessingHidetoshi Tanaka . . . . "
. . . 321 Constraint Logic Programnling and Parallel Theorenl ProvingParallel Constraint Logic Programming Language GDCC and its Parallel Constraint Solvers
Satoshi Terasaki, David
J.Hawley, Hiroyuki Sawada, Ken Satoh, Satoshi Menju,
Taro
Kawagishi, Noboru Iwayama
andAkira Aiba . . . .. . 330
cu-Prolog for Constraint-Based GrammarHiroshi Tsuda . . .
347 Model Generation Theorem Provers on a Parallel Inference MachineMasayuki Fujita, Ryuzo Hasegawa, Miyuki Koshimura and Hiroshi Fujita
Natural Language ProcessingOn a Grammar Formalism, Knowledge Bases and Tools for Natural Language Processing in Logic Programming
.357
Hiroshi Sano
andFumiyo Fukumoto . . .
376v
Argument Text Generation System (Dulcinea)
Teruo Ikeda, Akira Kotani, Kaoru Hagiwara and Yukihiro Kubo . . . 385
Situated Inference of Temporal InformationSatoshi Tojo and Hideki Yasukawa
. . . 395 A Parallel Cooperation Model for Natural Language ProcessingShigeichiro Yamasaki, Michiko Turuta, Ikuko
Nagasawa andKenji Sugiyama . . .
405 Parallel Inference Machine (PIM)Architecture and Implementation of PIM/p
Kouichi Kumon, Akira Asato, Susumu Arai, Tsuyoshi Shinogi, Akira Hattori,
Hiroyoshi Hatazawa and Kiyoshi Hirano . . . .
. . . 414 Architecture and Implementation of PIM/mHiroshi Nakashima, Katsuto Nakajima, Seiichi Kondo, Yasutaka
Takeda, Yu Inamura,Satoshi Onishi and Kanae Masuda
. . . 4 2 5 Parallel and Distributed Implementation of Concurrent Logic Programming Language KLIKeiji Hirata, Reki
Yamamoto,Akira Imai, Hideo Kawai, Kiyoshi Hirano,
Tsuneyoshi Takagi, Kazuo Taki, Akihiko Nakase and Kazuaki Rokusawa
.436 Author Index. . . . . .i
VII
CONTENTS OF VOLUME 2
FOUNDATIONS
Reasoning about ProgralTIS
Logic Program Synthesis from First Order Logic Specifications
Tadashi Kawamura . . . . . . .
. 463 Sound and Complete Partial Deduction with Unfolding Based on Well-Founded MeasuresBern Martens, Danny
DeSchreye and Maurice Bruynooghe . . . .
.473 A Framework for A.nalyzing the Termination of Definite Logic Programs with respect to CallPatterns
Danny
DeSchreye, Kristof Verschaetse
andMaurice Bruynooghe . . . .
481 Automatic Verification of GHC-Programs: TerminationLutz Plumer . . .
489 AnalogyAnalogical Generalization
Takenao Ohkawa, Toshiaki Mori, Noboru Babaguchi
andYoshikazu Tezuka . . .
497 Logical Structure of Analogy: Preliminary ReportJun Arima . . . 505
Abduction (1)Consistency-Based and Abductive Diagnoses as Generalised Stable Models
Chris Preist and Kave Eshghi
. . . . 514 A Forward-Chaining Hypothetical Reasoner Based on Upside-Down Meta-InterpretationYoshihiko Ohta and Katsumi Inoue . . . . . .
. 522 Logic Programming, Abduction and ProbabilityDavid Poole
. . . 530 Abduction (2)Abduction in Logic Programming with Equality P. T.
Cox,
E.Knill and
T.Pietrzykowski
Hypothetico-Deductive ReasoningChris Evans and Antonios
C.Kakas . . . .
Acyclic Disjunctive Logic Programs with Abductive Procedures as Proof Procedure
.539 .546
Phan Minh Dung . . . 555
Semantics of Logic ProgranlsAdding Closed World Assumptions to Well Founded Semantics
Luis Moniz Pereira, Jose
J.Alferes and Joaquim
N.Aparicio . . . .
Contributions to the Semantics of Open Logic ProgramsA. Bossi, M. Gabbrielli, G. Levi and M. C. Meo . . . .
A Generalized Semantics for Constraint Logic ProgramsRoberto Giacobazzi, Saumya K. Debray and Giorgio Levi
Extended Well-Founded Semantics for Paraconsistent Logic ProgramsChiaki Sakama . . . .
Invited PaperFormalizing Database Evolution in the Situation Calculus
. 562 . 570 .581 . 592
Raymond Reiter . . .
600Machine Learning
Learning Missing Clauses by Inverse Resolution
Peter Idestam-Almquist . . . .
A Machine Discovery from Amino Acid Sequences by Decision Trees over Regular PatternsSetsuo Arikawa, Satoru Kuhara, Satoru Miyano, Yasuhito Mukouchi, Ayumi Shinohara an
d Takeshi Sh in oh ara . . . . . . . . Efficient Induction of Version Spaces through Constrained Language ShiftClaudio Carpineto . . . .
Theorem ProvingTheorem Proving Engine and Strategy Des·cription Language
.. 610
.618 .626
Massimo Bruschi
. . . . 634 A New Algorithm for Subsumption TestByeong Man Kim, Sang Ho Lee, Seung Ryoul Maeng and Jung Wan Cho . . .
643 On the Duality of Abduction and Model GenerationMarc
Denecker and Danny
DeSchreye . . . .
650 Functional Programming and Constructive LogicDefining Concurrent Processes Constructively
Yukihide Takayama . . . ..
.658 Realizability Interpretation of Coinductive Definitions and Program Synthesis with StreamsMakoto Tatsuta . . .
.666 MLOG: A Strongly Typed Confluent Functional Language with Logical VariablesVincent Poirriez . . . .
. 674 ANew Perspective on Integrating Functional and Logic LanguagesJohn Darlington, Yi-ke Guo and Helen Pull . . . .
. 682 Temporal ReasoningA Mechanism for Reasoning about Time and Belief
Hideki Isozaki and Yoav Shoham
. . . ..Dealing with Time Granularity in the Event Calculus
Angelo Montanari, Enrico Maim, Emanuele Ciapessoni and Elena Ratto
ARCHITECTURES & SOFTWARE
Hardware Architecture and Evaluation
UNIRED II: The High Performance Inference Processor for the Parallel Inference Machine PIE64
.694 .702
Kentaro Shimada, Hanpei Koike and Hidehiko Tanaka . . . . ..
715 Hardware Implementation of Dynamic Load Balancing in the Parallel Inference MachinePIM/c
T.
Nakagawa,
N.Ido,
T.Tarui,
M.Asaie and
M.Sugie . . . .
. 723 Evaluation of the EM-4 Highly Parallel Computer using a Game Tree Searching ProblemYuetsu
Kodama, Shuichi Sakai and Yoshinori Yamaguchi . . . .731 OR-Parallel Speedups in a Knowledge Based System: on Muse and AuroraKhayri A.
M. Ali and Roland Karlsson . . . 739 Invited PaperA Universal Parallel Computer Architecture
William
J.Dally . . .
746AND-ParallelislTI and OR-Parallelism
An Automatic Translation Scheme from Prolog to the Andorra Kernel Language
Francisco Bueno
andManuel Hermenegildo . . . . . . . ..
Recomputation based Implementations of And-Or Parallel Prolog
Gopal
Gupta andManuel
V.Hermenegildo . . . .
Estimating the Inherent Parallelism in Prolog ProgramsDavid
C.Sehr
andLaxmikant
V.Kale . . . .
Implementation TechniquesImplementing Streams on Parallel Machines with Distributed Memory
Koichi Konishi,
Tsutomu Maruyama,Akihiko
Konagaya, KaoruYoshida
andTakashi Chikayama . . . .
Message-Oriented Parallel Implementation of Moded Flat GHCI{azunori Ueda
and MasaoMorita . . . .
Towards an Efficient Compile-Time Granularity Analysis Algorithmx. Zhong,
E. Tick, S. Duvvuru, L. Hansen, A. V. S. Sastry and R. Sundararajan Providing Iteration and Concurrency in Logic Programs through Bounded QuantificationsJonas Barklund
andHakan Millroth
. . . . Extension of Logic ProgrammingAn Implementation for a Higher Level Logic Programming Language
Anthony S. K. Cheng
andRoss A.
Paterson . . . . . . . Implementing Prolog Extensions: a Parallel Inference MachineJean-Marc
Alliot, Andreas Herzig
and Mamede Lima-Marques . . . . Parallel Constraint Solving in Andorra-ISteve Gregory
andRong
Yang . . . . A Parallel Execution of Functional Logic Language with Lazy EvaluationJong
H. Nang, D. W.Shin, S.
R. Maeng and Jung W.Cho . . . .
Task Scheduling and Load AnalysisSelf-Organizing Task Scheduling for Parallel Execution of Logic Programs
Zheng Lin . . . .
Asymptotic Load Balance of Distributed Hash TablesNobuyuki Ichiyoshi
andKouichi
Kimura ConcurrencyConstructing and Collapsing a Reflective Tower in Reflective Guarded Horn Clauses
Jiro Tanaka
andFumio Matono . . . .
CHARM: Concurrency and Hiding in an Abstract Rewriting MachineAndrea Corradini, Ugo
Montanari and FrancescaRossi . . . .
Less Abstract Semantics for Abstract Interpretation of FG H C ProgramsKenji Horiuchi . . . . . . .
Databases and Distributed SystelTISParallel Optimization and Execution of Large Join Queries
Eileen Tien Lin,
EdwardOmiecinski
andSudhakar Yalamanchili . . . .
Towards an Efficient Evaluation of Recursive Aggregates in Deductive DatabasesAlexandre Lefebvre . . . . . . .
A Distributed Programming Environment based on Logic Tuple SpacesPaolo Ciancarini
andDavid Gelernter . . . . . . .
IX
. 759 . 770 . 783
.791 . 799 .809 .817
. 825 . 833 .843 . 851
.859 .869
. 877 .887 .897
.907 .915 .926
Programluing Environn1.ent
Visualizing Parallel Logic Programs with VISTA
E. Tick . . . .
Concurrent Constraint Programs to Parse and Animate Pictures of Concurrent Constraint Programs
Kenneth
M. Kahn . . . . Logic Programs with InheritanceYaron
Goldberg, William Silverman
andEhud Shapiro . . . .
Implementing a Process Oriented Debugger with Reflection and Program TransformationMunenori
Maeda . . . . Production Systen1.sANew Parallelization Method for Production Systems
E. Bahr,
F.Barachini
andH. Mistelberger
. . . . Performance Evaluation of the Multiple Root Node Approach to the Rete Pattern Matcher for Production SystemsAndrew Sohn
and Jean-LucGaudiot . . . .
APPLICATIONS & SOCIAL IMPACTS
Constraint Logic Programluing Output in CLP(R)
Joxan Jaffar,
Michael
J.Maher, Peter
J.Stuckey
andRoland H.
Adapting CLP(R) to Floating-Point Arithmetic J.
H.
M.Lee
and M.H.
vanEmden ..
Domain Independent Propagation
Thierry
LeProvost
andMark Wallace . . . .
C. YapA Feature-Based Constraint System for Logic Programming with Entailment
Hassan 'Ai't-Kaci, Andreas Podelski
andGert Smolka . . . .
Qualitative ReasoningRange Determination of Design Parameters by Qualitative Reasoning and its Application to Electronic Circuits
· .. 934
.943 .951 . 961
· .. 969
· .. 977
.987 .996 1004 1012
Masaru
Ohki, Eiji Oohira, Hiroshi Shinjo
and MasahiroAbe
1022 Logical Implementation of Dynamical ModelsYoshiteru Ishida . . . .
1030 Knowledge RepresentationThe CLASSIC Knowledge Representation System or, I<:L-ONE: The Next Generation
Ronald J. Brachman, Alexander Borgida, Deborah
L.McGuinness, Peter
F.Patel-
Schneider
andLori Alperin Resnick . . . .
1036 Morphe: A Constraint-Based Object-Oriented Language Supporting Situated KnowledgeShigeru
Watari,Yasuaki
Honda and MarioTokoro
. . . . . . 1044 On the Evolution of Objects in a Logic Programming FrameworkF.
Nihan Kesim
andMarek Sergot
. . . 1052 Panel Discussion: Future Direction of Next Generation ApplicationsThe Panel on a Future Direction of New Generation Applications
Fumio Mizoguchi . . .
1061 Knowledge Representation Theory Meets Reality: Some Brief Lessons from the CLASSICExperience
Ronald
J.Brachman . . .
1063Reasoning wi th Constraints Catherine Lassez
Developments in Inductive Logic Programming
Stephen 1'1'1 uggleton . . . ..
Towards the General-Purpose Parallel Processing System Kazuo Taki . . . . Know ledge- Based SystelTIS
A Hybrid Reasoning System for Explaining Mistakes in Chinese Writing
(
XI
1066 1071 1074
Jacqueline Castaing . . . 1076 Automatic Generation of a Domain Specific Inference Program for Building a Knowledge
Processing System
Takayasu Kasahara, Naoyuki Yamada, Yasuhiro Kobayashi, Katsuyuki Yoshino and
Kikuo Yoshimura . . . 1084 Knowledge-Based Functional Testing for Large Software Systems
Uwe Nonnenmann and John K. Eddy . . . 1091 A Diagnostic and Control Expert System Based on a Plant MO,del
Junzo Suzuki, Chiho Konuma, Mikito Iwamasa, Naomichi Sueda, Shigeru Mochiji and
Akimoto Kamiya . . . 1099 Legal Reasoning
A Semiformal Metatheory for Fragmentary and Multilayered Knowledge as an Interactive Metalogic Program
Andreas Hamfelt and Ake Hansson . . . .. 1107 HELIC-II: A Legal Reasoning System on the Parallel Inference Machine
Katsumi Nitta, Yoshihisa Ohtake, Shigeru Maeda, Masayuki Ono, Hiroshi Ohsaki and
Kiyokazu Sakane . . . 1115 Natural Language Processing
Chart Parsers as Proof Procedures for Fixed-Mode Logic Programs David A. Rosenblueth . . . . A Discourse Structure Analyzer for Japanese Text
K. Sumita, K. Ono, T. Chino, T. Ukita and S. Amano . . . . Dynamics of Symbol Systems: An Integrated Architecture of Cognition K6iti Hasida . . . . Knowledge Support Systems
Mental Ergonomics as Basis for New-Generation Computer Systems M. H. van Emden . . . . . . . An Integrated Knowledge Support System
B. R. Gaines, M. Linster and M. L. G. Shaw . . . . Modeling the Generational Infrastructure of Information Technology
B. R. Gaines . . . .
Parallel Applications
Co-HLEX: Co-operative Recursive LSI Layout Problem Solver on Japan's Fifth Generation Parallel Inference Machine
1125 1133 1141
1149 1157 1165
Toshinori Watanabe and Keiko Komatsu . . . 1173 A Cooperative Logic Design Expert System on a Multiprocessor
Yoriko Minoda, Shuho Sawada, Yuka Takizawa, Fumihiro Maruyama and
Nobuaki Kawato . . . . . . . . 1181 A Parallel Inductive Learning Algorithm for Adaptive Diagnosis
Yoichiro N akakuki, Yoshiyuki Koseki and Midori Tanaka . . . 1190
Yukinori Matsumoto and Kazuo Taki . . . .
1198 Invited PaperApplications of Machine Learning: Towards Knowledge Synthesis
Ivan Bratko
1207Author Index. . .
i
FOUNDATIONS
PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON FIFTH GENERATION COMPUTER SYSTEMS 1992,
edited by ICOT. © ICOT, 1992 463
Logic Program Synthesis from First Order Logic Specifications
Tadashi KAWAMURA
Institute for New Generation Computer Technology 1-4-28 Mita, Minato-ku, Tokyo 108, Japan
tkawamur@icot.or.jp
Abstract
In this paper, a logic program synthesis method from first order logic specifications is described. The specifications are described by Horn clauses extended by universally quantified implicational formulae. Those formulae are transformed into definite clause programs by meaning- preserving unfold/fold transformation. We show some classes of first order formulae which can be successfully transformed into definite clauses automatically by un- fold/fold transformation.
1 Introduction
Logic program synthesis based on unfold/fold transfor- mation [1] is a standard method and has been investi- gated by many researchers [2, 3, 5, 6, 11, 12, 19]. As for the correctness of unfold/fold rules in logic program- ming, Tamaki and Sato proposed meaning-preserving unfold/fold rules for definite clause programs [20]. Then, Kanamori and Horiuchi proposed unfold/fold rules for a class of first order formulae [7]. Recently, Sato proposed unfold/fold rules for full first order formulae [18].
In the studies of program synthesis, unfold/fold rules are used to eliminate quantifiers by folding to obtain def- inite clause programs from· first order formulae. How- ever, in most of those studies, unfold/fold rules were ap- plied nondeterministically and general methods to derive definite clauses were not known. Recently, Dayantis [3]
showed a deterministic method to derive logic programs from a class of first order formulae. Sato and Tamaki [19]
also showed a deterministic method by incorporating the concept of continuation.
This paper shows another characterization of classes of first order formulae from which definite clause programs can be derived automatically. Those formulae are de- scribed by Horn clauses extended by universally quanti- fied implicational formulae. As for transformation rules, Kanamori and Horiuchi's unfold/fold rules are adopted.
A synthesis procedure based on unfold/fold rules is given, and with some syntactic restrictions, those formulae are successfully transformed into equivalent definite clause programs. This study is also an extension of those by
Pettorossi and Proietti [14, 15, 16] on logic program tr ansforma tions.
The rest of this paper is organized as follows. Section 2 describes unfold/fold rules and formalizes the synthesis process. Section 3 describes a program synthesis proce- dure and proves that definite clause programs can be suc- cessfully derived from some classes of first order formulae using this procedure. Section 4 discusses the relations to other works and Section 5 gives a conclusion.
In the following, familiarity with the basic terminolo- gies of logic programming is assumed[13]. As syntactical variables, X, Y, Z, U, V are used for variables, A, B, H for atoms and F, G for formulae, possibly with primes and subscripts. In addition, 0 is used for a substitution, FO for the formula obtained from formula F by applying substitution
0,
X for a vector of variables andFa[G']
for replacement of an occurrence of subformula G of formula F with formula G'.2 Unfold/Fold Transformation for Logic Program Synthesis
In this section, preliminary notions of our logic program synthesis are shown.
2.1 Preliminaries
Preliminary notions are described first.
A formula is called an implicational goal when it is of the form Fl -+ F2, where Fl and F2 are conjunctions of atoms.
Definition 2.1 Definite Formula
Formula C is called a definite formula when C is of the form
A f - G1 1\ G2 1\ ... 1\ G n (n ~ 0),
where Gi is a (possibly universally quantified) conjunc- tion of implicational goals for i
=
1,2, ... ,n. A is called the head of C, G1 1\ G2 1\ . .. 1\ Gn is called the body of C and each Gi is called a goal in the body of C.Note that the notion of a definite formula is a restricted form of that in [7].
A set of definite formulae is called a definite formula program, while a set of definite clauses is called a definite clause program. We may simply say programs instead of definite formula (or clause) programs when it is obvious to which we are referring.
Definition 2.2 Definition Formula
Let P be a definite formula program. A definite for- mula D is called a definition formula for P when all the predicates appearing in D's body are defined by definite clauses in. P and the predicate of D's head does not ap- pear in P. The predicate of D's head is called a new predicate, while those defined by definite clauses in P are old predicates. A set of formulae D is called a defi- nition formula set for P when every element D of D is a definition formula for P and the predicate of D's head appears only once in D.
Atoms with new predicates are called new atoms, while those with old predicates are called old atoms.
2.2 Unfold/Fold
~ansformation In this subsection, unfold/fold transformation rules are shown following [7]. Below, we assume that the logical constant i1'ue implicitly appears in the body of every unit clause. Further, we assume that a goal is always deleted from the body of a definite formula when it is the logical constant true, and a definite formula is always deleted when some goal in its body is the logical constant false.Further, we introduce the reduction of implicational goals with logical constant true and false, such as ,true::::} false, true /\ F ::::} F, and so on. (See [7] for details.) Let G be an implicational goal. The reduced form of G, denoted by G
L
is the normal form in the above reduction system.Variables not quantified in formula F are called global variables of F. Atoms appearing positively (negatively) in formula F are called positive (negative) atoms of F.
Definition 2.3 Positive Unfolding
Let Pi be a program, C be a definite formula in Pi, G be a goal in the body of C and A be a positive old atom of G containing no universally quantified variable.
Then, let Go be GA[Jalse]
1
and Cb be the definite for- mula obtained from C by replacing G with Go. Further, let Cl , C2 , ••. ,Ck be all the definite clauses in Pi whose heads are unifiable with A, say by mgu's 01 , O2 , ••• , Ok.Let Gj be the reduced form of GOj after replacing AOj in GOj with the body of CjOj , and Cj be the definite formula obtained from COj by replacing GOj in the body with Gj.
(New variables introduced from Cj are global variables of Gj.) Then, Pi+l = (Pi - {C})
u
{Cb,C~,c~, ... ,CD.Cb, C~, C~, . .. , C
k
are called the results of positive un- folding C at A (or G).Example 2.1 Let P be a definite clause program as fol- lows:
Cl : list([]).
C2 : list([XIL]) f -list(L).
C3 : 0 < suc(Y).
C4 : suc(X) < suc(Y) f -X < Y.
C5 : member(U,[UIL]).
C6 : member(U,[VIL]) f - member(U,L).
Let C7 be a definition formula for P as follows : C7 : less-than-all(X,L) f -
list(L) /\ V Y(member(Y,L) ---t X<Y).
Suppose that Po = P U {C7 }. Then, by unfolding C7 at list(L), program PI = P U {Cs, C9 } is obtained, where
Cs : less-than~all(X,[]) f -V Y(member(Y,[]) ---t X<Y).
C9 : less-than-all(X,[ZILJ) f -
list(L) /\ V Y(member(Y,[ZIL]) ---t X<Y).
Before showing the negative unfolding rule, we intro- duce the notion of terminating atoms. Intuitively, atom A is terminating when every derivation path of A is fi- nite. See [7] for the precise definition.
Definition 2.4 Negative Unfolding
Let Pi be a program, C be a definite formula in Pi, G be a goal in the body of C and A be a negative old atom of G such that every atom obtained from A by instanti- ating all global variables in A to ground is terminating.
Let Cl ; C2 , ••• ,Ck be all the definite clauses in Pi whose heads are unifiable with A, say by mgu's Oll ()2, ... ,()k,
where OJ instantiates no global variable in G. Let Go be GA[Jalse]
1
and Gj be the reduced form of G()j after re- placing AOj in G()j with the body of CjOj. (New variables introduced from Ci are universally quantified variables in Gi .) Let Cf be the definite formula obtained from C by replacing G in the body of C with Go /\ Gl /\ ... /\ Gk •Then, Pi+l
=
(Pi - {C} ) U {Cf} . Cf is called the results of negative unfolding C at A (or G).Example 2.2 Let P and PI be programs in Exam- ple 2.1. By unfolding Cs at member(X,[]), P2
=
Pu
{C9 , Cw } is obtained, where
CIa: less-than-all(X,[]) f -V Y (false ---t X < Y)
1.
that is,
CIa: less-than-all(X,[]).
Further, by unfolding C9 at member(X,[ZIL]), P3 = P U
{ClQ, Cn } is obtained, where
Cl l : less-than-all(X,[ZIL]) f -list(L) /\
V Y(false ---t X<YH /\
V Y(true ---t X<ZH /\
V Y (member(Y,L) ---t X<YH.
that is,
Cl l : less-than-all(X,[ZIL]) f - list(L) /\
X < Z /\ V Y (rnember(Y,L) ---t X < V).
Definition 2.5 Folding
Let Pi be a definite formula program, C be a definite formula in Pi of the form A f -K /\ Land D be a definite
formula of the form B +- K', where K,K' and L are conjunctions of goals. Suppose that there exists a sub- stitution () such that K'() = K holds. Let C' be a clause of the form A +-B(), L. Then Pi+1
=
(Pi - {C}) U {C'}.Note that when applying folding, some conditions have to be satisfied to preserve the meanings of programs. See [7] for details.
Example 2.3 Let P and P3 be programs in Exam- ple 2.2. By folding Cn by C7 , P4
=
P U {C1O , C12 } is obtained, whereC12 : less-than-all(X,[Y\L]) +-
X < Y 1\ less-than-all(X,L)
2.3 Program Synthesis by Unfold/Fold Transformation
In this subsection, our program synthesis problem is for- malized. Firstly, several notions are defined to formalize the program synthesis processes.
Definition 2.6 Descendant and Ancestor Formula Let P be a definite formula program, C be a definite formula in P and P' be a definite formula program ob- tained from P by successively applying positive or nega- tive unfolding to P. A definite formula C' in P' is called
a descendant formula of C when .
( a) C' is identical to C, or
(b) C' is the result of positive or negative unfolding of a descendant formula of C.
Conversely, C is called an ancestor formula of C'.
Example 2.4 In Examples 2.1 - 2.3, definite formulae C7 , C8 , . . . ,Cn are descendant formulae of C7 .
Definition 2.7 U-selection Rule
A rule that determines what transformation should be applied to a definite formula program is called a selection rule. Let P be a definite formula program and C be a definite formula in P. A selection rule R is called a U- selection rule for P rooted on C when R always selects positive or negative unfolding applied to a descendant formula of C. C is called the root formula for R (or of the transformation.) A definite formula program ob- tained from P by successively applying transformation rules according to R is called a definite formula program obtained from P via R.
Definition 2.8 Closed Program
Let P be a definite clause program, C be a definition formula for P, D be a definition formula set for P and R be a U-selection rule for P U {C} rooted on C. Let P' be a definite formula program obtained from P U {C} via R.
P' is said to be closed with respect to triple < P, C, D >
when every descendant formula C' of C in P' satisfies one of the following:
465
(a) C' is a definite clause.
(b) There exists a goal G consisting of positive atoms only in the body of C' such that an old atom in G is not unifiable with the head of any definite clause in P'.
(c) By successively folding C' by clauses in {C} U D, a definite clause can be obtained.
PU {C} is said to be closed with respect to D when there exists a closed program with respect to < P, C, D > and for every definition formula D in D there exists a closed program with respect to < P, D, D U {C} >.
Example 2.5 Let P and P3 be programs in Exam- ple 2.2. Then, P3 is closed w.r.t. < P, C7 ,
0
>. Further, P U {C7 } is closed w.r.t.0.
The above framework is an extension of the one shown in [8], and also a modification of the one Pettorossi and Proietti proposed [14, 15, 16] in their studies of program transformation.
Now, our problem can be formalized as follows: for given definite clause program P and definition formula C for P, find a finite definition formula set 1) for P such that P U {C} is closed with respect to D.
3 Some Classes of First Order Formulae from Which Logic Programs Can Be Derived
In this section, we specify some classes of first order for- mulae from which definite clause programs can be de- rived by unfold/fold transformation.
3.1 A Program Synthesis Procedure In this subsection, we show a naive program synthesis procedure. In the following, we borrow some notions about programs in [15, 16]. We consider definite formula (clause) programs with predicate =, which have no ex- plicit definition in the programs. Predicate
=
is called a base predicate, while other predicates are called de- fined predicates. Atoms with base predicates are called base atoms, while those with defined predicates are called defined atoms. Transformation rules can be applied to defined atoms only.A formula containing base atoms can be reduced by unifying arguments of
=.
When a universally quanti- fied variable and a global variable are unified, the global variable is substituted for the universal one. The above reduction is called the reduction with respect to=.
We assume that no formulae are reduced w.r.t.=
unless this is explicitly mentioned.Further, we assume that the following operations are always applied implicitly to the results of positive or neg- ative unfolding. Goals G is said to be connected when at most one universally quantified implicational goal G'
appears in G and each atom in G' has common univer- sally quantified variables with at least one another atom in G'. Let C be a definite formula such that all the goals in its body are connected. Let C' be one of the results of positive or negative unfolding C at some goal. By logical deduction, definite formulae
CL
C~,... ,C:n
(m 2: 1) areobtained from C' such that all the goals in the body of Cf are connected. (Note that some goal G in the body of C' is of the form Fl ---t F2 or Fl V F2 and no universally quantified variables appear in both Fl and F2 , C' can be split into two formulae by replacing G in C' with ,Fl
(or Fl ) and F2 .)
Before showing our program synthesis procedure, a no- tion is defined.
Definition 3.1 Sound Unfolding
Suppose that positive or negative unfolding is applied to a definite formula at atom A. Then, the application of unfolding is said to be sound when no two distinct universally quantified variables in A are unified when reducing the result of unfolding with respect to
=.
Some syntactic restrictions on programs ensure the soundness of all possible applications of unfolding. In fact, the restriction shown in [3] ensures the soundness.
However, in the following, we assume that every applica- tion of unfolding is sound, without giving any syntactic restriction, for simplicity.
Now, we show our program synthesis procedure, which is similar to partial evaluation procedures(cf.[9, 10]).
First, a procedure to synthesize new predicates is shown.
Procedure 3.1 Synthesis of New Predicates
Suppose that definite formula program P and definite formula C in P of the form A +- Gll G2 , .•• , Gn are given. Let G~ be the reduced formula obtained from Gi
by removing all base atoms and by replacing all univer- sally quantified variables appearing in every base atom with distinct fresh global variables if global variables are substituted for them when reducing Gi w.r.t.
=.
Let Dibe of the form Hi +- G~ for i = 1,2, ... , n, where Hi is an atom whose predicate does not appear in P or Hj for i =I-j and whose arguments are all global variables of C appearing in Gi. Then, Dl,D2 , ••• ,Dn are returned.
Note that in Procedure 3.1, C can be folded by Dl,D2 , •.• ,Dn after reducing it w.r.t.
=
when C is the result of sound unfolding, and the result of the folding is a definite clause.Example 3.1 Let P be a program as follows.
Cl : all-less-than(L,M) +-list(L) 1\ list(M) 1\
V U,V (member(U,L) 1\ member(V,M) ---t U < V).
C2 : member(U,[VIXD +- U
=
V.C3 : member(U,[VIX]) +- member(U,X).
The definition of
'<'
is given in Example 2.1. Suppose that C's body consists of only one goal. By applyingpositive unfolding and negative unfolding to C succes- sively, the following formulae are obtained. (The reduc- tion w.r.t. = is done when no universally quantified vari- able appears as an argument of =.)
C4 : all-less-than(O,M) +- list(M).
Cs : all-less-than([XILJ,M) +- (list(L) 1\ list(M)) 1\
(list(L) 1\ list(M) 1\
V U,V (U = X 1\ member(V,M) ---t U < V)) 1\
(list(L) 1\ list(M) 1\
VU,V (member(U,L)l\member(V,M) ---t U < V)).
Then, by Procedure 3.1, the following new predicates are defined from Cs.
Dl : new1(X,L,M) +-list(L) 1\ Hst(M) 1\
V V (member(V ,M) --+ X
<
V).D2 : new2(L,M) +-list(L) 1\ Hst(M) 1\
V U,V (member(U,L) 1\ member(V,M) ---t U < V).
Next, the whole procedure for program synthesis is shown.
Procedure 3.2 A Program Synthesis Procedure Suppose that definite clause program P and definition formula C for P are given. Let 'D be the set {C}.
( a) If there exist no unmarked formulae in 'D, then re- turn P and stop.
(b) Select an unmarked definition formula D from 'D.
Mark D 'selected.' Let P' be the set {D}.
(c) If there exist no formulae in P' which do not satisfy conditions (a) and (b) in Definition 2.8; then P :=
PUP' and go to (a).
(d) Select a definite formula C' from P'. Apply positive or negative unfolding to C'. Let CJ, ... , Cn be the results. Remove C' from P'.
(e) Apply Procedure 3.1 to Cl , . . . , Cn. Let DJ,"" Dm be the outputs. Add Di to 'D if it is not a definite clause and there exists no formula in 'D which is identical to D i
except for the predicate of the head. Fold C1 , •• • , Cn by the formulae in 'D and add the results to P'.
(f) Go to (c).
Example 3.2 Consider the program in Example 3.1 again. We see that D2 is identical to C except for the predicate of the head. Cs can be folded by D1 and C after reduction w.r.t. =. The result is as follows.
C6 : all-less-than([XIL],M) +-list(L) 1\ list(M) 1\
new1(X,L,M) 1\ all-less-than(L,M).
Similar operations are applied to D1 , and finally, the following clauses are obtained.
D3 : new1(X,L,D) +-list(L).
D4 : new1(X,L,[YIM)) +-X
<
Y 1\ new1(X,L,M).Note that Procedure 3.2 does not necessarily derive a definite clause program from a definite formula pro- gram. For example, when the following program is given as input, Procedure 3.2 does not halt.
C1 : p(X,Y) +- p(X,Z) 1\ p(Z,Y) C2 : h(X,Y) +-V Z (p(X,Z) --+ p(Y,Z))
3.2 Classes of First Order Formulae In this section, we show some classes of definite formula programs which can be transformed into equivalent def- inite clause programs by Procedure 3.2.
Throughout this subsection, we assume that unfolding is always applicable to every definite formula at an atom when there exist definite clauses whose heads are unifi- able with the atom. Note that the above assumption does not always hold. This problem will be discussed in 3.3.
After giving a notion, we show a theorem which is an extension of the results shown in [15]. A simple expres- sion is either a term or an atom.
Definition 3.2 Depth of Symbol in Simple Expression Let X be a variable or a constant and E be a simple expression in which X appears. The depth of X in E, denoted by depth( X ,E), is defined as follows.
(a) depth(X,X) = l.
(b) depth(X,E) = max{depth(X,ti)IX appears in ti for i = 1, ... ,n}
+
1, if E is either f(tl, ... ,tn ) or p( t l , ... , tn ), for any function symbolf
or any predi- cate symbol p.The deepest variable or constant in E is denoted by maxdepth( E).
Theorem 3.1 Let P be a definite clause program. Su'p- pose that for any definition formula C for P, there exists a U-selection rule R for P U {C} rooted on C such that R is defined for all descendant clauses of C in which at least one defined atom appears. Suppose also that there exist two positive integers Hand W such that every descen- dant clause C' of C in every program P' obtained from P U {C} via R satisfies the following two conditions.
( a) The depth of every term appearing in every goal in the body of C' is less than H.
(b) Let Gl,GZ, ... ,Gn be connected goals inthe body of C'. Then, the number of atoms appearing in Gi is less than W, for i = 1,2, ... , n.
Then, there exists a finite definition formula set 1) for P such that P U {C} is closed with respect to 1).
Proof. From hypothesis (a), only a finite number of dis- tinct atoms (modulo renaming of variables) can appear in the goals of all the descendant formulae of C. Then, apply Procedure 3.2 to P and C. Note that every goal in the body of every descendant formula of C is connected.
Then, for every goal of every descendant formula of C, the number of atoms appearing in the goal is less than W, from hypothesis (b). Hence, only a finite number of distinct goals can appear in all the descendant formulae of C. Thus, we can obtain a finite definition formula set 1)0 for P such that there exists a closed program P' w.r.t. < P, C, 1)0 >.
The above discussion holds for all the definition for- mulae in 1)0, since those formulae are constructed from
467
bodies of the descendant formulae of C. Evidently, only a finite number of distinct definition formulae can be de- fined. Thus, there exists a finite definition formula set 1) for P such that P U {C} is closed w.r. t. 1). 0
Theorem 3.1 shows that Procedure 3.2 can derive a definite clause program when (a) a term of infinite depth can not appear, or (b) an infinite number of atoms can not appear in a connected goal during a transformation process. In the following, we show some syntactic restric- tions on programs which satisfy the above conditions.
Proietti and Pettorossi showed some classes of definite clause programs which satisfy the conditions in Theo- rem 3.1 in their studies of program transformation [15].
We show that some extensions of their results are appli- cable to our problem.
The following definitions are according to [15]. The set of variables occurring in simple expression E is denoted by var(E).
Definition 3.3 Linear Term Formula and Program A simple expression or a formula is said to be linear when no variable appears in it more than once. A definite formula (clause) is called a linear term formula (clause) when every atom appearing in it is linear. A definite formula ( clause) program is called a linear term program when it consists of linear term formulae (clauses) only.
A linear term formula (clause) is called a strongly lin- ear term formula (clause) when its body is linear. A def- inite formula (clause) program is called a strongly linear term program when it consists of strongly linear term formulae (clauses) only.
Note that the following definite clause is not a linear term clause.
member(X,[XIL]).
However, it is easy to obtain an equivalent linear term clause as follows :
member(X,[YIL])+-- X=Y.
Definition 3.4 A Relation ~ between Linear Simple Expressions
Let El and Ez be linear simple expressions. When
depth(X,El)~depth(X,Ez) holds for every variable X in var(El)nvar(Ez), we write El ~ E z. (Both El ~ Ez and Ez ~ El hold when var(El)nvar(Ez)=
0. )
Definition 3.5 Non-Ascending Formula and Program Let C be a linear term formula and H be the head of C. C is said to be non-ascending when A ~ H holds for every defined atom A appearing in the body of C. A linear term program is said to be non-ascending when it consists of non-ascending formulae only.
A definite formula ( clause) is said to be strongly non- ascending when it is a strongly linear term formula (clause) and non-ascending. A definite formula (clause) program is said to be strongly non-ascending when it
consists of strongly non-ascending formulae (clauses) only.
Definition 3.6 Synchronized Descent Rule
Let P be a linear term program, R be a V-selection rule for P and C be any descendant formula of the root formula for R. Let AI, A 2, ... ,An be all the atoms ap- pearing in the body of C. Then, R is called a synchro- nized descent rule when
(a) R selects the application of positive or negative un- folding to C at Ai if and only if Aj :::; Ai holds for j = 1, ... , n, and
(b) R is not defined for C, otherwise.
Note that synchronized descent rules are not neces- sarily defined uniquely for given programs and definition formulae.
The following theorem is an extension of the one shown in [15, 16].
Lemma 3.2 Let P be a non-ascending definite clause program, C be a linear term definition formula for P, and R be a synchronized descent rule rooted on C. Let p' be a program obtained from PU{ C} via
R.
For each defined atom A appearing in the body of every descendant clause of C in pI, the following holds :maxdepth(A) ~
max{maxdepth(B)j B is a defined atom in P U {C}}
Proof By induction on the number of applications of
unfolding. 0
Now we show some classes of definite formula programs which satisfy the hypotheses of Theorem 3.1. In the fol- lowing, for simplicity, we deal with definition formulae with only one universally quantified implicational goal in the body. The results are easily extended to the defi- nite formulae with a conjunction of universally quantified implicationaJ goals.
The following results are also extensions of those shown in [15].
Theorem 3.3 Let P be a strongly non-ascending def- inite clause program and C be a linear term definition formula for P of the form H f - Al /\ VX(A2 ~ A3 ), such that the following hold.
(a) For every clause D in P of the form HD f -BI /\ ... /\
Bn /\ B~ /\ ... /\ E~, where BI , . . . ,En are defined atoms and B~, ... ,B~ are base atoms, the following hold.
(a-I) Let tH be any argument of HD . For every argu- ment ti of Bi , if tH contains a common variable with ti, then ti is a subterm of tHo
(a-2) For every argument ti of Bi , if ti is a su bterm of an argument tH of HD , then no other argument of Bi is a subterm of tHo
(b) There exist two arguments ti and Si of some Ai (ti
i
Si, i = 1,2 or 3) such that the following hold.
(b-l) There exists an argument tj of Aj (i
1=
j) such thatvars( Ai )nvars( Aj )=vars( ti )nvars( t j), and
. either ti is a subterm of tj, tj is ;1 subterm of ti or vars( ti)nvars( tj
)=0.
(b-2) There exists an argument Sk of Ak (k
=I
i,j) such that the same relations as above hold for Si andSk'
(b-3) Aj contains no common variable with Ak .
Then, there exists a definition formula set 'D for P such that P U {C} is closed with respect to 'D.
Proof Note that there exists an atom A in the body of C s.t. an argument of A is a maximal term in the body of C w.r.t. subterm ordering relation. Let C' be any result of unfolding C at A and G be any connected goal in the body of C' of the form FI /\ VX(F2 ~ F3 ), where Fi is a conjunction of atoms. Then, from the hypothesis, it can be shown that a similar property to hypothesis (b) holds for G. Note that the number of implicational goals dose not increase by applying positive unfolding and no global variables are instantiated by applying negative unfolding.
Then, again there exists an atom in the body of C' s.t.
one of its arguments is a maximal term in the body of C' w.r.t. subterm ordering relation. By induction on the number of applications of unfolding, a synchronized descent rule can be defined for every descendant formula of C. Then, from Lemma 3.2, the depth of every term appearing in every descendant clause of C is bounded.
Note that the number of different subterms of a term is bounded. Then, from the hypothesis, the number of atoms appearing in every connected goal in the body of every descendant formula of C is bounded. Thus, P and C satisfy the hypotheses of Theorem 3.1. Hence, there exists a definition formula set 'D for P such that P U {C}
is closed with respect to 'D. 0
Note that Theorem 3.3 holds for any nondeterministic choice of synchronized descent rules in the above proof.
Note also that any program can be modified to satisfy hypothesis (a) of Theorem 3.3 by introducing atoms with
= in the body.
Corollary 3.4 Let P be a strongly non-ascending defi- nite clause program and pI be a definite clause program such that no predicate appears in both P and P'. Let C be a linear term definition formula for P U pI of the form H f - Al /\ \fX(A2 ~ A3 ), where the predicates of Al and A2 are defined in P and that of A3 is defined in P'. Suppose that the following hold.
(a) Hypothesis (a) of Theorem 3.3 holds for every clause Din P.
(b) There exist arguments tl of Al and t2 of A2 such that the following hold.
(b-l) vars(A1)nvars(A2)=vars( tl)nvars(t2)'
(b-2) Either tl is a subterm of t z, tz is a subterm of tl or vars(tdnvars(tz)=0.
(c) No variable in A3 is instantiated by applying posi- tive or negative unfolding to C successively.
Then, there exists a definition formula set 'D for P U p' such that P U p' U {C} is closed with respect to 'D.
Proof. Suppose that unfolding is never applied at A3 . A synchronized descent rule can be defined by neglecting A3. Since variables in A3 are never instantiated, no other atoms are derived from A3 . Thus, the corollary holds. 0
In Corollary 3.4, no restrictions are required on the definition of A3 • This result corresponds to that in [3].
Note that any program can be modified to satisfy hy- pothesis (c) of Corollary 3.4 by introducing atoms with
= in the body.
Example 3.3 The program and the definition formula in Example 2.1 satisfy the hypotheses of Theorem 3.3 and Corollary 3.4, if clause C5 is replaced with the equivalent clause:
C~: member(U,[V\L]) f - U=V.
In fact, a definite clause program can be obtained, as shown in subsection 2.2.
Next, we show an extension of the results shown in Theorem 3.3. Let P be a non-ascending definite clause program and C be a definition formula for P of the form H f - A/\ VX(FI -+ Fz), where Ais an atom, and Fl and Fz are conjunctions of atoms. Let Di be the definition clause for P of the form Hi f - Fi for i = 1,2. If Di can be transformed into a set of definite clauses which satisfies the hypotheses of Theorem 3.3, by replacing Fi with Hi, we can show that P U {C} can be transformed into an equivalent definite clause program.
The above problem is related to the foldability prob- lem in [16]. The foldability problem is described infor- mally as follows. Let P be a definite clause program and C be a definition clause for P. Then, find program pI obtained from P U {C} which satisfies the following: for every descendant clause C' of C in pI, there exists an an- cestor clause D of C' such that C"s body is an instance of D's.
Proietti and Pettorossi showed some classes of definite clause programs such that thefoldability problem can be solved [16]. We show that their results are also available to our problem.
A definite clause program P is said to be linear recur- sive when at most one defined atom appears in the body of each clause in P. Note that a linear recursive and linear term program (clause) is a strongly linear term program (clause).
Lemma 3.5 Let P be a linear recursive non-ascending program and C be a non-ascending definition clause for P of the form H f - Al /\ Az /\ Bl /\ ... /\ Bn , where Al
469
and Az are defined atoms and B1 , ••. , Bn are base atoms.
Suppose that the following hold.
(a) For every clause D in P of the form HD f - AD /\
B~ /\ ... /\ B~, where AD is the only defined atom in the body of D, the following hold.
(a-I) Let tH be any argument of HD . For every ar- gument tA of AD, if tH contains a common variable with t A , then tA is a subterm of tHo
(a-2) For every argument tA of AD, if tA is a subterm of an argument tH of HD , then no other argument of AD is a subterm of tHo
(b) There exist arguments tl of Al and tz of Az such that the following hold.
(b-l) vars(A1)nvars(A2)=vars( t1)nvars( t2)'
(b-2) Either tl is a subterm of tz, t2 is a subterm of tl or vars(t1)nvars(t2)=0.
Then, from P U {C}, we can obtain a linear recursive non-ascending program which define the predicate of H by unfold/fold transformation.
Proof. As shown in [16], we can get a solution of the foldability problem for P and C. Then, obviously, a linear recursive program is obtained. 0
Example 3.4 Let P be a linear recurSIve non- ascending program as follows.
C1 : subseq([],L).
C2 : subseq([X\L],[Y\M]) f -X = Y /\ subseq(L,M).
C3 : subseq([X\L],[Y\M]) f -subseq([X\L],M).
Let C be a non-ascending definition clause for P as fol- lows.
C: csub(X,Y,Z) f - subseq(X,Y), subseq(X,Z).
Then, P U {C} can be transformed into a linear recursive non-ascending program as follows.
csub([],Y,Z).
csub([A\X],[B\Y],Z) f - A = B /\ cs(A,X,Y.Z).
csub([AIX],[BIYJ,Z) f - csub([AIX]'Y,Z).
cs(A,X,Y,[BIZ]) f - A = B /\ csub(X,Y,Z).
cs(A,X,Y,[BIZ]) f - cs(A,X,Y,Z).
Though Proietti and Pettrossi showed one more class [16], we will not discuss this here.
Now, we get the following theorem.
Theorem 3.6 Let P be a linear recursive non-ascending program and C be a linear term definition formula for P of the form H f - Al 1\ VX(A2 1\ B2 ---+ A3 /\ B 3), such that the following hold.
(a) Hypothesis (a) of Lemma 3.5 holds for P.
(b) Let 51 be the set of all the arguments of AI, and 5i be the set of all the arguments of Ai and Bi for i = 2,3. Then, there exist two terms tj and Sj in some 5j (tj
i=
Sj,j = 1,2 or 3) such that the following hold.(b-l) there exists a term t k in 5 k (j