├── COPYING ├── Docs ├── fig8a.pdf ├── gatn.pdf ├── manual.pdf ├── manual.tex ├── netfig.pdf └── snerefig1.pdf ├── JavaSnepsAPI ├── JavaSnepsAPI.jar ├── edu │ └── buffalo │ │ └── sneps │ │ ├── JavaSnepsAPI.java │ │ └── Substitution.java ├── java-sneps-api.lisp └── java_sneps_config.config ├── Jlinker ├── jl-config.cl └── jlinker.jar ├── SnepsGUI ├── AbsoluteLayout.jar ├── SnepsGUIMods │ ├── EPSComponentDump │ │ └── dump.jar │ ├── Jimi │ │ └── jimi-1.0.jar │ └── JungFiles │ │ ├── Colt │ │ └── lib │ │ │ ├── colt.jar │ │ │ └── concurrent.jar │ │ ├── Commons │ │ ├── commons-collections-3.2.jar │ │ └── commons-collections-testframework-3.2.jar │ │ ├── JUNG │ │ └── jung-1.7.6 │ │ │ └── jung-1.7.6.jar │ │ └── Xerxes │ │ ├── resolver.jar │ │ ├── xercesImpl.jar │ │ ├── xercesSamples.jar │ │ └── xml-apis.jar ├── SnepsGUIShow.jar └── swing-layout-1.0.jar ├── Tools ├── change-copyright.pl ├── change-license.pl ├── license.txt ├── make-tags └── rlog-tools.el ├── demo ├── activation │ ├── layout.lisp │ ├── load-activation.lisp │ ├── multi-changes.lisp │ ├── result-layout.lisp │ ├── rule-layout.lisp │ ├── simple-rule.sneps │ └── xnode.lisp ├── dbms │ └── dbmsdemo.sneps ├── defaults │ ├── birds.sneps │ ├── yale-shooting.sneps │ └── yale-shooting.snlog ├── demo-info.lisp ├── nlint │ ├── elephants-lexicon.lisp │ ├── elephants.atn │ ├── qa-demo.sneps │ ├── qa-grammar.atn │ ├── qa-lexicon.lisp │ ├── simple-grammar.atn │ ├── simple-lexicon.lisp │ ├── tree-demo.sneps │ └── tree-grammar.atn ├── snebr │ └── autobr.snlog ├── sneps │ ├── bidir.sneps │ ├── brachet-dist │ │ ├── brachet-base.lisp │ │ ├── brachet-setup.lisp │ │ ├── brachet.demo │ │ ├── brachet.sneps │ │ ├── defun-noun.lisp │ │ ├── paths.lisp │ │ └── rels.lisp │ ├── clue.sneps │ ├── freeman.sneps │ ├── jobspuzzle.sneps │ ├── like.sneps │ ├── numquant │ │ ├── jobspuzzle.sneps │ │ ├── meeting.sneps │ │ ├── mother.sneps │ │ └── owner.sneps │ ├── sneps79.lisp │ └── uvbr.sneps ├── snepslog │ ├── agents.snlog │ ├── blackbeard1.snlog │ ├── blackbeard2.snlog │ ├── blackbeard3.snlog │ ├── chap4.snlog │ ├── duck.snlog │ ├── example1.snlog │ ├── example2.snlog │ ├── example3.snlog │ ├── example4.snlog │ ├── example5.snlog │ ├── freeman.snlog │ ├── jobspuzzle.snlog │ ├── meetings.snlog │ ├── pegasus.sneps │ ├── pegasus.snlog │ ├── ruleintro.snlog │ ├── socrates.snlog │ ├── sourcedMeetings.snlog │ ├── steamroller.snlog │ ├── theorems.out │ ├── theorems.snlog │ └── uvbr.snlog └── snere │ ├── arcinfo │ ├── arcdemo.sneps │ ├── arcinfo.lisp │ ├── arclex.dat │ ├── arcloop │ ├── command-loop.aml │ ├── driver.lisp │ └── load-arc-snactor.lisp │ ├── blocksworld │ ├── arm-john.bm │ ├── arm.bm │ ├── blocks.lisp │ ├── blocksdemo.sneps │ ├── blocksworld.net │ ├── dk.bm │ ├── eye-c.bm │ ├── eye-l.bm │ ├── eye-lo.bm │ ├── eye-r.bm │ ├── eye-up.bm │ ├── graphics.lisp │ ├── lexicon.dat │ ├── load-blocksworld.lisp │ └── sneredemo.sneps │ ├── grammar.dat │ ├── imports.lisp │ ├── load-core.lisp │ └── nlib.lisp ├── load-logical-pathnames.lisp ├── load-sneps.lisp ├── logical-pathnames.lisp ├── match ├── ds │ ├── matching.lisp │ ├── matchingset.lisp │ ├── mbind.lisp │ ├── setnorm.lisp │ ├── substitution.lisp │ ├── supmatching.lisp │ └── supmatchingset.lisp ├── exports.lisp ├── fns │ ├── compute-support.lisp │ └── match.lisp └── imports.lisp ├── multi ├── ds │ ├── dequeue.lisp │ └── valve.lisp ├── exports.lisp ├── fns │ └── multi.lisp └── imports.lisp ├── nlint ├── define.lisp ├── englex │ ├── endofwords.text │ ├── englex.lisp │ ├── exports.lisp │ ├── homographs.text │ ├── imports.lisp │ ├── lenglex.lisp │ ├── negatives.text │ ├── paper.text │ ├── readme.text │ ├── related-forms.text │ ├── startofwords.text │ ├── testslex.lisp │ ├── verbthread.lisp │ └── wordize.lisp ├── gramm82-2.lisp ├── lexicon-2.lisp └── parser │ ├── exports.lisp │ ├── imports.lisp │ └── parser.lisp ├── packages.lisp ├── snebr ├── contrad.lisp ├── exports.lisp ├── imports.lisp ├── snepshandler.lisp └── sniphandler.lisp ├── sneps ├── ds │ ├── bind.lisp │ ├── bindset.lisp │ ├── cable.lisp │ ├── cableset.lisp │ ├── command.lisp │ ├── context0.lisp │ ├── context1.lisp │ ├── context2.lisp │ ├── context3.lisp │ ├── contextset.lisp │ ├── ctcableset.lisp │ ├── fcableset.lisp │ ├── file.lisp │ ├── nbindset.lisp │ ├── node0.lisp │ ├── node1.lisp │ ├── node2.lisp │ ├── nodebind.lisp │ ├── nodeset.lisp │ ├── nodeset2.lisp │ ├── otag.lisp │ ├── path.lisp │ ├── rel1.lisp │ ├── rel2.lisp │ ├── relset.lisp │ ├── snd.lisp │ ├── svar.lisp │ ├── svarset.lisp │ ├── transform.lisp │ ├── util.lisp │ └── var.lisp ├── exports.lisp ├── fns │ ├── buildfns.lisp │ ├── command.lisp │ ├── dbms.lisp │ ├── dd.lisp │ ├── demo-tool.lisp │ ├── demo.lisp │ ├── erase.lisp │ ├── find.lisp │ ├── findexact.lisp │ ├── findfilter.lisp │ ├── findhelp.lisp │ ├── hyp.lisp │ ├── infixfns.lisp │ ├── innet.lisp │ ├── intext.lisp │ ├── io-utils.lisp │ ├── load.lisp │ ├── oinnet.lisp │ ├── outnet.lisp │ ├── path.lisp │ ├── read.lisp │ ├── relfns.lisp │ ├── restr.lisp │ ├── snepstop.lisp │ ├── svfns.lisp │ ├── tconc.lisp │ ├── updatect.lisp │ └── with-snepsul.lisp └── imports.lisp ├── sneps_config.lisp ├── snepslog ├── exports.lisp ├── generator │ ├── generator.atn │ └── generator.lisp ├── imports.lisp ├── mode3.lisp ├── orders.lisp ├── parser │ ├── parser.lisp │ └── snepslog-parser.lisp ├── printer.lisp ├── reader.lisp ├── snepslog.demo ├── snepslog.lisp ├── tellask.lisp └── toplevel.lisp ├── snip ├── ds │ ├── act-utils.lisp │ ├── channel.lisp │ ├── chset.lisp │ ├── cqch.lisp │ ├── cqchset.lisp │ ├── destination.lisp │ ├── feeder.lisp │ ├── feederset.lisp │ ├── filter.lisp │ ├── fnode.lisp │ ├── fnodeset.lisp │ ├── freport.lisp │ ├── frepset.lisp │ ├── ich.lisp │ ├── ichset.lisp │ ├── instance.lisp │ ├── iset.lisp │ ├── ptree.lisp │ ├── report.lisp │ ├── repset.lisp │ ├── request.lisp │ ├── restriction.lisp │ ├── rui.lisp │ ├── ruiset.lisp │ ├── sign.lisp │ ├── support.lisp │ └── switch.lisp ├── exports.lisp ├── fns │ ├── achieve.lisp │ ├── act.lisp │ ├── add.lisp │ ├── and-ent.lisp │ ├── and-or.lisp │ ├── and.lisp │ ├── deduce.lisp │ ├── deducetrue.lisp │ ├── do-all.lisp │ ├── do-if.lisp │ ├── do-one.lisp │ ├── dynamic-add.lisp │ ├── filterhelp.lisp │ ├── icontext.lisp │ ├── make.lisp │ ├── mental-acts.lisp │ ├── message.lisp │ ├── non-rule.lisp │ ├── nor.lisp │ ├── nrn-finfers.lisp │ ├── nrn-reports.lisp │ ├── nrn-requests.lisp │ ├── num-ent.lisp │ ├── num-quant-rule.lisp │ ├── num-quant.lisp │ ├── or-ent.lisp │ ├── perform.lisp │ ├── plantrace.lisp │ ├── remark.lisp │ ├── resource-lim.lisp │ ├── rule-bintr.lisp │ ├── rule-eintr.lisp │ ├── rule-finfers.lisp │ ├── rule-reports.lisp │ ├── rule-requests.lisp │ ├── rule.lisp │ ├── sched.lisp │ ├── snif.lisp │ ├── sniterate.lisp │ ├── snsequence.lisp │ ├── support.lisp │ ├── thresh.lisp │ ├── transformers.lisp │ ├── user.lisp │ ├── when-do.lisp │ ├── whenever-do.lisp │ └── with-acts.lisp └── imports.lisp ├── system-utils.lisp └── system.lisp /Docs/fig8a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Docs/fig8a.pdf -------------------------------------------------------------------------------- /Docs/gatn.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Docs/gatn.pdf -------------------------------------------------------------------------------- /Docs/manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Docs/manual.pdf -------------------------------------------------------------------------------- /Docs/netfig.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Docs/netfig.pdf -------------------------------------------------------------------------------- /Docs/snerefig1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Docs/snerefig1.pdf -------------------------------------------------------------------------------- /JavaSnepsAPI/JavaSnepsAPI.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/JavaSnepsAPI/JavaSnepsAPI.jar -------------------------------------------------------------------------------- /JavaSnepsAPI/edu/buffalo/sneps/Substitution.java: -------------------------------------------------------------------------------- 1 | package edu.buffalo.sneps; 2 | import java.util.HashMap; 3 | 4 | /** 5 | * Represents a substitution (a set of pairs, each of which is a variable and a term). 6 | * Used by the {@link edu.buffalo.sneps.JavaSnepsAPI#askwh(String) askwh} and {@link edu.buffalo.sneps.JavaSnepsAPI#askwhnot(String) askwhnot} methods to represent substitutions. A HashSet of these are returned by these methods as there can be multiple substitutions that satisfy a particular query. 7 | **/ 8 | public class Substitution extends HashMap{ 9 | 10 | // Change to a HashMap 11 | 12 | /** 13 | * Creates an instance of the substitution with the specified capacity (number of substitution pairs). 14 | * @param capacity The capacity for this substitution 15 | **/ 16 | public Substitution (int capacity) { 17 | super(capacity); 18 | } 19 | 20 | 21 | /** 22 | * Adds a substitution pair to this substitution of the specified variable and value. 23 | * @param var The variable identifier. 24 | * @param val The value that unifies with that variable 25 | **/ 26 | public void addSubstitutionPair(String var, String val) { 27 | put(var,val); 28 | } 29 | 30 | /** Returns the value that unifies with the specified variable in this substitution. 31 | * @param var The variable identifier to retrieve the value from. 32 | * @return The value that unifies with var, or the empty string is no such variable is found in this set. 33 | **/ 34 | public String getValFromVar (String var) { 35 | 36 | return get(var); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /JavaSnepsAPI/java_sneps_config.config: -------------------------------------------------------------------------------- 1 | ;;; This file is used to configure the JavaSnepsAPI so that it knows how to 2 | ;;; load and run SNePS automatically. It has two fields: one that specifies 3 | ;;; a system command line to run sneps, and a second that specifies the 4 | ;;; locations of the SNePS config file (sneps_config.lisp). 5 | 6 | 7 | ;;; Replace the example path below to point to the config file in your install 8 | SNEPS_CONFIG_FILE=/projects/snwiz/Sneps262-Release/sneps_config.lisp 9 | 10 | ;;; Replace the example command below to one that will run SNePS on your system 11 | ;;; e.g. mlisp -L load-sneps.lisp 12 | ;;; Sneps-2.7.0.exe 13 | ;;; 14 | ;;; Do not use a script file, this is used by the JavaSnepsAPI to append 15 | ;;; command line arguments SNePS needs to read in order to start the jlinker 16 | ;;; process. 17 | SNEPS_COMMAND=mlisp -L /projects/snwiz/Sneps262-Release/load-sneps.lisp 18 | -------------------------------------------------------------------------------- /Jlinker/jlinker.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/Jlinker/jlinker.jar -------------------------------------------------------------------------------- /SnepsGUI/AbsoluteLayout.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/AbsoluteLayout.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/EPSComponentDump/dump.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/EPSComponentDump/dump.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/Jimi/jimi-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/Jimi/jimi-1.0.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Colt/lib/colt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Colt/lib/colt.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Colt/lib/concurrent.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Colt/lib/concurrent.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Commons/commons-collections-3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Commons/commons-collections-3.2.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Commons/commons-collections-testframework-3.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Commons/commons-collections-testframework-3.2.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/JUNG/jung-1.7.6/jung-1.7.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/JUNG/jung-1.7.6/jung-1.7.6.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/resolver.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/resolver.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xercesImpl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xercesImpl.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xercesSamples.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xercesSamples.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xml-apis.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIMods/JungFiles/Xerxes/xml-apis.jar -------------------------------------------------------------------------------- /SnepsGUI/SnepsGUIShow.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/SnepsGUIShow.jar -------------------------------------------------------------------------------- /SnepsGUI/swing-layout-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SNePS/SNePS2/d3862108609b1879f2c546112072ad4caefc050d/SnepsGUI/swing-layout-1.0.jar -------------------------------------------------------------------------------- /Tools/change-copyright.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Based off: http://use.perl.org/~schwern/journal/15301 4 | # Use this Perl script to crawl the Sneps directory structure changing the 5 | # copyright year 6 | # usage: perl change-copyright.pl 7 | 8 | 9 | 10 | use Fcntl ':mode'; 11 | 12 | my $top_path = shift; 13 | my $copy_date = shift; 14 | 15 | sub searchmod { 16 | my $path = shift; 17 | my ($file, $fullpath); 18 | opendir(DIR, $path) || die "Can't open $path: $!"; 19 | my @files = grep { !/^[\.#]/ } readdir(DIR); 20 | closedir DIR; 21 | 22 | foreach $file (@files){ 23 | $fullpath = "$path/$file"; 24 | 25 | if(-d $fullpath){ 26 | call &searchmod($fullpath); 27 | } 28 | elsif($fullpath =~ /.*\.lisp$/){ 29 | my $found_copyright = 0; 30 | 31 | my $temp_fn = getppid() . "-" . $file; 32 | 33 | open TEMPFILE, ">/tmp/" . $temp_fn; 34 | 35 | open IN, "<" . $fullpath; 36 | my $line; 37 | while($line = ){ 38 | if($line =~ /Copyright\s\(C\)\s(\d{4,4})\-\-(\d{4,4})/){ 39 | $found_copyright = 1; 40 | $line =~ s/$2/$copy_date/; 41 | } 42 | 43 | if($line =~ /;;\s(\d{4,4})/){ 44 | $found_copyright = 1; 45 | $line =~ s/$1/$copy_date/; 46 | } 47 | print TEMPFILE $line; 48 | 49 | } 50 | 51 | close IN; 52 | close TEMPFILE; 53 | 54 | system("mv /tmp/" . $temp_fn . " " . $fullpath); 55 | 56 | if(!$found_copyright){ 57 | print "Found a file without copyright information: $fullpath \n"; 58 | } 59 | } 60 | } 61 | } 62 | 63 | 64 | if (-d $top_path){ 65 | print "Examining $top_path for copyright information.\n"; 66 | } 67 | searchmod($top_path); 68 | 69 | -------------------------------------------------------------------------------- /Tools/change-license.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # Based off: http://use.perl.org/~schwern/journal/15301 4 | # Use this Perl script to crawl the Sneps directory structure changing the 5 | # copyright year 6 | # usage: perl change-license.pl 7 | 8 | 9 | 10 | use Fcntl ':mode'; 11 | 12 | # The directory to start in 13 | my $top_path = shift; 14 | 15 | # The license file to write to each sneps file 16 | my $license_file = shift; 17 | 18 | sub searchmod { 19 | my $path = shift; 20 | my ($file, $fullpath); 21 | opendir(DIR, $path) || die "Can't open $path: $!"; 22 | my @files = grep { !/^[\.#]/ } readdir(DIR); 23 | closedir DIR; 24 | 25 | foreach $file (@files){ 26 | $fullpath = "$path/$file"; 27 | 28 | if(-d $fullpath){ 29 | call &searchmod($fullpath); 30 | } 31 | elsif($fullpath =~ /.*\.lisp$/){ 32 | 33 | my $temp_fn = getppid() . "-" . $file; 34 | 35 | open TEMPFILE, ">/tmp/" . $temp_fn; 36 | 37 | open IN, "<" . $fullpath; 38 | my $line; 39 | while($line = ){ 40 | if($line =~ /;; This file is part of SNePS\./){ 41 | print TEMPFILE $line; 42 | print TEMPFILE "\n"; 43 | print TEMPFILE ";; \$BEGIN LICENSE\$\n\n"; 44 | while(!($line =~ /;; \$END LICENSE\$/)){ 45 | $line = ; 46 | } 47 | 48 | open LICENSE, "<" . $license_file; 49 | while($line = ){ 50 | print TEMPFILE ";;; " . $line; 51 | } 52 | print TEMPFILE "\n\n;; \$END LICENSE\$\n\n"; 53 | 54 | } 55 | else { 56 | print TEMPFILE $line; 57 | } 58 | } 59 | 60 | close IN; 61 | close TEMPFILE; 62 | 63 | system("mv /tmp/" . $temp_fn . " " . $fullpath); 64 | 65 | } 66 | } 67 | } 68 | 69 | 70 | if (-d $top_path){ 71 | print "Examining $top_path for license information.\n"; 72 | } 73 | searchmod($top_path); 74 | 75 | -------------------------------------------------------------------------------- /Tools/license.txt: -------------------------------------------------------------------------------- 1 | The contents of this file are subject to the University at 2 | Buffalo Public License Version 1.0 (the "License"); you may 3 | not use this file except in compliance with the License. You 4 | may obtain a copy of the License at 5 | http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 6 | 7 | Software distributed under the License is distributed on an 8 | "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 9 | or implied. See the License for the specific language gov 10 | erning rights and limitations under the License. 11 | 12 | The Original Code is SNePS 2.8. 13 | 14 | The Initial Developer of the Original Code is Research Foun 15 | dation of State University of New York, on behalf of Univer 16 | sity at Buffalo. 17 | 18 | Portions created by the Initial Developer are Copyright (C) 19 | 2011 Research Foundation of State University of New York, on 20 | behalf of University at Buffalo. All Rights Reserved. 21 | -------------------------------------------------------------------------------- /Tools/make-tags: -------------------------------------------------------------------------------- 1 | etags ./*.lisp \ 2 | ./demo/*.lisp \ 3 | ./demo/*/*.lisp \ 4 | ./demo/*/*/*.lisp \ 5 | ./ginseng/*.lisp \ 6 | ./match/*.lisp \ 7 | ./match/*/*.lisp \ 8 | ./multi/*.lisp \ 9 | ./multi/*/*.lisp \ 10 | ./nlint/*.lisp \ 11 | ./nlint/*/*.lisp \ 12 | ./snebr/*.lisp \ 13 | ./sneps/*.lisp \ 14 | ./sneps/*/*.lisp \ 15 | ./snepslog/*.lisp \ 16 | ./snepslog/*/*.lisp \ 17 | ./snip/*.lisp \ 18 | ./snip/*/*.lisp \ 19 | ./snip22/*.lisp \ 20 | ./xginseng/*.lisp 21 | -------------------------------------------------------------------------------- /demo/activation/load-activation.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: load-activation.lisp,v 1.2 2013/08/28 19:07:22 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :user) 40 | 41 | 42 | (unless (simple-system-created-p "Xginseng") 43 | (sneps-load "sneps:xginseng;load-xginseng.LISP")) 44 | 45 | (when (find-package 'opal) 46 | (make-simple-system 47 | "Activation" 48 | '((:compile-load "sneps:demo;activation;xnode") 49 | (:compile-load "sneps:demo;activation;multi-changes") 50 | (:compile-load "sneps:demo;activation;layout") 51 | ) 52 | :mode *sneps-make-option*)) 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /demo/activation/result-layout.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XGINSENG; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: result-layout.lisp,v 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | (in-package :xginseng) 37 | (create-instance 'M3 node 38 | (:box '(1227 1481 33 30)) 39 | (:name "M3!") 40 | (:sneps-node (sneps:node 'SNEPSUL::M3))) 41 | (dolist (node '(M3)) 42 | (push (eval node) (g-value display-window :nodes-on-display)) 43 | (opal:add-component display-aggregate (eval node))) 44 | (opal:add-component display-aggregate (make-arc M3 SOCRATES "member") :back) 45 | (opal:add-component display-aggregate (make-arc M3 MORTAL "class") :back) 46 | -------------------------------------------------------------------------------- /demo/activation/simple-rule.sneps: -------------------------------------------------------------------------------- 1 | ; Simple backward inference demo that illustrates node activation 2 | ; 3 | ; Authors: Deepak Kumar, Hans Chalupsky (Spring 92) 4 | ; 5 | ; Inference is carried out by node processes. The state of the 6 | ; node processes is shown graphically according to the following map: 7 | ; 8 | ; Process state XGinseng node color 9 | ; inactive WHITE 10 | ; initiated on the Multi queue LIGHT-GREY 11 | ; executing DARK-GREY 12 | ; 13 | ; When a process is executing it schedules new processes on the Multi 14 | ; queue which will continue inference once the current process terminates. 15 | ; 16 | 17 | ;;; adjustment for ACL6 (FLJ) 18 | ^^ 19 | #+(and allegro-version>= (version>= 6 0)) 20 | (sneps:adjust-for-acl6 :before ) 21 | ^^ 22 | 23 | 24 | 25 | (resetnet t) 26 | ; Define relations 27 | (define member class) 28 | ; All men are mortal 29 | (describe 30 | (assert forall $x 31 | ant (build member *x class man) 32 | cq (build member *x class mortal))) 33 | ; Socrates is a man. 34 | (describe 35 | (assert member Socrates class man)) 36 | ; Load the activation demo system: 37 | (^ (unless (user:simple-system-created-p "Activation") 38 | (user:sneps-load "sneps:demo;activation;load-activation.LISP") 39 | (unless (user:simple-system-created-p "Activation") 40 | (sneps::demo-control :dc-quit)))) 41 | dc-no-pause 42 | ; Show the current network in XGinseng: 43 | (^ (xginseng::restore-layout 44 | "sneps:demo;activation;rule-layout.LISP" nil)) 45 | ; Is Socrates mortal? 46 | (describe 47 | (deduce member Socrates class mortal)) 48 | ; Display the result 49 | ; 50 | ; Click on to exit the demo 51 | ; 52 | (^ (xginseng::restore-layout 53 | "sneps:demo;activation;result-layout.LISP")) 54 | 55 | 56 | ^^ 57 | #+(and allegro-version>= (version>= 6 0)) 58 | (sneps:adjust-for-acl6 :after) 59 | ^^ 60 | -------------------------------------------------------------------------------- /demo/activation/xnode.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XGINSENG; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: xnode.lisp,v 1.2 2013/08/28 19:07:22 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :xginseng) 40 | 41 | 42 | (defvar *fillstyle-update-wait-function* 43 | #'(lambda ()(sleep 1.2)) 44 | "Function to be called before the fillstyle of an XGinseng node gets 45 | updated") 46 | 47 | ;; An access function: 48 | (defun set-fillstyle.n (sneps-node activation) 49 | (let ((gi-node (intern (stringify.n sneps-node) 'xginseng))) 50 | ;; check whether we have an XGinseng node for this Sneps node 51 | (when (boundp gi-node) 52 | (setq gi-node (eval gi-node)) 53 | (funcall *fillstyle-update-wait-function*) 54 | (case activation 55 | (:initiated 56 | (s-value (g-value gi-node :frame) 57 | :filling-style opal:light-gray-fill)) 58 | (:executing 59 | (s-value (g-value gi-node :frame) 60 | :filling-style opal:dark-gray-fill)) 61 | (t (s-value (g-value gi-node :frame) 62 | :filling-style opal:white-fill))) 63 | (opal:update display-window) 64 | ))) 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /demo/defaults/birds.sneps: -------------------------------------------------------------------------------- 1 | ; This demo works only with Maria Cravo's implementation of default rules: 2 | ; 3 | (resetnet t) 4 | ; 5 | (define mem class) 6 | ; 7 | ; Normally birds fly 8 | (assert deflt $x ant(build class bird mem *x) cq(build class flies mem *x)) 9 | ; 10 | ; Penguins and ostriches are exceptions to the default rule M1. 11 | (assert forall $x 12 | ant((build class penguin mem *x) (build class ostrich mem *x)) 13 | cq(build min 0 max 0 arg(build applicable m1 darg1 *x))) 14 | ; 15 | ; Oscar is a bird. 16 | (assert mem oscar class bird) 17 | ; 18 | ; Tweety is a bird 19 | (assert mem tweety class bird) 20 | ; 21 | ; Who flies? 22 | (describe (deduce mem $who class flies)) 23 | ; 24 | (belief-spaces) 25 | ; 26 | ; Tweety is either a penguin or an ostrich. 27 | (assert min 1 max 1 arg((build mem tweety class penguin)(build mem tweety class ostrich))) 28 | ; 29 | ; Who flies? 30 | (describe (deduce mem $who class flies)) 31 | ; 32 | (belief-spaces) 33 | (consequence m3 m8) 34 | -------------------------------------------------------------------------------- /demo/defaults/yale-shooting.sneps: -------------------------------------------------------------------------------- 1 | ; This demo works only with Maria Cravo's implementation of default rules: 2 | ; 3 | ; 4.2 THE YALE SHOOTING PROBLEM 4 | ; 5 | (resetnet t) 6 | ; 7 | (define fact event sit) 8 | ; 9 | ; Normally for any fact F, any event E, and any situation S, if fact F 10 | ; is true in situation S, then it will still be true in the situation 11 | ; which results from S by the occurrence of event E. 12 | ; 13 | (assert deflt ($f $e $s) 14 | ant(build fact *f sit *s) 15 | cq(build fact *f sit (build event *e sit *s))) 16 | ; 17 | ; Given any situation S, the gun will be loaded in the situation 18 | ; which results from S by the occurrence of event LOADing the gun. 19 | ; 20 | (assert forall ($s) fact loaded sit (build event load sit *s)) 21 | ; 22 | ; Given any situation S, if the gun is loaded in situation S, 23 | ; then the default rule M1 cannot be applied to infer that 24 | ; the victim is ALIVE in the situation resulting from S by the 25 | ; the occurrence of event SHOOTing the gun. 26 | ; 27 | (assert forall ($s) ant(build fact loaded sit *s) 28 | cq(build min 0 max 0 arg(build applicable m1 29 | darg1 alive darg2 shoot darg3 *s))) 30 | ; 31 | ; Given any situation S, the victim will be dead in the situation 32 | ; resulting from S by the occurrence of event SHOOTing the gun. 33 | ; 34 | (assert forall ($s) ant(build fact loaded sit *s) 35 | cq(build fact dead sit (build event shoot sit *s))) 36 | ; 37 | ; The victim is ALIVE in SITUATION0. 38 | ; 39 | (assert fact alive sit situation0) 40 | ; 41 | ; Which facts are true in the situation which results from 42 | ; SITUATION0 by the occurrence of the following sequence 43 | ; of events: 1) Someone LOADs the gun, 44 | ; 2) There is a WAIT time, 45 | ; 3) Someone SHOOTs the gun. 46 | ; 47 | (describe (deduce fact $f sit 48 | (build event shoot sit 49 | (build event wait sit 50 | (build event load sit situation0))))) 51 | -------------------------------------------------------------------------------- /demo/defaults/yale-shooting.snlog: -------------------------------------------------------------------------------- 1 | ; This demo only works with Maria Cravo's implementation of default rules: 2 | ; (see the corresponding snepsul demo for more detailled explanations): 3 | ; 4 | ; 4.3 THE YALE SHOOTING PROBLEM USING SNePSLOG 5 | ; 6 | default (f,e,s) ((t(f,s)) => (t(f,result(e,s)))) 7 | all (s) (t(loaded,result(load,s))) 8 | all (s) ((t(loaded,s)) => (~applicable(wff1,alive,shoot,s))) 9 | all (s) ((t(loaded,s)) => (t(dead,result(shoot,s)))) 10 | t(alive,situation0) 11 | t(?f,result(shoot,result(wait,result(load,situation0))))? 12 | belief-spaces 13 | wff9 14 | wff10 15 | wff12 16 | wff14 17 | wff16 18 | wff18 19 | -------------------------------------------------------------------------------- /demo/nlint/qa-demo.sneps: -------------------------------------------------------------------------------- 1 | ;;; Demonstration of Using SNaLPS to implement a Cognitive Agent 2 | ;;; as documented in Section 7.5.2 of the SNePS 2.1 User's Manual 3 | ;;; by Stuart C. Shapiro 4 | ;;; June 2, 1994 5 | (resetnet t) 6 | ^^ 7 | (atnin "sneps:demo;nlint;qa-grammar.atn") 8 | (lexin "sneps:demo;nlint;qa-lexicon.lisp") 9 | (setf *infertrace* nil) 10 | (parse) 11 | A dog bit John. 12 | The dog slept. 13 | Mary believes that John likes the dog. 14 | Mary studies Computer Science. 15 | Mary used a computer. 16 | John saw a saw. 17 | What bit John? 18 | Who sleeps? 19 | Who studied? 20 | Who uses the computer? 21 | Who likes a dog? 22 | Who sees a saw? 23 | ^end. 24 | ^^ 25 | -------------------------------------------------------------------------------- /demo/nlint/qa-lexicon.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: qa-lexicon.lisp,v 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | ("a" ((ctgy . art)(definite . nil))) 38 | ("the" ((ctgy . art)(definite . t))) 39 | 40 | ("Computer Science" ((ctgy . npr))) 41 | ("John" ((ctgy . npr))) 42 | ("Mary" ((ctgy . npr))) 43 | 44 | ("computer" ((ctgy . n))) 45 | ("Computer" ((ctgy . multi-start) (multi-rest . ("Science"))) 46 | ((ctgy . n)(root . "computer"))) 47 | ("dog" ((ctgy . n))) 48 | ("man" ((ctgy . n)(plur . "men"))) 49 | ("men" ((ctgy . n)(root . "man")(num . plur))) 50 | ("woman" ((ctgy . n)(plur . "women"))) 51 | ("women" ((ctgy . n)(root . "woman")(num . plur))) 52 | 53 | ("saw" ((ctgy . n)) 54 | ((ctgy . v)(root . "see")(tense . past))) 55 | 56 | ("believe" ((ctgy . v)(stative . t))) 57 | ("bit" ((ctgy . v)(root . "bite")(tense . past))) 58 | ("bite" ((ctgy . v)(num . plur)(past . "bit"))) 59 | ("like" ((ctgy . v)(num . plur))) 60 | ("see" ((ctgy . v)(past . "saw"))) 61 | ("sleep" ((ctgy . v)(past . "slept"))) 62 | ("slept" ((ctgy . v)(root . "sleep")(tense . past))) 63 | ("study" ((ctgy . v))) 64 | ("use" ((ctgy . v))) 65 | 66 | ("who" ((ctgy . wh))) 67 | ("what" ((ctgy . wh))) 68 | 69 | #| 70 | A dog bit John. 71 | The dog slept. 72 | Mary believes that John likes the dog. 73 | Mary studies Computer Science. 74 | Mary used a computer. 75 | John saw a saw. 76 | What bit John? 77 | Who sleeps? 78 | Who studied? 79 | Who uses the computer? 80 | Who likes a dog? 81 | Who sees a saw? 82 | |# 83 | -------------------------------------------------------------------------------- /demo/nlint/simple-grammar.atn: -------------------------------------------------------------------------------- 1 | 2 | ;;; Author: Stuart C. Shapiro 3 | ;;; Written: February 90 4 | ;;; Description: The following is a simple grammar that allows parsing 5 | ;;; of sentences such as 'John caught a ball.', or 6 | ;;; 'I tell a story.'. For successful parses a parse-tree 7 | ;;; will be returned. 8 | 9 | (s (jump s-maj t (setq parser:*parse-trees* t))) 10 | 11 | (s-maj (push s-min t (setr s (buildq (s-maj *))) (to s/s-min))) 12 | (s/s-min (cat final-punc (addr s (buildq ((final-punc *)))) (to ends))) 13 | (ends (pop s t)) 14 | 15 | (s-min (push np t (setr subj *) (to s/np))) 16 | (s/np (cat v (setr vp (buildq (v *))) (to s/v))) 17 | (s/v (push np t (setr vp (buildq (vp + *) vp)) (to ends-min))) 18 | (ends-min (pop (buildq (s + +) subj vp) t)) 19 | 20 | (np (cat pro t (setr np (buildq ((pro *)))) (to endnp)) 21 | (cat npr t (setr np (buildq ((npr *)))) (to endnp)) 22 | (cat det t (setr np (buildq ((det *)))) (to np/det)) 23 | (jump np/det t)) 24 | (np/det (cat adj t (addr np (buildq ((adj *)))) (to np/det)) 25 | (cat n t (addr np (buildq ((n *)))) (to endnp))) 26 | (endnp (pop (buildq (@ (np) +) np) t)) 27 | -------------------------------------------------------------------------------- /demo/nlint/simple-lexicon.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: simple-lexicon.lisp,v 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | ("a" ((ctgy . det))) 39 | ("an" ((ctgy . det))) 40 | ("animal" ((ctgy . n))) 41 | ("are" ((ctgy . v)(root . "be")(num . (sing plur))(tense . pres)) 42 | ((ctgy . aux)(root . "be")(num . (sing plur))(tense . pres))) 43 | ("ball" ((ctgy . n))) 44 | ("be" ((ctgy . v)(root . "be")(presp . "being")) 45 | ((ctgy . aux) (root . "be")(presp . "being"))) 46 | ("big" ((ctgy . adj))) 47 | ("boy" ((ctgy . n) (gen . m)(num . sing))) 48 | ("circus" ((ctgy . multi-start)(multi-rest . ("elephant")))) 49 | ("circus elephant" ((ctgy . n))) 50 | ("is" ((ctgy . v)(root . "be")(num . sing)(tense . pres)) 51 | ((ctgy . aux)(root . "be")(num . sing)(tense . pres))) 52 | ("block" ((ctgy . n)) 53 | ((ctgy . v))) 54 | ("can" ((ctgy . aux)(modal . t)(num . (sing plur))) 55 | ((ctgy . n))) 56 | ("catch" ((ctgy . v)(past . "caught"))) 57 | ("caught" ((ctgy . v)(root . catch)(tense . past))) 58 | ("costume" ((ctgy . n))) 59 | ("clothes" ((ctgy . n))) 60 | ("dish" ((ctgy . n))) 61 | ("do" ((ctgy . v)) 62 | ((ctgy . aux))) 63 | ("did" ((ctgy . aux)(root . "do")(tense . past)) 64 | ((ctgy . v)(root . "do")(tense . past))) 65 | ("elephant" ((ctgy . n))) 66 | ("fish" ((ctgy . n)(num . (sing plur)))) 67 | ("frog" ((ctgy . n))) 68 | ("gentleman" ((ctgy . n))) 69 | ("green" ((ctgy . adj))) 70 | ("he" ((ctgy . pro))) 71 | ("head" ((ctgy . n))) 72 | ("help" ((ctgy . n)) 73 | ((ctgy . v))) 74 | ("I" ((ctgy . pro))) 75 | ("Jack" ((ctgy . npr))) 76 | ("love" ((ctgy . v)(stative . t))) 77 | ("move" ((ctgy . v))) 78 | ("performer" ((ctgy . n))) 79 | ("play" ((ctgy . v)(root . "play")) 80 | ((ctgy . n)(num . sing))) 81 | ("she" ((ctgy . pro))) 82 | ("story" ((ctgy . n))) 83 | ("take" ((ctgy . v))) 84 | ("tell" ((ctgy . v)(past . "told"))) 85 | ("the" ((ctgy . det))) 86 | ("told" ((ctgy . v)(root . "tell")(tense . past))) 87 | ("will" ((ctgy . aux)(modal . t)(num . (sing plur)))) 88 | ("you" ((ctgy . pro))) 89 | ("." ((ctgy . final-punc))) 90 | -------------------------------------------------------------------------------- /demo/nlint/tree-demo.sneps: -------------------------------------------------------------------------------- 1 | ;;; Demonstration of Using SNaLPS to Produce Parse Trees 2 | ;;; as documented in Section 7.5.1 of the SNePS 2.1 User's Manual 3 | ;;; by Stuart C. Shapiro 4 | ;;; June 2, 1994 5 | (resetnet t) 6 | ^^ 7 | (atnin "sneps:demo;nlint;tree-grammar.atn") 8 | (lexin "sneps:demo;nlint;qa-lexicon.lisp") 9 | (setf *infertrace* nil) 10 | (parse) 11 | A dog bit John. 12 | The dog slept. 13 | Mary believes that John likes the dog. 14 | Mary studies Computer Science. 15 | Mary used a computer. 16 | John saw a saw. 17 | What bit John? 18 | Who sleeps? 19 | Who studied? 20 | Who uses the computer? 21 | Who likes a dog? 22 | Who sees a saw? 23 | ^end. 24 | ^^ 25 | -------------------------------------------------------------------------------- /demo/nlint/tree-grammar.atn: -------------------------------------------------------------------------------- 1 | (s (jump s1 t (setf *parse-trees* t))) 2 | 3 | (s1 (cat wh t (setr subj '(np \?)) (setr mood 'question) (to vp)) 4 | (push np t (setr subj *) (setr mood 'decl) (to vp))) 5 | 6 | (vp (cat v (setr verb *) (to vp/v))) 7 | 8 | (vp/v (push np t (setr obj *) (to s/final)) 9 | (jump s/final t)) 10 | 11 | (s/final (jump s/end (overlap embedded t)) 12 | (wrd "." (overlap mood 'decl) (to s/end)) 13 | (wrd "?" (overlap mood 'question) (to s/end))) 14 | 15 | (s/end (pop (buildq (s (mood +) + (vp (v +))) mood subj verb) 16 | (nullr obj)) 17 | (pop (buildq (s (mood +) + (vp (v +) +)) mood subj verb obj) 18 | obj)) 19 | 20 | (np (wrd "that" t (to nomprop)) 21 | (cat npr t (setr np (buildq (npr *))) (setr def t) (to np/end)) 22 | (cat art t (setr def (getf definite)) (to np/art))) 23 | 24 | (np/art (cat n t (setr np (buildq (n *))) (to np/end))) 25 | 26 | (nomprop (push s1 t (sendr embedded t) (setr def t) (setr np *) 27 | (to np/end))) 28 | 29 | (np/end (pop (buildq (np (definite +) +) def np) t)) 30 | -------------------------------------------------------------------------------- /demo/sneps/bidir.sneps: -------------------------------------------------------------------------------- 1 | ; Node-Based, Bi-Directional Inference 2 | ; 3 | ; Define arcs. 4 | (define member class object property) 5 | ; 6 | ; for every p 7 | ; if p is a man or p is a woman then p is mortal and p is a rational animal. 8 | (describe (assert forall $p 9 | ant ((build member *p class man) 10 | (build member *p class woman)) 11 | cq ((build object *p property mortal) 12 | (build member *p class "rational animal")))) 13 | ; 14 | ; Socrates is a man. 15 | (describe (assert member Socrates class man)) 16 | ; 17 | ; Backward inference looks for all possible antecedents, 18 | ; but ignores other possible conclusions. 19 | ; Is Socrates mortal? 20 | (describe (deduce object Socrates property mortal)) 21 | ; 22 | ; Forward inference yields all possible conclusions. 23 | ; Ada is a woman! 24 | (describe (add member Ada class woman)) 25 | ; 26 | ; Backward inference to establish the context that what we are 27 | ; interested in is whether anyone is a rational animal. 28 | ; Who is a rational animal? 29 | (describe (deduce member *p class "rational animal")) 30 | ; 31 | ; Now, when we add information, conclusions irrelevant to the context 32 | ; are not drawn. 33 | ; Turing is a man! 34 | (describe (add member Turing class man)) 35 | -------------------------------------------------------------------------------- /demo/sneps/brachet-dist/brachet-setup.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;;; Copyright (C) 1984--2013 4 | ;;; Research Foundation of State University of New York 5 | 6 | ;;; Version: $Id: brachet-setup.lisp,v 7 | 8 | ;;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | (in-package :cl-user) 38 | 39 | (make-simple-system ;; FLJ 8/26/04 40 | "Brachet" 41 | '((:compile-load "sneps:demo;sneps;brachet-dist;defun-noun")) 42 | :mode *sneps-make-option*) 43 | 44 | -------------------------------------------------------------------------------- /demo/sneps/brachet-dist/paths.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;;; Copyright (C) 1984--2013 4 | ;;; Research Foundation of State University of New York 5 | 6 | ;;; Version: $Id: paths.lisp,v 7 | 8 | ;;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | ;;; Composition of certain paths 38 | 39 | ;;; Make Before Transitive 40 | (define-path before (compose before (kstar (compose after- ! before)))) 41 | 42 | ;;; Make After Transitive 43 | (define-path after (compose after (kstar (compose before- ! after)))) 44 | 45 | ;; If X is a member of the class Y and Y is a subclass of Z then 46 | ;; X is a member of the class Z. 47 | ;; Example: If Fido is a brachet and all brachets are hounds then 48 | ;;; Fido is a hound. 49 | (define-path class (compose class (kstar (compose subclass- ! superclass)))) 50 | 51 | ;; Make subclass transitive 52 | (define-path subclass (compose subclass (kstar (compose superclass- ! subclass)))) 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/sneps/brachet-dist/rels.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;;; Copyright (C) 1984--2013 4 | ;;; Research Foundation of State University of New York 5 | 6 | ;;; Version: $Id: rels.lisp,v 7 | 8 | ;;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | (define a1 a2 a3 a4 after agent antonym associated before cause 38 | class direction equiv etime from in indobj instr into lex location 39 | manner member mode object on onto part place possessor proper-name 40 | property rel skf sp-rel stime subclass superclass synonym time to whole 41 | kn_cat) 42 | -------------------------------------------------------------------------------- /demo/sneps/freeman.sneps: -------------------------------------------------------------------------------- 1 | ;;; 2 | ;;; WHO WILL FREEMAN MARRY 3 | ;;; 4 | (define member class person age profession agent willmarry) 5 | ; Freeman knows 5 women: Ada, Bea, Cyd, Deb, Eve. 6 | (describe (assert min 13 max 13 arg((build member (ada bea cyd deb eve) class woman) 7 | ; 8 | ; Two women are over 30, three are under 30. 9 | (build min 2 max 2 10 | arg ((build person ada age over30) 11 | (build person bea age over30) 12 | (build person cyd age over30) 13 | (build person deb age over30) 14 | (build person eve age over30))) 15 | (build forall $woman 16 | ant (build member *woman class woman) 17 | cq (build min 1 max 1 18 | arg ((build person *woman age over30) 19 | (build person *woman age under30)))) 20 | ; 21 | ; Two women are teachers, three are secretaries. 22 | (build min 2 max 2 23 | arg ((build person ada profession teacher) 24 | (build person bea profession teacher) 25 | (build person cyd profession teacher) 26 | (build person deb profession teacher) 27 | (build person eve profession teacher))) 28 | (build forall *woman 29 | ant (build member *woman class woman) 30 | cq (build min 1 max 1 31 | arg ((build person *woman profession teacher) 32 | (build person *woman profession secretary)))) 33 | ; 34 | ; Ada and Cyd are in the same age bracket. 35 | (build member (over30 under30) class age) 36 | (build forall $age 37 | ant (build member *age class age) 38 | cq (build thresh 1 39 | arg ((build person ada age *age) 40 | (build person cyd age *age)))) 41 | ; 42 | ; Deb and Eve are in different age brackets. 43 | (build forall *age 44 | ant (build member *age class age) 45 | cq (build min 1 max 1 46 | arg ((build person deb age *age) 47 | (build person eve age *age)))) 48 | ; 49 | ; Bea and Eve have the same occupation. 50 | (build member (teacher secretary) class occupation) 51 | (build forall $occupation 52 | ant (build member *occupation class occupation) 53 | cq (build thresh 1 54 | arg ((build person bea profession *occupation) 55 | (build person eve profession *occupation)))) 56 | ; 57 | ; Cyd and Deb have different occupations. 58 | (build forall *occupation 59 | ant (build member *occupation class occupation) 60 | cq (build min 1 max 1 61 | arg ((build person cyd profession *occupation) 62 | (build person deb profession *occupation)))) 63 | ; 64 | ; Of the five women, Freeman will marry the teacher over 30. 65 | (build min 1 max 1 66 | arg ((build min 2 max 2 67 | arg ((build person ada age over30) 68 | (build person ada profession 69 | teacher))) 70 | (build min 2 max 2 71 | arg ((build person bea age over30) 72 | (build person bea profession 73 | teacher))) 74 | (build min 2 max 2 75 | arg ((build person cyd age over30) 76 | (build person cyd profession 77 | teacher))) 78 | (build min 2 max 2 79 | arg ((build person deb age over30) 80 | (build person deb profession 81 | teacher))) 82 | (build min 2 max 2 83 | arg ((build person eve age over30) 84 | (build person eve profession 85 | teacher))))) 86 | (build forall *woman 87 | ant (build member *woman class woman) 88 | cq (build thresh 1 89 | arg ((build min 2 max 2 90 | arg ((build person *woman age over30) 91 | (build person *woman profession teacher))) 92 | (build agent freeman willmarry *woman))))))) 93 | 94 | -------------------------------------------------------------------------------- /demo/sneps/jobspuzzle.sneps: -------------------------------------------------------------------------------- 1 | (resetnet t) 2 | (define member class employee job) 3 | (describe (assert member Roberta class person)) 4 | (describe (assert member Thelma class person)) 5 | (describe (assert member Steve class person)) 6 | (describe (assert member Pete class person)) 7 | (describe (assert member chef class job)) 8 | (describe (assert member guard class job)) 9 | (describe (assert member nurse class job)) 10 | (describe (assert member telephone\ operator class job)) 11 | (describe (assert member police\ officer class job)) 12 | (describe (assert member teacher class job)) 13 | (describe (assert member actor class job)) 14 | (describe (assert member boxer class job)) 15 | (describe (assert forall $person 16 | ant (build member *person class person) 17 | cq (build min 2 max 2 18 | arg ((build employee *person job chef) 19 | (build employee *person job guard) 20 | (build employee *person job nurse) 21 | (build employee *person job telephone\ operator) 22 | (build employee *person job police\ officer) 23 | (build employee *person job teacher) 24 | (build employee *person job actor) 25 | (build employee *person job boxer))))) 26 | (describe (assert forall $job 27 | ant (build member *job class job) 28 | cq (build min 1 max 1 29 | arg ((build employee Roberta job *job) 30 | (build employee Thelma job *job) 31 | (build employee Steve job *job) 32 | (build employee Pete job *job))))) 33 | (describe (assert member Roberta class female)) 34 | (describe (assert member Thelma class female)) 35 | (describe (assert member Steve class male)) 36 | (describe (assert member Pete class male)) 37 | (describe (assert forall *person 38 | ant (build member *person class female) 39 | cq (build min 0 max 0 40 | arg ((build employee *person job nurse) 41 | (build employee *person job actor) 42 | (build employee *person job telephone\ operator))))) 43 | (describe (assert forall *person 44 | ant (build member *person class male) 45 | cq (build min 0 max 0 46 | arg (build employee *person job chef)))) 47 | (describe (assert min 0 max 0 48 | arg (build employee Roberta job boxer))) 49 | (describe (assert min 0 max 0 50 | arg ((build employee Pete job nurse) 51 | (build employee Pete job police\ officer) 52 | (build employee Pete job teacher)))) 53 | (describe (assert min 0 max 0 54 | arg ((build employee Roberta job chef) 55 | (build employee Roberta job police\ officer)))) 56 | (describe (assert forall *person 57 | ant (build member *person class person) 58 | cq (build min 0 max 1 59 | arg ((build employee *person job chef) 60 | (build employee *person job police\ officer))))) 61 | (describe (deduce (8 0) employee *person job *job)) 62 | -------------------------------------------------------------------------------- /demo/sneps/like.sneps: -------------------------------------------------------------------------------- 1 | ; Demonstration of use of rules as data and use of default reasoning. 2 | ; 3 | ; "Planes are like ships, except that they have a altitude, a pilot, 4 | ; a squadron, and a home-ship. Planes do not have draft, displacement 5 | ; or name. Planes also have types and classes, and have tail-numbers 6 | ; in place of hull-numbers." 7 | ; -- Naval Ocean Systems Center, Elements of Naval Domain 8 | ; Knowledge, NOSC Working Paper, San Diego, CA, April, 1981, 9 | ; p. 7. 10 | ; 11 | ;(snepslog echo) 12 | ; 13 | (define member class rel a1 a2) 14 | ; 15 | ;all(S)[Ship(S) V=> {Has-a(S, Cruise-speed), Has-a(S, Draft)}]. 16 | (describe (assert forall $s 17 | ant (build member *s class ship) 18 | cq ((build rel has-a a1 *s a2 cruise-speed) 19 | (build rel has-a a1 *s a2 draft)))) 20 | ; 21 | ;Like(Plane, Ship). 22 | (describe (assert rel like a1 plane a2 ship)) 23 | ; 24 | ;all(Class1, Class2) 25 | ; [Like(Class2, Class1) 26 | ; V=> all(Rel, Obj) [ {all(x)[Class1(x) V=> Rel(x, Obj)]} 27 | ; V=> 28 | ; {all(x)[Class2(x) V=> delta(Rel(x, Obj))]}]]. 29 | ; TEMPORARILY, THIS RULE IS UNIVERSAL, NOT GENERIC 30 | (describe (assert forall ($class1 $class2) 31 | ant (build rel like a1 *class2 a2 *class1) 32 | cq (build forall ($rel $obj) 33 | ant (build forall $x 34 | ant (build member *x class *class1) 35 | cq (build rel *rel a1 *x a2 *obj)) 36 | cq (build forall $x 37 | ant (build member *x class *class2) 38 | cq (build rel *rel a1 *x a2 *obj))))) 39 | ; 40 | ;all(p) [thresh(1) {Plane(p), Has-a(p, Altitude), Has-a(p, Pilot), 41 | ; Has-a(p, Squadron), Has-a(p, Home-ship)}]. 42 | (describe (assert forall $p 43 | ant (build member *p class plane) 44 | cq ((build member *p class plane) 45 | (build rel has-a a1 *p a2 altitude) 46 | (build rel has-a a1 *p a2 pilot) 47 | (build rel has-a a1 *p a2 squadron) 48 | (build rel has-a a1 *p a2 home-ship)))) 49 | ; 50 | ;all(p) [Plane(p) V=> andor(0,0) {Has-a(p, Draft), Has-a(p, Displacement), 51 | ; Has-a(p, Name)}]. 52 | (describe (assert forall *p 53 | ant (build member *p class plane) 54 | cq (build min 0 max 0 55 | arg ((build rel has-a a1 *p a2 draft) 56 | (build rel has-a a1 *p a2 displacement) 57 | (build rel has-a a1 *p a2 name))))) 58 | ; 59 | ;all(x) [andor(0,1) {Has-a(x, Tail-number), Has-a(x, Hull-number)}]. 60 | ;all(p) [Plane(p) V=> Has-a(p, Tail-number)]. 61 | (describe (assert forall *p 62 | ant (build member *p class plane) 63 | cq ((build rel has-a a1 *p a2 tail-number) 64 | (build min 0 max 0 65 | arg (build rel has-a a1 *p a2 hull-number))))) 66 | ; 67 | ;Plane(Flying-Dutchman). 68 | (describe (assert member flying-dutchman class plane)) 69 | ; 70 | ;Has-a(Flying-Dutchman, Cruise-speed)? 71 | (describe (deduce rel has-a a1 flying-dutchman a2 cruise-speed)) 72 | ; 73 | ;Has-a(Flying-Dutchman, Hull-number)? 74 | (describe (deduce rel has-a a1 flying-dutchman a2 hull-number)) 75 | ; 76 | ;Has-a(Flying-Dutchman, Draft)? 77 | (describe (deduce rel has-a a1 flying-dutchman a2 draft)) 78 | -------------------------------------------------------------------------------- /demo/sneps/numquant/meeting.sneps: -------------------------------------------------------------------------------- 1 | ; 2 | ; At least 3 of 5 professors are in meeting 3 | ; 4 | (resetnet t) 5 | (define member class agent rela object) 6 | ; 7 | (describe (assert etot 5 emin 3 pevb $x 8 | &ant (build member *x class professor) 9 | cq (build agent *x rela in object meeting))) 10 | ; 11 | ; whoever is in the hall is not in the meeting 12 | ; 13 | (describe (assert forall $x 14 | ant (build agent *x rela in object hall) 15 | cq (build min 0 max 0 16 | arg (build agent *x rela in object meeting)))) 17 | ; 18 | (describe (assert member pat class professor)) 19 | (describe (assert member gabor class professor)) 20 | (describe (assert member nick class professor)) 21 | (describe (assert member john class professor)) 22 | (describe (assert member stu class professor)) 23 | ; 24 | (describe (assert agent pat rela in object hall)) 25 | (describe (assert agent nick rela in object hall)) 26 | ; 27 | (describe (deduce agent *x rela in object meeting)) 28 | -------------------------------------------------------------------------------- /demo/sneps/numquant/mother.sneps: -------------------------------------------------------------------------------- 1 | ; 2 | ; Every person has at most one mother 3 | ; 4 | (resetnet t) 5 | (define member class agent object rela) 6 | ; 7 | (describe (assert forall $x 8 | ant (build member *x class person) 9 | cq (build emax 1 pevb $y 10 | &ant (build member *y class person) 11 | cq (build agent *y rela mother object *x)))) 12 | ; 13 | (describe (assert member jane class person)) 14 | (describe (assert member john class person)) 15 | (describe (assert member mary class person)) 16 | ; 17 | (describe (assert agent jane rela mother object john)) 18 | ; 19 | (describe (deduce agent mary rela mother object john)) 20 | 21 | -------------------------------------------------------------------------------- /demo/sneps/numquant/owner.sneps: -------------------------------------------------------------------------------- 1 | ; 2 | ; Of 5 dog ownership relations, between 2 and 4 involve spoiling. 3 | ; 4 | (resetnet t) 5 | (define member class agent object rela) 6 | ; 7 | (describe (assert etot 5 emin 2 emax 4 pevb ($x $y) 8 | &ant ((build member *x class person) 9 | (build member *y class dog) 10 | (build agent *x rela owns object *y)) 11 | cq (build agent *x rela spoils object *y))) 12 | ; 13 | (describe (assert member john class person)) 14 | (describe (assert member jane class person)) 15 | (describe (assert member mary class person)) 16 | (describe (assert member jim class person)) 17 | ; 18 | (describe (assert member rover class dog)) 19 | (describe (assert member spot class dog)) 20 | (describe (assert member lassie class dog)) 21 | ; 22 | (describe (assert agent john rela owns object rover)) 23 | (describe (assert agent john rela owns object spot)) 24 | (describe (assert agent mary rela owns object lassie)) 25 | (describe (assert agent jane rela owns object spot)) 26 | (describe (assert agent jim rela owns object lassie)) 27 | ; 28 | (describe (assert agent john rela spoils object rover)) 29 | (describe (assert agent john rela spoils object spot)) 30 | (describe (assert agent jane rela spoils object spot)) 31 | (describe (assert agent mary rela spoils object lassie)) 32 | ; 33 | (describe (deduce agent *x rela spoils object *y)) 34 | -------------------------------------------------------------------------------- /demo/sneps/uvbr.sneps: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode:Common-Lisp; Base:10 -*- 2 | ;;; 3 | ;;; Demonstration of UBVR in action in SNePS-2 4 | ;;; from Appendix of 5 | ;;; S. C. Shapiro, Symmetric Relations, Intensional Individuals, and Variable Binding 6 | ;;; Proc. IEEE 74, 10(Oct. 1986), 1354-1363 7 | ;;; 8 | (resetnet t) 9 | ;;; 10 | ;;; Define arc labels 11 | (define member class object property rel argument a1 a2 a3) 12 | ;;; 13 | ;;; Example 1: If x and y are brothers, then x likes y. 14 | ;;; 15 | (describe (assert rel brothers argument (Bob Joe Harry))) 16 | (describe (assert forall ($brother $brother2) 17 | ant (build rel brothers argument (*brother *brother2)) 18 | cq (build rel likes a1 *brother a2 *brother2))) 19 | (describe (deduce rel likes a1 *brother a2 *brother2)) 20 | ;;; 21 | ;;; Example 2: If a tract of the CNS is malfunctioning, adjacent tracts should be examined. 22 | ;;; 23 | (describe (assert forall $tract 24 | &ant ((build member *tract class tract) 25 | (build object *tract property malfunctioning)) 26 | cq (build forall $tract2 27 | &ant ((build member *tract2 class tract) 28 | (build rel adjacent argument (*tract *tract2))) 29 | cq (build rel should a1 examine a2 *tract2)))) 30 | (describe (assert member 16R class tract)) 31 | (describe (assert member 13RC8-C2 class tract)) 32 | (describe (assert rel adjacent argument (16R 13RC8-C2 ))) 33 | (describe (assert object 16R property malfunctioning)) 34 | (describe (deduce rel should a1 examine a2 *tract2)) 35 | ;;; 36 | ;;; Example 3: If an AND gate has high inputs and a low output, it is faulty. 37 | ;;; 38 | (describe (assert forall ($and-gate $input $input2 $output) 39 | &ant ((build member *and-gate class and-gate) 40 | (build rel gate a1 *and-gate a2 (*input *input2) a3 *output)) 41 | cq (build &ant ((build object *input property high) 42 | (build object *input2 property high) 43 | (build object *output property low)) 44 | cq (build object *and-gate property faulty)))) 45 | (describe (assert member A1 class and-gate)) 46 | (describe (assert rel gate a1 A1 a2 (A1inp1 A1inp2) a3 A1outp)) 47 | (describe (assert object A1inp1 property high)) 48 | (describe (assert object A1inp2 property low)) 49 | (describe (assert object A1outp property low)) 50 | (describe (assert member A2 class and-gate)) 51 | (describe (assert rel gate a1 A2 a2 (A2inp1 A2inp2) a3 A2outp)) 52 | (describe (assert object A2inp1 property high)) 53 | (describe (assert object A2inp2 property high)) 54 | (describe (assert object A2outp property low)) 55 | (describe (deduce object *and-gate property faulty)) 56 | ;;; 57 | ;;; Example 4: Elephants hate each other. 58 | ;;; 59 | (describe (assert member Clyde class elephant)) 60 | (describe (assert member Jumbo class elephant)) 61 | (describe (assert forall ($elephant $elephant2) 62 | &ant ((build member *elephant class elephant) 63 | (build member *elephant2 class elephant)) 64 | cq (build rel hates a1 *elephant a2 *elephant2))) 65 | (describe (deduce rel hates a1 *elephant a2 *elephant2)) 66 | -------------------------------------------------------------------------------- /demo/snepslog/agents.snlog: -------------------------------------------------------------------------------- 1 | ;;; Automatic Belief Revision Based on Fluents vs. Non-fluents. 2 | ;;; From Section 4.3.3 of 3 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 4 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 5 | ;;; Department of Computer Science and Engineering, University at Buffalo, 6 | ;;; Buffalo, NY, June 1, 2011. 7 | 8 | ;;; 9 | ;;; Set SNePSLOG flags 10 | ;;; 11 | 12 | ;;; Use mode 3 13 | set-mode-3 14 | 15 | ;;; Show supports 16 | expert 17 | 18 | ;;; Always use automatic belief revision 19 | br-mode auto 20 | 21 | ;; Use an entrenchment ordering in which non-fluents are more entrenched than fluents. 22 | set-order fluent 23 | 24 | ;;; Automatically and arbitrarily break entrenchment ties. 25 | br-tie-mode auto 26 | 27 | ;;; 28 | ;;; Define frames 29 | ;;; 30 | 31 | ;;; Define the Direction frame 32 | define-frame Direction(nil d) "[d] is a direction." 33 | 34 | ;;; Define the Facing frame. 35 | define-frame Facing(nil dir) "I am facing direction [dir]" 36 | 37 | ;;; Define the turn frame. 38 | define-frame turn(action newdir) "turn to [newdir]" 39 | 40 | ;;; 41 | ;;; Some settings that must be done in Lisp 42 | ;;; 43 | ^^ 44 | 45 | ;;; The Facing predicate is a fluent. 46 | (setf *fluents* '(Facing)) 47 | 48 | ;;; Define the turn attached function 49 | (define-attachedfunction turn ((newdir)) 50 | (format outunit "~&I'm turning to the ~A~%" newdir)) 51 | 52 | ;;; Attach the turn and believe actions. 53 | (attach-primaction turn turn believe believe) 54 | ^^ 55 | 56 | ;;; 57 | ;;; Domain Knowledge 58 | ;;; 59 | 60 | ;;; The directions are north, south, east, and west. 61 | Direction({north,south,east,west}). 62 | 63 | ;;; At any given time, the agent is facing either north, south, east, or west. 64 | nexists(_,1,_)(d)(Direction(d): Facing(d)). 65 | 66 | ;;; The effect of turning to direction d is to be facing d. 67 | all(d)(Direction(d) => Effect(turn(d), Facing(d))). 68 | 69 | ;;; 70 | ;;; Initial situation 71 | ;;; 72 | 73 | ;;; Now, the agent is facing west. 74 | perform believe(Facing(west)) 75 | 76 | ;;; The knowledge base now: 77 | list-asserted-wffs 78 | 79 | ;;; 80 | ;;; The agent performs 81 | ;;; 82 | 83 | ;;; The agent turns to the south. 84 | perform turn(south) 85 | 86 | ;;; The resulting knowledge base: 87 | list-asserted-wffs 88 | -------------------------------------------------------------------------------- /demo/snepslog/blackbeard1.snlog: -------------------------------------------------------------------------------- 1 | ;;; Assisted Nonprioritized Belief Revision with Manual tie-breaking 2 | ;;; From Section 4.2.1 of 3 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 4 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 5 | ;;; Department of Computer Science and Engineering, University at Buffalo, 6 | ;;; Buffalo, NY, June 1, 2011. 7 | 8 | ;;; Use mode 1 9 | set-mode-1 10 | 11 | ;;; Show supports 12 | expert 13 | 14 | ;;; Use the default belief revision mode of "manual". 15 | ;;; This is the default for modes 1 and 2, 16 | ;;; and still allows the user to choose "auto" mode 17 | ;;; for each contradiction that occurs. 18 | br-mode 19 | 20 | ;;; Use an entrenchment ordering where every proposition is minimally-entrenched. 21 | ;;; (epistemic ties are possible) 22 | ;;; 23 | set-order null-order 24 | 25 | ;;; Consult the user when an entrenchment tie occurs. 26 | br-tie-mode manual 27 | 28 | ;;; All pirates are uneducated 29 | all(x)(Pirate(x) => ~Educated(x)). 30 | 31 | ;;; All criminals are uneducated 32 | all(x)(Criminal(x) => ~Educated(x)). 33 | 34 | ;;; Blackbeard was a pirate and a criminal. 35 | and{Pirate(Blackbeard), Criminal(Blackbeard)}! 36 | 37 | ;;; The knowledge base thus far: 38 | list-asserted-wffs 39 | 40 | ;;; Blackbeard was educated (a contradiction) 41 | Educated(Blackbeard). 42 | 43 | ;;; Choose automatic belief revision for this problem. 44 | a 45 | 46 | ;;; Among these, I least like the proposition that all criminals are not educated. 47 | 1 48 | 49 | ;;; Among these, I least like the proposition that all pirates are not educated. 50 | 1 51 | 52 | ;;; The knowledge base now. 53 | list-asserted-wffs 54 | -------------------------------------------------------------------------------- /demo/snepslog/blackbeard2.snlog: -------------------------------------------------------------------------------- 1 | ;;; Assisted Nonprioritized Belief Revision with Manual tie-breaking 2 | ;;; showing Minimal Change of KB. 3 | ;;; From Section 4.2.2 of 4 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 5 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 6 | ;;; Department of Computer Science and Engineering, University at Buffalo, 7 | ;;; Buffalo, NY, June 1, 2011. 8 | 9 | ;;; Use mode 1 10 | set-mode-1 11 | 12 | ;;; Show supports 13 | expert 14 | 15 | ;;; Use the default belief revision mode of "manual". 16 | ;;; This is the default for modes 1 and 2, 17 | ;;; and still allows the user to choose "auto" mode 18 | ;;; for each contradiction that occurs. 19 | br-mode 20 | 21 | ;;; Use an entrenchment ordering where every proposition is minimally-entrenched. 22 | ;;; (epistemic ties are possible) 23 | ;;; 24 | set-order null-order 25 | 26 | ;;; Consult the user when an entrenchment tie occurs. 27 | br-tie-mode manual 28 | 29 | ;;; All pirates are uneducated 30 | all(x)(Pirate(x) => ~Educated(x)). 31 | 32 | ;;; All criminals are uneducated 33 | all(x)(Criminal(x) => ~Educated(x)). 34 | 35 | ;;; Blackbeard was a pirate and a criminal. 36 | and{Pirate(Blackbeard), Criminal(Blackbeard)}! 37 | 38 | ;;; The knowledge base thus far: 39 | list-asserted-wffs 40 | 41 | ;;; Blackbeard was educated (a contradiction) 42 | Educated(Blackbeard). 43 | 44 | ;;; Choose automatic belief revision for this problem. 45 | a 46 | 47 | ;;; Among these, I least like the proposition that all criminals are not educated. 48 | 1 49 | 50 | ;;; Among these, I least like the proposition that Blackbeard was educated. 51 | 3 52 | 53 | ;;; The knowledge base now. 54 | ;;; Note that, even though wft2 was chosen as the least entrenched 55 | ;;; among wft2, wft5, and wft6, it is still in the KB. 56 | ;;; That is because wft6 was chosen as the least entrenched 57 | ;;; among wft1, wft5, and wft6, and so had to be removed to get rid of the 58 | ;;; second no-good. 59 | ;;; Instead of removing both wft2 and wft6, it was sufficient to remove wft6. 60 | ;;; The final entrenchment order: 61 | ;;; wft2 < wft6 < {wft1, wft5, and all other wfts} 62 | list-asserted-wffs 63 | -------------------------------------------------------------------------------- /demo/snepslog/blackbeard3.snlog: -------------------------------------------------------------------------------- 1 | ;;; Fully Automatic Nonprioritized Belief Revision 2 | ;;; From Section 4.2.3 of 3 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 4 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 5 | ;;; Department of Computer Science and Engineering, University at Buffalo, 6 | ;;; Buffalo, NY, June 1, 2011. 7 | 8 | ;;; Use mode 1 9 | set-mode-1 10 | 11 | ;;; Show supports 12 | expert 13 | 14 | ;;; Always use automatic belief revision 15 | br-mode auto 16 | 17 | ;;; Use an entrenchment ordering where every proposition is minimally-entrenched. 18 | ;;; (epistemic entrenchment ties are possible) 19 | ;;; 20 | set-order null-order 21 | 22 | ;;; Automatically use the lexicographic ordering of wffNames 23 | ;;; to break epistemic entrenchment ties. 24 | br-tie-mode auto 25 | 26 | ;;; All pirates are uneducated 27 | all(x)(Pirate(x) => ~Educated(x)). 28 | 29 | ;;; All criminals are uneducated 30 | all(x)(Criminal(x) => ~Educated(x)). 31 | 32 | ;;; Blackbeard was a pirate and a criminal. 33 | and{Pirate(Blackbeard), Criminal(Blackbeard)}! 34 | 35 | ;;; The knowledge base thus far: 36 | list-asserted-wffs 37 | 38 | ;;; Blackbeard was educated (a contradiction, handled automatically) 39 | Educated(Blackbeard). 40 | 41 | ;;; The knowledge base now. 42 | ;;; The two no-goods are {wft1, wft5, wft6} and {wft2, wft5, wft6}. 43 | ;;; wft1 is the lexicographic lowest of the first group, 44 | ;;; and wft2 is the lexicographic lowest of the second group, 45 | ;;; so they were removed. 46 | list-asserted-wffs 47 | -------------------------------------------------------------------------------- /demo/snepslog/duck.snlog: -------------------------------------------------------------------------------- 1 | ;;; Prioritized Belief Revision with Manual Tie-Breaking 2 | ;;; From Section 4.2.4 of 3 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 4 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 5 | ;;; Department of Computer Science and Engineering, University at Buffalo, 6 | ;;; Buffalo, NY, June 1, 2011. 7 | 8 | ;;; Use mode 3 9 | set-mode-3 10 | 11 | ;;; Show supports 12 | expert 13 | 14 | ;;; Note that we will use the default belief revision mode of "auto", 15 | ;;; which is the default for mode 3. 16 | br-mode 17 | 18 | ;;; Use an entrenchment ordering 19 | ;;; where every proposition is equally entrenched. 20 | set-order null-order 21 | 22 | ;;; Consult the user when an entrenchment tie needs to be broken. 23 | br-tie-mode manual 24 | 25 | ;;; Attach the believe action to the believe term. 26 | ^(attach-primaction believe believe) 27 | 28 | define-frame Walk(verb prep obj) "it walks [prep] a [obj]" 29 | define-frame Talk(verb prep obj) "it talks [prep] a [obj]" 30 | define-frame x(verb prep obj) "it xes [prep] a [obj]" 31 | define-frame Isa(verb obj) "It is a [obj]" 32 | 33 | ;;; If it xes like a y, it is a y." 34 | all(x,y)(x(like,y) => Isa(y)). 35 | 36 | ;;; It walks like a duck. 37 | Walk(like, duck)! 38 | 39 | ;;; It talks like a duck. 40 | Talk(like, duck)! 41 | 42 | ;;; The knowledge base so far: 43 | list-asserted-wffs 44 | 45 | ;;; Believe that it is not a duck, regardless of what you currently believe. 46 | perform believe(~Isa(duck)) 47 | 48 | ;;; So, it doesn't walk like a duck. 49 | 2 50 | 51 | ;;; So, it doesn't talk like a duck. 52 | 2 53 | 54 | ;;; The revised knowledge base: 55 | list-asserted-wffs 56 | -------------------------------------------------------------------------------- /demo/snepslog/example1.snlog: -------------------------------------------------------------------------------- 1 | all (x) (a(x) => b(x)) 2 | 3 | all (x) (a(x) => c(x)) 4 | 5 | all (x) (c(x) and b(x) => d(x)) 6 | 7 | a(r) 8 | 9 | d(?q)? 10 | -------------------------------------------------------------------------------- /demo/snepslog/example2.snlog: -------------------------------------------------------------------------------- 1 | resetnet 2 | 3 | expert 4 | 5 | all (x, y) ((x and y) => x) ? 6 | 7 | list-wffs 8 | 9 | -------------------------------------------------------------------------------- /demo/snepslog/example3.snlog: -------------------------------------------------------------------------------- 1 | resetnet 2 | 3 | all (x,y) (x => x or y)! 4 | -------------------------------------------------------------------------------- /demo/snepslog/example4.snlog: -------------------------------------------------------------------------------- 1 | resetnet 2 | 3 | a and ~a ! 4 | -------------------------------------------------------------------------------- /demo/snepslog/example5.snlog: -------------------------------------------------------------------------------- 1 | resetnet 2 | 3 | (~p <=> q) <=> (p <=> ~q)? 4 | -------------------------------------------------------------------------------- /demo/snepslog/freeman.snlog: -------------------------------------------------------------------------------- 1 | set-mode-1 2 | 3 | woman (ada) 4 | woman (bea) 5 | woman (cyd) 6 | woman (deb) 7 | woman (eve) 8 | andor (3,3)(age(ada, u30), 9 | age(bea, u30), 10 | age(cyd, u30), 11 | age(deb, u30), 12 | age(eve, u30)) 13 | andor (2,2)(age(ada, o30), 14 | age(bea, o30), 15 | age(cyd, o30), 16 | age(deb, o30), 17 | age(eve, o30)), 18 | all (x) (woman(x) => andor(1,1)(age(x, u30), age(x, o30))) 19 | andor(2,2) (worker(ada,teacher), 20 | worker(bea,teacher), 21 | worker(cyd,teacher), 22 | worker(deb,teacher), 23 | worker(eve,teacher)) 24 | andor(3,3) (worker(ada,secretary), 25 | worker(bea,secretary), 26 | worker(cyd,secretary), 27 | worker(deb,secretary), 28 | worker(eve,secretary)) 29 | all (x) (woman(x) => andor(1,1) (worker(x,secretary), 30 | worker(x,teacher))) 31 | all (x) (thresh (1) (age(ada,x), age(cyd,x))) 32 | all (x) (andor (1,1) (age(deb,x), age(eve,x))) 33 | all (x) (thresh (1) (worker(bea,x), worker(eve,x))) 34 | all (x) (andor(1,1) (worker(cyd,x), worker(deb,x))) 35 | andor(1,1) (andor(2,2)(age(ada,o30), worker(ada,teacher)), 36 | andor(2,2)(age(bea,o30), worker(bea,teacher)), 37 | andor(2,2)(age(cyd,o30), worker(cyd,teacher)), 38 | andor(2,2)(age(deb,o30), worker(deb,teacher)), 39 | andor(2,2)(age(eve,o30), worker(eve,teacher))) 40 | all (x) (thresh (1) (marry(Freeman,x), 41 | age(x, o30) and worker(x, teacher))) 42 | 43 | 44 | age(ada,o30) 45 | 46 | age(cyd, o30) 47 | 48 | worker(ada, teacher) 49 | 50 | worker(deb, teacher) 51 | -------------------------------------------------------------------------------- /demo/snepslog/jobspuzzle.snlog: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode:Common-Lisp; Package:SNEPS; Base:10 -*- 2 | ;;; 3 | ;;; THE JOBS PUZZLE 4 | ;;; A SNePS Exercise demonstrating non-standard connectives and quantifiers 5 | ;;; by Stuart C. Shapiro 6 | ;;; based on 7 | ;;; The Jobs Puzzle in Full, Chapter 3.2 8 | ;;; of Automated Reasoning: Introduction and Applications 9 | ;;; by Larry Wos, Ross Overbeek, Ewing Lusk, and Jim Boyle 10 | ;;; Prentice-Hall, Englewood Cliffs, NJ, 1984, pp. 55-58. 11 | ;;; 12 | ;;; Most inputs below are preceded by a line labelled "jp:", 13 | ;;; which comes directly from the statement of the jobs puzzle, 14 | ;;; p. 55 of Wos et al. 15 | ;;; and some lines labelled "inf", which are permissable immediate 16 | ;;; inferences from the puzzle statement according to page 56 or 17 | ;;; Chapter 3.2.1, "The Solution by Person or Persons Unknown" 18 | ;;; of Wos et al. 19 | ;;; and some lines labelled "scs:", which are my comments. 20 | ;;; 21 | clearkb 22 | set-mode-1 23 | 24 | ;;; 25 | ;;; jp: There are four people: Roberta, Thelma, Steve, and Pete. 26 | Person({Roberta, Thelma, Steve, Pete}). 27 | ;;; 28 | ;;; jp: The jobs are: chef, guard, nurse, telephone operator, police 29 | ;;; officer (gender not implied), teacher, actor, and boxer. 30 | Job({chef, guard, nurse, telephoneOperator, 31 | policeOfficer, teacher, actor, boxer}). 32 | ;;; 33 | ;;; jp: Among [the people], they hold eight different jobs. 34 | ;;; jp: Each holds exactly two jobs. 35 | all(p)(Person(p) => nexists(2,2,8)(j)({Job(j)}: {hasJob(p,j)})). 36 | ;;; 37 | ;;; inf: "No job is held by more than one person." 38 | all(j)(Job(j) => nexists(1,1,4)(p)({Person(p)}: {hasJob(p,j)})). 39 | ;;; 40 | ;;; inf: "if the four names did not clearly imply the sex of the people, 41 | ;;; [the puzzle] would be impossible to solve." 42 | Female({Roberta, Thelma}). 43 | Male({Steve, Pete}). 44 | ;;; 45 | ;;; jp: The job of nurse is held by a male. 46 | ;;; inf: "everyday language distinguishes [actors and actresses] based 47 | ;;; on sex." 48 | ;;; jp: The husband of the chef is the telephone operator. 49 | ;;; inf: "the implicit fact that husbands are male" 50 | ;;; scs: So neither the nurse, the actor, nor the telephone operator is 51 | ;;; a woman. 52 | all(w)(Female(w) 53 | => nor{hasJob(w, nurse), hasJob(w, actor),hasJob(w, telephoneOperator)}). 54 | ;;; 55 | ;;; inf: since the chef has a husband, she must be female. 56 | all(m)(Male(m) => ~hasJob(m, chef)). 57 | ;;; 58 | ;;; jp: Roberta is not a boxer. 59 | ~hasJob(Roberta, boxer). 60 | ;;; 61 | ;;; jp: Pete has no education past the ninth grade. 62 | ~educatedPastNinthGrade(Pete). 63 | ;;; inf: "the jobs of nurse, police officer, and teacher each require 64 | ;;; more than a ninth-grade education." 65 | all(x)(~educatedPastNinthGrade(x) => 66 | nor{hasJob(x, nurse),hasJob(x, policeOfficer), hasJob(x, teacher)}). 67 | ;;; 68 | ;;; jp: Roberta, the chef, and the police officer went golfing together. 69 | ;;; inf: "Thus, we know that Roberta is neither the chef nor the police 70 | ;;; officer." 71 | nor{hasJob(Roberta, chef), hasJob(Roberta, policeOfficer)}. 72 | ;;; 73 | ;;; inf: "Since they went golfing together, the chef and the police 74 | ;;; officer are not the same person." 75 | all(p)(Person(p) => nand{hasJob(p, chef), hasJob(p, policeOfficer)}). 76 | ;;; 77 | ;;; jp: Question: Who holds which jobs? 78 | ask hasJob(?p, ?j)? 79 | -------------------------------------------------------------------------------- /demo/snepslog/meetings.snlog: -------------------------------------------------------------------------------- 1 | ;;; Automatic Belief Revision 2 | ;;; Based on an Explicit Object-Language Ordering Predicate. 3 | ;;; From Section 4.3.1 of 4 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 5 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 6 | ;;; Department of Computer Science and Engineering, University at Buffalo, 7 | ;;; Buffalo, NY, June 1, 2011. 8 | ;;; Based on 9 | ;;; Maria R. Cravo and João P. Martins, "SNePSwD: A Newcomer to the 10 | ;;; SNePS Family", Journal of Experimental and Theoretical Artificial 11 | ;;; Intelligence 5, 1993, 135-148. 12 | 13 | ;;; Use mode 1 14 | set-mode-1 15 | 16 | ;;; Show supports 17 | expert 18 | 19 | ;;; Always use automatic belief revision 20 | br-mode auto 21 | 22 | ;;; Use an explicit object-language epistemic entrenchment order 23 | ;;; based on IsLessEntrenched(p1, p2) 24 | set-order explicit 25 | 26 | ;;; Consult the user when an entrenchment tie needs to be broken. 27 | br-tie-mode manual 28 | 29 | ;;; The epistemic entrenchment ordering is transitive. 30 | all(x,y,z)({IsLessEntrenched(x,y), IsLessEntrenched(y,z)} &=> IsLessEntrenched(x,z)). 31 | 32 | ;;; There are four kinds of meetings: official meetings, classes, work meetngs, 33 | ;;; and social meetings. Any meeting will be of exactly one of these types. 34 | all(m)(meeting(m) => xor{official(m), class(m), work(m), social(m)}). 35 | 36 | ;;; Any meeting will be either in the morning or the afternoon, but not both. 37 | all(m)(meeting(m) => xor{in(m,morning), in(m,afternoon)}). 38 | 39 | ;;; If one person attends two different meetings, then one of the meetings has 40 | ;;; to be in the morning, and the other in the afternoon. 41 | all(m1,m2,p)({attends(m1,p), attends(m2,p)} &=> 42 | (in(m1,morning) <=> in(m2,afternoon))). 43 | 44 | ;;; Philip, Peter, and John will attend work meetings. 45 | all(m)(work(m) => {attends(m, Philip), attends(m, Peter), attends(m, John)}). 46 | 47 | ;;; w is a work meeting 48 | and{meeting(w), work(w)}. 49 | 50 | ;;; Peter prefers meetings in the morning. 51 | all(m)(attends(m,Peter) => in(m,morning)). 52 | 53 | ;;; John prefers meetings in the afternoon. 54 | all(m)(attends(m,John) => in(m,afternoon)). 55 | 56 | ;;; Philip prefers meetings in the morning. 57 | all(m)(attends(m,Philip) => in(m,morning)). 58 | 59 | ;;; The knowledge base so far: 60 | list-asserted-wffs 61 | 62 | ;;; Philip's preference is less important than John's. 63 | IsLessEntrenched(wff11, wff10). 64 | 65 | ;;; John's preference is less important than Peter's. 66 | IsLessEntrenched(wff10, wff9). 67 | 68 | ;;; Peter's preference is less important than any other information. 69 | IsLessEntrenched(wff9,{wff1, wff2, wff3, wff4, wff5, wff8 }). 70 | 71 | ;;; The knowledge base so far: 72 | list-asserted-wffs 73 | 74 | ;;; When is the meeting? 75 | in(w,?when)? 76 | 77 | ;;; The revised knowledge base: 78 | list-asserted-wffs 79 | -------------------------------------------------------------------------------- /demo/snepslog/pegasus.sneps: -------------------------------------------------------------------------------- 1 | (resetnet) 2 | (define mem class h-prop prop sub sup) 3 | (assert h-prop tornado prop white) 4 | (assert mem tornado class horses) 5 | (assert h-prop horses prop not-flies) 6 | (assert h-prop winged-horses prop flies) 7 | (assert sub winged-horses sup horses) 8 | (assert h-prop winged-horses prop has-wings) 9 | (assert mem pegasus class winged-horses) 10 | (define-path h-prop (compose h-prop 11 | (kstar (compose sup- ! sub)) 12 | (kstar (compose class- ! mem)))) 13 | (assert forall $x ant (build h-prop *x prop not-flies) 14 | cq (build min 0 max 0 arg (build h-prop *x prop flies))) 15 | ;(full-describe (deduce h-prop $who prop flies)) 16 | -------------------------------------------------------------------------------- /demo/snepslog/pegasus.snlog: -------------------------------------------------------------------------------- 1 | ;; Simple demo that shows how SNePSLOG handles contradictions: 2 | clearkb 3 | set-mode-1 4 | ;; Tornado is a white horse 5 | white(tornado). 6 | horse(tornado). 7 | ;; Horses do not fly 8 | all (x) (horse(x) => ~flies(x)). 9 | ;; Winged horses do fly... 10 | all (x) (winged-horse(x) => flies(x)). 11 | ;; ...they are horses... 12 | all (x) (winged-horse(x) => horse(x)). 13 | ;; ... and they have wings. 14 | all (x) (winged-horse(x) => has-wings (x)). 15 | ;; Pegasus is a winged horse 16 | winged-horse(pegasus). 17 | ;; Does Pegasus have wings...YES 18 | has-wings(pegasus)? 19 | ;; Does Tornado fly? - NO 20 | flies(tornado)? 21 | ;; Does Pegasus fly? Type in the query and try it out. 22 | ;; flies(pegasus)? 23 | -------------------------------------------------------------------------------- /demo/snepslog/ruleintro.snlog: -------------------------------------------------------------------------------- 1 | ;;; Various examples of rule introduction: 2 | ;;; 3 | ;;; And introduction: 4 | clearkb 5 | set-mode-1 6 | 7 | adult(). 8 | robin(). 9 | adult() and robin()? 10 | list-wffs 11 | ;;; Simple entailment introduction: 12 | clearkb 13 | robin() => bird(). 14 | bird() => animal(). 15 | robin() => animal()? 16 | list-asserted-wffs 17 | ;;; Introduction of an or-entailment with two antecedents 18 | ;;; of which only one of which leads to the consequent.: 19 | ;;; This should not work. 20 | clearkb 21 | robin() => bird(). 22 | bird() => animal(). 23 | {robin(),sparrow()} v=> {animal()}? 24 | list-asserted-wffs 25 | ;;; Introduction of an or-entailment with two antecedents 26 | ;;; both of which lead to the consequent. 27 | ;;; This should work, but the code doesn't support it. 28 | clearkb 29 | robin() => bird(). 30 | sparrow() => bird(). 31 | bird() => animal(). 32 | {robin(),sparrow()} v=> {animal()}? 33 | list-asserted-wffs 34 | ;;; Introduction of an and-entailment: 35 | clearkb 36 | robin() => bird(). 37 | nestling() or adult(). 38 | {bird(), adult()} &=> laysEggs(). 39 | {robin(), ~nestling()} &=> laysEggs()? 40 | list-asserted-wffs 41 | ;;; Introduction of an and-entailment with two consequents: 42 | clearkb 43 | robin() => bird(). 44 | nestling() or adult(). 45 | {adult(),bird()} &=> {animal(), laysEggs()}. 46 | {robin(), ~nestling()} &=> {animal(), laysEggs()}? 47 | list-asserted-wffs 48 | ;;; Introduction of an or-entailment which is an instance of the 49 | ;;; antecedent of a quantified rule. This case used to assert pattern 50 | ;;; nodes in early versions of SNePS-2.1 (asserted pattern nodes are 51 | ;;; very dangerous objects). Now the antecedents are properly substituted 52 | ;;; and only if they do not contain any free variables they will get 53 | ;;; asserted in the introduction context: 54 | clearkb 55 | robin(Betty) => bird(Betty). 56 | sparrow(Betty) => bird(Betty). 57 | bird(Betty) => animal(Betty). 58 | all(x)(({robin(x),sparrow(x)} v=> {animal(x)}) 59 | => entails(or{robin(x),sparrow(x)},animal(x))). 60 | ;;; This question shows that if we cannot get proper instantiations of the 61 | ;;; variables of the antecedent entailment no introduction will get attempted: 62 | entails(or{robin(?who),sparrow(?who)},animal(?who))? 63 | clear-infer 64 | ;;; Now we can bind x to a and hence we are in a position to start 65 | ;;; entailment introduction. 66 | ;;; This should not work because v=>I is not implemented for multiple antecedents. 67 | entails(or{robin(Betty),sparrow(Betty)},animal(Betty))? 68 | list-asserted-wffs 69 | ;;; Introduction of an and-entailment which is an instance of the 70 | ;;; antecedent of a quantified rule (similar to previous example): 71 | clearkb 72 | robin(Betty) => bird(Betty). 73 | nestling(Betty) or adult(Betty). 74 | {bird(Betty),adult(Betty)} &=> {laysEggs(Betty)}. 75 | all(x)(({robin(x),adult(x)} &=> {laysEggs(x)}) 76 | => entails(and{robin(x),adult(x)},laysEggs(x))). 77 | ;;; This should not work. 78 | entails(and{robin(?who),adult(?who)},laysEggs(?who))? 79 | clear-infer 80 | ;;; But this should. 81 | entails(and{robin(Betty),adult(Betty)},laysEggs(Betty))? 82 | list-asserted-wffs 83 | ;;; Universal introduction (not yet implemented), however, in early 84 | ;;; versions of SNePS-2.1 a query such as the one below would start 85 | ;;; implication introduction with the usual assertion of a pattern node: 86 | clearkb 87 | robin(Betty) => animal(Betty). 88 | all(x)(robin(x) => bird(x)). 89 | all(x)(bird(x) => animal(x)). 90 | ;;; Currently this does not derive anything (not even by accident): 91 | all(x)(robin(x) => animal(x))? 92 | list-asserted-wffs 93 | -------------------------------------------------------------------------------- /demo/snepslog/socrates.snlog: -------------------------------------------------------------------------------- 1 | ;; Simple backward chaining through a rule: 2 | clearkb 3 | set-mode-1 4 | 5 | man(socrates). 6 | all(x)(man(x) => mortal(x)). 7 | mortal(socrates)? 8 | -------------------------------------------------------------------------------- /demo/snepslog/sourcedMeetings.snlog: -------------------------------------------------------------------------------- 1 | ;;; Automatic Belief Revision 2 | ;;; Based on Explicit Sources and Object-Language Source-Ordering. 3 | ;;; From Sections 4.3.1 and 4.3.2 of 4 | ;;; Ari I. Fogel, On the Use of Epistemic Ordering Functions as Decision 5 | ;;; Criteria for Automated and Assisted Belief Revision in SNePS, MS Thesis, 6 | ;;; Department of Computer Science and Engineering, University at Buffalo, 7 | ;;; Buffalo, NY, June 1, 2011. 8 | ;;; Based on 9 | ;;; Frances L. Johnson and Stuart C. Shapiro, Says Who?---Incorporating Source 10 | ;;; Credibility Issues into Belief Revision, Technical Report 99-08, 11 | ;;; Department of Computer Science and Engineering, University at Buffalo, 12 | ;;; Buffalo, NY, July 31, 1999. 13 | 14 | ;;; Use mode 1 15 | set-mode-1 16 | 17 | ;;; Show supports 18 | expert 19 | 20 | ;;; Always use automatic belief revision 21 | br-mode auto 22 | 23 | ;;; Use an explicit object-language source-credibility order 24 | ;;; based on IsBetterSource(s1, s2) 25 | set-order source 26 | 27 | ;;; Consult the user when an entrenchment tie needs to be broken. 28 | br-tie-mode manual 29 | 30 | ;;; There are four kinds of meetings: official meetings, classes, work meetngs, 31 | ;;; and social meetings. Any meeting will be of exactly one of these types. 32 | all(m)(meeting(m) => xor{official(m), class(m), work(m), social(m)}). 33 | 34 | ;;; Any meeting will be either in the morning or the afternoon, but not both. 35 | all(m)(meeting(m) => xor{in(m,morning), in(m,afternoon)}). 36 | 37 | ;;; If one person attends two different meetings, then one of the meetings has 38 | ;;; to be in the morning, and the other in the afternoon. 39 | all(m1,m2,p)({attends(m1,p), attends(m2,p)} &=> 40 | (in(m1,morning) <=> in(m2,afternoon))). 41 | 42 | ;;; Philip, Peter, and John will attend work meetings. 43 | all(m)(work(m) => {attends(m, Philip), attends(m, Peter), attends(m, John)}). 44 | 45 | ;;; w is a work meeting 46 | and{meeting(w), work(w)}. 47 | 48 | ;;; Peter prefers meetings in the morning. 49 | all(m)(meeting(m) => in(m,morning)). ; wff8 50 | HasSource(wff8, Peter). 51 | 52 | ;;; John prefers meetings in the afternoon. 53 | all(m)(meeting(m) => in(m,afternoon)). ; wff10 54 | HasSource(wff10, John). 55 | 56 | ;;; Philip prefers meetings in the morning. 57 | HasSource(wff8, Philip). 58 | 59 | ;;; Peter's preference outweighs John's preference. 60 | IsBetterSource(Peter, John). 61 | 62 | ;;; John's preference outweighs Philip's preference 63 | IsBetterSource(John, Philip). 64 | 65 | ;;; IsBetterSource is transitive. 66 | all(x,y,z)({IsBetterSource(x,y), IsBetterSource(y,z)} &=> IsBetterSource(x,z)). 67 | 68 | ;;; Note that unsourced assertions outweigh sourced assertions. 69 | 70 | ;;; The knowledge base so far: 71 | list-asserted-wffs 72 | 73 | ;;; When is the meeting? 74 | in(w,?when)? 75 | 76 | ;;; The revised knowledge base: 77 | list-asserted-wffs 78 | -------------------------------------------------------------------------------- /demo/snepslog/theorems.snlog: -------------------------------------------------------------------------------- 1 | expert 2 | set-mode-1 3 | 4 | ;a1- 5 | clearkb 6 | (p or p) => p ? 7 | 8 | ;a2- 9 | clearkb 10 | q => (p or q) ? 11 | 12 | ;a3- 13 | clearkb 14 | (p or q) => (q or p) ? 15 | 16 | ;a4- 17 | clearkb 18 | (q => r) => ((p or q) => (p or r)) ? 19 | 20 | ;pc13 lei da identidade 21 | clearkb 22 | thresh(1) {p, p}? 23 | 24 | ;pc14 25 | clearkb 26 | p => (p or q) ? 27 | 28 | ;pc15 29 | clearkb 30 | (p and q) => p ? 31 | 32 | ;pc16 33 | clearkb 34 | (p and q) => q ? 35 | 36 | ;pc17 37 | clearkb 38 | p => (q => p) ? 39 | 40 | ;pc18 41 | clearkb 42 | ~p => (p => q) ? 43 | 44 | ;pc19 lei da adjuncao 45 | clearkb 46 | p => (q => (p and q)) ? 47 | 48 | ;pc20 lei da permutacao 49 | clearkb 50 | thresh(1) {p => (q => r), q => (p => r)} ? 51 | 52 | ;pc21 lei do silogismo 1 53 | clearkb 54 | (p => q) =>((q => r) => (p => r))? 55 | 56 | ;pc22 lei do silogismo 2 57 | clearkb 58 | (q => r) => ((p => q) => (p => r))? 59 | 60 | ;pc23 lei da importacao 61 | clearkb 62 | (p => (q => r)) => ((p and q) => r)? 63 | 64 | ;pc 24 lei da exportacao 65 | clearkb 66 | ((p and q) => r) => (p => (q => r))? 67 | 68 | ;pc25 lei da composicao 69 | clearkb 70 | (p => q) => ((p => r) => (p => (q and r)))? 71 | 72 | ;pc26 73 | clearkb 74 | (p => q) => ((r => s) => ((p and r) => (q and s)))? 75 | 76 | ;pc27 77 | clearkb 78 | (p => r) => ((q => r) => ((p or q) => r))? 79 | 80 | 81 | ;pc28 Da' erro 82 | ;clearkb 83 | ;thresh(1) {thresh(1) {~p, q}, thresh(1) {p, ~q}}? 84 | 85 | ;pc29 Da' erro 86 | ;clearkb 87 | ;thresh(1) {thresh(1){p,q},thresh(1){~p, ~q}}? 88 | 89 | ;pc30 90 | clearkb 91 | thresh(1){~p => p, p}? 92 | 93 | ;pc31 94 | clearkb 95 | thresh(1) {(q => p) and (~q => p), p}? 96 | 97 | ;pc32 98 | clearkb 99 | thresh(1) {(p => q) and (p => ~q), ~p}? 100 | -------------------------------------------------------------------------------- /demo/snepslog/uvbr.snlog: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode:Common-Lisp; Base:10 -*- 2 | ;;; 3 | ;;; Demonstration of UBVR in action in SNePS-2 4 | ;;; from Appendix of 5 | ;;; S. C. Shapiro, 6 | ;;; Symmetric Relations, Intensional Individuals, and Variable Binding 7 | ;;; Proc. IEEE 74, 10(Oct. 1986), 1354-1363 8 | ;;; 9 | ;;; Start with an empty network 10 | clearkb 11 | set-mode-1 12 | 13 | ;;; 14 | ;;; Example 1: If x and y are brothers, then x likes y. 15 | ;;; 16 | Brothers({Bob, Joe, Harry}). 17 | all(b1,b2)(Brothers({b1,b2}) => Likes(b1,b2)). 18 | Likes(?b1,?b2)? 19 | ;;; 20 | ;;; Example 2: If a tract of the CNS is malfunctioning, adjacent 21 | ;;; tracts should be examined. 22 | ;;; 23 | all(tract1)({Tract(tract1), Malfunctioning(tract1)} 24 | &=> (all(tract2)({Tract(tract2), Adjacent({tract1,tract2})} 25 | &=> {Should-Examine(tract2)}))). 26 | Tract(16R). 27 | Tract(13RC8-C2). 28 | Adjacent({16R,13RC8-C2}). 29 | Malfunctioning(16R). 30 | Should-Examine(?tract)? 31 | ;;; 32 | ;;; Example 3: If an AND gate has high inputs and a low output, it is faulty. 33 | ;;; 34 | all(ag,i,i2,o)({And-Gate(ag),Gate(ag,{i,i2},o)} 35 | &=> ({High(i),High(i2),Low(o)} 36 | &=> {Faulty(ag)})). 37 | And-Gate(A1). 38 | Gate(A1,{A1inp1,A1inp2},A1outp). 39 | High(A1inp1). 40 | Low(A1inp2). 41 | Low(A1outp). 42 | And-Gate(A2). 43 | Gate(A2,{A2inp1,A2inp2},A2outp). 44 | High(A2inp1). 45 | High(A2inp2). 46 | Low(A2outp). 47 | Faulty(?g)? 48 | ;;; 49 | ;;; Example 4: Elephants hate each other. 50 | ;;; 51 | Elephant(Clyde). 52 | Elephant(Jumbo). 53 | all(e1,e2)({Elephant(e1), Elephant(e2)} &=> {Hates(e1,e2)}). 54 | Hates(?e1,?e2)? 55 | -------------------------------------------------------------------------------- /demo/snere/arcinfo/arcloop: -------------------------------------------------------------------------------- 1 | #! /bin/csh -f 2 | # 3 | # This script runs ARC, starts up the command loop 4 | # and automatically exits once the loop terminates 5 | # 6 | 7 | set interfacedir = /u0/grads/hans/interface 8 | set snactordir = /u0/grads/hans/snactor 9 | 10 | arc < ::= OPEN | CLOSED 45 | ; 46 | ; ----------------------------------------------------------------------------- 47 | ; RECOGNIZERS is.valve : --> 48 | ; 49 | ; ============================================================================= 50 | ; 51 | ; is.valve 52 | ; -------- 53 | ; 54 | ; arguments : u - 55 | ; 56 | ; returns : 57 | ; 58 | ; description : returns "true" if "u" is a , "false" otherwise 59 | ; 60 | ; written : rgh 11/18/85 61 | ; modified: 62 | ; 63 | ; 64 | (defmacro is.valve (u) 65 | `(and (atom ,u) 66 | (or (eq ,u 'OPEN) 67 | (eq ,u 'CLOSED)))) 68 | ; 69 | ; 70 | ; ============================================================================= 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /multi/exports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: MULTI; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: exports.lisp,v 1.2 2013/08/28 19:07:23 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :multi) 40 | 41 | 42 | ;;; Globals used in process registers 43 | (defvar *QUEUES*) 44 | (defvar *NAME*) 45 | (defvar *PRIORITY*) 46 | (defvar *use-one-queue-only*) 47 | 48 | (export '(dp evnts in-trace ev-trace unin-trace unev-trace regfetch 49 | regstore new initiate schedule multip *QUEUES* *NAME* 50 | *PRIORITY* *use-one-queue-only* clear-all-queues 51 | new-process-name process-change-slots)) 52 | 53 | ;;; 23 Feb 2011 ABCL-specfic code to fix bug: 54 | ;;; When SNePS commands were later defined for these symbols via 55 | ;;; defsnepscom, ABCL 0.24.0 was crashing when defsnepscom called 56 | ;;; shadowing-import. Importing them with shadowing-import initially 57 | ;;; solves the problem. - JPB 58 | #+abcl (shadowing-import '(in-trace ev-trace unev-trace unin-trace) (find-package 'snepsul)) 59 | #-abcl (import '(in-trace ev-trace unev-trace unin-trace) (find-package 'snepsul)) 60 | 61 | 62 | 63 | (in-package :dequeue) 64 | 65 | (export '(empty front delete-front insert-rear new insert-front 66 | in-queue queue-length)) 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /multi/imports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: MULTI; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: imports.lisp,v 1.2 2013/08/28 19:07:23 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :multi) 40 | 41 | 42 | (import '(sneps:defsnepscom)) 43 | 44 | (import 'sneps:build-namestring) ;; added for acl6 compatibility(FLJ) 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /nlint/define.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;;; Copyright (C) 1984--2013 4 | ;;; Research Foundation of State University of New York 5 | 6 | ;;; Version: $Id: define.lisp,v 7 | 8 | ;;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | (define member 38 | class 39 | before after 40 | name 41 | named 42 | which 43 | adj 44 | agent 45 | verb 46 | object 47 | lex 48 | stime 49 | etime) 50 | 51 | (build stime now) = now 52 | 53 | (^ (defun add-indef (phrase) 54 | (let ((string-phrase (cond ((listp phrase) (princ-to-string (car phrase))) 55 | (t (princ-to-string phrase))))) 56 | (cond ((member (char string-phrase 0) '("a" "e" "i" "o" "u") :test 'string-equal) 57 | (append '(|an|) (listify phrase))) 58 | (t (append '(\a) (listify phrase)))))) 59 | ) 60 | 61 | (^ (defun mylength (s) 62 | (cond ((null s) 0) 63 | ((atom s) 1) 64 | (t (1+ (mylength (cdr s))))))) 65 | -------------------------------------------------------------------------------- /nlint/englex/imports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: ENGLEX; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: imports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :englex) 40 | 41 | 42 | (import '(sneps:defsnepscom parser::mem*)) 43 | 44 | (import 'sneps:build-namestring) ;; for acl6 (FLJ) 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /nlint/englex/negatives.text: -------------------------------------------------------------------------------- 1 | a 2 | barely 3 | but 4 | cannot 5 | counter 6 | de 7 | di 8 | dis 9 | doubt 10 | either 11 | fail 12 | few 13 | hardly 14 | il 15 | ill 16 | im 17 | in 18 | infrequently 19 | ir 20 | less 21 | little 22 | negligible 23 | neither 24 | never 25 | no 26 | nobody 27 | non 28 | none 29 | nor 30 | not 31 | nothing 32 | occasionally 33 | off 34 | only 35 | rarely 36 | scarely 37 | seldom 38 | stop 39 | un 40 | 41 | 42 | References: 43 | 44 | Reference Guide To English by Maclin 45 | 46 | The Holt Guild To English by William F. Irmscher 47 | 48 | The English Language by W. N. Francis 49 | 50 | The Random House Handbook by F. Crews 51 | 52 | College Handbook Of Composition by E. Wollen, F. Scott and F. Bracher 53 | 54 | Prose Style by W. Stone 55 | 56 | Handbook Of Current English by Perin Smith Corder 57 | -------------------------------------------------------------------------------- /nlint/englex/readme.text: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | New features created for englex: exporting created word information; all 3 | suffixes are experts; de-prefixation (and beginning word removal) works; 4 | and tracing works. 5 | ------------------------------------------------------------------------------- 6 | 7 | 1)englex.lisp: This file represents all the changes I have made to 8 | the englex package to date. 9 | 10 | 2)englex.s3bin is the compile version of (1). 11 | 12 | 3)homographs : is a file that describes how all the homographs work as 13 | experts. i.e., all homographs of a suffix are well represented (I 14 | modified 20 of the homograph suffixes [and word endings]), and 15 | feature-lists can have more than one ctgy feature. 16 | 17 | 4)endofwords : now contains example words for the 5 new suffix endings; 18 | example words for the new pattern of word for the suffix es; also the 19 | suffix en has more example words. 20 | 21 | 5)startofwords : Now has a small note that briefly describes how 22 | prefixes, and word beginnings are currently handled by englex. 23 | 24 | 25 | < Below are descriptions of the 5 log files of changes to the original 26 | (or latest) englex package to get (1) above. > 27 | 28 | 6)1_log-file : is a file describing the changes made to Hans's old 29 | lenglex package. i.e, it describes adding new suffixes and minor 30 | patches (such as working on suffix ing, making sure [lookup "axes"] 31 | works, "ability" is a suffix and really not used as a word). 32 | 33 | 7)2_Export_New_Word-Log : is a file to be appended to (5) above. This 34 | file explains how I implemented exportation for new word information 35 | (like macro lexin). i.e., It uses a call to routine definewords. 36 | 37 | 8)3_Expert-Log : is a file to be appended to (5) above also. The 38 | changes described here make englex a expert. (i.e., descriptions of 39 | modification of about 15 suffixes and 5 word endings.) To see which 40 | have changed just compare the old homograph file with the one in 41 | this directory. 42 | 43 | 9)4_Prefix-Log : is a small file describing how I finally improved 44 | de-prefixation, and beginning word removal. 45 | (Also, using geth call instead of lexic call in 2 places.) 46 | 47 | 10)5_Trace-Log : describes implementing tracing. eg: (lookup "word" t). 48 | 49 | 1)readme is this file. 50 | -------------------------------------------------------------------------------- /nlint/englex/related-forms.text: -------------------------------------------------------------------------------- 1 | ____________________________________________________________________________ 2 | Implemented Suffix Corresponding Unimplemented Related Form(s) 3 | ____________________________________________________________________________ 4 | fic fice 5 | 6 | ergic ergetical, ergetically, ergy; ergies (plural) 7 | 8 | fend fense, fensive 9 | 10 | ard arts (plural) 11 | 12 | ize iser, isation 13 | 14 | an eanly; eans (plurals) 15 | 16 | en nly 17 | 18 | tain tention, tenance, tinence 19 | 20 | ion ia (plural) 21 | 22 | itis itides (plural) 23 | 24 | ous osity 25 | 26 | ment mentum (singular);menta, menti (plurals) 27 | 28 | fy (i)fice 29 | 30 | ary arium, aria 31 | _______________________________________________________________________________ 32 | 33 | References: Same As Appendix A. 34 | -------------------------------------------------------------------------------- /nlint/englex/wordize.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: ENGLEX; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: wordize.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :englex) 40 | 41 | 42 | (defun wordize (numbr lexeme) 43 | "Returns the singular or plural form of the 2nd arg according to the 44 | feature given as the 1st arg." 45 | (let* ((lex (first-atom lexeme)) 46 | (lexeme (typecase lex 47 | (string lex) 48 | (symbol (symbol-name lex)) 49 | (sneps::node (symbol-name (sneps::node-na lex)))))) 50 | (cond ((null numbr) (or (lookup-lexical-feature 'root lexeme) lexeme)) 51 | ((eq numbr 'sing) (or (lookup-lexical-feature 'root lexeme) lexeme)) 52 | ((lookup-lexical-feature 'plur lexeme)) 53 | (t (pluralize (or (lookup-lexical-feature 'root lexeme) lexeme)))))) 54 | 55 | (defun pluralize (wform) 56 | (let ((wlength (1- (length wform))) 57 | (vowls '(#\a #\e #\i #\o #\u))) 58 | (cond ((char= (schar wform wlength) #\f) 59 | (concatenate 'string (subseq wform 0 wlength) "ves")) 60 | ((char= (schar wform wlength) #\y) 61 | (cond ((member (schar wform (1- wlength)) vowls :test #'char=) 62 | (concatenate 'string wform "s")) 63 | (t 64 | (concatenate 'string (subseq wform 0 wlength) "ies")))) 65 | ((string= (subseq wform (- wlength 2) (1+ wlength)) "sis") 66 | (concatenate 'string (subseq wform 0 (1- wlength)) "es")) 67 | ((or (char= (schar wform wlength) #\x) 68 | (char= (schar wform wlength) #\s) 69 | (char= (schar wform wlength) #\z) 70 | (and (char= (schar wform wlength) #\o) 71 | (not (member (schar wform (1- wlength)) vowls 72 | :test #'char=))) 73 | (and (char= (schar wform wlength) #\h) 74 | (char= (schar wform (1- wlength)) #\c))) 75 | (concatenate 'string wform "es")) 76 | (t (concatenate 'string wform "s"))))) 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /nlint/lexicon-2.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;;; Copyright (C) 1984--2013 4 | ;;; Research Foundation of State University of New York 5 | 6 | ;;; Version: $Id: lexicon-2.lisp,v 7 | 8 | ;;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | ("a" ((ctgy . det))) 38 | ("an" ((ctgy . det))) 39 | ("ant" ((ctgy . n))) 40 | ("animal" ((ctgy . n))) 41 | ("bat" ((ctgy . n))) 42 | ("be" ((ctgy . v))) 43 | ("believe" ((ctgy . v)(prop-att . t))) 44 | ("Bill" ((ctgy . npr)(gen . m))) 45 | ("car" ((ctgy . n))) 46 | ("Carol" ((ctgy . npr)(gen . f))) 47 | ("cat" ((ctgy . n))) 48 | ("dog" ((ctgy . n))) 49 | ("elk" ((ctgy . n))) 50 | ("fox" ((ctgy . n))) 51 | ("girl" ((ctgy . n))) 52 | ("gnu" ((ctgy . n))) 53 | ("Guatemalan" ((ctgy . adj))) 54 | ("he" ((ctgy . pron))) 55 | ("Hector" ((ctgy . npr)(gen . m))) 56 | ("hen" ((ctgy . n))) 57 | ("is" ((ctgy . v)(root . "be")(num . sing)(tense . pres))) 58 | ("it" ((ctgy . pron))) 59 | ("John" ((ctgy . npr)(gen . m))) 60 | ("Lucy" ((ctgy . npr)(gen . f))) 61 | ("man" ((ctgy . n)(plur . "men"))) 62 | ("Mary" ((ctgy . npr)(gen . f))) 63 | ("men" ((ctgy . n)(root . "man")(num . plur))) 64 | ("mortal" ((ctgy . adj))) 65 | ("old" ((ctgy . adj))) 66 | ("owl" ((ctgy . n))) 67 | ("pear" ((ctgy . n))) 68 | ("pet" ((ctgy . n))) 69 | ("people" ((ctgy . n)(root . "person")(num . plur))) 70 | ("person" ((ctgy . n)(plur . "people"))) 71 | ("philosophical" ((ctgy . adj))) 72 | ("pick" ((ctgy . v))) 73 | ("poor" ((ctgy . adj))) 74 | ("rat" ((ctgy . n))) 75 | ("rich" ((ctgy . adj))) 76 | ("saw" ((ctgy . n)(root . "saw1")) 77 | ((ctgy . v)(root . "see")(tense . past))) 78 | ("saw1" ((ctgy . n)(root . "saw"))) 79 | ("see" ((ctgy . v)(past . "saw")(pastp . "seen"))) 80 | ("seen" ((ctgy . v)(root . "see")(tense . pastp)(pprt . t))) 81 | ("she" ((ctgy . pron))) 82 | ("smart" ((ctgy . adj))) 83 | ("Socrates" ((ctgy . npr)(gen . m))) 84 | ("sow" ((ctgy . n))) 85 | ("Stu" ((ctgy . npr)(gen . m))) 86 | ("sweet" ((ctgy . adj))) 87 | ("tall" ((ctgy . adj))) 88 | ("that" ((ctgy . conj))) 89 | ("the" ((ctgy . det))) 90 | ("the-editor-of-Byte" ((ctgy . npr)(gen m f))) 91 | ("this" ((ctgy . demon))) 92 | ("what" ((ctgy . pron))) 93 | ("was" ((ctgy . v)(root . "be")(num . sing)(tense . past))) 94 | ("who" ((ctgy . pron))) 95 | ("wise" ((ctgy . adj))) 96 | ("yak" ((ctgy . n))) 97 | ("young" ((ctgy . adj))) 98 | 99 | -------------------------------------------------------------------------------- /nlint/parser/exports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: PARSER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: exports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :parser) 40 | 41 | 42 | ;;; Export the following symbols from the PARSER package. 43 | 44 | (export 's) ; "S" is the start state of the parser. 45 | 46 | (export '(*config* *trace-level* *parse-trees* *all-parses* 47 | *terminating-punctuation-flag* 48 | *punct-chars* *white-space* *quote-chars* *escape-chars* 49 | break-arc unbreak-arc 50 | *input-redirect-stream* *lexentry* *atn-arcs-hashtable* 51 | setr getr sendr liftr current-configuration packageless-equal 52 | buildq lexin parse atnin talk getarcs putarc geta addr 53 | overlap disjoint nullr endofsentence addl flatten parser-print 54 | atnreadln convertline list-to-type nl-tell 55 | hold to jump cat vir wrd rcall call tst group push pop lex I understand 56 | that)) 57 | 58 | (import '( *trace-level* putarc getarcs overlap disjoint 59 | endofsentence buildq pconcat 60 | geta addr addl setr sendr liftr getr nullr 61 | hold to jump cat vir wrd rcall tst group 62 | definenet parse lex I understand that 63 | break-arc unbreak-arc current-configuration 64 | *all-parses* *parse-trees* *terminating-punctuation-flag* 65 | *punct-chars* *white-space* *quote-chars* *escape-chars* 66 | packageless-equal) 67 | (find-package 'snepsul)) 68 | 69 | ;;; 23 Feb 2011 ABCL-specific code to fix bug: 70 | ;;; When a SNePS command was later defined for atnin via 71 | ;;; defsnepscom, ABCL 0.24.0 was crashing when defsnepscom called 72 | ;;; shadowing-import. Importing atnin initially with shadowing-import 73 | ;;; solves the problem. - JPB 74 | #+abcl (shadowing-import 'atnin (find-package 'snepsul)) 75 | #-abcl (import 'atnin (find-package 'snepsul)) 76 | 77 | (shadowing-import '(call getf push pop) (find-package 'snepsul)) 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /nlint/parser/imports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: PARSER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: imports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :parser) 40 | 41 | 42 | ;;; Import the following symbols into the PARSER package from 43 | ;;; the SNePS package. 44 | 45 | (import '(sneps:|#| sneps:% sneps:$ sneps:^ 46 | sneps:define 47 | ; sneps:test sneps::using-reader-macro-characters 48 | sneps:defsnepscom 49 | snip:deduce snip:add 50 | englex:get-lexical-feature englex:first-atom englex:flistify 51 | englex:lookup englex:lookup-lexical-feature englex:*lexicon* 52 | englex:verbize 53 | englex:wordize 54 | snepsul:s)) 55 | 56 | (shadowing-import '(sneps::find sneps:|*| sneps:!)) 57 | 58 | (shadow 'cl:getf) 59 | 60 | (import 'sneps:build-namestring) ;; for acl6 (FLJ) 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /packages.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: USER; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: packages.lisp,v 1.2 2013/08/28 19:07:21 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :cl-user) 40 | 41 | 42 | (defvar *sneps-packages* 43 | '(:logical-pathname 44 | :sneps 45 | :dequeue 46 | :multi 47 | :match 48 | :snip 49 | :snebr 50 | :snepslog 51 | :englex 52 | :parser 53 | :snepsul) 54 | "The list of packages used by the SNePS system") 55 | 56 | 57 | ;; Create all packages: 58 | ;; 59 | (dolist (package *sneps-packages*) 60 | (unless (find-package package) 61 | (make-package package :use '(:cl)))) 62 | 63 | ;; Shadow various symbols inherited from the LISP package: 64 | ;; 65 | (shadow '(find describe + - * ^ = > assert load 66 | #+clisp !) 67 | (find-package 'sneps)) 68 | 69 | (shadow '(print delete) 70 | (find-package 'dequeue)) 71 | 72 | (shadow '(conjugate getf) 73 | (find-package 'englex)) 74 | 75 | (shadow '(* call getf push pop) 76 | (find-package 'parser)) 77 | 78 | ;; Export some system utilities: 79 | ;; 80 | (export '(sneps-translate sneps-load 81 | sneps-probe-file simple-system-created-p) 82 | (find-package 'cl-user)) 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /snebr/exports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEBR; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: exports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snebr) 40 | 41 | 42 | (export '(ck-contradiction *br-auto-mode* *br-tie-mode* *most-entrenched-props* 43 | *order-cache* ck-inconsistency set-order br-mode br-tie-mode)) 44 | 45 | ;(import '(snip:deduce snip:add) (find-package 'sneps)) 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /snebr/imports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEBR; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: imports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snebr) 40 | 41 | 42 | (import '(sneps:is.n sneps:describe.n sneps:nodeset.n sneps:node-to-number.n 43 | sneps:new.ns sneps:isnew.ns sneps:ismemb.ns sneps:nodeaccess sneps:node sneps:node-asupport 44 | sneps:choose.ns sneps:others.ns sneps:makeone.ns sneps:union.ns 45 | sneps:remove.ns sneps:cardinality.ns sneps:insert.ns sneps:compl.ns)) 46 | 47 | (import '(sneps:is.ct sneps:new.cts sneps:isnew.cts sneps:ismemb.cts 48 | sneps:choose.cts sneps:others.cts sneps:makeone.cts sneps:union.cts 49 | sneps:insert.cts sneps:remove.cts sneps:cardinality.cts sneps:issubset.cts 50 | sneps:ctcs-to-cts sneps:update-contexts sneps:repeat sneps:buildcontext 51 | sneps:ok-update-contexts sneps:fullbuildcontext sneps:clear-infer 52 | sneps:value.sv sneps:name.ct sneps:isassert.n sneps:context-hyps 53 | sneps:defsnepscom)) 54 | 55 | (import '(sneps:arg sneps:arg-)) 56 | 57 | (import 'sneps:build-namestring) ;; for acl6 (FLJ) 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /sneps/ds/file.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: file.lisp,v 1.2 2013/08/28 19:07:25 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | ; ============================================================================= 43 | ; Data Type: ::= ( ... ) 44 | ; ============================================================================= 45 | ; 46 | ; 47 | ; ============================================================================= 48 | ; 49 | ; isendoffile 50 | ; ----------- 51 | ; 52 | ; arguments : inunit - 53 | ; 54 | ; returns : 55 | ; 56 | ; description : Tests "inunit" for end-of-file and 57 | ; returns "true" if EOF(), else "false". 58 | ; 59 | ; written : jgn 10/7/83 60 | ; modified: 61 | ; 62 | ; 63 | ;(defmacro isendoffile (inunit) 64 | ; `(eq (tyipeek ,inunit) -1)) 65 | ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 | (defmacro isendoffile (inunit) 67 | `(eq (peek-char nil ,inunit nil -1) -1)) 68 | ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69 | ; 70 | ; 71 | ; ============================================================================= 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /sneps/ds/node0.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: node0.lisp,v 1.3 2013/08/28 19:07:25 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | ; ============================================================================= 43 | ; Data Type: 44 | ; ============================================================================= 45 | ; 46 | 47 | (defstruct (node 48 | (:print-function node-printer) 49 | ) 50 | (na nil) ; Node Access, nil if this is a temporary node 51 | (order nil) ; Node order. A positive integer corresponding to 52 | ; the prder of creation. Added HI 3/20/99. 53 | (type ':unknown) ; Node type. Possibilities are :base :mol :var :pat :unknown 54 | ; NOTE: type :unknown can also appear from read.fcs -- ssc 02/26/87 55 | (perm nil) ; Flag. T if node is permanent. 56 | (height 0) ; Length of longest descending path 57 | (freevars nil) ; The sneps variable nodes that are free in this node. 58 | (fcableset nil) ; The node's flat-cable-set (a disembodied property list). 59 | (gi-node nil) ; The ginseng node for displaying this node graphically. 60 | (activation nil) ; the process associated with this node. 61 | (asupport nil) ; The assumption-support. 62 | (jsupport nil) ; The justification-support. 63 | (contexts nil) ; The contexts where the node is present as an hyp. 64 | (snepslog nil)) ; the snepslog version of this node pam 89/1/3 65 | 66 | 67 | (defun node-printer (obj stream depth) 68 | (declare (ignore depth)) 69 | ;; 70 | ;; Test whether CRNTCT is bound, because if it is not (due to some 71 | ;; sneps bug) debugging (inspecting, tracing) doesn't work because 72 | ;; these functions try to print nodes using this print function 73 | ;; 74 | ;; (buildcontext nil) = (buildcontext (new.ns)) 75 | ;; it was used nil because this file has to be loaded before 76 | ;; macro new.ns. 77 | ;; 78 | (let ((crntct (if (boundp 'crntct) crntct (buildcontext nil)))) 79 | (declare (special crntct)) 80 | (prin1 (node-na obj) stream) 81 | (if (isassert.n obj) (write-string "!" stream)))) 82 | -------------------------------------------------------------------------------- /sneps/ds/nodeset2.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: nodeset2.lisp,v 1.2 2013/08/28 19:07:25 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; exist-assertion.ns 45 | ; ------------------- 46 | ; 47 | ; 48 | ; 49 | (defmacro exist-assertion.ns (ns) 50 | `(do.ns (n ,ns nil) 51 | (when (isassert.n n) 52 | (return t)))) 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /sneps/fns/findhelp.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: findhelp.lisp,v 1.2 2013/08/28 19:07:25 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | (defconstant *path-specifiers* 43 | '(converse compose kstar kplus or and not relative-complement 44 | irreflexive-restrict exception domain-restrict 45 | range-restrict ) 46 | " A list of all of the available path constructors.") 47 | 48 | (defun is.qv (qv) 49 | (and (consp qv) (eq (car qv) '?))) 50 | 51 | (defmacro svar.qv (qv) 52 | `(second ,qv)) 53 | 54 | (defmacro is.p (p) 55 | `(and (consp ,p) 56 | (or (is.r (car ,p)) 57 | (member (car ,p) ',*path-specifiers*)))) 58 | 59 | (defmacro rel-to-path (r) 60 | `(or (get ,r :pathdef) (list ,r))) 61 | 62 | (defun is.nsf (nsf) 63 | (or (consp nsf) (atom nsf))) 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /sneps/fns/intext.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: intext.lisp,v 1.2 2013/08/28 19:07:25 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | ;;; These shadowing, exporting, and importing operations should go 41 | ;;; into the appropriate exports and imports files 42 | ;;; But they can't because that would mess up the loading of the SNePS system 43 | 44 | (export 'load) 45 | (shadowing-import 'load :snepslog) 46 | 47 | 48 | ;; intext 49 | ;; ------ 50 | ;; 51 | ;; arguments : file - 52 | ;; 53 | ;; returns : 54 | ;; 55 | ;; description : User function to be called from the Sneps 56 | ;; environment. It opens FILE and uses it as the 57 | ;; source of the input stream for the read-eval-print 58 | ;; loop of Sneps until encountering eof on FILE. 59 | ;; FILE is then closed and the source of input 60 | ;; used prior to opening FILE is reinstated as 61 | ;; the source of input stream (just like demo 62 | ;; but no input echoing). 63 | ;; 64 | ;; side-effects : It changes the source of input and it prints 65 | ;; a message at the beginning and the end. 66 | ;; 67 | ;; written : jgn 09/01/83 68 | ;; modified: ejm 02/28/84, 06/01/84 69 | ;; hc 11/22/91 70 | ;; hc 07/18/93 71 | ;; 72 | (defsnepscom intext ((file)) 73 | (declare (special outunit)) 74 | (format outunit "~&Loading file ~A.~%" file) 75 | (load file :format :snepsul) 76 | (values)) 77 | -------------------------------------------------------------------------------- /sneps/fns/svfns.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: svfns.lisp,v 1.2 2013/08/28 19:07:26 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | ; ========================================================================== 43 | ; 44 | ; * 45 | ; - 46 | ; 47 | ; arguments : sv - 48 | ; 49 | ; returns : 50 | ; 51 | ; description : Gets the value of the sneps variable "sv". 52 | ; This value is a , and is one of the 53 | ; following: , , , 54 | ; or . 55 | ; 56 | ; written: CCC 08/02/83 57 | ; modified: ejm 10/23/83 58 | ; njm 04/28/89 59 | ; hc 07/18/93 60 | ; 61 | (defsnepscom * ((id) (top ns bns tbns fns rs) t) 62 | (values (value.sv id) (value.sv 'defaultct))) 63 | 64 | 65 | ; ========================================================================== 66 | ; 67 | ; $ 68 | ; - 69 | ; 70 | ; arguments : sv - 71 | ; 72 | ; returns : 73 | ; 74 | ; description : Creates a new , which 75 | ; becomes the value of the "sv". 76 | ; 77 | ; side-effects : Adds the new variable node to the value of 78 | ; "varnodes". 79 | ; 80 | ; written : CCC 08/02/83 81 | ; modified: ejm 10/11/83 82 | ; hc 07/18/93 83 | ; 84 | (defsnepscom $ ((id) (bns) t) 85 | (let ((svar (genpvar.n))) 86 | (setf (node-snepslog svar) id) 87 | (set.sv id (makeone.ns svar)))) 88 | 89 | ; ========================================================================== 90 | ; 91 | 92 | 93 | (defsnepscom |#| ((id) $ t) 94 | (set.sv id (makeone.ns (genpbase.n)))) 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /sneps/fns/tconc.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: tconc.lisp,v 1.2 2013/08/28 19:07:26 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | (defstruct tconc car cdr) 43 | 44 | (defun tconc (tconc-cell s-exp) 45 | (prog ((list-s-exp (list s-exp))) 46 | (cond ((eql tconc-cell nil) 47 | (setq tconc-cell (make-tconc :car list-s-exp 48 | :cdr list-s-exp))) 49 | ((tconc-p tconc-cell) 50 | (rplacd (tconc-cdr tconc-cell) list-s-exp) 51 | (setf (tconc-cdr tconc-cell) list-s-exp)) 52 | (t (error "~a is not a tconc cell. ~%" tconc-cell)))) 53 | tconc-cell) 54 | 55 | (defun lconc (tconc-cell list) 56 | (cond ((eql tconc-cell nil) 57 | (setq tconc-cell (make-tconc :car list 58 | :cdr (last list)))) 59 | ((tconc-p tconc-cell) 60 | (rplacd (tconc-cdr tconc-cell) list) 61 | (setf (tconc-cdr tconc-cell) (last list))) 62 | (t (error "~a is not a tconc cell. ~%" tconc-cell))) 63 | tconc-cell) 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /sneps/imports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: imports.lisp,v 1.2 2013/08/28 19:07:24 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :sneps) 40 | 41 | 42 | ;;; Import the following symbols into the SNePS Package. 43 | 44 | #+symbolics (shadowing-import 'scl::beep (find-package 'sneps)) 45 | 46 | (import 'snip:act) 47 | 48 | (import 'snip:*infertrace*) 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /snepslog/exports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPSLOG; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: exports.lisp,v 1.2 2013/08/28 19:07:26 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snepslog) 40 | 41 | 42 | ;;; Export the following symbols from the SNePSLOG package. 43 | 44 | (export '( atnin 45 | surface slight-surface node-intern sneps-node? 46 | snepslogreadon snepslogreadoff *SNePSLOGRunning* 47 | snepslog-read snepslog-print node-to-text *fluents* 48 | Tell Ask Askifnot Askwh Askwhnot forEachSub)) 49 | 50 | (shadowing-import '(trace untrace) 51 | (find-package 'snepsul)) 52 | 53 | (import '(expert normal trace-atn untrace-atn clearkb set-mode-1 set-mode-2 54 | Tell Ask Askifnot Askwh Askwhnot) 55 | (find-package 'snepsul)) 56 | 57 | (export '(fluent source explicit null-order)) 58 | 59 | -------------------------------------------------------------------------------- /snip/ds/filter.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: filter.lisp,v 1.2 2013/08/28 19:07:26 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; ::= 45 | ; 46 | ; ----------------------------------------------------------------------------- 47 | ; 48 | ; PRIMITIVE new.filter : --> 49 | ; ELEMENTS 50 | ; 51 | ; RECOGNIZERS is.filter : --> 52 | ; 53 | ; ============================================================================= 54 | ; 55 | ; new.filter 56 | ; ---------- 57 | ; 58 | ; returns : 59 | ; 60 | ; description : returns a "new" 61 | ; 62 | ; written : rgh 11/18/85 63 | ; modified: 64 | ; 65 | ; 66 | (defmacro new.filter () 67 | `(new.sbst)) 68 | ; 69 | ; 70 | ; ============================================================================= 71 | ; 72 | ; is.filter 73 | ; --------- 74 | ; 75 | ; arguments : u - 76 | ; 77 | ; returns : 78 | ; 79 | ; description : returns "true" if "u" is a , "false" otherwise 80 | ; 81 | ; written : rgh 11/18/85 82 | ; modified: 83 | ; 84 | ; 85 | (defmacro is.filter (u) 86 | `(is.sbst ,u)) 87 | ; 88 | ; 89 | ; ============================================================================= 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /snip/ds/sign.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: sign.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; ::= POS | NEG 45 | ; 46 | ; ============================================================================= 47 | ; 48 | ; RECOGNIZERS is.sign : --> 49 | ; 50 | ; TESTS iseq.sign : x --> 51 | ; 52 | ; ============================================================================= 53 | ; 54 | ; is.sign 55 | ; ------- 56 | ; 57 | ; arguments : u - 58 | ; 59 | ; returns : 60 | ; 61 | ; description : returns "true" if "u" is a , "false" otherwise 62 | ; 63 | ; written : rgh 11/10/85 64 | ; modified: 65 | ; 66 | ; 67 | (defmacro is.sign (u) 68 | `(and (atom ,u) 69 | (or (eq ,u 'POS) 70 | (eq ,u 'NEG)))) 71 | ; 72 | ; 73 | ; ============================================================================= 74 | ; 75 | ; iseq.sign 76 | ; --------- 77 | ; 78 | ; arguments : s1 - 79 | ; s2 - 80 | ; 81 | ; returns : 82 | ; 83 | ; description : returns "true" if "s1" and "s2" are equal 84 | ; 85 | ; written : rgh 11/30/85 86 | ; modified: 87 | ; 88 | ; 89 | (defmacro iseq.sign (s1 s2) 90 | `(eq ,s1 ,s2)) 91 | ; 92 | ; 93 | ; ============================================================================= 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /snip/ds/switch.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: switch.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; ::= 45 | ; 46 | ; ----------------------------------------------------------------------------- 47 | ; 48 | ; PRIMITIVE new.switch : --> 49 | ; ELEMENTS 50 | ; 51 | ; RECOGNIZERS is.switch : --> 52 | ; 53 | ; ============================================================================= 54 | ; 55 | ; new.switch 56 | ; ---------- 57 | ; 58 | ; returns : 59 | ; 60 | ; description : returns a "new" 61 | ; 62 | ; written : rgh 11/18/85 63 | ; modified: 64 | ; 65 | ; 66 | (defmacro new.switch () 67 | `(new.sbst)) 68 | ; 69 | ; 70 | ; ============================================================================= 71 | ; 72 | ; is.switch 73 | ; --------- 74 | ; 75 | ; arguments : u - 76 | ; 77 | ; returns : 78 | ; 79 | ; description : returns "true" if "u" is a , "false" otherwise 80 | ; 81 | ; written : rgh 11/18/85 82 | ; modified: 83 | ; 84 | ; 85 | (defmacro is.switch (u) 86 | `(is.sbst ,u)) 87 | ; 88 | ; 89 | ; ============================================================================= 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /snip/exports.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: exports.lisp,v 1.2 2013/08/28 19:07:26 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | (export '(perform deduce add dynamic-add *infertrace* *plantrace* 43 | *depthCutoffBack* *depthCutoffForward* user high low plantrace 44 | describe-one-node addsupport.n filter.sup new.sup insert.sup 45 | combine-ots* crntctname 46 | Stop-Handled-by-Contradiction-Handler 47 | *use-intensional-contexts* 48 | 49 | 50 | slight-describe-or-surface slight-describe-or-surface.ns 51 | describe-or-surface describe-or-surface.ns node-description.n 52 | 53 | act define-primaction attach-primaction 54 | declare-primitive schedule-act 55 | 56 | achieve believe disbelieve adopt unadopt snsequence snif 57 | sniterate forget do-one do-all withsome withall 58 | 59 | pos neg define-attachedFunction attach-function attachedfunction)) 60 | 61 | ;;; 23 Feb 2011 ABCL-specific code to fix bug: 62 | ;;; When SNePS commands were later defined for these symbols via 63 | ;;; defsnepscom, ABCL 0.24.0 was crashing when defsnepscom called 64 | ;;; shadowing-import. Importing them with shadowing-import initially 65 | ;;; solves the problem. - JPB 66 | #+abcl (shadowing-import '(perform deduce add dynamic-add) 67 | (find-package 'snepsul)) 68 | #-abcl (shadowing-import '(perform deduce add dynamic-add) 69 | (find-package 'snepsul)) 70 | 71 | (import '( *infertrace* *plantrace* 72 | *use-intensional-contexts* 73 | *depthCutoffBack* *depthCutoffForward* 74 | 75 | achieve believe disbelieve adopt unadopt snsequence snif 76 | sniterate forget do-one do-all withsome withall schedule-act 77 | define-primaction attach-primaction declare-primitive 78 | 79 | define-attachedFunction attach-function attachedfunction) 80 | (find-package 'snepsul)) 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /snip/fns/do-all.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: do-all.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | ;;; 42 | ;;; Representation 43 | ;;; 44 | ;;; act = action act-node 45 | ;;; objecti ith-argument to act-node 46 | 47 | ;;; Added the check for no acts to be done. scs 11/2/06 48 | (defun do-all (n) 49 | "Schedules the performing of all the actions on the queue." 50 | (let ((all-acts (sneps::pathfrom '(snepsul::object1) n)) 51 | (pr (activation.n n))) 52 | (plantrace "Now doing: DO-ALL " all-acts nil) 53 | (cond (all-acts 54 | (do.ns (act all-acts) 55 | (schedule-act act))) 56 | (t (plantrace "Nothing to do" (new.ns) nil))) 57 | (regstore pr '*AGENDA* 'DONE))) 58 | 59 | -------------------------------------------------------------------------------- /snip/fns/do-if.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: do-if.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; DO-IF functions 43 | ; 44 | (defun rule-handler.do-if (ant-act cqch) 45 | (let ((sensory-act (choose.ns (makeone.ns 46 | (match::applysubst (choose.ns ant-act) 47 | (filter.ch cqch))))) 48 | pr) 49 | (remark `"~%Since" (makeone.ns *NODE*) nil) 50 | (remark `"~%I will perform" (makeone.ns sensory-act) nil) 51 | (activate.n sensory-act) 52 | (setq pr (activation.n sensory-act)) 53 | (regstore pr '*PRIORITY* 'INTEND) 54 | (regstore pr '*AGENDA* 'START) 55 | (multi:schedule pr multi::*act-queue*) 56 | t)) 57 | 58 | ; 59 | ; ============================================================================= 60 | ; 61 | 62 | (defun usability-test.do-if (sign) 63 | (declare (special *NODE*)) 64 | (and (eq sign 'POS) 65 | (or (isnew.ns (quantified-vars.n *NODE*)) 66 | (not (isnew.ns (nodeset.n *NODE* 'sneps::forall)))))) 67 | 68 | 69 | ; 70 | ; 71 | ; ============================================================================= 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /snip/fns/do-one.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: do-one.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | ;;; 42 | ;;; Representation 43 | ;;; 44 | ;;; act = action act-node 45 | ;;; objecti ith-argument to act-node 46 | 47 | ;;; Added the check for no acts to be done. scs 11/2/06 48 | (defun do-one (n) 49 | "Randomly picks one of a set of actions and intends it to be performed." 50 | (let* ((possible-actions (sneps:pathfrom '(object1) n)) 51 | (chosen-act (choose-arbitrary-element possible-actions)) 52 | (pr (activation.n n))) 53 | (plantrace "Now doing: DO-ONE " possible-actions nil) 54 | (cond (chosen-act 55 | (plantrace "Chose to do the act " (list chosen-act) nil) 56 | (schedule-act chosen-act)) 57 | (t (plantrace "Nothing to do" (new.ns) nil))) 58 | (regstore pr '*AGENDA* 'DONE))) 59 | -------------------------------------------------------------------------------- /snip/fns/icontext.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNEPS; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: icontext.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | (defvar *use-intensional-contexts* t 43 | "If t use context names instead of actual context structures as the 44 | contexts passed back and forth in SNIP data structures.") 45 | 46 | (defmacro when-intensional-contexts (&rest body) 47 | `(when *use-intensional-contexts* 48 | ,@body)) 49 | 50 | ;; For proper linking of sub contexts to super contexts we'll need some 51 | ;; access functions which should go here. E.g., if during hypothetical 52 | ;; reasoning we get stuck somewhere and later add a node to the default 53 | ;; context to continue the deduction, the newly added node has to be 54 | ;; inherited by the hypothetical reasoning context in order to be useful 55 | ;; there. 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /snip/fns/non-rule.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: non-rule.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; non-rule 45 | ; -------- 46 | ; 47 | ; description : This is the node activation process for non-rule 48 | ; nodes. 49 | ; 50 | ; written : rgh 11/18/85 51 | ; modified: rgh 3/08/86 52 | ; rgh 3/22/86 53 | ; rgh 4/13/86 54 | ; njm 4/27/89 55 | ; 56 | ; 57 | (defun non-rule (*NAME* *NODE* *KNOWN-INSTANCES* *REPORTS* *REQUESTS* 58 | *INCOMING-CHANNELS* *OUTGOING-CHANNELS* 59 | *PENDING-FORWARD-INFERENCES* *PRIORITY*) 60 | (declare (special multi::curnt%)) 61 | (catch 'Stop-Handled-by-Contradiction-Handler 62 | (cond (multi:*use-one-queue-only* 63 | (process-reports.non-rule) 64 | (process-requests.non-rule) 65 | (process-forward-inferences.non-rule)) 66 | ((not (isnew.repset *REPORTS*)) 67 | (process-reports.non-rule)) 68 | (t (process-requests.non-rule) 69 | (process-forward-inferences.non-rule)))) 70 | (multi:process-change-slots multi::curnt% 71 | (vector *NAME* *NODE* *KNOWN-INSTANCES* 72 | *REPORTS* *REQUESTS* 73 | *INCOMING-CHANNELS* 74 | *OUTGOING-CHANNELS* 75 | *PENDING-FORWARD-INFERENCES* 76 | *PRIORITY*))) 77 | 78 | (setf (get 'non-rule 'multi::lregs%) 79 | '(*NAME* *NODE* *KNOWN-INSTANCES* *REPORTS* *REQUESTS* 80 | *INCOMING-CHANNELS* *OUTGOING-CHANNELS* *PENDING-FORWARD-INFERENCES* 81 | *PRIORITY*)) 82 | ; 83 | ; 84 | ; ============================================================================= 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /snip/fns/num-ent.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: num-ent.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; numerical-entailment functions 43 | ; 44 | (defun rule-handler.num-ent (ant-report cqch) 45 | ;; if the antecedents have the same set of variables, 46 | ;; use S-indexing, otherwise use linear ruiset handling 47 | (do* ((ruis (if (is-all-pat-same-vars (ants.cqch cqch)) 48 | (get-rule-use-info-sindexing ant-report cqch) 49 | (get-rule-use-info ant-report cqch)) 50 | (others.ruis ruis)) 51 | (ants (ants.cqch cqch)) 52 | (rui (choose.ruis ruis) (choose.ruis ruis))) 53 | ((isnew.ruis ruis)) 54 | (when (not (< (poscount.rui rui) 55 | (node-to-number.n 56 | (choose.ns (nodeset.n *NODE* 'sneps:thresh))))) 57 | (let ((restr (make.restr (subst.rui rui))) 58 | (ch (channel.cqch cqch))) 59 | (unless-remarkedp.rui 60 | rui (remark '"~%Since" (makeone.ns *NODE*) restr)) 61 | (do.ns (next-ant ants) 62 | (when (eq (flag.fns next-ant (fns.rui rui)) 'TRUE) 63 | (unless-remarkedp.rui 64 | rui (remark '"~%and~%" (makeone.ns next-ant) restr)))) 65 | (unless-remarkedp.rui 66 | rui (remark '"~%I infer~%" (makeone.ns (destination.ch ch)) restr)) 67 | (send-reports 68 | (makeone.repset 69 | (make.rep 70 | (restrict.sbst (subst.rui rui) (freevars.n (destination.ch ch))) 71 | (compute-new-support.&-ent ch rui) 72 | 'POS *NODE* nil (context.ch ch))) 73 | ch))))) 74 | 75 | (defun usability-test.num-ent (sign) 76 | (and (eq sign 'POS) 77 | (or (isnew.ns (quantified-vars.n *NODE*)) 78 | (not (isnew.ns (nodeset.n *NODE* 'sneps::forall)))))) 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /snip/fns/num-quant-rule.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: num-quant-rule.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; num-quant.rule 45 | ; -------------- 46 | ; 47 | ; description : This is the node activation process for numerical quantifier rule 48 | ; nodes 49 | ; 50 | ;============================================================================== 51 | 52 | (defun num-quant.rule (*NAME* *TYPE* *NODE* *KNOWN-INSTANCES* 53 | *NUM-QUANT-POS-INSTANCES* *NUM-QUANT-NEG-INSTANCES* 54 | *REPORTS* *REQUESTS* *INCOMING-CHANNELS* *OUTGOING-CHANNELS* 55 | *RULE-USE-CHANNELS* *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* 56 | *PRIORITY* *RULE-HANDLER* *USABILITY-TEST*) 57 | (declare (special multi::curnt%)) 58 | (catch 'Stop-Handled-by-Contradiction-Handler 59 | (cond (multi:*use-one-queue-only* 60 | (process-reports.rule) 61 | (process-requests.rule) 62 | (process-forward-inferences.rule)) 63 | ((not (isnew.repset *REPORTS*)) 64 | (process-reports.rule)) 65 | (t (process-requests.rule) 66 | (process-forward-inferences.rule)))) 67 | (multi:process-change-slots 68 | multi::curnt% 69 | (vector *NAME* *TYPE* *NODE* *KNOWN-INSTANCES* 70 | *NUM-QUANT-POS-INSTANCES* *NUM-QUANT-NEG-INSTANCES* 71 | *REPORTS* *REQUESTS* *INCOMING-CHANNELS* 72 | *OUTGOING-CHANNELS* *RULE-USE-CHANNELS* 73 | *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* 74 | *PRIORITY* *RULE-HANDLER* *USABILITY-TEST*))) 75 | 76 | (setf (get 'num-quant.rule 'multi::lregs%) 77 | '(*NAME* *TYPE* *NODE* *KNOWN-INSTANCES* *NUM-QUANT-POS-INSTANCES* *NUM-QUANT-NEG-INSTANCES* 78 | *REPORTS* *REQUESTS* *INCOMING-CHANNELS* *OUTGOING-CHANNELS* *RULE-USE-CHANNELS* 79 | *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* *PRIORITY* 80 | *RULE-HANDLER* *USABILITY-TEST*)) 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /snip/fns/perform.lisp: -------------------------------------------------------------------------------- 1 | ;;; =========================================================================== 2 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 3 | 4 | ;; Copyright (C) 1993--2013 5 | ;; Research Foundation of State University of New York 6 | 7 | ;; Version: $Id: perform.lisp,v 1.2 2013/08/28 19:07:27 shapiro Exp $ 8 | 9 | ;; This file is part of SNePS. 10 | 11 | ;; $BEGIN LICENSE$ 12 | 13 | ;;; The contents of this file are subject to the University at 14 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 15 | ;;; not use this file except in compliance with the License. You 16 | ;;; may obtain a copy of the License at 17 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 18 | ;;; 19 | ;;; Software distributed under the License is distributed on an 20 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 21 | ;;; or implied. See the License for the specific language gov 22 | ;;; erning rights and limitations under the License. 23 | ;;; 24 | ;;; The Original Code is SNePS 2.8. 25 | ;;; 26 | ;;; The Initial Developer of the Original Code is Research Foun 27 | ;;; dation of State University of New York, on behalf of Univer 28 | ;;; sity at Buffalo. 29 | ;;; 30 | ;;; Portions created by the Initial Developer are Copyright (C) 31 | ;;; 2011 Research Foundation of State University of New York, on 32 | ;;; behalf of University at Buffalo. All Rights Reserved. 33 | 34 | 35 | ;; $END LICENSE$ 36 | 37 | 38 | 39 | 40 | (in-package :snip) 41 | 42 | 43 | ;;; Definitions of SNACTOR 44 | ;;; 45 | ;;; Representation 46 | ;;; 47 | ;;; act = action act-node 48 | ;;; objecti ith-argument to act-node 49 | 50 | 51 | (defsnepscom perform ((nodeset &rest context-specifier) add) 52 | (sneps:clear-infer) 53 | (let* ((crntct (sneps:processcontextdescr context-specifier)) 54 | (crntctname crntct) 55 | (intended-act (choose.ns (sneps::nseval nodeset))) 56 | pr) 57 | (declare (special crntctname)) 58 | (activate-act.n intended-act) 59 | (setq pr (activation.n intended-act)) 60 | (regstore pr '*PRIORITY* 'INTEND) 61 | (regstore pr '*AGENDA* 'START) 62 | (multip (dequeue:insert-front pr (dequeue:new)) 63 | (dequeue:new) 64 | (dequeue:new)))) 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /snip/fns/plantrace.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: plantrace.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | (defvar *plantrace* nil) 43 | 44 | (defun plantrace (msg nodeset restriction) 45 | (declare (special *plantrace*)) 46 | (cond ((null *plantrace*)) 47 | ((listp *plantrace*) (eval *plantrace*)) 48 | ((eql *plantrace* 'snepsul::surface) 49 | (format t (format nil "~&~%~a" msg)) 50 | (mapcar #'(lambda (x) (eval `(snepsul::surface ,x))) 51 | (parser::flistify nodeset))) 52 | ; (eval `(snepsul::surface ,@(sneps:apply-subst.ns (subst.restr restriction) nodeset))) 53 | (t (format t (format nil "~&~%~a" msg)) 54 | (cond (nodeset 55 | (PP-nodetree (plantrace-desc-ns nodeset restriction))))))) 56 | 57 | (defun plantrace-desc-ns (nodeset restriction) 58 | (mapcar #'(lambda (n) (plantrace-desc-one-n n restriction)) 59 | nodeset)) 60 | 61 | (defun plantrace-desc-one-n (node restriction) 62 | (let ((sbst (subst.restr restriction))) 63 | (cond ((is.n node) 64 | (cond ((isbase.n node) 65 | (cond ((isnumber.n node) (node-to-number.n node)) 66 | (t (list node)))) 67 | ((isvar.n node) 68 | (cond ((isbound.sbst node sbst) 69 | (list node (intern "<--" *package*) 70 | (cond ((eq *plantrace* 'FULL-TRACE) 71 | (plantrace-desc-one-n 72 | (mnode.sbst node sbst) 73 | restriction)) 74 | (t (describe.n (mnode.sbst node sbst)))))) 75 | (t node))) 76 | ((or (ismol.n node) (ispat.n node)) 77 | (cons (describe.n node) 78 | (mapcar #'(lambda (c) 79 | (sneps::new.c 80 | (sneps::relation.c c) 81 | (mapcar #'(lambda (n) 82 | (plantrace-desc-one-n n restriction)) 83 | (sneps::nodeset.c c)))) 84 | (n-to-downcs node)))))) 85 | (t node)))) 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /snip/fns/resource-lim.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: resource-lim.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; decrease-resources 45 | ; ------------------ 46 | ; 47 | ; returns : 48 | ; 49 | ; nonlocal-vars : REMAINING-RESOURCES 50 | ; 51 | ; description : reduces the available resources whenever match or 52 | ; forward-match is called 53 | ; 54 | ; side-effects : changes the value of REMAINING-RESOURCES 55 | ; 56 | ; implementation: tempororily de-activated for initial tests 57 | ; 58 | ; written : rgh 10/05/85 59 | ; modified: 60 | ; 61 | ; 62 | (defmacro decrease-resources () 63 | `t) 64 | ; 65 | ; 66 | ; ============================================================================= 67 | ; 68 | ; enough-resources 69 | ; ---------------- 70 | ; 71 | ; returns : 72 | ; 73 | ; nonlocal-vars : REMAINING-RESOURCES 74 | ; 75 | ; description : checks to see if there are enough resources available 76 | ; to perform a match 77 | ; 78 | ; implementation: tempororily de-activated for initial tests 79 | ; 80 | ; written : rgh 10/05/85 81 | ; modified: 82 | ; 83 | ; 84 | (defmacro enough-resources () 85 | `t) 86 | ; 87 | ; 88 | ; ============================================================================= 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /snip/fns/rule.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 Research Foundation of 4 | ;; State University of New York 5 | 6 | ;; Version: $Id: rule.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; rule 45 | ; ---- 46 | ; 47 | ; description : This is the node activation process for rule nodes 48 | ; 49 | ; written : rgh 2/02/86 50 | ; modified: rgh 3/08/86 51 | ; rgh 3/22/86 52 | ; rgh 3/31/86 53 | ; rgh 4/03/86 54 | ; rgh 4/13/86 55 | ; njm 4/27/89 56 | ; 57 | ; 58 | (defun rule (*NAME* *TYPE* *NODE* *KNOWN-INSTANCES* *REPORTS* *REQUESTS* 59 | *INCOMING-CHANNELS* *OUTGOING-CHANNELS* *RULE-USE-CHANNELS* 60 | *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* *PRIORITY* 61 | *RULE-HANDLER* *USABILITY-TEST*) 62 | (declare (special multi::curnt%)) 63 | (catch 'Stop-Handled-by-Contradiction-Handler 64 | (cond (multi:*use-one-queue-only* 65 | (process-reports.rule) 66 | (process-requests.rule) 67 | (process-forward-inferences.rule)) 68 | ((not (isnew.repset *REPORTS*)) 69 | (process-reports.rule)) 70 | (t (process-requests.rule) 71 | (process-forward-inferences.rule)))) 72 | (multi:process-change-slots 73 | multi::curnt% 74 | (vector *NAME* *TYPE* *NODE* *KNOWN-INSTANCES* *REPORTS* *REQUESTS* 75 | *INCOMING-CHANNELS* *OUTGOING-CHANNELS* *RULE-USE-CHANNELS* 76 | *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* 77 | *PRIORITY* *RULE-HANDLER* *USABILITY-TEST*))) 78 | 79 | (setf (get 'rule 'multi::lregs%) 80 | '(*NAME* *TYPE* *NODE* *KNOWN-INSTANCES* *REPORTS* *REQUESTS* 81 | *INCOMING-CHANNELS* *OUTGOING-CHANNELS* *RULE-USE-CHANNELS* 82 | *INTRODUCTION-CHANNELS* *PENDING-FORWARD-INFERENCES* *PRIORITY* 83 | *RULE-HANDLER* *USABILITY-TEST*)) 84 | ; 85 | ; 86 | ; ============================================================================= 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /snip/fns/sched.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: MULTI; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1984--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: sched.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :multi) 40 | 41 | 42 | ; ============================================================================= 43 | ; 44 | ; schedule 45 | ; -------- 46 | ; 47 | ; arguments : event - 48 | ; events - 49 | ; 50 | ; returns : 51 | ; 52 | ; description : the scheduling function required by Multi 53 | ; 54 | ; written : rgh 11/18/85 55 | ; modified: rgh 12/02/85 56 | ; rgh 4/13/86 57 | ; rgh 4/20/86 58 | ; njm 1/19/89 59 | ; njm 3/22/89 60 | ; njm/hc 4/26/89 61 | ; dk 4/17/91 62 | ; 63 | ; This is the new, streamlined version that doesn't have to 64 | ; deal with high-priority and low-priority processes on the 65 | ; same queue anymore. 66 | ; 67 | (defun schedule (event queue) 68 | (cond ((eq (regfetch event '*PRIORITY*) 'snip::INTEND) ; intended acts 69 | (dequeue:insert-front event queue)) ; go on front -dk 70 | ((dequeue:in-queue event queue) queue) 71 | ((eq (regfetch event '*NAME*) 'snip:USER) 72 | (dequeue:insert-front event queue)) 73 | (t (dequeue:insert-rear event queue)))) 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /snip/fns/snsequence.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: snsequence.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | ;; altered for ACL 6 compatibility (FLJ) 40 | 41 | 42 | (in-package :snip) 43 | 44 | 45 | ;;; 46 | ;;; Representation 47 | ;;; 48 | ;;; act = action snsequence 49 | ;;; object1 act1 50 | ;;; object2 act2 51 | ;;; ... 52 | 53 | 54 | (defun snsequence (n) 55 | "Performs the objecti acts in order of i." 56 | (let ((i 0) acts all-acts (n-act (activation.n n))) 57 | ;; Use CLtL-I-style `loop': 58 | (regstore n-act '*AGENDA* 'DONE) 59 | (loop 60 | (incf i) 61 | (setq acts 62 | (sneps::nodeset.n n (intern 63 | (build-namestring :object i) :snepsul))) 64 | (if (isnew.ns acts) 65 | (return) 66 | (setf all-acts (append acts all-acts)))) 67 | (dolist (act all-acts) 68 | (activate-act.n act) 69 | (let ((pr (activation.n act))) 70 | (regstore pr '*PRIORITY* 'INTEND) 71 | (regstore pr '*AGENDA* 'START) 72 | (initiate pr))))) 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /snip/fns/whenever-do.lisp: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: SNIP; Base: 10 -*- 2 | 3 | ;; Copyright (C) 1993--2013 4 | ;; Research Foundation of State University of New York 5 | 6 | ;; Version: $Id: whenever-do.lisp,v 1.2 2013/08/28 19:07:28 shapiro Exp $ 7 | 8 | ;; This file is part of SNePS. 9 | 10 | ;; $BEGIN LICENSE$ 11 | 12 | ;;; The contents of this file are subject to the University at 13 | ;;; Buffalo Public License Version 1.0 (the "License"); you may 14 | ;;; not use this file except in compliance with the License. You 15 | ;;; may obtain a copy of the License at 16 | ;;; http://www.cse.buffalo. edu/sneps/Downloads/ubpl.pdf. 17 | ;;; 18 | ;;; Software distributed under the License is distributed on an 19 | ;;; "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express 20 | ;;; or implied. See the License for the specific language gov 21 | ;;; erning rights and limitations under the License. 22 | ;;; 23 | ;;; The Original Code is SNePS 2.8. 24 | ;;; 25 | ;;; The Initial Developer of the Original Code is Research Foun 26 | ;;; dation of State University of New York, on behalf of Univer 27 | ;;; sity at Buffalo. 28 | ;;; 29 | ;;; Portions created by the Initial Developer are Copyright (C) 30 | ;;; 2011 Research Foundation of State University of New York, on 31 | ;;; behalf of University at Buffalo. All Rights Reserved. 32 | 33 | 34 | ;; $END LICENSE$ 35 | 36 | 37 | 38 | 39 | (in-package :snip) 40 | 41 | 42 | ; WHENEVER-DO functions 43 | ; 44 | 45 | (defun rule-handler.whenever-do (ant-report cqch) 46 | ;; if the antecedents have the same set of variables, 47 | ;; use S-indexing, otherwise use linear ruiset handling 48 | (when (isassert.n *node*) 49 | (let ((ruis (if (is-all-pat-same-vars (ants.cqch cqch)) 50 | (get-rule-use-info-sindexing ant-report cqch) 51 | (get-rule-use-info ant-report cqch)))) 52 | (do.set (rui ruis t) 53 | (when (and (eq (sign.rep ant-report) 'pos) 54 | (>= (poscount.rui rui) 1)) 55 | (let* ((restr (make.restr (subst.rui rui))) 56 | (ch (channel.cqch cqch)) 57 | (reactionset 58 | (sneps:apply-subst.ns (subst.restr restr) 59 | (makeone.ns (destination.ch ch)))) 60 | (reaction (choose.ns reactionset)) 61 | pr) 62 | (unless-remarkedp.rui 63 | rui 64 | (remark '"~%Since" (makeone.ns *node*) restr) 65 | (remark '"and" (makeone.ns (signature.rep ant-report)) restr) 66 | (remark '"I will perform" reactionset nil)) 67 | (when (isnew.ns (nodeset.n reaction 'action)) 68 | (error 69 | "~&The supposed ACT node ~A does not have an ACTION." 70 | reaction)) 71 | (activate-act.n reaction) 72 | (setq pr (activation.n reaction)) 73 | (regstore pr '*priority* 'intend) 74 | (regstore pr '*agenda* 'start) 75 | (multi:schedule pr multi::*act-queue*))))))) 76 | 77 | 78 | 79 | ; 80 | ; ============================================================================= 81 | ; 82 | 83 | (defun usability-test.whenever-do (sign) 84 | (declare (special *NODE*)) 85 | (and (eq sign 'POS) 86 | (or (isnew.ns (quantified-vars.n *NODE*)) 87 | (not (isnew.ns (nodeset.n *NODE* 'sneps::forall)))))) 88 | 89 | 90 | ; 91 | ; 92 | ; ============================================================================= 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | --------------------------------------------------------------------------------