----------------------------------------------------------------------- | | | Amzi! News, Summer 1995 | | | ----------------------------------------------------------------------- Amzi! has moved to a new Internet site: web http://www.amzi.com ftp ftp.amzi.com/pub/users/amzi Contents Cogent Prolog has a New Name--Amzi! Prolog+Logic Server... ...and a New Release--Version 3.3... ...and New Packaging Write Your Own Rule Language Publish Your Rule Language M-U Data Delivers Consistent Cheese Quality The Learning Edge Builds a Sales Advisor Ordering/Upgrade Information and Form Cogent Prolog has a New Name--Amzi! Prolog+Logic Server... ---------------------------------------------------------- We have renamed Cogent Prolog to Amzi! Prolog+Logic Server. Although we had been pondering this for some time, the change was hastened by Cogent Data Technologies who has had the name for 11 years as opposed to our 9 (and they didn't want to share). ...and a New Release--Version 3.3... ------------------------------------ The 3.3 release is a collection of enhancements and fixes over the past 6 months, plus product name and packaging changes. The new product name affects command, file and API procedure names. We've also added a lot of features that we hope will make your work easier. Delphi and Windows '95 The 3.3 release adds support for Borland's Delphi. The Logic Server is implemented as a component with methods for API functions. The component uses Delphi exception handling and includes a help file. And, the Amzi! language can be extended with routines (predicates) written in Delphi. The 3.3 release also runs under Windows '95 (both the 16 and 32 bit IDEs and libraries). Logic Server Enhancements A Logic Server API trace facility has been added—when enabled, it allows you to examine the parameters passed into and values returned from each of the Logic Server calls. This makes is much easier to identify problems with pointers, memory models, etc. Various new INI parameters give you control over string sizes, number of clauses and other system limits. Also many (all?) GPFs arising from exceeding various limits have been eliminated. IDE Improvements Several enhancements have been made to the IDE. Control- Break now interrupts Prolog code execution. Modified files are flagged with an * and saved before a consult or compile. The last file/project consulted is saved across sessions so it can be readily reconsulted. Windows positions are also saved across sessions. You can select the font used in the edit, debugger and listener windows. Language Enhancements New predicates added include: atom_uplow/2, atom_codes/2, atom_length/2, atom_concat/3, atomlist_concat/2, sub_atom/4, sub_string/4, nonblank_string /1, flush_in/0, flush_out/0 and once/1. For sophisticated error handling catch/3 and throw/1 have been added. Error handling has also been improved by flagging attempts to redefine system symbols (;,!) and predicates (fail, read, etc.). More Samples Finally, seven new sample programs have been added: four from the Active Prolog Tutor, the MONEY puzzle, the traffic shell (see rule-language article) and an income tax program. These are all the changes since February. Check your READ.ME file to determine which of these features you already have. ...and New Packaging -------------------- Part of the 3.3 release is new packaging. There are three editions of Amzi! Prolog + Logic Server: Professional, 16-bit Professional and Personal. The Professional Editions include royalty-free distribution, whereas the Personal Edition is limited to non-commer-cial use only. The features of each are noted below. A Student Edition of Amzi! Prolog is for single machine development of Prolog-only programs (and does not include the Logic Server). It is ideal for individual, class and lab use, and contains the IDE, listener (interpreter), compiler and debugger. Professional 16-bit Prof Personal Development Tools x x x 16 & 32-bit DOS Libraries x x x 16-bit Windows DLL x x x 16-bit Windows Libraries x x 32-bit Windows DLL x x 32-bit Windows Libraries x Commercial Distribution x x Write Your Own Rule Language ---------------------------- Prolog is a powerful tool for implementing other language ideas. This fact is exploited by many Prolog programmers who implement applications in two distinct pieces. One is a customized language for expressing a solution to the application, and the other the solution itself. For example, Ray Reeves wrote a language for expressing the solutions to word arithmetic puzzles, Jonas Beckman wrote a language for expressing quality- maintenance rules, Harry Dowhal wrote one for expressing marketing information, our Active Prolog Tutor has a language for building Prolog tutorials, and Prolog's DCG is a language for language parsing. (The source code for the DCG translator is in the Prolog samples.) Consider this simple expert system that provides some driving advice, written directly in Prolog. action(stop) :- traffic_light(red). action(proceed) :- traffic_light(green). action(accelerate) :- traffic_light(yellow), driving(crazy). action(stop) :- traffic_light(yellow), driving(sane). driving(crazy) :- city('Boston'). driving(sane) :- not city('Boston'). traffic_light(X) :- ask(traffic_light, X). city(X) :- ask(city, X). Well, even this case is not quite pure Prolog. The rules use a predicate ask/2 which can be considered an addition to Prolog to make the rules easier to express. It's a very useful predicate in rule-based programs as it remembers the answers to questions, so the user isn't pestered more than once. ask(Attr, Val) :- % already known? known(Attr, X), % if so don't ask !, % the right one? X = Val. ask(Attr, Val) :- write('What is the value of'), write(Attr), write('?'), read(X), assert( known( Attr, X ) ), % the right one? X = Val. The program works like this: ?- action(X). What is the value of traffic_light? yellow. What is the value of city? 'Boston'. X = accelerate But let's say you wanted your users to enter the rules, and didn't want to use pure Prolog syntax. Maybe you want the rules to look like this: if traffic_light is green then action is proceed. if traffic_light is red then action is stop. if traffic_light is yellow and driving is crazy then action is accelerate. if traffic_light is yellow and driving is sane then action is stop. if city is 'Boston' then driving is crazy. if city is not 'Boston' then driving is sane. No problem, just write your own inference engine, and, for this example, use Prolog operators to create the easy-to-read syntax. (You can also use DCG for more sophisticated language ideas.) Operator definitions allow the rules to be written without the strict functor(arg1, arg2) syntax normally used. For example, the first traffic_light rule would have to be written as if(then( is(traffic_light, green), is(action, proceed))). without the operator definitions. Both forms are equivalent as far as Prolog is concerned. % prefix operator :- op(790, fx, if). % infix operator :- op(780, xfx, then). % infix that can be linked :- op(770, xfy, and). % redefining existing ops :- op(700, xfx, is). :- op(690, fx, not). The operators enable the rule syntax. Now, just two predicates implement the inference engine. Given the goal of 'proving' an attribute-value pair, the system looks for rules with a 'then' side that provides a value for the attribute. If it finds one, then it attempts to prove the subgoals on the 'if' side of the rule. If there are no rules for finding the value of an attribute, then the user is asked for a value. (It uses the same ask/2.) prove( Attr is Value and Rest ) :- getav(Attr, Value), prove(Rest). prove( Attr is not Value) :- atomic(Value), not(ask(Attr, Value)). prove( Attr is Value ) :- getav(Attr, Value). getav( Attr, Value ) :- if Conditions then Attr is X, Value = X, prove( Conditions ). getav( Attr, Value) :- not(if _ then Attr is _), ask( Attr, Value ). Here's how this one works: ?- prove(action is X). What is the value of traffic_light? red. X = stop Once you write your own rule language and engine, there's no limit to what you can do with it. More details on this code, and a forward-chaining version as well, are in the Prolog Samples directory on our Internet site (the files are TRAFFICx.PRO) More on this subject will be published in an article in an upcoming issue of Dr. Dobb's Journal. A detailed study of building rule-based languages (shells) in Prolog is provided by Expert Systems in Prolog, a book with accompanying diskette that contains full source code for a variety of prototype shells. Contact us for more information. Publish Your Rule Language -------------------------- Amzi! is interested in publishing your custom rule-languages (shells). Your shells can be for general purposes like game playing, business modeling or project scheduling. Or, they can be industry-specific like insurance underwriting, paper/pulp processing or software help desks. We are interested in relationships from simply distributing your products to having Amzi! becoming the publisher of your rule-language. As a publisher, Amzi! is responsible for the promotion, manufacturing, support and distribution. If you think you have a marketable product, please contact us. MU-Data Delivers Consistent Cheese Quality ------------------------------------------ MU-Data built an application that will be used by Sweden's largest cheese manufacturer to ensure consistent quality cheese production in each of its plants. The milk that starts the cheese process can vary considerably, but the cheese that's produced should be the same. A few individuals in the company know how to adjust the cheese production to ensure consistent quality. MU-Data implemented a system that uses Access, Visual Basic and Amzi! Prolog to monitor the cheese production and apply the rules for adjusting the process to ensure quality cheese. Data about the cheese is stored in an Access database. That data is presented to the user through a number of Visual Basic dials and gauges. If any of the dials or gauges winds up in a red zone, then the rule- base, written in Amzi! Prolog is activated. It makes recommendations on how to adjust the cheese process to bring the cheese back on track. The Learning Edge Builds a Sales Advisor ---------------------------------------- The Learning Edge implemented an application for a large computer manufacturer that makes product recommendations based on a potential customer's situation. The application is distributed by the manufacturer as part of its marketing materials. It uses a Windows front-end to gather information about the potential customer's site, such as the hardware in place, the operating systems used, and the development methodologies employed. It then applies a rule-base of around 175 rules to that information, making recommendations of the products that would be most suitable for that customer. The GUI front-end is developed with Toolbook, a package that makes it easy to implement multi-media GUIs under Windows. The rule-base is a customized one, that is run from an engine written in Amzi! Prolog. The Amzi! Prolog Logic Server DLL is accessed directly from Toolbook. Ordering/Upgrade Information ---------------------------- Save $100 on the Profes-sional Edition 'til Sept 30 Readers of this newsletter can save $100 off the price of the Professional Edition if you order by September 30, 1995 (the regular price is $598). You must send or fax this original order form to receive this special savings, or mention code N4P when ordering by phone. Last Chance for 1.x and 2.0 Users 1.x Cogent and 2.0 Compiler & Interpreter users can take advantage of a special $100 credit until Sept. 30, 1995. Current Subscribers Current Subscription Plus customers will automatically receive the Professional Edition if you have the old NT Edition, or the 16-bit Professional Edition if you have the old Windows+ DOS Edition. Subscription updates will be mailed in mid-August. Upgrading Subscriptions If you are a 16-bit Professional Subscriber (i.e. purchased the old Windows+DOS Edition), you can upgrade to the Professional Edition using this order form. The remainder of your subscription will be applied to the new edition. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ORDER/UPGRADE FORM Name: Company: Full Mailing Address: Phone/Fax: Payment Method: __Check __MasterCard __Visa Card #:______________________________________ Exp:_________ Signature:___________________________________________________ My serial numbers are (fill in if you have not registered): Product Name Serial # ___________________________________ ____________________ ___________________________________ ____________________ If you did not purchase from us, and purchased on June 1, 1995 or later, please enclose a copy of your dated sales receipt. To order call us: 508 / 897 - 7332 Or, mail form to: Amzi! 40 Samuel Prescott Drive Stow, MA 01775 U.S.A. Or, fax to: 508 / 897 -2784 Or, e-mail to: www.amzi.com (Internet) [1] ORDER AMZI! PROLOG-Which of the following editions would you like to purchase or upgrade to? __Professional __16-bit Prof __Personal __Student $498 $298 $298 $79 ^^^^Special Offer Check your choice and enter the price here ______ [2] CREDIT FOR PRIOR PURCHASE-Select the amount of the credit below that applies to your previous purchase: Purchases after June 1, 1995 Prolog for NT 3.0 $488 Prolog for Win+DOS 3.0 $288 Purchases before June 1, 1995 Prolog for NT 3.0 $448 Prolog for Win+DOS 3.0 $248 Purchases Anytime (3.0 Products) Compiler & Interpreter 3.0 $149 Interpreter-Only 3.0 $49 Compiler & Interpreter 2.0 or Cogent 1.x Users upgrading to Personal or Professional $100 Enter the applicable credit (if any) here ______ [3] Subtract [2] from [1] and enter here (not less than 0) ______ [4] ORDER ADDITIONAL PRODUCTS-Select here: __Subscription Plus $150 ______ __Expert Systems in Prolog, book & diskette $94 ______ __Active Prolog Tutor, Personal Edition $75 ______ __Adventure in Prolog, book $43 ______ __Programming in Prolog, 4th Ed., book $34 ______ [5] SUBTOTAL-Add [3] and [4] and enter result here ______ [6] SALES TAX-Massachusetts residents add 5% sales tax ______ [7] SHIPPING-$10 North America; $20 All other countries ______ [8] TOTAL-Add [5], [6] and [7] (payable in US $ please) ______