-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change formatting of negative numbers from
-x
to (- x)
to be SMTL…
…IB2 compliant
- Loading branch information
Showing
9 changed files
with
85 additions
and
32 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
5 changes: 5 additions & 0 deletions
5
lowlevel/src/snapshots/smtlib_lowlevel__tests__z3__negative_numbers-2.snap
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,5 @@ | ||
--- | ||
source: lowlevel/src/tests.rs | ||
expression: "d.exec(&Command::parse(r#\"(assert (< x 0))\"#)?)?" | ||
--- | ||
Success |
5 changes: 5 additions & 0 deletions
5
lowlevel/src/snapshots/smtlib_lowlevel__tests__z3__negative_numbers-3.snap
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,5 @@ | ||
--- | ||
source: lowlevel/src/tests.rs | ||
expression: "d.exec(&Command::parse(r#\"(check-sat)\"#)?)?" | ||
--- | ||
SpecificSuccessResponse(CheckSatResponse(Sat)) |
9 changes: 9 additions & 0 deletions
9
lowlevel/src/snapshots/smtlib_lowlevel__tests__z3__negative_numbers-4.snap
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,9 @@ | ||
--- | ||
source: lowlevel/src/tests.rs | ||
expression: "d.exec(&Command::parse(r#\"(get-model)\"#)?)?" | ||
--- | ||
SpecificSuccessResponse(GetModelResponse(GetModelResponse([ | ||
DefineFun(FunctionDef(Symbol("x"), [], Sort(Simple(Symbol("Int"))), Application(Identifier(Simple(Symbol("-"))), [ | ||
SpecConstant(Numeral(Numeral("2"))), | ||
]))), | ||
]))) |
5 changes: 5 additions & 0 deletions
5
lowlevel/src/snapshots/smtlib_lowlevel__tests__z3__negative_numbers.snap
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,5 @@ | ||
--- | ||
source: lowlevel/src/tests.rs | ||
expression: "d.exec(&Command::parse(r#\"(declare-const x Int)\"#)?)?" | ||
--- | ||
Success |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use terms::StaticSorted; | ||
|
||
use crate::terms::{forall, Sorted}; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
fn int_math() { | ||
let x = Int::new_const("x"); | ||
let y = Int::new_const("hello"); | ||
// let x_named = x.labeled(); | ||
let mut z = 12 + y * 4; | ||
z += 3; | ||
let w = x * x + z; | ||
println!("{w}"); | ||
} | ||
|
||
#[test] | ||
fn quantifiers() { | ||
let x = Int::new_const("x"); | ||
let y = Int::new_const("y"); | ||
|
||
let res = forall((x, y), (x + 2)._eq(y)); | ||
println!("{}", ast::Term::from(res)); | ||
} | ||
|
||
#[test] | ||
fn negative_numbers() { | ||
let mut solver = Solver::new(crate::backend::z3_binary::Z3Binary::new("z3").unwrap()).unwrap(); | ||
let x = Int::new_const("x"); | ||
solver.assert(x.lt(-1)).unwrap(); | ||
let model = solver.check_sat_with_model().unwrap().expect_sat().unwrap(); | ||
match model.eval(x) { | ||
Some(x) => println!("This is the value of x: {x}"), | ||
None => panic!("Oh no! This should never happen, as x was part of an assert"), | ||
} | ||
} |
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