-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmlt_star_validation.als
executable file
·403 lines (325 loc) · 11.1 KB
/
mlt_star_validation.als
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
module mltStarValidation
open mlt_star
/** UTILS - PREDICATES AND FUNCTIONS */
/** The predicates bellow are used throughout the code improving its readability. */
pred triviallyCharacterizes[t,t':Type]
{
characterizes[t,t'] and (some t" :Type |
(characterizes[t,t"] or powertypeOf[t,t"]) and properSpecializes[t",t'])
}
pred triviallySubordinateTo[t,t':Type]
{
isSubordinateTo[t,t'] and (some t" :Type |
isSubordinateTo[t,t"] and properSpecializes[t",t'])
}
/** THEOREMS FROM SOSYM PAPER */
/** Theorem T10: each type has at most one power type */
pred theoremT10
{
all t:Entity| lone powertypeOf.t
}
/** Theorem T11: each type is power type of, at most, one other type */
pred theoremT11
{
all t:Entity| lone t.powertypeOf
}
/** Theorem T12: if a type t2 specializes a type t1 then the power type of t2 specializes
* the power type of t1.
*
* ∀ t1,t2,t3,t4 (specializes(t2,t1)∧isPowertypeOf(t4,t2)∧isPowertypeOf(t3,t1))
* →specializes(t4,t3)
*/
pred theoremT12
{
all t1,t2,t3,t4:Entity | (t1 in t2.specializes and t2 in t4.powertypeOf and t1 in t3.powertypeOf) implies t3 in t4.specializes
}
/** Theorem T13: If a type t2 is power type of a type t1 and a type t3 characterizes the
* same base type t1 then all instances of t3 are also instances of the power type t2
* and, thus, t3 proper specializes t2.
*
* ∀t1,t2,t3 (isPowertypeOf(t2,t1)∧characterizes(t3,t1))→properSpecializes(t3,t2)
*/
pred theoremT13
{
all t1,t2,t3:Entity | (t1 in t2.powertypeOf and t1 in t3.characterizes) implies t2 in t3.properSpecializes
}
/** Theorem T14: if two types t1 and t2 both partitions the same type t3 then it is not
* possible for t1 to specialize t2.
*
* ∀ t1,t2,t3,t4 (partitions(t1,t3)∧partitions(t2,t3))→¬properSpecializes(t1,t2)
*/
pred theoremT14
{
all t1,t2,t3:Entity | (t3 in t1.partitions and t3 in t2.partitions) implies (t2 not in t1.properSpecializes)
}
/** THEOREMS - NON FORMALIZED (SOSYM) */
/** The theorems below are not explicity defined on Sosym paper but the rules that
* they formalize are cited in natural language*/
/** Since the instantiation relation denotes that an element is a member of the extension
* of a type, it must be irreflexive, asymmetric and intransitive */
pred iofProperties
{
all x,y:Entity | x in y.iof => y not in x.iof /** Assymetric */
all x:Entity | x not in x.iof /** Irreflexive */
all x,y,z:Entity | (y in x.iof and z in y.iof) => z not in x.iof /** Intransitive */
all x:Entity | x not in x.^iof /** Acyclic */
}
/** The instantiation properties specified on Sosym's paper are only aplicable to
* Basic MLT, so the following predicated was corrected in this sense. */
pred iofPropertiesForOrderedTypes
{
all x,y :OrderedType+Individual | iof[y,x] implies y not in x.iof /** Assymetric */
all x :OrderedType+Individual | not iof[x,x] /** Irreflexive */
all x,y,z :OrderedType+Individual |
(iof[x,y] and iof[y,z]) implies not iof[x,z] /** Intransitive */
all x :OrderedType+Individual | x not in x.^iof /** Acyclic */
}
/** Specialization is a partial order relation (i.e., a reflexive, transitive and antisymmetric
* relation), which is guaranteed in this theory for ordered types. */
pred specializationProperties
{
all disj x, y :Entity | specializes[y,x] => not specializes[x,y] /** Antissymetric */
all t :Type | specializes[t,t] /** Reflexive */
all x, y, z :Entity |
(specializes[x,y] and specializes[y,z]) implies specializes[x,z] /** Transitive */
}
/** This "theorem" is to check the structure of Basic Types present in old good MLT. */
pred basicMLTPattern
{
// all types specialize a basic type y and instantiate z such that
// z is the basic type immediately higher than y (except at the top)
all x:OrderedType | some y: BasicType |
(specializes[x,y]) and
((no b : BasicType | iof[y,b]) or // basic type is at the top of basic types
(some z: BasicType | iof[y,z] and iof[x,z] )) // or type is instance of basic type at higher order
}
pred subordinationProperties
{
no t, t' :Type |
isSubordinateTo[t,t'] and isSubordinateTo[t',t] /** Irreflexive and Asymmetric*/
all t, t', t" :Type | (isSubordinateTo[t,t'] and specializes[t',t"])
implies isSubordinateTo[t,t"] /** Transitive */
}
/** NEW THEOREMS */
/** The theorems below are not cited in Sosym paper, even in natural language */
/** Since every specialization of Entity_ has instances, it has is and instance of Type_.
* Also, every instance of Type_ is a specialization of Entity_. So, Type_ is powertype of
* Entity. */
pred TypeIsPowerTypeOfEntity
{
all t :Type_, e :Entity_ | powertypeOf[t,e]
}
/** This "theorem" shows the basic model of MLT*, the same MLT Basic Types does. */
pred mltStarPattern
{
all t :Type_, e :Entity_ | iof[t,e]
all t :Type_, e :Entity_ | iof[e,t]
lone Entity_
lone Type_
lone OrderlessType_
lone OrderedType_
lone Individual_
}
/** If a type t has some cross-level relation to some type t', t is going to characterize
* every type t' specializes from. */
pred trivialCharacterization
{
all t, t' :Type |
(powertypeOf[t,t'] or characterizes[t,t']) implies
(all t" :Type | properSpecializes[t',t"] implies characterizes[t,t"])
}
/** A type can only be a powertype or characterizer of other type, excluding trivial
* characterizations. */
pred uniqueCrossLevelRelation
{
all disj t, t', t" :Type |
(characterizes[t,t'] and powertypeOf[t,t"]) implies triviallyCharacterizes[t,t']
}
/** Every type that is source of a cross-level relation characterizes Entity_, unless
* it is the the powertype of Entity_, Type_. */
pred allCharacterizesOfEntity_
{
let sources = (powertypeOf + characterizes).Type | all t :sources |
some Entity_ implies (characterizes[t,Entity_] or t in Type_)
}
pred noSelfCharacterization
{
no t :OrderedType | t in characterizes.Type and iof[t,t]
}
pred noMultilpleCharacterizationOfOrderedTypes
{
/** I'd like to expand this to all types */
all disj t, t', t" :OrderedType |
(characterizes[t,t'] and characterizes[t,t"] and properSpecializes[t',t"]) implies
(triviallyCharacterizes[t,t"])
}
/** This is not a new theorem, it is the transitivity the paper describes on the table*/
pred trivialSubordination
{
all t, t' :Type | isSubordinateTo[t,t'] implies isSubordinateTo[t,t'.specializes]
}
pred inheritedCharacterization
{
all t, t' :Type |
(characterizes[t,t'] and not triviallyCharacterizes[t,t']) implies
(all t" :Type | specializes[t",t] implies characterizes[t",t'])
}
/** Reflexive, assymetric, transitive */
pred specializesProperties
{
all t :Type | specializes[t,t]
no t, t' :Type | specializes[t,t'] and specializes[t',t]
all t, t', t'' :Type | specializes[t,t'] and specializes[t',t''] implies specializes[t,t'']
}
/** Irreflexive, assymetric, transitive */
pred properSpecializesProperties
{
no t :Type | properSpecializes[t,t]
no t, t' :Type | properSpecializes[t,t'] and properSpecializes[t',t]
all t, t', t'' :Type | properSpecializes[t,t'] and properSpecializes[t',t''] implies properSpecializes[t,t'']
}
/** Irreflexive */
pred isSubordinateToProperties
{
no t :Type | isSubordinateTo[t,t]
// TIMEOUT - no t, t' :Type | isSubordinateTo[t,t'] and isSubordinateTo[t',t]
// TIMEOUT - all t, t', t'' :Type | isSubordinateTo[t,t'] and isSubordinateTo[t',t''] implies isSubordinateTo[t,t'']
}
/** Irreflexive, assymetric, intransitive */
pred powertypeOfProperties
{
no t :Type | powertypeOf[t,t]
no t, t' :Type | powertypeOf[t,t'] and powertypeOf[t',t]
no t, t', t'' :Type | powertypeOf[t,t'] and powertypeOf[t',t''] and powertypeOf[t,t'']
}
/** Irreflexive, assymetric, non-transitive */
pred characterizesProperties
{
no t :Type | characterizes[t,t]
no t, t' :Type | characterizes[t,t'] and characterizes[t',t]
no t, t', t'' :Type | characterizes[t,t'] and characterizes[t',t''] and characterizes[t,t'']
}
/** Irreflexive, assymetric, intransitive */
pred compCharacterizesProperties
{
no t :Type | compCharacterizes[t,t]
no t, t' :Type | compCharacterizes[t,t'] and compCharacterizes[t',t]
no t, t', t'' :Type | compCharacterizes[t,t'] and compCharacterizes[t',t''] and compCharacterizes[t,t'']
}
check { compCharacterizesProperties } for 11
/** Irreflexive, assymetric, non-transitive */
pred disjCharacterizesProperties
{
no t :Type | disjCharacterizes[t,t]
no t, t' :Type | disjCharacterizes[t,t'] and disjCharacterizes[t',t]
//no t, t', t'' :Type | disjCharacterizes[t,t'] and disjCharacterizes[t',t''] and disjCharacterizes[t,t'']
}
/** Irreflexive, assymetric, intransitive */
pred partitionsProperties
{
no t :Type | partitions[t,t]
no t, t' :Type | partitions[t,t'] and partitions[t',t]
no t, t', t'' :Type | partitions[t,t'] and partitions[t',t''] and partitions[t,t'']
}
check
{
// no t :OrderlessType, t':OrderedType | characterizes[t,t']
//Type = OrderedType+OrderlessType
no e :Entity | #(e.iof & BasicType) > 1
}
for 10
-- Defining the "R_" basic type
sig R_ in Type {}
fact {
all e : Entity |
e in R_ iff
(
(all x : Entity | e in x.iof iff (x not in iof.x))
)
}
-- existence of the "Russellian" type
pred noRussellProperty
{
no R_
}
/** SIMULATIONS HELPERS */
pred simulate2Level
{
// simulates two-level model (non multi-level)
#BasicType=1 and no OrderlessType
}
pred simulate3Level
{
// simulates three-level model (multi-level but no OrderlessType)
#BasicType=2 and no OrderlessType
}
pred simulateMLTStar
{
// simulates three-level model with orderless entities
#BasicType=3 and some OrderlessType
}
pred simulateMLTStarPredefinedTypes -- MLT star with all the predefined types
{
some Entity_ and some Type_ and some OrderedType_ and some OrderlessType_
and some BasicType
some OrderedType - BasicType
}
assert formalizedSosymTheorems
{
BasicType in OrderedType
theoremT10 and theoremT11 and theoremT12 and theoremT13 and theoremT14
}
assert nonFormalizedSosymTheorems
{
iofPropertiesForOrderedTypes
specializationProperties
basicMLTPattern
subordinationProperties
}
assert newTheorems
{
TypeIsPowerTypeOfEntity
mltStarPattern
trivialCharacterization
uniqueCrossLevelRelation
allCharacterizesOfEntity_
noSelfCharacterization
noMultilpleCharacterizationOfOrderedTypes
trivialSubordination
inheritedCharacterization
}
assert allTheorems
{
/** formalizedSosymTheorems */
BasicType in OrderedType
theoremT10 and theoremT11 and theoremT12 and theoremT13 and theoremT14
/** nonFormalizedSosymTheorems */
iofPropertiesForOrderedTypes
specializationProperties
basicMLTPattern
subordinationProperties
/** newTheorems */
TypeIsPowerTypeOfEntity
mltStarPattern
trivialCharacterization
uniqueCrossLevelRelation
allCharacterizesOfEntity_
noSelfCharacterization
noMultilpleCharacterizationOfOrderedTypes
trivialSubordination
inheritedCharacterization
}
assert noRussellProperty_ {
noRussellProperty
}
/** SIMULATIONS */
run simulate2Level for 7
run simulate3Level for 10
run simulateMLTStar for 8
run simulateMLTStarPredefinedTypes for 15
check formalizedSosymTheorems for 7
check nonFormalizedSosymTheorems for 7
check newTheorems for 11
check allTheorems for 7
check noRussellProperty_ for 8
/* It is necessary at least 7 entities in order to instantiated MLT* basic model. */