forked from LogicalContracts/LogicalEnglish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
014_escrow.pl
executable file
·75 lines (57 loc) · 2.6 KB
/
014_escrow.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
:- module('014+http://tests.com',[]).
en("the target language is: prolog. % other languages available soon
the templates are:
*an agent* has paid itself *a fee*.
the event predicates are:
*a payer* sets up *an escrow* for *an agent* to pay *an amount* to *a payee* and deduct *a fee*.
*an agent* pays out *an amount* of *an escrow* to *a payee*.
*an agent* pays back *an amount* of *an escrow* to *a payer*.
the fluents are:
*a payer* has *an escrow* for *an agent* to pay *an amount* to *a payee* and deduct *a fee*.
*an escrow* of *an amount* has been paid out to *a payee*.
the knowledge base escrow includes:
it becomes the case that
a payer has an escrow for an agent to pay an amount to a payee and deduct a fee
when
the payer sets up the escrow for the agent to pay the amount to the payee and deduct the fee.
it becomes the case that
an escrow of an amount has been paid out to a payee
when
an agent pays out the amount of the escrow to the payee
if a payer has the escrow for the agent to pay a sum to the payee and deduct a fee
and the agent has paid itself the fee
and the amount is the sum - the fee.
it becomes not the case that
a payer has an escrow for an agent to pay a sum to a payee and deduct a fee
when
the agent pays out an amount of the escrow to the payee
if the payer has the escrow for the agent to pay the sum to the payee and deduct the fee
and the agent has paid itself the fee
and the amount is the sum - the fee.
it becomes not the case that
a payer has an escrow for an agent to pay a sum to a payee and deduct a fee
when
the agent pays back an amount of the escrow to the payer
if the payer has the escrow for the agent to pay the sum to the payee and deduct the fee
and the agent has paid itself the fee
and the amount is the sum - the fee.
% initial act
the payer sets up the escrow for the agent to pay 500 to the payee and deduct 5, at 1.
scenario clause one is:
the agent has paid itself each fee.
the agent pays out 495 of the escrow to the payee, at 5.
scenario clause two is:
the agent has paid itself each fee.
the agent pays back 495 of the escrow to the payee, at 5.
query one is:
a payer has an escrow for an agent to pay an amount to a payee and deduct a fee, at 2.
query two is:
a payer has an escrow for an agent to pay an amount to a payee and deduct a fee, at 8.
query three is:
which agent pays back which amount of which escrow to which payer.
").
/** <examples>
?- answer("query one with scenario clause one").
?- answer("query one with scenario clause two").
?- answer("query three with scenario clause two").
*/