Skip to content

Commit

Permalink
Make propositional implication to always be available.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgSkv committed Jan 16, 2025
1 parent fe41e05 commit 1cb6af7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
34 changes: 34 additions & 0 deletions integration_tests/propositional_implication_test.l
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Testing propositional implication.

Bird("duck");
Bird("sparrow");

Animal("dog");

Dragon("wyvern");

Flies("duck");
Flies("sparrow");
Flies("wyvern");

WhoFiles("animal") :- Animal(x) => Flies(x);
WhoFiles("bird") :- Bird(x) => Flies(x);
WhoFiles("dragon") :- Dragon(x) => Flies(x);

@OrderBy(Test, "col0");
Test(x) :- WhoFiles(x);
6 changes: 6 additions & 0 deletions integration_tests/propositional_implication_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
+--------+
| col0 |
+--------+
| bird |
| dragon |
+--------+
2 changes: 2 additions & 0 deletions integration_tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def RunAll(test_presto=False, test_trino=False):
RunTest("dialects/trino/joins_test")
RunTest("dialects/trino/joins_test")

RunTest("propositional_implication_test")

RunTest("duckdb_negation_test")
RunTest("duckdb_is_default")

Expand Down
6 changes: 3 additions & 3 deletions parser_py/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,9 @@ def ParseProposition(s):
c = ParsePropositionalEquivalence(s)
if c:
return {'conjunction': {'conjunct': [c]}}
c = ParsePropositionalImplication(s)
if c:
return {'conjunction': {'conjunct': [c]}}
c = ParsePropositionalImplication(s)
if c:
return {'conjunction': {'conjunct': [c]}}

c = ParseImplication(s)
if c:
Expand Down

0 comments on commit 1cb6af7

Please sign in to comment.