"********************************************************************************** * 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 (V1679) (cond ((and (cons? V1679) (and (cons? (tl V1679)) (= () (tl (tl V1679))))) (simple-error (cn "datatype syntax error here: " (shen.app (shen.next-50 50 (hd V1679)) " " shen.a)))) (true (shen.sys-error shen.datatype-error)))) (defun shen. (V1684) (let Result (let Parse_shen. (shen. V1684) (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_ ( V1684) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1689) (let Result (let Parse_shen. (shen. V1689) (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. V1689) (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. (V1694) (let Result (let Parse_shen. (shen. V1694) (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_ ( V1694) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1699) (let Result (if (and (cons? (hd V1699)) (= if (hd (hd V1699)))) (let Parse_shen. (shen. (shen.pair (tl (hd V1699)) (shen.hdtl V1699))) (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 V1699)) (= let (hd (hd V1699)))) (let Parse_shen. (shen. (shen.pair (tl (hd V1699)) (shen.hdtl V1699))) (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. (V1704) (let Result (if (cons? (hd V1704)) (let Parse_X (hd (hd V1704)) (if (variable? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1704)) (shen.hdtl V1704))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1709) (let Result (if (cons? (hd V1709)) (let Parse_X (hd (hd V1709)) (if (not (or (element? Parse_X (cons >> (cons ; ()))) (or (shen.singleunderline? Parse_X) (shen.doubleunderline? Parse_X)))) (shen.pair (hd (shen.pair (tl (hd V1709)) (shen.hdtl V1709))) (shen.remove-bar Parse_X)) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen.remove-bar (V1710) (cond ((and (cons? V1710) (and (cons? (tl V1710)) (and (cons? (tl (tl V1710))) (and (= () (tl (tl (tl V1710)))) (= (hd (tl V1710)) bar!))))) (cons (hd V1710) (hd (tl (tl V1710))))) ((cons? V1710) (cons (shen.remove-bar (hd V1710)) (shen.remove-bar (tl V1710)))) (true V1710))) (defun shen. (V1715) (let Result (let Parse_shen. (shen. V1715) (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_ ( V1715) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1720) (let Result (if (cons? (hd V1720)) (let Parse_X (hd (hd V1720)) (if (= Parse_X ;) (shen.pair (hd (shen.pair (tl (hd V1720)) (shen.hdtl V1720))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1725) (let Result (if (and (cons? (hd V1725)) (= ! (hd (hd V1725)))) (shen.pair (hd (shen.pair (tl (hd V1725)) (shen.hdtl V1725))) !) (fail)) (if (= Result (fail)) (let Result (let Parse_shen. (shen. V1725) (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. V1725) (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. (V1730) (let Result (let Parse_shen. (shen. V1730) (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. V1730) (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 (V1731 V1732) (@p V1731 V1732)) (defun shen. (V1737) (let Result (let Parse_shen. (shen. V1737) (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. V1737) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (cons (shen.hdtl Parse_shen.) ())) (fail))) (if (= Result (fail)) (let Result (let Parse_ ( V1737) (if (not (= (fail) Parse_)) (shen.pair (hd Parse_) ()) (fail))) (if (= Result (fail)) (fail) Result)) Result)) Result))) (defun shen. (V1742) (let Result (if (cons? (hd V1742)) (let Parse_X (hd (hd V1742)) (if (= Parse_X (intern ",")) (shen.pair (hd (shen.pair (tl (hd V1742)) (shen.hdtl V1742))) shen.skip) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1747) (let Result (let Parse_shen. (shen. V1747) (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. V1747) (if (not (= (fail) Parse_shen.)) (shen.pair (hd Parse_shen.) (shen.hdtl Parse_shen.)) (fail))) (if (= Result (fail)) (fail) Result)) Result))) (defun shen. (V1752) (let Result (let Parse_shen. (shen. V1752) (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. (V1757) (let Result (if (cons? (hd V1757)) (let Parse_X (hd (hd V1757)) (if (shen.doubleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1757)) (shen.hdtl V1757))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen. (V1762) (let Result (if (cons? (hd V1762)) (let Parse_X (hd (hd V1762)) (if (shen.singleunderline? Parse_X) (shen.pair (hd (shen.pair (tl (hd V1762)) (shen.hdtl V1762))) Parse_X) (fail))) (fail)) (if (= Result (fail)) (fail) Result))) (defun shen.singleunderline? (V1763) (and (symbol? V1763) (shen.sh? (str V1763)))) (defun shen.sh? (V1764) (cond ((= "_" V1764) true) (true (and (= (pos V1764 0) "_") (shen.sh? (tlstr V1764)))))) (defun shen.doubleunderline? (V1765) (and (symbol? V1765) (shen.dh? (str V1765)))) (defun shen.dh? (V1766) (cond ((= "=" V1766) true) (true (and (= (pos V1766 0) "=") (shen.dh? (tlstr V1766)))))) (defun shen.process-datatype (V1767 V1768) (shen.remember-datatype (shen.s-prolog (shen.rules->horn-clauses V1767 V1768)))) (defun shen.remember-datatype (V1773) (cond ((cons? V1773) (do (set shen.*datatypes* (adjoin (hd V1773) (value shen.*datatypes*))) (do (set shen.*alldatatypes* (adjoin (hd V1773) (value shen.*alldatatypes*))) (hd V1773)))) (true (shen.sys-error shen.remember-datatype)))) (defun shen.rules->horn-clauses (V1776 V1777) (cond ((= () V1777) ()) ((and (cons? V1777) (and (tuple? (hd V1777)) (= shen.single (fst (hd V1777))))) (cons (shen.rule->horn-clause V1776 (snd (hd V1777))) (shen.rules->horn-clauses V1776 (tl V1777)))) ((and (cons? V1777) (and (tuple? (hd V1777)) (= shen.double (fst (hd V1777))))) (shen.rules->horn-clauses V1776 (append (shen.double->singles (snd (hd V1777))) (tl V1777)))) (true (shen.sys-error shen.rules->horn-clauses)))) (defun shen.double->singles (V1778) (cons (shen.right-rule V1778) (cons (shen.left-rule V1778) ()))) (defun shen.right-rule (V1779) (@p shen.single V1779)) (defun shen.left-rule (V1780) (cond ((and (cons? V1780) (and (cons? (tl V1780)) (and (cons? (tl (tl V1780))) (and (tuple? (hd (tl (tl V1780)))) (and (= () (fst (hd (tl (tl V1780))))) (= () (tl (tl (tl V1780))))))))) (let Q (gensym Qv) (let NewConclusion (@p (cons (snd (hd (tl (tl V1780)))) ()) Q) (let NewPremises (cons (@p (map (lambda X1668 (shen.right->left X1668)) (hd (tl V1780))) Q) ()) (@p shen.single (cons (hd V1780) (cons NewPremises (cons NewConclusion ())))))))) (true (shen.sys-error shen.left-rule)))) (defun shen.right->left (V1785) (cond ((and (tuple? V1785) (= () (fst V1785))) (snd V1785)) (true (simple-error "syntax error with ========== ")))) (defun shen.rule->horn-clause (V1786 V1787) (cond ((and (cons? V1787) (and (cons? (tl V1787)) (and (cons? (tl (tl V1787))) (and (tuple? (hd (tl (tl V1787)))) (= () (tl (tl (tl V1787)))))))) (cons (shen.rule->horn-clause-head V1786 (snd (hd (tl (tl V1787))))) (cons :- (cons (shen.rule->horn-clause-body (hd V1787) (hd (tl V1787)) (fst (hd (tl (tl V1787))))) ())))) (true (shen.sys-error shen.rule->horn-clause)))) (defun shen.rule->horn-clause-head (V1788 V1789) (cons V1788 (cons (shen.mode-ify V1789) (cons Context_1957 ())))) (defun shen.mode-ify (V1790) (cond ((and (cons? V1790) (and (cons? (tl V1790)) (and (= : (hd (tl V1790))) (and (cons? (tl (tl V1790))) (= () (tl (tl (tl V1790)))))))) (cons mode (cons (cons (hd V1790) (cons : (cons (cons mode (cons (hd (tl (tl V1790))) (cons + ()))) ()))) (cons - ())))) (true V1790))) (defun shen.rule->horn-clause-body (V1791 V1792 V1793) (let Variables (map (lambda X1669 (shen.extract_vars X1669)) V1793) (let Predicates (map (lambda X (gensym shen.cl)) V1793) (let SearchLiterals (shen.construct-search-literals Predicates Variables Context_1957 Context1_1957) (let SearchClauses (shen.construct-search-clauses Predicates V1793 Variables) (let SideLiterals (shen.construct-side-literals V1791) (let PremissLiterals (map (lambda X (shen.construct-premiss-literal X (empty? V1793))) V1792) (append SearchLiterals (append SideLiterals PremissLiterals))))))))) (defun shen.construct-search-literals (V1798 V1799 V1800 V1801) (cond ((and (= () V1798) (= () V1799)) ()) (true (shen.csl-help V1798 V1799 V1800 V1801)))) (defun shen.csl-help (V1804 V1805 V1806 V1807) (cond ((and (= () V1804) (= () V1805)) (cons (cons bind (cons ContextOut_1957 (cons V1806 ()))) ())) ((and (cons? V1804) (cons? V1805)) (cons (cons (hd V1804) (cons V1806 (cons V1807 (hd V1805)))) (shen.csl-help (tl V1804) (tl V1805) V1807 (gensym Context)))) (true (shen.sys-error shen.csl-help)))) (defun shen.construct-search-clauses (V1808 V1809 V1810) (cond ((and (= () V1808) (and (= () V1809) (= () V1810))) shen.skip) ((and (cons? V1808) (and (cons? V1809) (cons? V1810))) (do (shen.construct-search-clause (hd V1808) (hd V1809) (hd V1810)) (shen.construct-search-clauses (tl V1808) (tl V1809) (tl V1810)))) (true (shen.sys-error shen.construct-search-clauses)))) (defun shen.construct-search-clause (V1811 V1812 V1813) (shen.s-prolog (cons (shen.construct-base-search-clause V1811 V1812 V1813) (cons (shen.construct-recursive-search-clause V1811 V1812 V1813) ())))) (defun shen.construct-base-search-clause (V1814 V1815 V1816) (cons (cons V1814 (cons (cons (shen.mode-ify V1815) In_1957) (cons In_1957 V1816))) (cons :- (cons () ())))) (defun shen.construct-recursive-search-clause (V1817 V1818 V1819) (cons (cons V1817 (cons (cons Assumption_1957 Assumptions_1957) (cons (cons Assumption_1957 Out_1957) V1819))) (cons :- (cons (cons (cons V1817 (cons Assumptions_1957 (cons Out_1957 V1819))) ()) ())))) (defun shen.construct-side-literals (V1824) (cond ((= () V1824) ()) ((and (cons? V1824) (and (cons? (hd V1824)) (and (= if (hd (hd V1824))) (and (cons? (tl (hd V1824))) (= () (tl (tl (hd V1824)))))))) (cons (cons when (tl (hd V1824))) (shen.construct-side-literals (tl V1824)))) ((and (cons? V1824) (and (cons? (hd V1824)) (and (= let (hd (hd V1824))) (and (cons? (tl (hd V1824))) (and (cons? (tl (tl (hd V1824)))) (= () (tl (tl (tl (hd V1824)))))))))) (cons (cons is (tl (hd V1824))) (shen.construct-side-literals (tl V1824)))) ((cons? V1824) (shen.construct-side-literals (tl V1824))) (true (shen.sys-error shen.construct-side-literals)))) (defun shen.construct-premiss-literal (V1829 V1830) (cond ((tuple? V1829) (cons shen.t* (cons (shen.recursive_cons_form (snd V1829)) (cons (shen.construct-context V1830 (fst V1829)) ())))) ((= ! V1829) (cons cut (cons Throwcontrol ()))) (true (shen.sys-error shen.construct-premiss-literal)))) (defun shen.construct-context (V1831 V1832) (cond ((and (= true V1831) (= () V1832)) Context_1957) ((and (= false V1831) (= () V1832)) ContextOut_1957) ((cons? V1832) (cons cons (cons (shen.recursive_cons_form (hd V1832)) (cons (shen.construct-context V1831 (tl V1832)) ())))) (true (shen.sys-error shen.construct-context)))) (defun shen.recursive_cons_form (V1833) (cond ((cons? V1833) (cons cons (cons (shen.recursive_cons_form (hd V1833)) (cons (shen.recursive_cons_form (tl V1833)) ())))) (true V1833))) (defun preclude (V1834) (shen.preclude-h (map (lambda X1670 (shen.intern-type X1670)) V1834))) (defun shen.preclude-h (V1835) (let FilterDatatypes (set shen.*datatypes* (difference (value shen.*datatypes*) V1835)) (value shen.*datatypes*))) (defun include (V1836) (shen.include-h (map (lambda X1671 (shen.intern-type X1671)) V1836))) (defun shen.include-h (V1837) (let ValidTypes (intersection V1837 (value shen.*alldatatypes*)) (let NewDatatypes (set shen.*datatypes* (union ValidTypes (value shen.*datatypes*))) (value shen.*datatypes*)))) (defun preclude-all-but (V1838) (shen.preclude-h (difference (value shen.*alldatatypes*) (map (lambda X1672 (shen.intern-type X1672)) V1838)))) (defun include-all-but (V1839) (shen.include-h (difference (value shen.*alldatatypes*) (map (lambda X1673 (shen.intern-type X1673)) V1839)))) (defun shen.synonyms-help (V1844) (cond ((= () V1844) (shen.demodulation-function (value shen.*tc*) (mapcan (lambda X1674 (shen.demod-rule X1674)) (value shen.*synonyms*)))) ((and (cons? V1844) (cons? (tl V1844))) (do (shen.pushnew (cons (hd V1844) (cons (hd (tl V1844)) ())) shen.*synonyms*) (shen.synonyms-help (tl (tl V1844))))) (true (simple-error "odd number of synonyms ")))) (defun shen.pushnew (V1845 V1846) (if (element? V1845 (value V1846)) (value V1846) (set V1846 (cons V1845 (value V1846))))) (defun shen.demod-rule (V1847) (cond ((and (cons? V1847) (and (cons? (tl V1847)) (= () (tl (tl V1847))))) (cons (shen.rcons_form (hd V1847)) (cons -> (cons (shen.rcons_form (hd (tl V1847))) ())))) (true (shen.sys-error shen.demod-rule)))) (defun shen.demodulation-function (V1848 V1849) (do (tc -) (do (eval (cons define (cons shen.demod (append V1849 (shen.default-rule))))) (do (if V1848 (tc +) shen.skip) synonyms)))) (defun shen.default-rule () (cons X (cons -> (cons X ()))))