Skip to content

Commit b1cdfd5

Browse files
authored
Merge branch 'main' into scheduling
2 parents 86815a0 + b13ba6f commit b1cdfd5

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

crates/filament/src/ir_passes/discharge.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use fil_ast as ast;
99
use fil_ir::{self as ir, Ctx, DisplayCtx};
1010
use fil_utils::GlobalPositionTable;
1111
use itertools::Itertools;
12-
use std::collections::HashMap;
12+
use std::collections::{HashMap, HashSet};
1313
use std::{fs, iter};
1414
use term::termcolor::{ColorChoice, StandardStream};
1515

@@ -612,6 +612,9 @@ impl Visitor for Discharge {
612612
}
613613

614614
let bs = self.sol.bool_sort();
615+
616+
let mut interned_props = HashSet::new();
617+
615618
// Declare all expressions
616619
for (idx, expr) in data
617620
.comp
@@ -626,6 +629,9 @@ impl Visitor for Discharge {
626629
.map(|i| (i, data.comp.get(i)));
627630

628631
for (pidx, prop) in relevant_props {
632+
// Save the proposition in the interned_props set
633+
interned_props.insert(pidx);
634+
629635
let assign = self.prop_to_sexp(prop);
630636
let sexp = self
631637
.sol
@@ -679,6 +685,8 @@ impl Visitor for Discharge {
679685
.props()
680686
.iter()
681687
.filter(|(idx, _)| idx.valid(&data.comp))
688+
// Filter out propositions that are already defined in expressions
689+
.filter(|(idx, _)| !interned_props.contains(idx))
682690
{
683691
// Define assertion equating the proposition to its assignment
684692
let assign = self.prop_to_sexp(prop);

runt.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@ ver = "0.4.1"
22

33

44
[[tests]]
5-
name = "check"
5+
name = "check-z3"
66
paths = ["tests/check/*.fil", "primitives/*.fil"]
77
cmd = """
8-
./target/debug/filament {} --check
8+
./target/debug/filament {} --check --solver z3
9+
"""
10+
expect_dir = "tests/check/"
11+
12+
[[tests]]
13+
name = "check-cvc5"
14+
paths = ["tests/check/*.fil", "primitives/*.fil"]
15+
cmd = """
16+
./target/debug/filament {} --check --solver cvc5
917
"""
1018
expect_dir = "tests/check/"
1119

0 commit comments

Comments
 (0)