Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
827f2d5
workflow try 1
zengzirong May 31, 2025
a2c66bc
workflow try 1
zengzirong May 31, 2025
34202e5
workflow test 1
zengzirong May 31, 2025
3b786ac
workflow try 2
zengzirong May 31, 2025
992131c
workflow test 2
zengzirong May 31, 2025
07f9723
workflow test 3
zengzirong May 31, 2025
09d36ee
new workflow try
zengzirong May 31, 2025
c88b45e
new workflow try
zengzirong May 31, 2025
0427842
workflow new try
zengzirong May 31, 2025
f2a93ba
src/main/java/org/qed/Generated/RRuleInstances/FilterIntoJoin.java
zengzirong May 31, 2025
c33bb3f
new workflow
zengzirong May 31, 2025
fc46291
new test
zengzirong May 31, 2025
71b9eb9
updated pom.xml
zengzirong May 31, 2025
e74cc30
new test
zengzirong May 31, 2025
de4e7eb
new workflow
zengzirong May 31, 2025
8697048
new test
zengzirong May 31, 2025
d7ddac7
workflow
zengzirong May 31, 2025
62a12dd
new test
zengzirong May 31, 2025
6913915
new workflow
zengzirong May 31, 2025
f5a4383
new test
zengzirong May 31, 2025
8ead6a7
new workflow
zengzirong Jun 1, 2025
5c00f9e
new test
zengzirong Jun 1, 2025
5b56bc6
new workflow
zengzirong Jun 1, 2025
440de53
new test
zengzirong Jun 1, 2025
3b82055
new test
zengzirong Jun 1, 2025
9f6a48b
new test
zengzirong Jun 1, 2025
7dd23c3
delete join associate temporarily
zengzirong Jun 1, 2025
c878388
new test
zengzirong Jun 1, 2025
e304797
new test
zengzirong Jun 1, 2025
5a39e4e
new test
zengzirong Jun 1, 2025
36c6c46
new test
zengzirong Jun 1, 2025
0667797
restore FilterIntoJoin.java
zengzirong Jun 1, 2025
e164dda
update test.yml
zengzirong Jun 1, 2025
a25c7dd
delete unprovable rules
zengzirong Jun 1, 2025
7a86409
test rule that cannot compile
zengzirong Jun 1, 2025
357dcb9
update workflow
zengzirong Jun 1, 2025
248f038
restore FilterIntoJoin.java to correct version
zengzirong Jun 1, 2025
1257866
update java version
zengzirong Jun 1, 2025
a0b066b
test workflow
zengzirong Jun 1, 2025
2a2e9ce
update workflow
zengzirong Jun 1, 2025
d21779e
new update
zengzirong Jun 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test All Rules

on:
push:
paths:
- 'src/main/java/org/qed/Generated/RRuleInstances/**/*.java'
pull_request:
paths:
- 'src/main/java/org/qed/Generated/RRuleInstances/**/*.java'

jobs:
test-all-rules:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'

- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build project
run: mvn -B compile --file pom.xml

- name: Generate JSON for all rules
run: |
mkdir -p tmp-rules
mvn dependency:resolve
chmod +x scripts/generate-rule-json.sh
./scripts/generate-rule-json.sh

- name: Install dependencies
run: |
chmod +x scripts/install-dependencies.sh
./scripts/install-dependencies.sh

- name: Build qed-prover
run: |
chmod +x scripts/build-qed-prover.sh
./scripts/build-qed-prover.sh

- name: Test all rules
run: |
chmod +x scripts/test-rules.sh
./scripts/test-rules.sh

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: results
path: tmp-rules/
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@
<version>0.67.0</version>
</dependency>
<dependency>
<groupId>io.github.cvc5</groupId>
<groupId>io.github.p-org.solvers</groupId>
<artifactId>cvc5</artifactId>
<version>1.2.1</version>
<version>0.0.7-v5</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
</dependencies>
</project>
</project>
10 changes: 10 additions & 0 deletions scripts/build-qed-prover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Build qed-prover with Rust nightly

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
source $HOME/.cargo/env

git clone https://github.com/qed-solver/prover.git qed-prover
cd qed-prover
cargo +nightly build --release
45 changes: 45 additions & 0 deletions scripts/generate-rule-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Script to generate JSON files for all RRule instances

# Create temporary Java file for JSON generation
cat > JsonGenerator.java << 'EOF'
import org.qed.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.nio.file.*;

public class JsonGenerator {
public static void main(String[] args) throws Exception {
String className = args[0];
Class<?> clazz = Class.forName(className);
RRule rule = (RRule) clazz.getDeclaredConstructor().newInstance();
ObjectMapper mapper = new ObjectMapper();
String fileName = rule.name() + "-" + rule.info() + ".json";
ObjectNode jsonNode = rule.toJson();
mapper.writerWithDefaultPrettyPrinter().writeValue(
Path.of("tmp-rules", fileName).toFile(),
jsonNode
);
}
}
EOF

# Build classpath
MAVEN_CP=$(mvn dependency:build-classpath -Dmdep.outputFile=/dev/stdout -q)
CLASSPATH="target/classes:${MAVEN_CP}"

# Compile the generator
javac -cp "$CLASSPATH" JsonGenerator.java

# Generate JSON for each rule
find src/main/java/org/qed/Generated/RRuleInstances -name '*.java' | while read file; do
className=$(echo "$file" | sed 's|src/main/java/||; s|/|.|g; s|\.java$||')
echo "Generating JSON for: $className"
java -cp ".:$CLASSPATH" JsonGenerator "$className"
done

# Cleanup
rm -f JsonGenerator.java JsonGenerator.class

echo "JSON generation complete. Files are in tmp-rules/"
17 changes: 17 additions & 0 deletions scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Install required dependencies for qed-prover

sudo apt-get update
sudo apt-get install -y jq z3

# Install cvc5 - try package manager first, otherwise build from source
sudo apt-get install -y cvc5 || (
sudo apt-get install -y cmake libgmp-dev &&
git clone --depth 1 https://github.com/cvc5/cvc5.git &&
cd cvc5 &&
./configure.sh --auto-download &&
cd build &&
make -j$(nproc) &&
sudo make install
)
33 changes: 33 additions & 0 deletions scripts/test-rules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Test all generated rules with qed-prover

echo "## QED Prover Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

failed_rules=""
total_count=0
passed_count=0

for json_file in tmp-rules/*.json; do
rule_name=$(basename "$json_file" .json)
total_count=$((total_count + 1))
./qed-prover/target/release/qed-prover "$json_file" || true

result_file="${json_file%.json}.result"
if [ -f "$result_file" ] && jq -e '.provable == true' "$result_file" > /dev/null 2>&1; then
echo "✅ $rule_name: PASSED" >> $GITHUB_STEP_SUMMARY
passed_count=$((passed_count + 1))
else
echo "❌ $rule_name: FAILED" >> $GITHUB_STEP_SUMMARY
failed_rules="$failed_rules$rule_name,"
fi
done

echo "" >> $GITHUB_STEP_SUMMARY
echo "**Summary:** $passed_count/$total_count passed" >> $GITHUB_STEP_SUMMARY

if [ -n "$failed_rules" ]; then
echo "::error::Failed rules: ${failed_rules%,}"
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public RelRN before() {
var join = left.join(JoinRelType.INNER, joinCond, right);
return join.filter("outer");
}

@Override
public RelRN after() {
return left.join(JoinRelType.INNER, RexRN.and(joinCond, left.joinPred("outer", right)), right);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ public record SemiJoinFilterTranspose() implements RRule {

@Override
public RelRN before() {
// Semi-join followed by a filter
return left.join(JoinRelType.SEMI, joinCond, right).filter(filterPred);
}

@Override
public RelRN after() {
// Push the filter before the semi-join
RelRN leftFiltered = left.filter(filterPred);
return leftFiltered.join(JoinRelType.SEMI, leftFiltered.joinPred("join", right), right);
}
Expand Down