"********************************************************************************** * The License * * * * The user is free to produce commercial applications with the software, to * * distribute these applications in source or binary form, and to charge monies * * for them as he sees fit and in concordance with the laws of the land subject * * to the following license. * * * * 1. The license applies to all the software and all derived software and * * must appear on such. * * * * 2. It is illegal to distribute the software without this license attached * * to it and use of the software implies agreement with the license as such. * * It is illegal for anyone who is not the copyright holder to tamper with * * or change the license. * * * * 3. Neither the names of Lambda Associates or the copyright holder may be used * * to endorse or promote products built using the software without specific * * prior written permission from the copyright holder. * * * * 4. That possession of this license does not confer on the copyright holder * * any special contractual obligation towards the user. That in no event * * shall the copyright holder be liable for any direct, indirect, incidental, * * special, exemplary or consequential damages (including but not limited * * to procurement of substitute goods or services, loss of use, data, * * interruption), however caused and on any theory of liability, whether in * * contract, strict liability or tort (including negligence) arising in any * * way out of the use of the software, even if advised of the possibility of * * such damage. * * * * 5. It is permitted for the user to change the software, for the purpose of * * improving performance, correcting an error, or porting to a new platform, * * and distribute the derived version of Shen provided the resulting program * * conforms in all respects to the Shen standard and is issued under that * * title. The user must make it clear with his distribution that he/she is * * the author of the changes and what these changes are and why. * * * * 6. Derived versions of this software in whatever form are subject to the same * * restrictions. In particular it is not permitted to make derived copies of * * this software which do not conform to the Shen standard or appear under a * * different title. * * * * It is permitted to distribute versions of Shen which incorporate libraries, * * graphics or other facilities which are not part of the Shen standard. * * * * For an explication of this license see www.shenlanguage.org/license.htm which * * explains this license in full. * * * ***************************************************************************************** "(defun shen.datatype-error (V1591) (cond ((and (cons? V1591) (and (cons? (tl V1591)) (= () (tl (tl V1591))))) (simple-error (cn "datatype syntax error here: " (shen.app (shen.next-50 50 (hd V1591)) " " shen.a)))) (true (shen.sys-error shen.datatype-error)))) (defun shen. (V1596) (let Result (let Parse_shen. (shen. V1596) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_ ( V1596) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1601) (let Result (let Parse_shen. (shen. V1601) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent shen.single (cons (shen.hdtl Parse_shen.) (cons (shen.hdtl Parse_shen.) (cons (shen.hdtl Parse_shen.) ()))))) (fail))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1601) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent shen.double (cons (shen.hdtl Parse_shen.) (cons (shen.hdtl Parse_shen.) (cons (shen.hdtl Parse_shen.) ()))))) (fail))) (fail))) (fail))) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1606) (let Result (let Parse_shen. (shen. V1606) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_ ( V1606) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1611) (let Result (if (and (cons? (hd V1611)) (= if (hd (hd V1611)))) (let Parse_shen. (shen. (shen.pair (tl (hd V1611)) (shen.hdtl V1611))) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons if (cons (shen.hdtl Parse_shen.) ()))) (fail))) (fail)) (if (= Result (fail)) (let Result (if (and (cons? (hd V1611)) (= let (hd (hd V1611)))) (let Parse_shen. (shen. (shen.pair (tl (hd V1611)) (shen.hdtl V1611))) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons let (cons (shen.hdtl Parse_shen.) (cons (shen.hdtl Parse_shen.) ())))) (fail))) (fail))) (fail)) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1616) (let Result (if (cons? (hd V1616)) (let Parse_X (hd (hd V1616)) (if (variable? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1616)) (shen.hdtl V1616))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1621) (let Result (if (cons? (hd V1621)) (let Parse_X (hd (hd V1621)) (if (not (or (element? Parse_X (cons >> (cons ; ()))) (or (shen.singleunderline? Parse_X) (shen.doubleunderline? Parse_X)))) (shen.pair (hd (shen.pair (tl (hd V1621)) (shen.hdtl V1621))) (shen.remove-bar Parse_X)) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen.remove-bar (V1622) (cond ((and (cons? V1622) (and (cons? (tl V1622)) (and (cons? (tl (tl V1622))) (and (= () (tl (tl (tl V1622)))) (= (hd (tl V1622)) bar!))))) (cons (hd V1622) (hd (tl (tl V1622))))) ((cons? V1622) (cons (shen.remove-bar (hd V1622)) (shen.remove-bar (tl V1622)))) (true V1622))) (defun shen. (V1627) (let Result (let Parse_shen. (shen. V1627) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_ ( V1627) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1632) (let Result (if (cons? (hd V1632)) (let Parse_X (hd (hd V1632)) (if (= Parse_X ;) (shen.pair (hd (shen.pair (tl (hd V1632)) (shen.hdtl V1632))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1637) (let Result (if (and (cons? (hd V1637)) (= ! (hd (hd V1637)))) (shen.pair (hd (shen.pair (tl (hd V1637)) (shen.hdtl V1637))) !) (fail)) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1637) (if (not (= (fail) Parse_shen.)) (if (and (cons? (hd Parse_shen.)) (= >> (hd (hd Parse_shen.)))) (let Parse_shen. (shen. (shen.pair (tl (hd Parse_shen.)) (shen.hdtl Parse_shen.))) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1637) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent () (shen.hdtl Parse_shen.))) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result))) (defun shen. (V1642) (let Result (let Parse_shen. (shen. V1642) (if (not (= (fail) Parse_shen.)) (if (and (cons? (hd Parse_shen.)) (= >> (hd (hd Parse_shen.)))) (let Parse_shen. (shen. (shen.pair (tl (hd Parse_shen.)) (shen.hdtl Parse_shen.))) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1642) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.sequent () (shen.hdtl Parse_shen.))) (fail))) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen.sequent (V1643 V1644) (@p V1643 V1644)) (defun shen. (V1649) (let Result (let Parse_shen. (shen. V1649) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (let Parse_shen. (shen. Parse_shen.) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) (shen.hdtl Parse_shen.))) (fail))) (fail))) (fail))) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1649) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) ())) (fail))) (if (= Result (fail)) (let Result (let Parse_ ( V1649) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result))) (defun shen. (V1654) (let Result (if (cons? (hd V1654)) (let Parse_X (hd (hd V1654)) (if (= Parse_X (intern ",")) (shen.pair (hd (shen.pair (tl (hd V1654)) (shen.hdtl V1654))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1659) (let Result (let Parse_shen. (shen. V1659) (if (not (= (fail) Parse_shen.)) (if (and (cons? (hd Parse_shen.)) (= : (hd (hd Parse_shen.)))) (let Parse_shen. (shen. (shen.pair (tl (hd Parse_shen.)) (shen.hdtl Parse_shen.))) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.curry (shen.hdtl Parse_shen.)) (cons : (cons (shen.demodulate (shen.hdtl Parse_shen.)) ())))) (fail))) (fail)) (fail))) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1659) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.hdtl Parse_shen.)) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1664) (let Result (let Parse_shen. (shen. V1664) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.curry-type (shen.hdtl Parse_shen.))) (fail))) (if (= Result (fail)) (fail) Result))) (defun shen. (V1669) (let Result (if (cons? (hd V1669)) (let Parse_X (hd (hd V1669)) (if (shen.doubleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1669)) (shen.hdtl V1669))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1674) (let Result (if (cons? (hd V1674)) (let Parse_X (hd (hd V1674)) (if (shen.singleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1674)) (shen.hdtl V1674))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen.singleunderline? (V1675) (and (symbol? V1675) (shen.sh? (str V1675)))) (defun shen.sh? (V1676) (cond ((= "_" V1676) true) (true (and (= (pos V1676 0) "_") (shen.sh? (tlstr V1676)))))) (defun shen.doubleunderline? (V1677) (and (symbol? V1677) (shen.dh? (str V1677)))) (defun shen.dh? (V1678) (cond ((= "=" V1678) true) (true (and (= (pos V1678 0) "=") (shen.dh? (tlstr V1678)))))) (defun shen.process-datatype (V1679 V1680) (shen.remember-datatype (shen.s-prolog (shen.rules->horn-clauses V1679 V1680)))) (defun shen.remember-datatype (V1685) (cond ((cons? V1685) (do (set shen.*datatypes* (adjoin (hd V1685) (value shen.*datatypes*))) (do (set shen.*alldatatypes* (adjoin (hd V1685) (value shen.*alldatatypes*))) (hd V1685)))) (true (shen.sys-error shen.remember-datatype)))) (defun shen.rules->horn-clauses (V1688 V1689) (cond ((= () V1689) ()) ((and (cons? V1689) (and (tuple? (hd V1689)) (= shen.single (fst (hd V1689))))) (cons (shen.rule->horn-clause V1688 (snd (hd V1689))) (shen.rules->horn-clauses V1688 (tl V1689)))) ((and (cons? V1689) (and (tuple? (hd V1689)) (= shen.double (fst (hd V1689))))) (shen.rules->horn-clauses V1688 (append (shen.double->singles (snd (hd V1689))) (tl V1689)))) (true (shen.sys-error shen.rules->horn-clauses)))) (defun shen.double->singles (V1690) (cons (shen.right-rule V1690) (cons (shen.left-rule V1690) ()))) (defun shen.right-rule (V1691) (@p shen.single V1691)) (defun shen.left-rule (V1692) (cond ((and (cons? V1692) (and (cons? (tl V1692)) (and (cons? (tl (tl V1692))) (and (tuple? (hd (tl (tl V1692)))) (and (= () (fst (hd (tl (tl V1692))))) (= () (tl (tl (tl V1692))))))))) (let Q (gensym Qv) (let NewConclusion (@p (cons (snd (hd (tl (tl V1692)))) ()) Q) (let NewPremises (cons (@p (map shen.right->left (hd (tl V1692))) Q) ()) (@p shen.single (cons (hd V1692) (cons NewPremises (cons NewConclusion ())))))))) (true (shen.sys-error shen.left-rule)))) (defun shen.right->left (V1697) (cond ((and (tuple? V1697) (= () (fst V1697))) (snd V1697)) (true (simple-error "syntax error with ========== ")))) (defun shen.rule->horn-clause (V1698 V1699) (cond ((and (cons? V1699) (and (cons? (tl V1699)) (and (cons? (tl (tl V1699))) (and (tuple? (hd (tl (tl V1699)))) (= () (tl (tl (tl V1699)))))))) (cons (shen.rule->horn-clause-head V1698 (snd (hd (tl (tl V1699))))) (cons :- (cons (shen.rule->horn-clause-body (hd V1699) (hd (tl V1699)) (fst (hd (tl (tl V1699))))) ())))) (true (shen.sys-error shen.rule->horn-clause)))) (defun shen.rule->horn-clause-head (V1700 V1701) (cons V1700 (cons (shen.mode-ify V1701) (cons Context_1957 ())))) (defun shen.mode-ify (V1702) (cond ((and (cons? V1702) (and (cons? (tl V1702)) (and (= : (hd (tl V1702))) (and (cons? (tl (tl V1702))) (= () (tl (tl (tl V1702)))))))) (cons mode (cons (cons (hd V1702) (cons : (cons (cons mode (cons (hd (tl (tl V1702))) (cons + ()))) ()))) (cons - ())))) (true V1702))) (defun shen.rule->horn-clause-body (V1703 V1704 V1705) (let Variables (map shen.extract_vars V1705) (let Predicates (map (lambda X (gensym shen.cl)) V1705) (let SearchLiterals (shen.construct-search-literals Predicates Variables Context_1957 Context1_1957) (let SearchClauses (shen.construct-search-clauses Predicates V1705 Variables) (let SideLiterals (shen.construct-side-literals V1703) (let PremissLiterals (map (lambda X (shen.construct-premiss-literal X (empty? V1705))) V1704) (append SearchLiterals (append SideLiterals PremissLiterals))))))))) (defun shen.construct-search-literals (V1710 V1711 V1712 V1713) (cond ((and (= () V1710) (= () V1711)) ()) (true (shen.csl-help V1710 V1711 V1712 V1713)))) (defun shen.csl-help (V1716 V1717 V1718 V1719) (cond ((and (= () V1716) (= () V1717)) (cons (cons bind (cons ContextOut_1957 (cons V1718 ()))) ())) ((and (cons? V1716) (cons? V1717)) (cons (cons (hd V1716) (cons V1718 (cons V1719 (hd V1717)))) (shen.csl-help (tl V1716) (tl V1717) V1719 (gensym Context)))) (true (shen.sys-error shen.csl-help)))) (defun shen.construct-search-clauses (V1720 V1721 V1722) (cond ((and (= () V1720) (and (= () V1721) (= () V1722))) shen.skip) ((and (cons? V1720) (and (cons? V1721) (cons? V1722))) (do (shen.construct-search-clause (hd V1720) (hd V1721) (hd V1722)) (shen.construct-search-clauses (tl V1720) (tl V1721) (tl V1722)))) (true (shen.sys-error shen.construct-search-clauses)))) (defun shen.construct-search-clause (V1723 V1724 V1725) (shen.s-prolog (cons (shen.construct-base-search-clause V1723 V1724 V1725) (cons (shen.construct-recursive-search-clause V1723 V1724 V1725) ())))) (defun shen.construct-base-search-clause (V1726 V1727 V1728) (cons (cons V1726 (cons (cons (shen.mode-ify V1727) In_1957) (cons In_1957 V1728))) (cons :- (cons () ())))) (defun shen.construct-recursive-search-clause (V1729 V1730 V1731) (cons (cons V1729 (cons (cons Assumption_1957 Assumptions_1957) (cons (cons Assumption_1957 Out_1957) V1731))) (cons :- (cons (cons (cons V1729 (cons Assumptions_1957 (cons Out_1957 V1731))) ()) ())))) (defun shen.construct-side-literals (V1736) (cond ((= () V1736) ()) ((and (cons? V1736) (and (cons? (hd V1736)) (and (= if (hd (hd V1736))) (and (cons? (tl (hd V1736))) (= () (tl (tl (hd V1736)))))))) (cons (cons when (tl (hd V1736))) (shen.construct-side-literals (tl V1736)))) ((and (cons? V1736) (and (cons? (hd V1736)) (and (= let (hd (hd V1736))) (and (cons? (tl (hd V1736))) (and (cons? (tl (tl (hd V1736)))) (= () (tl (tl (tl (hd V1736)))))))))) (cons (cons is (tl (hd V1736))) (shen.construct-side-literals (tl V1736)))) ((cons? V1736) (shen.construct-side-literals (tl V1736))) (true (shen.sys-error shen.construct-side-literals)))) (defun shen.construct-premiss-literal (V1741 V1742) (cond ((tuple? V1741) (cons shen.t* (cons (shen.recursive_cons_form (snd V1741)) (cons (shen.construct-context V1742 (fst V1741)) ())))) ((= ! V1741) (cons cut (cons Throwcontrol ()))) (true (shen.sys-error shen.construct-premiss-literal)))) (defun shen.construct-context (V1743 V1744) (cond ((and (= true V1743) (= () V1744)) Context_1957) ((and (= false V1743) (= () V1744)) ContextOut_1957) ((cons? V1744) (cons cons (cons (shen.recursive_cons_form (hd V1744)) (cons (shen.construct-context V1743 (tl V1744)) ())))) (true (shen.sys-error shen.construct-context)))) (defun shen.recursive_cons_form (V1745) (cond ((cons? V1745) (cons cons (cons (shen.recursive_cons_form (hd V1745)) (cons (shen.recursive_cons_form (tl V1745)) ())))) (true V1745))) (defun preclude (V1746) (let FilterDatatypes (set shen.*datatypes* (difference (value shen.*datatypes*) V1746)) (value shen.*datatypes*))) (defun include (V1747) (let ValidTypes (intersection V1747 (value shen.*alldatatypes*)) (let NewDatatypes (set shen.*datatypes* (union ValidTypes (value shen.*datatypes*))) (value shen.*datatypes*)))) (defun preclude-all-but (V1748) (preclude (difference (value shen.*alldatatypes*) V1748))) (defun include-all-but (V1749) (include (difference (value shen.*alldatatypes*) V1749))) (defun shen.synonyms-help (V1754) (cond ((= () V1754) synonyms) ((and (cons? V1754) (cons? (tl V1754))) (do (shen.pushnew (cons (hd V1754) (shen.curry-type (hd (tl V1754)))) shen.*synonyms*) (shen.synonyms-help (tl (tl V1754))))) (true (simple-error (cn "odd number of synonyms " ""))))) (defun shen.pushnew (V1755 V1756) (if (element? V1755 (value V1756)) (value V1756) (set V1756 (cons V1755 (value V1756)))))