NU-Prolog Reference Manual

NU-Prolog Reference Manual

NU-Prolog Reference Manual Version 1.5.24 edited by James A. Thom & Justin Zobel Technical Report 86/10 Machine Intelligence Project Department of Computer Science University of Melbourne (Revised November 1990) Copyright 1986, 1987, 1988, Machine Intelligence Project, The University of Melbourne. All rights reserved. The Technical Report edition of this publication is given away free subject to the condition that it shall not, by the way of trade or otherwise, be lent, resold, hired out, or otherwise circulated, without the prior consent of the Machine Intelligence Project at the University of Melbourne, in any form or cover other than that in which it is published and without a similar condition including this condition being imposed on the subsequent user. The Machine Intelligence Project makes no representations or warranties with respect to the contents of this document and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Furthermore, the Machine Intelligence Project reserves the right to revise this document and to make changes from time to time in its content without being obligated to notify any person or body of such revisions or changes. The usual codicil that no part of this publication may be reproduced, stored in a retrieval system, used for wrapping fish, or transmitted, in any form or by any means, electronic, mechanical, photocopying, paper dart, recording, or otherwise, without someone's express permission, is not imposed. Enquiries relating to the acquisition of NU-Prolog should be made to NU-Prolog Distribution Manager Machine Intelligence Project Department of Computer Science The University of Melbourne Parkville, Victoria 3052 Australia Telephone: (03) 344 5229. Electronic mail: [email protected] Warning: Some of Doc in TechJarg PREFACE TO VERSION 1.1 The development of the NU-Prolog² system has been a collective effort of members of the Machine Intelligence Project at The University of Melbourne. The Machine Intelligence Project was initiated, in 1984, by the Honourable Barry Jones, Minister of Science, and Dr. Jean-Louis Lassez. We would like to thank the Australian Government's Department of Science and The University of Melbourne for funding the project, and Pyramid Australia for the loan of a Pyramid 90X computer during 1985. The NU-Prolog language, which is a advance towards declarative programming in logic, was principally designed by Lee Naish. The NU-Prolog system itself was designed by Lee Naish and Jeffrey Schultz. NU-Prolog was implemented under UNIX³ by Jeffrey Schultz, with assistance from David Morley (parser, definite clause grammars), Lee Naish (negation, extended syntax), John Shepherd (assembler, loader, superimposed coding, revision system), Kotagiri Ramamohanarao (superimposed coding), James Thom (database interface), Justin Zobel (nit, extended syntax), Philip Dart (top level of interpreter). and Zoltan Somogyi (revision system design), This manual was edited and written by James Thom and Justin Zobel, with assistance from Philip Dart, Lee Naish, Jeffrey Schultz and John Shepherd. We acknowledge the comments provided by other staff members and graduate students, including Rodney Topor and Richard Helm. Finally, we would like to thank John Lloyd and Kotagiri Ramamohanarao for supervising the Machine Intelligence Project. James Thom Justin Zobel January 1987 _____________________________ ² NU-Prolog (pronounced ``new prolog'') is the successor of MU-Prolog 3.2, and is not an acro- nym for Naish's Ultra Prolog. ³ UNIX is a trademark of Bell Laboratories. iii Table of Contents Chapter 1 INTRODUCTION ............................................................................................. 1 Chapter 2 USING NU-PROLOG ....................................................................................... 3 2.1 Getting Started .............................................................................................. 4 2.2 nc − NU-Prolog Compiler ........................................................................... 6 2.3 np − NU-Prolog Interpreter ......................................................................... 8 2.4 nit − NU-Prolog Program Checker .............................................................. 11 2.5 nac − NU-Prolog control preprocessor ........................................................ 14 2.6 revise − Incremental Program Revision Facility ......................................... 17 Chapter 3 SYNTAX OF NU-PROLOG ............................................................................. 19 3.1 Variables ....................................................................................................... 19 3.2 Constants ...................................................................................................... 20 3.2.1 Atoms ................................................................................................ 20 3.2.2 Integers .............................................................................................. 20 3.2.3 Floats ................................................................................................. 20 3.3 Terms ............................................................................................................ 22 3.4 Clauses .......................................................................................................... 22 3.5 Predicates ...................................................................................................... 22 3.6 Lists .............................................................................................................. 23 3.7 Strings ........................................................................................................... 23 3.8 Operators ...................................................................................................... 24 3.9 Comments ..................................................................................................... 25 Chapter 4 SEMANTICS OF NU-PROLOG ...................................................................... 27 4.1 Semantics ...................................................................................................... 27 4.1.1 Declarative Semantics ........................................................................ 28 4.1.2 Operational Semantics ....................................................................... 28 4.2 Declarative Constructs .................................................................................. 29 4.2.1 Standard Constructs ........................................................................... 29 4.2.2 Quantifiers ......................................................................................... 30 4.2.3 Negation, Implication, and Related Constructs ................................. 30 4.2.4 Aggregate Functions .......................................................................... 32 4.2.5 When Declarations ............................................................................. 34 4.3 Non-declarative Constructs .......................................................................... 36 4.3.1 Non-logical Quantifiers ..................................................................... 36 4.3.2 Cut ..................................................................................................... 36 4.3.3 Non-logical Constructs ...................................................................... 36 Chapter 5 SYSTEM PREDICATES .................................................................................. 39 5.1 Predicates which Succeed or Fail ................................................................. 39 5.2 Predicates for Conditional Compilation or Loading .................................... 40 5.3 Interpreter Predicates .................................................................................... 41 5.3.1 Examining the Program State ............................................................ 41 5.3.2 Examining and Controlling the Execution State ............................... 41 iv 5.3.3 Debugging Predicates ........................................................................ 43 5.4 Terms and Lists ............................................................................................ 47 5.4.1 Manipulating Lists ............................................................................. 47 5.4.2 Examining Characters ........................................................................ 49 5.4.3 Examining Terms .............................................................................. 49 5.4.4 Modifying Terms ............................................................................... 53 5.4.5 Comparison of Terms ........................................................................ 53 5.5 Arithmetic Operators and Predicates ............................................................ 55 5.5.1 Arithmetic Operators ......................................................................... 55 5.5.2 Arithmetic Predicates ......................................................................... 59 5.6 I/O Predicates ............................................................................................... 62 5.6.1 Stream Management Predicates ......................................................... 62 5.6.2 Input Predicates ................................................................................. 65 5.6.3 Output Predicates ..............................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    176 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us