-
Notifications
You must be signed in to change notification settings - Fork 6
/
7_loan_agreement.pl
executable file
·259 lines (209 loc) · 6.68 KB
/
7_loan_agreement.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
:- module('one+http://tests.com',[]).
en("the target language is: prolog.
the timeless predicates are:
*an amount* is due on *a date* from *a borrower* to *a lender*,
*a concept* is that *a definition*,
*a thing* is different from *a second thing*,
*a borrower* represents-warrants *a requirement*,
*an amount* is the total due,
*a borrower* covenants *a covenance*,
*a borrower* pays *an amount* to *a lender*,
*a requirement* is in default,
*a requirement* is remedy,
*a person* is bankrupted by insolvency,
the time-varying predicates are:
*a lender* is liable to litigation,
*a borrower* requested *an amount* on *a date*,
*a lender* advanced *an amount* on *a date*,
*an agreement* is terminated,
nothing,
*a payment* is potentially defaulted,
*a borrower* paid *an amount* to *a lender* on *a date*,
*a person* notified *a message* on *a date*,
*a requirement* is defaulted on *a date*,
*a requirement* is cured,
*a requirement* is remedied,
*a borrower* is liable to litigation,
it is *a date*.
the event predicates are:
it is the end of *a date*,
*a borrower* requests *an amount*,
*a lender* advances *an amount*,
end of the world,
*a borrower* pays *an amount* to *a lender*,
*a person* notifies *a message*,
*a requirement* remedies,
*a borrower* goes bankrupt,
*a borrower* is insolvent,
*a requirement* is proved untrue,
*a requirement* is failure to perform,
the knowledge base Loan includes:
% preliminars
it becomes the case that
it is a new day
when
it is the end of a date
if the new day is 1 day after the date.
% Article 1
it becomes the case that
lender is liable to litigation
when
it is the end of 2014-06-02
if borrower requested 1000 on 2014-06-01
and it is not the case that
lender advanced 1000 on a date.
it becomes the case that
the agreement is terminated
when
it is the end of 2014-06-01T00:00:00
if it is not the case that
borrower requested 1000 on 2014-06-01.
it becomes the case that
borrower requested an amount on a date
when
borrower requests the amount, at the date.
%if it is the date.
it becomes the case that
lender advanced an amount on a date
when
lender advances the amount, at the date.
%if it is the date.
% Articles 2 and 10
550 is due on 2015-06-01T00:00:00 from borrower to lender.
525 is due on 2016-06-01T00:00:00 from borrower to lender.
it becomes the case that
a payment is potentially defaulted
when
it is the end of a date
if the payment is that borrower pays an amount to lender
and the amount is due on the date from borrower to lender
and it is not the case that
borrower paid the amount to lender on a second date.
it becomes the case that
borrower paid an amount to lender on a date
when
borrower pays the amount to lender, at the date.
%if it is the date.
it is illegal that
borrower pays an amount to lender
if an amount is due on a date from borrower to lender
and it is a second date
and the second date is before the date.
% Article 5
It becomes the case that
a person notified a message on a date
when
the person notifies the message, at the date.
%if it is the date.
It becomes the case that
a requirement is defaulted on a date
when
it is the end of the date
if the requirement is potentially defaulted
and lender notified a message on a second date
and the message is that the requirement is in default
and it is not the case that
a second requirement is defaulted on a third date
and the second requirement is different from the requirement
and it is not the case that
the requirement is cured.
A requirement is cured
if the requirement is remedied
and borrower notified a message on a date
and the message is that the requirement is remedy.
It becomes the case that
a reparation is remedied
when
borrower pays an amount to lender
if a requirement is potentially defaulted
and the requirement is that the borrower pays an amount to lender
and the reparation is that borrower pays an amount to lender.
It becomes the case that
a requirement is remedied
when
the requirement remedies.
It becomes the case that
a default is potentially defaulted
when
borrower goes bankrupt
if the default is that borrower is bankrupted by insolvency.
% Article 3
It becomes the case that
a requirement is potentially defaulted
when
the requirement is proved untrue
if a person represents-warrants the requirement.
borrower represents-warrants warrants information.
% Article 5
It becomes the case that
a requirement is potentially defaulted
when
the requirement is failure to perform
if borrower covenants the requirement.
a borrower covenants covenants information.
% Article 6
It becomes the case that
borrower is liable to litigation
when
it is the end of a date
if a requirement is defaulted on the date
and the date is before 2020-06-01
and a sum is the total due
and it is not the case that
borrower paid the sum to lender on the date.
It becomes the case that
agreement is terminated
when
borrower pays a sum to lender
if a requirement is defaulted on a date
and it is the date
and the sum is the total due.
It becomes the case that
agreement is terminated
when
borrower pays 525 to lender
if it is not the case that
a requirement is defaulted on a date
and borrower paid 550 to lender on a second date.
1075 is the total due
if it is not the case that
borrower paid 550 to lender on a date.
525 is the total due
if borrower paid 550 to lender on a date
and it is not the case that
borrower paid 525 to lender on a date.
scenario test1 is:
borrower requests 1000, at 2014-06-01.
lender advances 1000, at 2014-06-02.
borrower pays 550 to lender, at 2015-06-01.
borrower pays 525 to lender, at 2016-06-01.
scenario test2 is:
it is the end of 2014-08-01, at 2014-08-01.
query 0 is:
it is which day.
query 1 is:
an amount is due on a date from borrower to lender.
query 2 is:
lender is liable to litigation, at 2014-06-02T00:00:00.
query 3 is:
borrower requested an amount on a date.
query 4 is:
a borrower pays an amount to a lender.
query 5 is:
a person is liable to litigation.
query 6 is:
the agreement is terminated.
query 7 is:
borrower paid 525 to lender on a date.
query 8 is:
which requirement is potentially defaulted.
query 9 is:
which one represents-warrants which cause.
").
/** <examples>
?- answer("1 with test2").
?- is_it_illegal("borrower pays an amount to lender, at a date", test2).
?- answer("2 with test1").
?- answer("9 with test1").
?- answer("3 with test1").
*/