Include Paulo Moura's Logtalk OO LP system
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@53 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
24
Logtalk/examples/symdiff/NOTES
Normal file
24
Logtalk/examples/symdiff/NOTES
Normal file
@@ -0,0 +1,24 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.8.4
|
||||
|
||||
Copyright (c) 1998-2001 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
To load all objects in this example consult the symdiff.loader utility
|
||||
file (note that the *.loader files are Prolog files).
|
||||
|
||||
This folder contains an example of using parametric objects to implement
|
||||
symbolic expression differentiation and simplification.
|
||||
|
||||
Limitations:
|
||||
|
||||
- the expression that we intend to differentiate or simplify
|
||||
must be a compound term. Accepted functors are *, +, -, **, and log.
|
||||
|
||||
- use as a variable the atom x.
|
||||
|
||||
- only integers can be used as constants.
|
||||
|
||||
This example is still incomplete. For example, using sum distribuition
|
||||
property to simplify expressions is not yet implemented.
|
||||
36
Logtalk/examples/symdiff/SCRIPT
Normal file
36
Logtalk/examples/symdiff/SCRIPT
Normal file
@@ -0,0 +1,36 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.8.4
|
||||
|
||||
Copyright (c) 1998-2001 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
|
||||
% simplify the expression x^1 + x0 - x1
|
||||
|
||||
| ?- (x**1 + x*0 - x*1)::simplify(S).
|
||||
|
||||
S = 0
|
||||
|
||||
yes
|
||||
|
||||
|
||||
% diffrentiate and then simplify the expression 2x^3 + x^2 - 4x
|
||||
|
||||
| ?- (2*x**3 + x**2 - 4*x)::diff(D), D::simplify(S).
|
||||
|
||||
D = 2*(3*x**2*1)+2*x**1*1-4*1
|
||||
S = 2*(3*x**2)+2*x-4
|
||||
|
||||
yes
|
||||
|
||||
|
||||
% diffrentiate and then simplify the expression ln(x^2 + 2x - 7) + 4x
|
||||
|
||||
| ?- (log(x**2 + 2*x - 7) + 4*x)::diff(D), D::simplify(S).
|
||||
|
||||
D = (2*x**1*1+2*1)*(x**2+2*x-7)** -1+4*1
|
||||
S = (2*x+2)*(x**2+2*x-7)** -1+4
|
||||
|
||||
yes
|
||||
41
Logtalk/examples/symdiff/log1.lgt
Normal file
41
Logtalk/examples/symdiff/log1.lgt
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
:- object(log(_),
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
parnames is ['Expression'],
|
||||
comment is 'Symbolic differentiation and simplification of log/1 expressions.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(Diff) :-
|
||||
this(log(X)),
|
||||
once(diff(X, Diff)).
|
||||
|
||||
|
||||
diff(I, 0) :-
|
||||
integer(I).
|
||||
|
||||
diff(X, DX * X ** -1) :-
|
||||
X::diff(DX).
|
||||
|
||||
|
||||
simplify(S) :-
|
||||
this(log(X)),
|
||||
once(simplify(X, S)).
|
||||
|
||||
|
||||
simplify(1, 0).
|
||||
|
||||
simplify(I, Log) :-
|
||||
integer(I),
|
||||
Log is log(I).
|
||||
|
||||
simplify(X, X).
|
||||
|
||||
|
||||
:- end_object.
|
||||
25
Logtalk/examples/symdiff/log1.pl
Normal file
25
Logtalk/examples/symdiff/log1.pl
Normal file
@@ -0,0 +1,25 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic log1__ddcl/4.
|
||||
:- dynamic log1__ddef/5.
|
||||
log1_(log1__dcl,log1__def,log1__super,log1__sdcl,log1__sdef,log1__ddcl,log1__ddef).
|
||||
log1__dcl(_9931,_9932,_9933,_9934):-fail.
|
||||
log1__dcl(_9931,_9932,_9933,_9934,log(_9938),log(_9938)):-log1__dcl(_9931,_9932,_9933,_9934).
|
||||
log1__dcl(_9931,_9932,_9933,_9934,log(_9938),log(_9938)):-log1__ddcl(_9931,_9932,_9933,_9934).
|
||||
log1__dcl(_9931,_9932,_9933,_9934,log(_9938),_9936):-symdiffp0__dcl(_9931,_9932,_9933,_9934,_9936).
|
||||
log1__def(diff(_9934),_9929,_9930,_9931,log1_diff1(_9934,_9929,_9930,_9931)).
|
||||
log1__def(diff(_9934,_9935),_9929,_9930,_9931,log1_diff2(_9934,_9935,_9929,_9930,_9931)).
|
||||
log1__def(simplify(_9934),_9929,_9930,_9931,log1_simplify1(_9934,_9929,_9930,_9931)).
|
||||
log1__def(simplify(_9934,_9935),_9929,_9930,_9931,log1_simplify2(_9934,_9935,_9929,_9930,_9931)).
|
||||
log1__def(_9931,_9932,_9933,_9934,_9935,log(_9938)):-log1__def(_9931,_9932,_9933,_9934,_9935).
|
||||
log1__def(_9931,_9932,_9933,_9934,_9935,log(_9938)):-log1__ddef(_9931,_9932,_9933,_9934,_9935).
|
||||
log1__super(_9931,_9932,_9933,_9934,_9935,_9936):-fail.
|
||||
log1_diff1(_9931,_9932,log(_9936),_9934):-once(log1_diff2(_9936,_9931,_9932,log(_9936),_9934)).
|
||||
log1_diff2(_9931,0,_9933,_9934,_9935):-integer(_9931).
|
||||
log1_diff2(_9931,_9937*_9931** -1,_9933,_9934,_9935):-lgt_send_to_object(_9931,diff(_9937),_9934).
|
||||
log1_simplify1(_9931,_9932,log(_9936),_9934):-once(log1_simplify2(_9936,_9931,_9932,log(_9936),_9934)).
|
||||
log1_simplify2(1,0,_9930,_9931,_9932).
|
||||
log1_simplify2(_9931,_9932,_9933,_9934,_9935):-integer(_9931),_9932 is log(_9931).
|
||||
log1_simplify2(_9928,_9928,_9930,_9931,_9932).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(log(_9945),log1_,log1__dcl,log1__def,log1__super),lgt_implements_protocol_(log(_9953),symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/log1.xml
Normal file
33
Logtalk/examples/symdiff/log1.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[log(Expression)]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of log/1 expressions.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
72
Logtalk/examples/symdiff/minus2.lgt
Normal file
72
Logtalk/examples/symdiff/minus2.lgt
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
:- object(_ - _,
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
parnames is ['Expression1', 'Expression2'],
|
||||
comment is 'Symbolic differentiation and simplification of -/2 expressions.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(Diff) :-
|
||||
this(X - Y),
|
||||
once(diff(X, Y, Diff)).
|
||||
|
||||
|
||||
diff(I, J, 0) :-
|
||||
integer(I),
|
||||
integer(J).
|
||||
|
||||
diff(X, J, DX) :-
|
||||
integer(J),
|
||||
X::diff(DX).
|
||||
|
||||
diff(I, Y, DY) :-
|
||||
integer(I),
|
||||
Y::diff(DY).
|
||||
|
||||
diff(X, Y, DX - DY) :-
|
||||
X::diff(DX),
|
||||
Y::diff(DY).
|
||||
|
||||
|
||||
simplify(S) :-
|
||||
this(X - Y),
|
||||
once(simplify(X, Y, S)).
|
||||
|
||||
|
||||
simplify(X, X, 0).
|
||||
|
||||
simplify(I, J, S) :-
|
||||
integer(I),
|
||||
integer(J),
|
||||
S is I - J.
|
||||
|
||||
simplify(X, 0, S) :-
|
||||
X::simplify(S).
|
||||
|
||||
simplify(0, Y, S) :-
|
||||
Y::simplify(S).
|
||||
|
||||
simplify(X, J, S - J) :-
|
||||
integer(J),
|
||||
X::simplify(S).
|
||||
|
||||
simplify(I, Y, I - S) :-
|
||||
integer(I),
|
||||
Y::simplify(S).
|
||||
|
||||
simplify(X, Y, S) :-
|
||||
X::simplify(SX),
|
||||
Y::simplify(SY),
|
||||
(X - Y \= SX - SY ->
|
||||
(SX - SY)::simplify(S)
|
||||
;
|
||||
S = SX - SY).
|
||||
|
||||
|
||||
:- end_object.
|
||||
31
Logtalk/examples/symdiff/minus2.pl
Normal file
31
Logtalk/examples/symdiff/minus2.pl
Normal file
@@ -0,0 +1,31 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic '-2__ddcl'/4.
|
||||
:- dynamic '-2__ddef'/5.
|
||||
'-2_'('-2__dcl','-2__def','-2__super','-2__sdcl','-2__sdef','-2__ddcl','-2__ddef').
|
||||
'-2__dcl'(_17137,_17138,_17139,_17140):-fail.
|
||||
'-2__dcl'(_17137,_17138,_17139,_17140,_17144-_17145,_17144-_17145):-'-2__dcl'(_17137,_17138,_17139,_17140).
|
||||
'-2__dcl'(_17137,_17138,_17139,_17140,_17144-_17145,_17144-_17145):-'-2__ddcl'(_17137,_17138,_17139,_17140).
|
||||
'-2__dcl'(_17137,_17138,_17139,_17140,_17144-_17145,_17142):-symdiffp0__dcl(_17137,_17138,_17139,_17140,_17142).
|
||||
'-2__def'(diff(_17140),_17135,_17136,_17137,'-2_diff1'(_17140,_17135,_17136,_17137)).
|
||||
'-2__def'(diff(_17140,_17141,_17142),_17135,_17136,_17137,'-2_diff3'(_17140,_17141,_17142,_17135,_17136,_17137)).
|
||||
'-2__def'(simplify(_17140),_17135,_17136,_17137,'-2_simplify1'(_17140,_17135,_17136,_17137)).
|
||||
'-2__def'(simplify(_17140,_17141,_17142),_17135,_17136,_17137,'-2_simplify3'(_17140,_17141,_17142,_17135,_17136,_17137)).
|
||||
'-2__def'(_17137,_17138,_17139,_17140,_17141,_17144-_17145):-'-2__def'(_17137,_17138,_17139,_17140,_17141).
|
||||
'-2__def'(_17137,_17138,_17139,_17140,_17141,_17144-_17145):-'-2__ddef'(_17137,_17138,_17139,_17140,_17141).
|
||||
'-2__super'(_17137,_17138,_17139,_17140,_17141,_17142):-fail.
|
||||
'-2_diff1'(_17137,_17138,_17142-_17143,_17140):-once('-2_diff3'(_17142,_17143,_17137,_17138,_17142-_17143,_17140)).
|
||||
'-2_diff3'(_17137,_17138,0,_17140,_17141,_17142):-integer(_17137),integer(_17138).
|
||||
'-2_diff3'(_17137,_17138,_17139,_17140,_17141,_17142):-integer(_17138),lgt_send_to_object(_17137,diff(_17139),_17141).
|
||||
'-2_diff3'(_17137,_17138,_17139,_17140,_17141,_17142):-integer(_17137),lgt_send_to_object(_17138,diff(_17139),_17141).
|
||||
'-2_diff3'(_17137,_17138,_17144-_17145,_17140,_17141,_17142):-lgt_send_to_object(_17137,diff(_17144),_17141),lgt_send_to_object(_17138,diff(_17145),_17141).
|
||||
'-2_simplify1'(_17137,_17138,_17142-_17143,_17140):-once('-2_simplify3'(_17142,_17143,_17137,_17138,_17142-_17143,_17140)).
|
||||
'-2_simplify3'(_17134,_17134,0,_17137,_17138,_17139).
|
||||
'-2_simplify3'(_17137,_17138,_17139,_17140,_17141,_17142):-integer(_17137),integer(_17138),_17139 is _17137-_17138.
|
||||
'-2_simplify3'(_17137,0,_17139,_17140,_17141,_17142):-lgt_send_to_object(_17137,simplify(_17139),_17141).
|
||||
'-2_simplify3'(0,_17138,_17139,_17140,_17141,_17142):-lgt_send_to_object(_17138,simplify(_17139),_17141).
|
||||
'-2_simplify3'(_17137,_17138,_17144-_17138,_17140,_17141,_17142):-integer(_17138),lgt_send_to_object(_17137,simplify(_17144),_17141).
|
||||
'-2_simplify3'(_17137,_17138,_17137-_17145,_17140,_17141,_17142):-integer(_17137),lgt_send_to_object(_17138,simplify(_17145),_17141).
|
||||
'-2_simplify3'(_17137,_17138,_17139,_17140,_17141,_17142):-lgt_send_to_object(_17137,simplify(_17151),_17141),lgt_send_to_object(_17138,simplify(_17160),_17141),(_17137-_17138\=_17151-_17160->lgt_send_to_object_nv(_17151-_17160,simplify(_17139),_17141);_17139=_17151-_17160).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(_17151-_17152,'-2_','-2__dcl','-2__def','-2__super'),lgt_implements_protocol_(_17160-_17161,symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/minus2.xml
Normal file
33
Logtalk/examples/symdiff/minus2.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[Expression1-Expression2]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of -/2 expressions.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
70
Logtalk/examples/symdiff/plus2.lgt
Normal file
70
Logtalk/examples/symdiff/plus2.lgt
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
:- object(_ + _,
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
parnames is ['Expression1', 'Expression2'],
|
||||
comment is 'Symbolic differentiation and simplification of +/2 expressions.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(Diff) :-
|
||||
this(X + Y),
|
||||
once(diff(X, Y, Diff)).
|
||||
|
||||
|
||||
diff(I, J, 0) :-
|
||||
integer(I),
|
||||
integer(J).
|
||||
|
||||
diff(X, J, DX) :-
|
||||
integer(J),
|
||||
X::diff(DX).
|
||||
|
||||
diff(I, Y, DY) :-
|
||||
integer(I),
|
||||
Y::diff(DY).
|
||||
|
||||
diff(X, Y, DX + DY) :-
|
||||
X::diff(DX),
|
||||
Y::diff(DY).
|
||||
|
||||
|
||||
simplify(S) :-
|
||||
this(X + Y),
|
||||
once(simplify(X, Y, S)).
|
||||
|
||||
|
||||
simplify(I, J, S) :-
|
||||
integer(I),
|
||||
integer(J),
|
||||
S is I + J.
|
||||
|
||||
simplify(X, 0, S) :-
|
||||
X::simplify(S).
|
||||
|
||||
simplify(0, Y, S) :-
|
||||
Y::simplify(S).
|
||||
|
||||
simplify(X, J, S + J) :-
|
||||
integer(J),
|
||||
X::simplify(S).
|
||||
|
||||
simplify(I, Y, I + S) :-
|
||||
integer(I),
|
||||
Y::simplify(S).
|
||||
|
||||
simplify(X, Y, S) :-
|
||||
X::simplify(SX),
|
||||
Y::simplify(SY),
|
||||
(X + Y \= SX + SY ->
|
||||
(SX + SY)::simplify(S)
|
||||
;
|
||||
S = SX + SY).
|
||||
|
||||
|
||||
:- end_object.
|
||||
30
Logtalk/examples/symdiff/plus2.pl
Normal file
30
Logtalk/examples/symdiff/plus2.pl
Normal file
@@ -0,0 +1,30 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic '+2__ddcl'/4.
|
||||
:- dynamic '+2__ddef'/5.
|
||||
'+2_'('+2__dcl','+2__def','+2__super','+2__sdcl','+2__sdef','+2__ddcl','+2__ddef').
|
||||
'+2__dcl'(_24091,_24092,_24093,_24094):-fail.
|
||||
'+2__dcl'(_24091,_24092,_24093,_24094,_24098+_24099,_24098+_24099):-'+2__dcl'(_24091,_24092,_24093,_24094).
|
||||
'+2__dcl'(_24091,_24092,_24093,_24094,_24098+_24099,_24098+_24099):-'+2__ddcl'(_24091,_24092,_24093,_24094).
|
||||
'+2__dcl'(_24091,_24092,_24093,_24094,_24098+_24099,_24096):-symdiffp0__dcl(_24091,_24092,_24093,_24094,_24096).
|
||||
'+2__def'(diff(_24094),_24089,_24090,_24091,'+2_diff1'(_24094,_24089,_24090,_24091)).
|
||||
'+2__def'(diff(_24094,_24095,_24096),_24089,_24090,_24091,'+2_diff3'(_24094,_24095,_24096,_24089,_24090,_24091)).
|
||||
'+2__def'(simplify(_24094),_24089,_24090,_24091,'+2_simplify1'(_24094,_24089,_24090,_24091)).
|
||||
'+2__def'(simplify(_24094,_24095,_24096),_24089,_24090,_24091,'+2_simplify3'(_24094,_24095,_24096,_24089,_24090,_24091)).
|
||||
'+2__def'(_24091,_24092,_24093,_24094,_24095,_24098+_24099):-'+2__def'(_24091,_24092,_24093,_24094,_24095).
|
||||
'+2__def'(_24091,_24092,_24093,_24094,_24095,_24098+_24099):-'+2__ddef'(_24091,_24092,_24093,_24094,_24095).
|
||||
'+2__super'(_24091,_24092,_24093,_24094,_24095,_24096):-fail.
|
||||
'+2_diff1'(_24091,_24092,_24096+_24097,_24094):-once('+2_diff3'(_24096,_24097,_24091,_24092,_24096+_24097,_24094)).
|
||||
'+2_diff3'(_24091,_24092,0,_24094,_24095,_24096):-integer(_24091),integer(_24092).
|
||||
'+2_diff3'(_24091,_24092,_24093,_24094,_24095,_24096):-integer(_24092),lgt_send_to_object(_24091,diff(_24093),_24095).
|
||||
'+2_diff3'(_24091,_24092,_24093,_24094,_24095,_24096):-integer(_24091),lgt_send_to_object(_24092,diff(_24093),_24095).
|
||||
'+2_diff3'(_24091,_24092,_24098+_24099,_24094,_24095,_24096):-lgt_send_to_object(_24091,diff(_24098),_24095),lgt_send_to_object(_24092,diff(_24099),_24095).
|
||||
'+2_simplify1'(_24091,_24092,_24096+_24097,_24094):-once('+2_simplify3'(_24096,_24097,_24091,_24092,_24096+_24097,_24094)).
|
||||
'+2_simplify3'(_24091,_24092,_24093,_24094,_24095,_24096):-integer(_24091),integer(_24092),_24093 is _24091+_24092.
|
||||
'+2_simplify3'(_24091,0,_24093,_24094,_24095,_24096):-lgt_send_to_object(_24091,simplify(_24093),_24095).
|
||||
'+2_simplify3'(0,_24092,_24093,_24094,_24095,_24096):-lgt_send_to_object(_24092,simplify(_24093),_24095).
|
||||
'+2_simplify3'(_24091,_24092,_24098+_24092,_24094,_24095,_24096):-integer(_24092),lgt_send_to_object(_24091,simplify(_24098),_24095).
|
||||
'+2_simplify3'(_24091,_24092,_24091+_24099,_24094,_24095,_24096):-integer(_24091),lgt_send_to_object(_24092,simplify(_24099),_24095).
|
||||
'+2_simplify3'(_24091,_24092,_24093,_24094,_24095,_24096):-lgt_send_to_object(_24091,simplify(_24105),_24095),lgt_send_to_object(_24092,simplify(_24114),_24095),(_24091+_24092\=_24105+_24114->lgt_send_to_object_nv(_24105+_24114,simplify(_24093),_24095);_24093=_24105+_24114).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(_24105+_24106,'+2_','+2__dcl','+2__def','+2__super'),lgt_implements_protocol_(_24114+_24115,symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/plus2.xml
Normal file
33
Logtalk/examples/symdiff/plus2.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[Expression1+Expression2]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of +/2 expressions.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
48
Logtalk/examples/symdiff/power2.lgt
Normal file
48
Logtalk/examples/symdiff/power2.lgt
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
:- object(_ ** _,
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
parnames is ['Expression', 'Power'],
|
||||
comment is 'Symbolic differentiation and simplification of **/2 expressions.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(Diff) :-
|
||||
this(X ** Y),
|
||||
once(diff(X, Y, Diff)).
|
||||
|
||||
|
||||
diff(X, Y, Y * X ** Y2 * DX) :-
|
||||
integer(Y),
|
||||
Y2 is Y - 1,
|
||||
X::diff(DX).
|
||||
|
||||
diff(X, Y, Y * X ** Y2 * DX) :-
|
||||
Y2 = Y - 1,
|
||||
X::diff(DX).
|
||||
|
||||
|
||||
simplify(S) :-
|
||||
this(X ** Y),
|
||||
once(simplify(X, Y, S)).
|
||||
|
||||
|
||||
simplify(_, 0, 1).
|
||||
|
||||
simplify(X, 1, X).
|
||||
|
||||
simplify(X, Y, S ** Y) :-
|
||||
integer(Y),
|
||||
X::simplify(S).
|
||||
|
||||
simplify(X, Y, SX ** SY) :-
|
||||
X::simplify(SX),
|
||||
Y::simplify(SY).
|
||||
|
||||
|
||||
:- end_object.
|
||||
26
Logtalk/examples/symdiff/power2.pl
Normal file
26
Logtalk/examples/symdiff/power2.pl
Normal file
@@ -0,0 +1,26 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic '**2__ddcl'/4.
|
||||
:- dynamic '**2__ddef'/5.
|
||||
'**2_'('**2__dcl','**2__def','**2__super','**2__sdcl','**2__sdef','**2__ddcl','**2__ddef').
|
||||
'**2__dcl'(_37598,_37599,_37600,_37601):-fail.
|
||||
'**2__dcl'(_37598,_37599,_37600,_37601,_37605**_37606,_37605**_37606):-'**2__dcl'(_37598,_37599,_37600,_37601).
|
||||
'**2__dcl'(_37598,_37599,_37600,_37601,_37605**_37606,_37605**_37606):-'**2__ddcl'(_37598,_37599,_37600,_37601).
|
||||
'**2__dcl'(_37598,_37599,_37600,_37601,_37605**_37606,_37603):-symdiffp0__dcl(_37598,_37599,_37600,_37601,_37603).
|
||||
'**2__def'(diff(_37601),_37596,_37597,_37598,'**2_diff1'(_37601,_37596,_37597,_37598)).
|
||||
'**2__def'(diff(_37601,_37602,_37603),_37596,_37597,_37598,'**2_diff3'(_37601,_37602,_37603,_37596,_37597,_37598)).
|
||||
'**2__def'(simplify(_37601),_37596,_37597,_37598,'**2_simplify1'(_37601,_37596,_37597,_37598)).
|
||||
'**2__def'(simplify(_37601,_37602,_37603),_37596,_37597,_37598,'**2_simplify3'(_37601,_37602,_37603,_37596,_37597,_37598)).
|
||||
'**2__def'(_37598,_37599,_37600,_37601,_37602,_37605**_37606):-'**2__def'(_37598,_37599,_37600,_37601,_37602).
|
||||
'**2__def'(_37598,_37599,_37600,_37601,_37602,_37605**_37606):-'**2__ddef'(_37598,_37599,_37600,_37601,_37602).
|
||||
'**2__super'(_37598,_37599,_37600,_37601,_37602,_37603):-fail.
|
||||
'**2_diff1'(_37598,_37599,_37603**_37604,_37601):-once('**2_diff3'(_37603,_37604,_37598,_37599,_37603**_37604,_37601)).
|
||||
'**2_diff3'(_37598,_37599,_37599*_37598**_37612*_37606,_37601,_37602,_37603):-integer(_37599),_37612 is _37599-1,lgt_send_to_object(_37598,diff(_37606),_37602).
|
||||
'**2_diff3'(_37598,_37599,_37599*_37598**_37612*_37606,_37601,_37602,_37603):-_37612=_37599-1,lgt_send_to_object(_37598,diff(_37606),_37602).
|
||||
'**2_simplify1'(_37598,_37599,_37603**_37604,_37601):-once('**2_simplify3'(_37603,_37604,_37598,_37599,_37603**_37604,_37601)).
|
||||
'**2_simplify3'(_37595,0,1,_37598,_37599,_37600).
|
||||
'**2_simplify3'(_37595,1,_37595,_37598,_37599,_37600).
|
||||
'**2_simplify3'(_37598,_37599,_37605**_37599,_37601,_37602,_37603):-integer(_37599),lgt_send_to_object(_37598,simplify(_37605),_37602).
|
||||
'**2_simplify3'(_37598,_37599,_37605**_37606,_37601,_37602,_37603):-lgt_send_to_object(_37598,simplify(_37605),_37602),lgt_send_to_object(_37599,simplify(_37606),_37602).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(_37612**_37613,'**2_','**2__dcl','**2__def','**2__super'),lgt_implements_protocol_(_37621**_37622,symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/power2.xml
Normal file
33
Logtalk/examples/symdiff/power2.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[Expression**Power]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of **/2 expressions.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
10
Logtalk/examples/symdiff/symdiff.loader
Normal file
10
Logtalk/examples/symdiff/symdiff.loader
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
:- initialization(
|
||||
logtalk_load([
|
||||
symdiffp,
|
||||
x,
|
||||
log1,
|
||||
minus2,
|
||||
plus2,
|
||||
times2,
|
||||
power2])).
|
||||
31
Logtalk/examples/symdiff/symdiffp.lgt
Normal file
31
Logtalk/examples/symdiff/symdiffp.lgt
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
:- protocol(symdiffp).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
comment is 'Symbolic differentiation and simplification protocol.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
:- public(diff/1).
|
||||
|
||||
:- mode(diff(-expression), one).
|
||||
|
||||
:- info(diff/1, [
|
||||
comment is 'Returns the symbolic differentiation of self.',
|
||||
argnames is ['Expression']]).
|
||||
|
||||
|
||||
:- public(simplify/1).
|
||||
|
||||
:- mode(simplify(-expression), one).
|
||||
|
||||
:- info(simplify/1, [
|
||||
comment is 'Returns the symbolic simplification of self.',
|
||||
argnames is ['Expression']]).
|
||||
|
||||
|
||||
:- end_protocol.
|
||||
8
Logtalk/examples/symdiff/symdiffp.pl
Normal file
8
Logtalk/examples/symdiff/symdiffp.pl
Normal file
@@ -0,0 +1,8 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
symdiffp0_(symdiffp0__dcl).
|
||||
symdiffp0__dcl(diff(_2249),p(p(p)),static,no).
|
||||
symdiffp0__dcl(simplify(_2249),p(p(p)),static,no).
|
||||
symdiffp0__dcl(_2247,_2248,_2249,_2250,symdiffp):-symdiffp0__dcl(_2247,_2248,_2249,_2250).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_protocol_(symdiffp,symdiffp0_)]))).
|
||||
50
Logtalk/examples/symdiff/symdiffp.xml
Normal file
50
Logtalk/examples/symdiff/symdiffp.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<type>protocol</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification protocol.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
<predicate>
|
||||
<name><![CDATA[diff/1]]></name>
|
||||
<scope>public</scope>
|
||||
<compilation>static</compilation>
|
||||
<mode>
|
||||
<template><![CDATA[diff(-expression)]]></template>
|
||||
<solutions>one</solutions>
|
||||
</mode>
|
||||
<comment><![CDATA[Returns the symbolic differentiation of self.]]></comment>
|
||||
<template><![CDATA[diff(Expression)]]></template>
|
||||
</predicate>
|
||||
<predicate>
|
||||
<name><![CDATA[simplify/1]]></name>
|
||||
<scope>public</scope>
|
||||
<compilation>static</compilation>
|
||||
<mode>
|
||||
<template><![CDATA[simplify(-expression)]]></template>
|
||||
<solutions>one</solutions>
|
||||
</mode>
|
||||
<comment><![CDATA[Returns the symbolic simplification of self.]]></comment>
|
||||
<template><![CDATA[simplify(Expression)]]></template>
|
||||
</predicate>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
74
Logtalk/examples/symdiff/times2.lgt
Normal file
74
Logtalk/examples/symdiff/times2.lgt
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
:- object(_ * _,
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
parnames is ['Expression1', 'Expression2'],
|
||||
comment is 'Symbolic differentiation and simplification of */2 expressions.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(Diff) :-
|
||||
this(X * Y),
|
||||
once(diff(X, Y, Diff)).
|
||||
|
||||
|
||||
diff(I, J, 0) :-
|
||||
integer(I),
|
||||
integer(J).
|
||||
|
||||
diff(0, _, 0).
|
||||
|
||||
diff(_, 0, 0).
|
||||
|
||||
diff(X, J, J * DX) :-
|
||||
integer(J),
|
||||
X::diff(DX).
|
||||
|
||||
diff(I, Y, I * DY) :-
|
||||
integer(I),
|
||||
Y::diff(DY).
|
||||
|
||||
diff(X, Y, X * DY + DX * Y) :-
|
||||
X::diff(DX),
|
||||
Y::diff(DY).
|
||||
|
||||
|
||||
simplify(S) :-
|
||||
this(X * Y),
|
||||
once(simplify(X, Y, S)).
|
||||
|
||||
|
||||
simplify(I, J, S) :-
|
||||
integer(I),
|
||||
integer(J),
|
||||
S is I * J.
|
||||
|
||||
simplify(0, _, 0).
|
||||
|
||||
simplify(_, 0, 0).
|
||||
|
||||
simplify(1, Y, SY) :-
|
||||
Y::simplify(SY).
|
||||
|
||||
simplify(X, 1, SX) :-
|
||||
X::simplify(SX).
|
||||
|
||||
simplify(I, Y, I * SY) :-
|
||||
integer(I),
|
||||
Y::simplify(SY).
|
||||
|
||||
simplify(X, J, J * SX) :-
|
||||
integer(J),
|
||||
X::simplify(SX).
|
||||
|
||||
simplify(X, Y, SX * SY) :-
|
||||
X::simplify(SX),
|
||||
Y::simplify(SY).
|
||||
|
||||
|
||||
:- end_object.
|
||||
34
Logtalk/examples/symdiff/times2.pl
Normal file
34
Logtalk/examples/symdiff/times2.pl
Normal file
@@ -0,0 +1,34 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic '*2__ddcl'/4.
|
||||
:- dynamic '*2__ddef'/5.
|
||||
'*2_'('*2__dcl','*2__def','*2__super','*2__sdcl','*2__sdef','*2__ddcl','*2__ddef').
|
||||
'*2__dcl'(_32011,_32012,_32013,_32014):-fail.
|
||||
'*2__dcl'(_32011,_32012,_32013,_32014,_32018*_32019,_32018*_32019):-'*2__dcl'(_32011,_32012,_32013,_32014).
|
||||
'*2__dcl'(_32011,_32012,_32013,_32014,_32018*_32019,_32018*_32019):-'*2__ddcl'(_32011,_32012,_32013,_32014).
|
||||
'*2__dcl'(_32011,_32012,_32013,_32014,_32018*_32019,_32016):-symdiffp0__dcl(_32011,_32012,_32013,_32014,_32016).
|
||||
'*2__def'(diff(_32014),_32009,_32010,_32011,'*2_diff1'(_32014,_32009,_32010,_32011)).
|
||||
'*2__def'(diff(_32014,_32015,_32016),_32009,_32010,_32011,'*2_diff3'(_32014,_32015,_32016,_32009,_32010,_32011)).
|
||||
'*2__def'(simplify(_32014),_32009,_32010,_32011,'*2_simplify1'(_32014,_32009,_32010,_32011)).
|
||||
'*2__def'(simplify(_32014,_32015,_32016),_32009,_32010,_32011,'*2_simplify3'(_32014,_32015,_32016,_32009,_32010,_32011)).
|
||||
'*2__def'(_32011,_32012,_32013,_32014,_32015,_32018*_32019):-'*2__def'(_32011,_32012,_32013,_32014,_32015).
|
||||
'*2__def'(_32011,_32012,_32013,_32014,_32015,_32018*_32019):-'*2__ddef'(_32011,_32012,_32013,_32014,_32015).
|
||||
'*2__super'(_32011,_32012,_32013,_32014,_32015,_32016):-fail.
|
||||
'*2_diff1'(_32011,_32012,_32016*_32017,_32014):-once('*2_diff3'(_32016,_32017,_32011,_32012,_32016*_32017,_32014)).
|
||||
'*2_diff3'(_32011,_32012,0,_32014,_32015,_32016):-integer(_32011),integer(_32012).
|
||||
'*2_diff3'(0,_32009,0,_32011,_32012,_32013).
|
||||
'*2_diff3'(_32008,0,0,_32011,_32012,_32013).
|
||||
'*2_diff3'(_32011,_32012,_32012*_32019,_32014,_32015,_32016):-integer(_32012),lgt_send_to_object(_32011,diff(_32019),_32015).
|
||||
'*2_diff3'(_32011,_32012,_32011*_32019,_32014,_32015,_32016):-integer(_32011),lgt_send_to_object(_32012,diff(_32019),_32015).
|
||||
'*2_diff3'(_32011,_32012,_32011*_32022+_32024*_32012,_32014,_32015,_32016):-lgt_send_to_object(_32011,diff(_32024),_32015),lgt_send_to_object(_32012,diff(_32022),_32015).
|
||||
'*2_simplify1'(_32011,_32012,_32016*_32017,_32014):-once('*2_simplify3'(_32016,_32017,_32011,_32012,_32016*_32017,_32014)).
|
||||
'*2_simplify3'(_32011,_32012,_32013,_32014,_32015,_32016):-integer(_32011),integer(_32012),_32013 is _32011*_32012.
|
||||
'*2_simplify3'(0,_32009,0,_32011,_32012,_32013).
|
||||
'*2_simplify3'(_32008,0,0,_32011,_32012,_32013).
|
||||
'*2_simplify3'(1,_32012,_32013,_32014,_32015,_32016):-lgt_send_to_object(_32012,simplify(_32013),_32015).
|
||||
'*2_simplify3'(_32011,1,_32013,_32014,_32015,_32016):-lgt_send_to_object(_32011,simplify(_32013),_32015).
|
||||
'*2_simplify3'(_32011,_32012,_32011*_32019,_32014,_32015,_32016):-integer(_32011),lgt_send_to_object(_32012,simplify(_32019),_32015).
|
||||
'*2_simplify3'(_32011,_32012,_32012*_32019,_32014,_32015,_32016):-integer(_32012),lgt_send_to_object(_32011,simplify(_32019),_32015).
|
||||
'*2_simplify3'(_32011,_32012,_32018*_32019,_32014,_32015,_32016):-lgt_send_to_object(_32011,simplify(_32018),_32015),lgt_send_to_object(_32012,simplify(_32019),_32015).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(_32025*_32026,'*2_','*2__dcl','*2__def','*2__super'),lgt_implements_protocol_(_32034*_32035,symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/times2.xml
Normal file
33
Logtalk/examples/symdiff/times2.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[Expression1*Expression2]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of */2 expressions.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
20
Logtalk/examples/symdiff/x.lgt
Normal file
20
Logtalk/examples/symdiff/x.lgt
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
:- object(x,
|
||||
implements(symdiffp)).
|
||||
|
||||
|
||||
:- info([
|
||||
authors is 'Paulo Moura',
|
||||
version is 1.0,
|
||||
date is 1999/12/29,
|
||||
comment is 'Symbolic differentiation and simplification of a variable.',
|
||||
source is 'Example based on the Clocksin and Mellish Prolog book.']).
|
||||
|
||||
|
||||
diff(1).
|
||||
|
||||
|
||||
simplify(x).
|
||||
|
||||
|
||||
:- end_object.
|
||||
18
Logtalk/examples/symdiff/x.pl
Normal file
18
Logtalk/examples/symdiff/x.pl
Normal file
@@ -0,0 +1,18 @@
|
||||
:- op(600,xfy,::).
|
||||
:- op(600,fy,::).
|
||||
:- op(600,fx,^^).
|
||||
:- dynamic x0__ddcl/4.
|
||||
:- dynamic x0__ddef/5.
|
||||
x0_(x0__dcl,x0__def,x0__super,x0__sdcl,x0__sdef,x0__ddcl,x0__ddef).
|
||||
x0__dcl(_5074,_5075,_5076,_5077):-fail.
|
||||
x0__dcl(_5074,_5075,_5076,_5077,x,x):-x0__dcl(_5074,_5075,_5076,_5077).
|
||||
x0__dcl(_5074,_5075,_5076,_5077,x,x):-x0__ddcl(_5074,_5075,_5076,_5077).
|
||||
x0__dcl(_5074,_5075,_5076,_5077,x,_5079):-symdiffp0__dcl(_5074,_5075,_5076,_5077,_5079).
|
||||
x0__def(diff(_5077),_5072,_5073,_5074,x0_diff1(_5077,_5072,_5073,_5074)).
|
||||
x0__def(simplify(_5077),_5072,_5073,_5074,x0_simplify1(_5077,_5072,_5073,_5074)).
|
||||
x0__def(_5074,_5075,_5076,_5077,_5078,x):-x0__def(_5074,_5075,_5076,_5077,_5078).
|
||||
x0__def(_5074,_5075,_5076,_5077,_5078,x):-x0__ddef(_5074,_5075,_5076,_5077,_5078).
|
||||
x0__super(_5074,_5075,_5076,_5077,_5078,_5079):-fail.
|
||||
x0_diff1(1,_5072,_5073,_5074).
|
||||
x0_simplify1(x,_5072,_5073,_5074).
|
||||
:- initialization((lgt_assert_relation_clauses([lgt_current_object_(x,x0_,x0__dcl,x0__def,x0__super),lgt_implements_protocol_(x,symdiffp,public)]))).
|
||||
33
Logtalk/examples/symdiff/x.xml
Normal file
33
Logtalk/examples/symdiff/x.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE logtalk SYSTEM "logtalk.dtd">
|
||||
<?xml-stylesheet type="text/xsl" href="logtalk.xsl"?>
|
||||
<logtalk>
|
||||
<entity>
|
||||
<name><![CDATA[x]]></name>
|
||||
<type>object</type>
|
||||
<compilation>static</compilation>
|
||||
<comment><![CDATA[Symbolic differentiation and simplification of a variable.]]></comment>
|
||||
<authors><![CDATA[Paulo Moura]]></authors>
|
||||
<version>1.0</version>
|
||||
<date>1999/12/29</date>
|
||||
<info>
|
||||
<key>source</key>
|
||||
<value><![CDATA[Example based on the Clocksin and Mellish Prolog book.]]></value>
|
||||
</info>
|
||||
</entity>
|
||||
<relations>
|
||||
<implements>
|
||||
<name><![CDATA[symdiffp]]></name>
|
||||
<scope>public</scope>
|
||||
<file><![CDATA[symdiffp]]></file>
|
||||
</implements>
|
||||
</relations>
|
||||
<predicates>
|
||||
<public>
|
||||
</public>
|
||||
<protected>
|
||||
</protected>
|
||||
<private>
|
||||
</private>
|
||||
</predicates>
|
||||
</logtalk>
|
||||
Reference in New Issue
Block a user