Path: ...!eternal-september.org!feeder3.eternal-september.org!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: melahi_ahmed@yahoo.fr (ahmed) Newsgroups: comp.lang.forth Subject: Re: Expert systems in forth Date: Sun, 5 Jan 2025 11:39:19 +0000 Organization: novaBBS Message-ID: References: <069d1724f6056b4c36d9e1ffaa3d606d@www.novabbs.com> <2025Jan5.094909@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="2120502"; mail-complaints-to="usenet@i2pn2.org"; posting-account="t+/9LUKLIiUqIe6reyFE7me/EcA/Gr17dRXgwnADesE"; User-Agent: Rocksolid Light X-Spam-Checker-Version: SpamAssassin 4.0.0 X-Rslight-Site: $2y$10$.2F2VN5H6GtRrbxEIMBACuA4qCDYTQZUqz2V1vVDB7AMPPo0eQrRC X-Rslight-Posting-User: 5f6b2e70af503e44dad56966aa15d35bdef29623 Bytes: 3805 Lines: 100 Hi, thanks for testing. As already said in my previous post the work is under development. The system works well taking in consideration: - known that the scanning of the rules is linear, it doesn't repeat the same question but can ask for additional inforamtion, for example, when responding to eat-vegetals by no (or empty) it can ask if it is herbivore, the `no' reponse doesn't change the truth of a goal fact but the goal fact becomes true if all condtion facts are true. - when doing backward chaining, there are some results but they are not displayed, for your example: it says Finally: and nothing displayed after, but there are some results like: carnivore, ungulate and you can see these by executing .facts which displays only the true facts. After "Finally" the system executes the actions associated to the facts that are true and in this case the actions associated to carnivore and ungulate but these actions aren't set before (nothing in the action field of the fcats carnivore and ungulate). I'll see how to change the flow of the inference using the action field of facts and executing them during the inference, like this we can choose the next rule to use. I think this can be possible by modifying the words `,' and `.;' It is up to the knowledge engineer to define how rules are scanned (linear, predetermined or with respect to the responses given by the user when asked to verify a fact) and this is not in expert_systems.fs file itself but in its data base file (where facts, rules and actions are defined) (here animal.fs). Adding the rules for platypus : s" platypus :- swim , not-fly , eat-meat , hoofs , hair .;" >rules and defining the action associated to platypus: : _paltypus_ s" It is a platypus." ; s" _platypus_ cr type" platypus action>fact gives: <-? verify: feathers <--- verify: wings <--- verify: lay-eggs <--- verify: hair <--- yes apparently, apparently, verify: eat-vegetals <--- verify: eat-meat <--- yes apparently, apparently, verify: hoofs <--- yes apparently, apparently, verify: swim <--- yes verify: black&white <--- verify: bird <--- verify: long-neck <--- verify: not-fly <--- yes verify: black-stripes <--- verify: tawny-color <--- verify: herbivore <--- verify: long-legs <--- verify: dark-spots <--- verify: fly-well <--- verify: fly <--- apparently, It is a platypus. apparently, It is a platypus. final result: ------------- finally, It is a platypus. ok Thanks again. Ahmed --