-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from LiliNemes/subsetting
Implement subsetting for references and predicates.
- Loading branch information
Showing
52 changed files
with
1,320 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...or/src/test/resources/tools/refinery/generator/concretization/predicateSubsetting.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class A { | ||
partial A[] foo | ||
} | ||
|
||
pred hasCommonFoo(A a1, A a2) <-> | ||
a1 != a2, | ||
a1 != a3, | ||
a2 != a3, | ||
foo(a1, a3), | ||
foo(a2, a3). | ||
|
||
pred noCommonFoo(A a1, A a2) subsets foo <-> | ||
a1 != a2, | ||
!hasCommonFoo(a1, a2). | ||
|
||
!exists(A::new). | ||
atom x, y, z. | ||
A(x). | ||
A(y). | ||
A(z). | ||
concretization rule addNoFoo() ==> !foo(x, z). | ||
|
||
% EXPECT CANDIDATE: | ||
foo(x, y). | ||
foo(y, x). | ||
!noCommonFoo(x, z). |
38 changes: 38 additions & 0 deletions
38
...resources/tools/refinery/generator/semantics/crossreference/basePredicateSuperset.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class Definition. | ||
|
||
class Usage. | ||
|
||
class PartDefinition extends Definition. | ||
|
||
class PartUsage extends Usage. | ||
|
||
class FeatureTyping { | ||
Usage[1] typedFeature | ||
Definition[1] featureType | ||
} | ||
|
||
pred def(Usage u, Definition d) <-> | ||
typedFeature(t, u), | ||
featureType(t, d). | ||
|
||
pred partDef(PartUsage u, PartDefinition d) subsets def. | ||
|
||
% TEST: subset not allowed | ||
|
||
PartUsage(part1). | ||
PartDefinition(partDef1). | ||
!exists(FeatureTyping::new). | ||
|
||
% EXPECT: | ||
!partDef(part1, partDef1). | ||
|
||
% TEST: superset forced | ||
|
||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). |
53 changes: 53 additions & 0 deletions
53
...est/resources/tools/refinery/generator/semantics/crossreference/containerSuperset.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class Definition { | ||
Usage[] usages opposite def | ||
} | ||
|
||
class Usage { | ||
Definition[] def opposite usages | ||
} | ||
|
||
class PartDefinition extends Definition { | ||
container PartUsage partUsages opposite partDef subsets usages | ||
} | ||
|
||
class PartUsage extends Usage { | ||
contains PartDefinition[] partDef opposite partUsages | ||
} | ||
|
||
% TEST: subset not allowed | ||
|
||
PartUsage(part1). | ||
PartDefinition(partDef1). | ||
!def(part1, partDef1). | ||
|
||
% EXPECT: | ||
!partDef(part1, partDef1). | ||
|
||
% TEST: superset forced | ||
|
||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). | ||
|
||
% TEST: superset forced with default false | ||
|
||
default !def(*, *). | ||
partDef(part1, partDef1). | ||
?def(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). | ||
|
||
% TEST WITH ERRORS: inconsistency with default false | ||
|
||
default !def(*, *). | ||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1): error. | ||
partDef(part1, partDef1): error. |
49 changes: 49 additions & 0 deletions
49
...t/resources/tools/refinery/generator/semantics/crossreference/containmentSuperset.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class Definition. | ||
|
||
class Usage { | ||
Definition[] def | ||
} | ||
|
||
class PartDefinition extends Definition. | ||
|
||
class PartUsage extends Usage { | ||
contains PartDefinition[] partDef subsets def | ||
} | ||
|
||
% TEST: subset not allowed | ||
|
||
PartUsage(part1). | ||
PartDefinition(partDef1). | ||
!def(part1, partDef1). | ||
|
||
% EXPECT: | ||
!partDef(part1, partDef1). | ||
|
||
% TEST: superset forced | ||
|
||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). | ||
|
||
% TEST: superset forced with default false | ||
|
||
default !def(*, *). | ||
partDef(part1, partDef1). | ||
?def(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). | ||
|
||
% TEST WITH ERRORS: inconsistency with default false | ||
|
||
default !def(*, *). | ||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1): error. | ||
partDef(part1, partDef1): error. |
31 changes: 31 additions & 0 deletions
31
...test/resources/tools/refinery/generator/semantics/crossreference/directedSuperset.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class Definition. | ||
|
||
class Usage { | ||
Definition[] def | ||
} | ||
|
||
class PartDefinition extends Definition. | ||
|
||
class PartUsage extends Usage { | ||
PartDefinition[] partDef subsets def | ||
} | ||
|
||
% TEST: subset not allowed | ||
|
||
PartUsage(part1). | ||
PartDefinition(partDef1). | ||
!def(part1, partDef1). | ||
|
||
% EXPECT: | ||
!partDef(part1, partDef1). | ||
|
||
% TEST: superset forced | ||
|
||
partDef(part1, partDef1). | ||
|
||
% EXPECT: | ||
def(part1, partDef1). |
29 changes: 29 additions & 0 deletions
29
...st/resources/tools/refinery/generator/semantics/crossreference/undirectedSuperset.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class Usage { | ||
Usage[] usage | ||
} | ||
|
||
class PartUsage extends Usage { | ||
PartUsage[] partUsage opposite partUsage subsets usage | ||
} | ||
|
||
% TEST: subset not allowed | ||
|
||
PartUsage(part1). | ||
PartUsage(part2). | ||
!usage(part1, part2). | ||
|
||
% EXPECT: | ||
!partUsage(part1, part2). | ||
!partUsage(part2, part1). | ||
|
||
% TEST: superset forced | ||
|
||
partUsage(part1, part2). | ||
|
||
% EXPECT: | ||
usage(part1, part2). | ||
usage(part2, part1). |
39 changes: 39 additions & 0 deletions
39
...nerator/src/test/resources/tools/refinery/generator/semantics/predicateSubsetting.problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
% Copyright (c) 2024 The Refinery Authors <https://refinery.tools/> | ||
% | ||
% SPDX-License-Identifier: EPL-2.0 | ||
|
||
class A { | ||
A[] foo | ||
} | ||
|
||
pred hasCommonFoo(A a1, A a2) <-> | ||
a1 != a2, | ||
a1 != a3, | ||
a2 != a3, | ||
foo(a1, a3), | ||
foo(a2, a3). | ||
|
||
pred noCommonFoo(A a1, A a2) subsets foo <-> | ||
a1 != a2, | ||
!hasCommonFoo(a1, a2). | ||
|
||
!exists(A::new). | ||
A(x). | ||
A(y). | ||
A(z). | ||
|
||
% TEST: no propagation without assertion | ||
|
||
% EXPECT EXACTLY: | ||
?foo(x, y). | ||
?foo(y, x). | ||
?noCommonFoo(x, z). | ||
|
||
% TEST: with negative assertion | ||
|
||
!foo(x, z). | ||
|
||
% EXPECT: | ||
foo(x, y). | ||
foo(y, x). | ||
!noCommonFoo(x, z). |
Oops, something went wrong.