-
Notifications
You must be signed in to change notification settings - Fork 1
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 #58 from bruderj15/develop
Develop
- Loading branch information
Showing
42 changed files
with
644 additions
and
217 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
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
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,20 @@ | ||
module Language.Hasmtlib.Example.ArithFun where | ||
|
||
import Prelude hiding (mod, (&&)) | ||
import Language.Hasmtlib | ||
import Control.Monad | ||
|
||
main :: IO () | ||
main = do | ||
res <- solveWith (solver @SMT cvc5) $ do | ||
setLogic "QF_LIRA" | ||
|
||
xs <- replicateM 10 $ var @RealSort | ||
|
||
forM_ xs $ \x -> assert $ x >=? 0 && x <? fromIntegral (length xs) | ||
forM_ xs $ assert . isIntSort | ||
assert $ distinct xs | ||
|
||
return xs | ||
|
||
print res |
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
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,23 @@ | ||
module Language.Hasmtlib.Example.IncrementalOptimization where | ||
|
||
import Language.Hasmtlib | ||
import Control.Monad.IO.Class | ||
|
||
main :: IO () | ||
main = do | ||
iSolver <- interactiveSolver z3 | ||
interactiveWith iSolver $ do | ||
setOption $ ProduceModels True | ||
setLogic "QF_LIA" | ||
|
||
x <- var @IntSort | ||
|
||
assert $ x >? -2 | ||
assertSoftWeighted (x >? -1) 5.0 | ||
|
||
minimize x | ||
|
||
(_, sol) <- solve | ||
liftIO $ print $ decode sol x | ||
|
||
return () |
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,19 @@ | ||
module Language.Hasmtlib.Example.IncrementalOptimization where | ||
|
||
import Language.Hasmtlib | ||
|
||
main :: IO () | ||
main = do | ||
res <- solveWith (solver @OMT z3) $ do | ||
setLogic "QF_LIA" | ||
|
||
x <- var @IntSort | ||
|
||
assert $ x >? -2 | ||
assertSoftWeighted (x >? -1) 5.0 | ||
|
||
minimize x | ||
|
||
return x | ||
|
||
print res |
Oops, something went wrong.