forked from souffle-lang/souffle
-
Notifications
You must be signed in to change notification settings - Fork 0
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 souffle-lang#1712 from darth-tytus/negation
Relax type constraints involving negation.
- Loading branch information
Showing
9 changed files
with
133 additions
and
61 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
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
69 changes: 69 additions & 0 deletions
69
tests/semantic/type_system_negation/type_system_negation.dl
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,69 @@ | ||
// Souffle - A Datalog Compiler | ||
// Copyright (c) 2020, The Souffle Developers. All rights reserved | ||
// Licensed under the Universal Permissive License v 1.0 as shown at: | ||
// - https://opensource.org/licenses/UPL | ||
// - <souffle root>/licenses/SOUFFLE-UPL.txt | ||
|
||
// | ||
// Type System Negation | ||
// Created for issues #1464 & #1560 | ||
// | ||
|
||
|
||
|
||
//////////////////////////// | ||
// #1464 by @nevillegrech // | ||
//////////////////////////// | ||
|
||
.type Variable <: symbol | ||
.type StackIndex <: symbol | ||
.type VariableOrStackIndex = Variable | StackIndex | ||
|
||
.decl Aa(a: VariableOrStackIndex) | ||
.decl Bb(a: Variable) | ||
.decl Cc(a: VariableOrStackIndex) | ||
|
||
|
||
Cc(a) :- !Bb(a), Aa(a). | ||
|
||
|
||
//////////////////////////////// | ||
// #1560 by @langston-barrett // | ||
//////////////////////////////// | ||
.type A <: symbol | ||
.type B <: symbol | ||
.type U = A | B | ||
|
||
.decl b(x:B) | ||
.decl u(x:U) | ||
.decl r(x:U, y:U) | ||
.decl s(x:B, y:number) | ||
|
||
// Get rid of "no rules/facts defined" warning | ||
b("a"). | ||
r("a1", "b2"). | ||
s("b2", 1). | ||
|
||
u(x) :- b(x). | ||
u(x) :- s(x, _). | ||
u(x) :- r(x, y), s(y, _). | ||
u(x) :- r(x, y), !s(y, _). | ||
|
||
|
||
//////////////////////// | ||
// #1560 by @b-scholz // | ||
//////////////////////// | ||
|
||
.type even <: number // even numbers | ||
.type odd <: number // odd numbers | ||
|
||
.decl e(n:number) | ||
e(0). | ||
e(x + 2) :- e(x), x < 100. | ||
|
||
.decl o(n:number) | ||
o(1). | ||
o(x + 2) :- o(x), x < 100. | ||
|
||
.decl my_even(n:number) | ||
my_even(x) :- e(x), !o(x), x <= 10. |
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,6 @@ | ||
Warning: No rules/facts defined for relation Aa in file type_system_negation.dl at line 22 | ||
.decl Aa(a: VariableOrStackIndex) | ||
------^--------------------------- | ||
Warning: No rules/facts defined for relation Bb in file type_system_negation.dl at line 23 | ||
.decl Bb(a: Variable) | ||
------^--------------- |
Empty file.
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