aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/MODELS2020-CaseStudies/case.study.familyTree.run/outputs/debug/generated3valued.vql_deactivated
blob: 315a1e15f1452e3c2f434214bc3e9f02767b4515 (plain) (blame)
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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
import epackage "http://www.bme.hu/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage"
import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/problem"
import epackage "http://www.bme.hu/mit/inf/dslreasoner/logic/model/language"

//////////
// 0. Util
//////////
private pattern interpretation(problem:LogicProblem, interpretation:PartialInterpretation) {
	PartialInterpretation.problem(interpretation,problem);
}
	
/////////////////////////
// 0.1 Existence
/////////////////////////
/** [[exist(element)]]=1 */
private pattern mustExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
	find interpretation(problem,interpretation);
	LogicProblem.elements(problem,element);
} or {
	find interpretation(problem,interpretation);
	PartialInterpretation.newElements(interpretation,element);
}

/** [[exist(element)]]>=1/2 */
private pattern mayExist(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
    find mustExist(problem,interpretation,element);
} or {
    find interpretation(problem,interpretation);
    neg find elementCloseWorld(element);
    PartialInterpretation.openWorldElements(interpretation,element);
}

private pattern elementCloseWorld(element:DefinedElement) {
	PartialInterpretation.openWorldElements(i,element);
    PartialInterpretation.maxNewElements(i,0);
} or {
	Scope.targetTypeInterpretation(scope,interpretation);
	PartialTypeInterpratation.elements(interpretation,element);
	Scope.maxNewElements(scope,0);
}

////////////////////////
// 0.2 Equivalence
////////////////////////
pattern mayEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement)
// For non-primitive type. Boolean types always must equivalent or cannot equivalent
{
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	a == b;
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	IntegerElement(a);
	IntegerElement(b);
	PrimitiveElement.valueSet(a,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	IntegerElement(a);
	IntegerElement(b);
	PrimitiveElement.valueSet(b,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	RealElement(a);
	RealElement(b);
	PrimitiveElement.valueSet(a,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	RealElement(a);
	RealElement(b);
	PrimitiveElement.valueSet(b,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	RealElement(a);
	IntegerElement(b);
	PrimitiveElement.valueSet(a,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	RealElement(a);
	IntegerElement(b);
	PrimitiveElement.valueSet(b,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	IntegerElement(a);
	RealElement(b);
	PrimitiveElement.valueSet(a,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	IntegerElement(a);
	RealElement(b);
	PrimitiveElement.valueSet(b,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	StringElement(a);
	StringElement(b);
	PrimitiveElement.valueSet(a,false);
} or {
	find mayExist(problem,interpretation,a);
	find mayExist(problem,interpretation,b);
	StringElement(a);
	StringElement(b);
	PrimitiveElement.valueSet(b,false);
}

pattern mustEquivalent(problem:LogicProblem, interpretation:PartialInterpretation, a: DefinedElement, b: DefinedElement) {
// For non-primitive and Boolean primitive type
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	a == b;
} or {
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	PrimitiveElement.valueSet(a,true);
	PrimitiveElement.valueSet(b,true);
	IntegerElement.value(a,value);
	IntegerElement.value(b,value);
} or {
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	PrimitiveElement.valueSet(a,true);
	PrimitiveElement.valueSet(b,true);
	RealElement.value(a,value);
	RealElement.value(b,value);
} or {
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	PrimitiveElement.valueSet(a,true);
	PrimitiveElement.valueSet(b,true);
	RealElement.value(a,value);
	IntegerElement.value(b,value);
} or {
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	PrimitiveElement.valueSet(a,true);
	PrimitiveElement.valueSet(b,true);
	IntegerElement.value(a,value);
	RealElement.value(b,value);
} or {
	find mustExist(problem,interpretation,a);
	find mustExist(problem,interpretation,b);
	PrimitiveElement.valueSet(a,true);
	PrimitiveElement.valueSet(b,true);
	StringElement.value(a,value);
	StringElement.value(b,value);
}

//////////
// 1. Problem-Specific Base Indexers
//////////
// 1.1 Type Indexers
//////////
// 1.1.1 Required Patterns by TypeIndexer
//////////
private pattern typeInterpretation(problem:LogicProblem, interpretation:PartialInterpretation, type:TypeDeclaration, typeInterpretation:PartialComplexTypeInterpretation) {
	find interpretation(problem,interpretation);
	LogicProblem.types(problem,type);
	PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
	PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
}

private pattern directInstanceOf(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement, type:Type) {
	find interpretation(problem,interpretation);
	LogicProblem.types(problem,type);
	TypeDefinition.elements(type,element);
} or {
	find interpretation(problem,interpretation);
	find typeInterpretation(problem,interpretation,type,typeInterpretation);
	PartialComplexTypeInterpretation.elements(typeInterpretation,element);
}

private pattern isPrimitive(element: PrimitiveElement) {
	PrimitiveElement(element);
}
//////////
// 1.1.2 primitive Type Indexers
//////////
// Currently unused. Refer primitive types as:
// > PrimitiveElement(element)
// specific types are referred as:
// > BooleanElement(variableName)
// > IntegerElement(variableName)
// > RealElement(variableName)
// > StringElement(variableName)
// And their value as
// > BooleanElement.value(variableName,value)
// > IntegerElement.value(variableName,value)
// > RealElement.value(variableName,value)
// > StringElement.value(variableName,value)
// Whether a value is set is defined by:
// > PrimitiveElement.valueSet(variableName,isFilled);
//////////
// 1.1.3 domain-specific Type Indexers
//////////
/**
 * An element must be an instance of type "FamilyTree class".
 */
private pattern mustInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
	Type.name(type,"FamilyTree class");
	find directInstanceOf(problem,interpretation,element,type);
}
private pattern scopeDisallowsNewFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation) {
	find interpretation(problem,interpretation);
	PartialInterpretation.scopes(interpretation,scope);
	Scope.targetTypeInterpretation(scope,typeInterpretation);
	Scope.maxNewElements(scope,0);
	PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
	Type.name(type,"FamilyTree class");
}

/**
 * An element may be an instance of type "FamilyTree class".
 */
private pattern mayInstanceOfFamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.newElements(interpretation,element);
	neg find mustInstanceOfMember_class(problem,interpretation,element);
	neg find scopeDisallowsNewFamilyTree_class(problem, interpretation);
	neg find isPrimitive(element);
} or {
	find interpretation(problem,interpretation);
	PartialInterpretation.openWorldElements(interpretation,element);
	neg find mustInstanceOfMember_class(problem,interpretation,element);
	neg find scopeDisallowsNewFamilyTree_class(problem, interpretation);
	neg find isPrimitive(element);
} or
{ find mustInstanceOfFamilyTree_class(problem,interpretation,element); }
/**
 * An element must be an instance of type "Member class".
 */
private pattern mustInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement) {
	Type.name(type,"Member class");
	find directInstanceOf(problem,interpretation,element,type);
}
private pattern scopeDisallowsNewMember_class(problem:LogicProblem, interpretation:PartialInterpretation) {
	find interpretation(problem,interpretation);
	PartialInterpretation.scopes(interpretation,scope);
	Scope.targetTypeInterpretation(scope,typeInterpretation);
	Scope.maxNewElements(scope,0);
	PartialComplexTypeInterpretation.interpretationOf(typeInterpretation,type);
	Type.name(type,"Member class");
}

/**
 * An element may be an instance of type "Member class".
 */
private pattern mayInstanceOfMember_class(problem:LogicProblem, interpretation:PartialInterpretation, element:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.newElements(interpretation,element);
	neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
	neg find scopeDisallowsNewMember_class(problem, interpretation);
	neg find isPrimitive(element);
} or {
	find interpretation(problem,interpretation);
	PartialInterpretation.openWorldElements(interpretation,element);
	neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
	neg find scopeDisallowsNewMember_class(problem, interpretation);
	neg find isPrimitive(element);
} or
{ find mustInstanceOfMember_class(problem,interpretation,element); }

//////////
// 1.2 Relation Declaration Indexers
//////////
/**
 * Matcher for detecting tuples t where []members reference FamilyTree(source,target)
 */
private pattern mustInRelationmembers_reference_FamilyTree(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"members reference FamilyTree");
	PartialRelationInterpretation.relationlinks(relationIterpretation,link);
	BinaryElementRelationLink.param1(link,source);
	BinaryElementRelationLink.param2(link,target);
}
/**
 * Matcher for detecting tuples t where <>members reference FamilyTree(source,target)
 */
private pattern mayInRelationmembers_reference_FamilyTree(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	// The two endpoint of the link have to exist
	find mayExist(problem, interpretation, source);
	find mayExist(problem, interpretation, target);
	// Type consistency
	find mayInstanceOfFamilyTree_class(problem,interpretation,source);
	find mayInstanceOfMember_class(problem,interpretation,target);
	// The reference is containment, then a new reference cannot be create if:
	// 1. Multiple parents
	neg find mustContains4(problem,interpretation,_,target);
	// 2. Circle in the containment hierarchy
	neg find mustTransitiveContains(source,target);
} or {
	find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target);
}
/**
 * Matcher for detecting tuples t where []children reference Member(source,target)
 */
private pattern mustInRelationchildren_reference_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member");
	PartialRelationInterpretation.relationlinks(relationIterpretation,link);
	BinaryElementRelationLink.param1(link,source);
	BinaryElementRelationLink.param2(link,target);
}
/**
 * Matcher for detecting tuples t where <>children reference Member(source,target)
 */
private pattern mayInRelationchildren_reference_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	// The two endpoint of the link have to exist
	find mayExist(problem, interpretation, source);
	find mayExist(problem, interpretation, target);
	// Type consistency
	find mayInstanceOfMember_class(problem,interpretation,source);
	find mayInstanceOfMember_class(problem,interpretation,target);
	// There are "numberOfExistingReferences" currently existing instances of the reference to the target,
	// the upper bound of the opposite reference multiplicity should be considered.
	numberOfExistingOppositeReferences == count find mustInRelationparents_reference_Member(problem,interpretation,target,_);
	check(numberOfExistingOppositeReferences < 2);
} or {
	find mustInRelationchildren_reference_Member(problem,interpretation,source,target);
}
/**
 * Matcher for detecting tuples t where []parents reference Member(source,target)
 */
private pattern mustInRelationparents_reference_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"parents reference Member");
	PartialRelationInterpretation.relationlinks(relationIterpretation,link);
	BinaryElementRelationLink.param1(link,source);
	BinaryElementRelationLink.param2(link,target);
}
/**
 * Matcher for detecting tuples t where <>parents reference Member(source,target)
 */
private pattern mayInRelationparents_reference_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	// The two endpoint of the link have to exist
	find mayExist(problem, interpretation, source);
	find mayExist(problem, interpretation, target);
	// Type consistency
	find mayInstanceOfMember_class(problem,interpretation,source);
	find mayInstanceOfMember_class(problem,interpretation,target);
	// There are "numberOfExistingReferences" currently existing instances of the reference from the source,
	// the upper bound of the multiplicity should be considered.
	numberOfExistingReferences == count find mustInRelationparents_reference_Member(problem,interpretation,source,_);
	check(numberOfExistingReferences < 2);
} or {
	find mustInRelationparents_reference_Member(problem,interpretation,source,target);
}
/**
 * Matcher for detecting tuples t where []name attribute Member(source,target)
 */
private pattern mustInRelationname_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member");
	PartialRelationInterpretation.relationlinks(relationIterpretation,link);
	BinaryElementRelationLink.param1(link,source);
	BinaryElementRelationLink.param2(link,target);
}
/**
 * Matcher for detecting tuples t where <>name attribute Member(source,target)
 */
private pattern mayInRelationname_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	// The two endpoint of the link have to exist
	find mayExist(problem, interpretation, source);
	find mayExist(problem, interpretation, target);
	// Type consistency
	find mayInstanceOfMember_class(problem,interpretation,source);
	StringElement(target);
	// There are "numberOfExistingReferences" currently existing instances of the reference from the source,
	// the upper bound of the multiplicity should be considered.
	numberOfExistingReferences == count find mustInRelationname_attribute_Member(problem,interpretation,source,_);
	check(numberOfExistingReferences < 1);
} or {
	find mustInRelationname_attribute_Member(problem,interpretation,source,target);
}
/**
 * Matcher for detecting tuples t where []age attribute Member(source,target)
 */
private pattern mustInRelationage_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member");
	PartialRelationInterpretation.relationlinks(relationIterpretation,link);
	BinaryElementRelationLink.param1(link,source);
	BinaryElementRelationLink.param2(link,target);
}
/**
 * Matcher for detecting tuples t where <>age attribute Member(source,target)
 */
private pattern mayInRelationage_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target:DefinedElement)
{
	find interpretation(problem,interpretation);
	// The two endpoint of the link have to exist
	find mayExist(problem, interpretation, source);
	find mayExist(problem, interpretation, target);
	// Type consistency
	find mayInstanceOfMember_class(problem,interpretation,source);
	IntegerElement(target);
	// There are "numberOfExistingReferences" currently existing instances of the reference from the source,
	// the upper bound of the multiplicity should be considered.
	numberOfExistingReferences == count find mustInRelationage_attribute_Member(problem,interpretation,source,_);
	check(numberOfExistingReferences < 1);
} or {
	find mustInRelationage_attribute_Member(problem,interpretation,source,target);
}

//////////
// 1.3 Relation Definition Indexers
//////////
// Must, May and Current queries for pattern queries memberIsItsOwnParent
private pattern mustInRelation_pattern_queries_memberIsItsOwnParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	var_m == var_p;
	find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
	find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
}
private pattern mayInRelation_pattern_queries_memberIsItsOwnParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	var_m == var_p;
	find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
	find mayInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
}
private pattern currentInRelation_pattern_queries_memberIsItsOwnParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	var_m == var_p;
	find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_p);
	find mustInRelationparents_reference_Member(problem,interpretation,var_p,var_p);
}
// Must, May and Current queries for pattern queries twoMembersHaveNoParent
private pattern mustInRelation_pattern_queries_twoMembersHaveNoParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m1, var_m2)
{
	find interpretation(problem,interpretation);
	// var_m1 exported
	// var_m2 exported
	find mustInstanceOfMember_class(problem,interpretation,var_m1);
	find mustInstanceOfMember_class(problem,interpretation,var_m2);
	neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
	neg find mayInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
	neg find mayEquivalent(problem, interpretation, var_m1, var_m2);
}
private pattern mayInRelation_pattern_queries_twoMembersHaveNoParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m1, var_m2)
{
	find interpretation(problem,interpretation);
	// var_m1 exported
	// var_m2 exported
	find mayInstanceOfMember_class(problem,interpretation,var_m1);
	find mayInstanceOfMember_class(problem,interpretation,var_m2);
	neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
	neg find mustInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
	neg find mustEquivalent(problem, interpretation, var_m1, var_m2);
}
private pattern currentInRelation_pattern_queries_twoMembersHaveNoParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m1, var_m2)
{
	find interpretation(problem,interpretation);
	// var_m1 exported
	// var_m2 exported
	find mustInstanceOfMember_class(problem,interpretation,var_m1);
	find mustInstanceOfMember_class(problem,interpretation,var_m2);
	neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m1);
	neg find currentInRelation_pattern_queries_memberHasParent(problem,interpretation,var_m2);
	neg find mustEquivalent(problem, interpretation, var_m1, var_m2);
}
// Must, May and Current queries for pattern queries memberHasParent
private pattern mustInRelation_pattern_queries_memberHasParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	// var_m exported
	find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
	find mustInstanceOfMember_class(problem,interpretation,var__0);
}
private pattern mayInRelation_pattern_queries_memberHasParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	// var_m exported
	find mayInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
	find mayInstanceOfMember_class(problem,interpretation,var__0);
}
private pattern currentInRelation_pattern_queries_memberHasParent(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find interpretation(problem,interpretation);
	// var_m exported
	find mustInRelationparents_reference_Member(problem,interpretation,var_m,var__0);
	find mustInstanceOfMember_class(problem,interpretation,var__0);
}
// Must, May and Current queries for pattern queries parentTooYoung
private pattern mustInRelation_pattern_queries_parentTooYoung(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m, var_p)
{
	find interpretation(problem,interpretation);
	// var_m exported
	// var_p exported
	find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
	find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
	find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
	find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
	PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge);
	PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge);
	check((value_var_mAge<=(value_var_pAge+12)));
}
private pattern mayInRelation_pattern_queries_parentTooYoung(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m, var_p)
{
	find interpretation(problem,interpretation);
	// var_m exported
	// var_p exported
	find mayInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
	find mayInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
	find mayInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
	find mayInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
	PrimitiveElement.valueSet(var_mAge,setted_var_mAge); IntegerElement.value(var_mAge,value_var_mAge);
	PrimitiveElement.valueSet(var_pAge,setted_var_pAge); IntegerElement.value(var_pAge,value_var_pAge);
	check(
		!setted_var_mAge || !setted_var_pAge
		||
		((value_var_mAge<=(value_var_pAge+12)))
	);
}
private pattern currentInRelation_pattern_queries_parentTooYoung(
	problem:LogicProblem, interpretation:PartialInterpretation,
	var_m, var_p)
{
	find interpretation(problem,interpretation);
	// var_m exported
	// var_p exported
	find mustInRelationmembers_reference_FamilyTree(problem,interpretation,_var__0,var_m);
	find mustInRelationparents_reference_Member(problem,interpretation,var_m,var_p);
	find mustInRelationage_attribute_Member(problem,interpretation,var_m,var_mAge);
	find mustInRelationage_attribute_Member(problem,interpretation,var_p,var_pAge);
	PrimitiveElement.valueSet(var_mAge,true); IntegerElement.value(var_mAge,value_var_mAge);
	PrimitiveElement.valueSet(var_pAge,true); IntegerElement.value(var_pAge,value_var_pAge);
	check((value_var_mAge<=(value_var_pAge+12)));
}

//////////
// 1.4 Containment Indexer
//////////
private pattern mustContains2(source: DefinedElement, target: DefinedElement) {
	find mustContains4(_,_,source,target);
}
	
private pattern mustContains4(problem:LogicProblem, interpretation:PartialInterpretation,
	source: DefinedElement, target: DefinedElement)
	{ find mustInRelationmembers_reference_FamilyTree(problem,interpretation,source,target); }

private pattern mustTransitiveContains(source,target) {
	find mustContains2+(source,target);
}

//////////
// 2. Invalidation Indexers
//////////
// 2.1 Invalidated by WF Queries
//////////
pattern invalidatedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find mustInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m);
}
pattern invalidatedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m1, var_m2)
{
	find mustInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2);
}
pattern invalidatedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m, var_p)
{
	find mustInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p);
}

//////////
// 3. Unfinishedness Indexers
//////////
// 3.1 Unfinishedness Measured by Multiplicity
//////////

//////////
// 3.2 Unfinishedness Measured by WF Queries
//////////
pattern unfinishedBy_pattern_queries_memberIsItsOwnParent(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m)
{
	find currentInRelation_pattern_queries_memberIsItsOwnParent(problem,interpretation,var_m);
}
pattern unfinishedBy_pattern_queries_twoMembersHaveNoParent(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m1, var_m2)
{
	find currentInRelation_pattern_queries_twoMembersHaveNoParent(problem,interpretation,var_m1,var_m2);
}
pattern unfinishedBy_pattern_queries_parentTooYoung(problem:LogicProblem, interpretation:PartialInterpretation,
	var_m, var_p)
{
	find currentInRelation_pattern_queries_parentTooYoung(problem,interpretation,var_m,var_p);
}

//////////
// 4. Refinement Indexers
//////////
// 4.1 Object constructors
//////////
private pattern hasElementInContainment(problem:LogicProblem, interpretation:PartialInterpretation)
{
	find interpretation(problem,interpretation);
	find mustInstanceOfFamilyTree_class(problem,interpretation,root);
	find mustExist(problem, interpretation, root);
}or{
	find interpretation(problem,interpretation);
	find mustInstanceOfMember_class(problem,interpretation,root);
	find mustExist(problem, interpretation, root);
}
pattern createObject_Member_class_by_members_reference_FamilyTree(
	problem:LogicProblem, interpretation:PartialInterpretation,
	relationInterpretation:PartialRelationInterpretation, typeInterpretation:PartialComplexTypeInterpretation,
	container:DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
	PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class");
	PartialInterpretation.partialrelationinterpretation(interpretation,relationInterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationInterpretation,"members reference FamilyTree");
	find mustInstanceOfFamilyTree_class(problem,interpretation,container);
	find mayInstanceOfMember_class(problem,interpretation,newObject);
	find mayInRelationmembers_reference_FamilyTree(problem,interpretation,container,newObject);
	find mustExist(problem, interpretation, container);
	neg find mustExist(problem, interpretation, newObject);
}
pattern createObject_Member_class(
	problem:LogicProblem, interpretation:PartialInterpretation,
	typeInterpretation:PartialComplexTypeInterpretation)
{
	find interpretation(problem,interpretation);
	neg find hasElementInContainment(problem,interpretation);
	PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
	PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"Member class");
	find mayInstanceOfMember_class(problem,interpretation,newObject);
	find mayExist(problem, interpretation, newObject);
	neg find mustExist(problem, interpretation, newObject);
}
pattern createObject_FamilyTree_class(
	problem:LogicProblem, interpretation:PartialInterpretation,
	typeInterpretation:PartialComplexTypeInterpretation)
{
	find interpretation(problem,interpretation);
	neg find hasElementInContainment(problem,interpretation);
	PartialInterpretation.partialtypeinterpratation(interpretation,typeInterpretation);
	PartialComplexTypeInterpretation.interpretationOf.name(typeInterpretation,"FamilyTree class");
	find mayInstanceOfFamilyTree_class(problem,interpretation,newObject);
	find mayExist(problem, interpretation, newObject);
	neg find mustExist(problem, interpretation, newObject);
}

//////////
// 4.2 Type refinement
//////////
pattern refineTypeTo_Member_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) {
	find interpretation(problem,interpretation);
	PartialInterpretation.newElements(interpretation,element);
	find mayInstanceOfMember_class(problem,interpretation,element);
	neg find mustInstanceOfMember_class(problem,interpretation,element);
	neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
}
pattern refineTypeTo_FamilyTree_class(problem:LogicProblem, interpretation:PartialInterpretation, element: DefinedElement) {
	find interpretation(problem,interpretation);
	PartialInterpretation.newElements(interpretation,element);
	find mayInstanceOfFamilyTree_class(problem,interpretation,element);
	neg find mustInstanceOfMember_class(problem,interpretation,element);
	neg find mustInstanceOfFamilyTree_class(problem,interpretation,element);
}

//////////
// 4.3 Relation refinement
//////////
pattern refineRelation_children_reference_Member_and_parents_reference_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	relationIterpretation:PartialRelationInterpretation, oppositeInterpretation:PartialRelationInterpretation,
	from: DefinedElement, to: DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"children reference Member");
	PartialInterpretation.partialrelationinterpretation(interpretation,oppositeInterpretation);
	PartialRelationInterpretation.interpretationOf.name(oppositeInterpretation,"parents reference Member");
	find mustExist(problem, interpretation, from);
	find mustExist(problem, interpretation, to);
	find mustInstanceOfMember_class(problem,interpretation,from);
	find mustInstanceOfMember_class(problem,interpretation,to);
	find mayInRelationchildren_reference_Member(problem,interpretation,from,to);
	neg find mustInRelationchildren_reference_Member(problem,interpretation,from,to);
}
pattern refineRelation_name_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	relationIterpretation:PartialRelationInterpretation,
	from: DefinedElement, to: DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"name attribute Member");
	find mustExist(problem, interpretation, from);
	find mustExist(problem, interpretation, to);
	find mustInstanceOfMember_class(problem,interpretation,from);
	StringElement(to);
	find mayInRelationname_attribute_Member(problem,interpretation,from,to);
	neg find mustInRelationname_attribute_Member(problem,interpretation,from,to);
}
pattern refineRelation_age_attribute_Member(
	problem:LogicProblem, interpretation:PartialInterpretation,
	relationIterpretation:PartialRelationInterpretation,
	from: DefinedElement, to: DefinedElement)
{
	find interpretation(problem,interpretation);
	PartialInterpretation.partialrelationinterpretation(interpretation,relationIterpretation);
	PartialRelationInterpretation.interpretationOf.name(relationIterpretation,"age attribute Member");
	find mustExist(problem, interpretation, from);
	find mustExist(problem, interpretation, to);
	find mustInstanceOfMember_class(problem,interpretation,from);
	IntegerElement(to);
	find mayInRelationage_attribute_Member(problem,interpretation,from,to);
	neg find mustInRelationage_attribute_Member(problem,interpretation,from,to);
}

//////////
// 5 Unit Propagations
//////////

// Main propagations: