-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
187 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[prover_modifiers] | ||
name = "Z3" | ||
driver = "z3_nombqi_seq.drv" |
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
module SeqExt | ||
use seq.Seq | ||
use int.Int | ||
|
||
let function subsequence (s : seq 't) (i : int) (j : int) : seq 't = s[i..j] | ||
function subsequence [@inline:trivial] (s : seq 't) (i : int) (j : int) : seq 't = s[i..j] | ||
|
||
function extract (s: seq 't) (offset: int) (len: int) : seq 't = s[offset..offset+len] | ||
|
||
end |
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,142 @@ | ||
(* This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
Copyright (c) 2011-2021 ETH Zurich. | ||
*) | ||
prelude ";;; generated by no_mbqi extension" | ||
prelude "(set-option :smt.AUTO_CONFIG false)" | ||
prelude "(set-option :smt.PHASE_SELECTION 0)" | ||
prelude "(set-option :smt.RESTART_STRATEGY 0)" | ||
prelude "(set-option :smt.RESTART_FACTOR 1.5)" | ||
prelude "(set-option :smt.ARITH.RANDOM_INITIAL_VALUE true)" | ||
prelude "(set-option :smt.CASE_SPLIT 3)" | ||
prelude "(set-option :smt.DELAY_UNITS true)" | ||
prelude "(set-option :NNF.SK_HACK true)" | ||
prelude "(set-option :smt.MBQI false)" | ||
prelude "(set-option :smt.BV.REFLECT true)" | ||
prelude "(set-option :smt.qi.max_multi_patterns 1000)" | ||
prelude "(set-option :smt.QI.EAGER_THRESHOLD 10)" | ||
|
||
theory map.Const | ||
syntax function const "((as const %t0) %1)" | ||
meta "encoding:ignore_polymorphism_ls" function const | ||
end | ||
|
||
theory seq.Seq | ||
prelude ";;; generated by sequence encoding" | ||
prelude "(declare-fun seq.range (Int) (Seq Int))" | ||
prelude "(assert (forall ((n Int)) (! (=> (<= 0 n) (= (seq.len (seq.range n)) n)) :pattern (seq.range n))))" | ||
prelude "(assert (forall ((n Int) (i Int)) (! (=> (and (<= 0 i) (< i n)) (= (seq.nth_i (seq.range n) i) i)) :pattern (seq.nth_i (seq.range n) i))))" | ||
|
||
syntax type seq "(Seq %1)" | ||
meta "encoding:ignore_polymorphism_ts" type seq | ||
|
||
|
||
syntax function length "(seq.len %1)" | ||
meta "encoding:ignore_polymorphism_ls" function length | ||
remove prop length_nonnegative | ||
meta "encoding:ignore_polymorphism_pr" prop length_nonnegative | ||
|
||
syntax function get "(seq.nth_i %1 %2)" | ||
meta "encoding:ignore_polymorphism_ls" function get | ||
|
||
syntax function ([]) "(seq.nth_i %1 %2)" | ||
meta "encoding:ignore_polymorphism_ls" function ([]) | ||
|
||
syntax predicate (==) "(= %1 %2)" | ||
meta "encoding:ignore_polymorphism_ls" predicate (==) | ||
remove prop (==)'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop (==)'spec'0 | ||
remove prop (==)'spec | ||
meta "encoding:ignore_polymorphism_pr" prop (==)'spec | ||
|
||
(* see below for range*) | ||
syntax function create "(seq.map %2 (seq.range %1))" | ||
meta "encoding:ignore_polymorphism_ls" function create | ||
remove prop create'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop create'spec'0 | ||
remove prop create'spec | ||
meta "encoding:ignore_polymorphism_pr" prop create'spec | ||
|
||
syntax constant empty "(as seq.empty %t0)" | ||
remove prop empty'def | ||
meta "encoding:ignore_polymorphism_pr" prop empty'def | ||
|
||
syntax function set "(seq.++ (seq.extract %1 0 %2) (seq.unit %3) (seq.extract %1 (+ %2 1) (- (seq.len %1) (+ %2 1))))" | ||
meta "encoding:ignore_polymorphism_ls" function set | ||
remove prop set'def | ||
meta "encoding:ignore_polymorphism_pr" prop set'def | ||
remove prop set'spec'1 | ||
meta "encoding:ignore_polymorphism_pr" prop set'spec'1 | ||
remove prop set'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop set'spec'0 | ||
remove prop set'spec | ||
meta "encoding:ignore_polymorphism_pr" prop set'spec | ||
|
||
syntax function ([<-]) "(seq.++ (seq.extract %1 0 %2) (seq.unit %3) (seq.extract %1 (+ %2 1) (- (seq.len %1) (+ %2 1))))" | ||
meta "encoding:ignore_polymorphism_ls" function ([<-]) | ||
remove prop ([<-])'def | ||
meta "encoding:ignore_polymorphism_pr" prop ([<-])'def | ||
|
||
syntax function singleton "(seq.unit %1)" | ||
meta "encoding:ignore_polymorphism_ls" function singleton | ||
remove prop singleton'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop singleton'spec'0 | ||
remove prop singleton'spec | ||
meta "encoding:ignore_polymorphism_pr" prop singleton'spec | ||
|
||
syntax function cons "(seq.++ (seq.unit %1) %2)" | ||
meta "encoding:ignore_polymorphism_ls" function cons | ||
remove prop cons'spec'1 | ||
meta "encoding:ignore_polymorphism_pr" prop cons'spec'1 | ||
remove prop cons'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop cons'spec'0 | ||
remove prop cons'spec | ||
meta "encoding:ignore_polymorphism_pr" prop cons'spec | ||
|
||
syntax function snoc "(seq.++ %1 (seq.unit %2))" | ||
meta "encoding:ignore_polymorphism_ls" function snoc | ||
remove prop snoc'spec'1 | ||
meta "encoding:ignore_polymorphism_pr" prop snoc'spec'1 | ||
remove prop snoc'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop snoc'spec'0 | ||
remove prop snoc'spec | ||
meta "encoding:ignore_polymorphism_pr" prop snoc'spec | ||
|
||
syntax function ([..]) "(seq.extract %1 %2 (- %3 %2))" | ||
meta "encoding:ignore_polymorphism_ls" function singleton | ||
remove prop ([..])'def | ||
meta "encoding:ignore_polymorphism_pr" prop ([..])'def | ||
remove prop ([..])'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop ([..])'spec'0 | ||
remove prop ([..])'spec | ||
meta "encoding:ignore_polymorphism_pr" prop ([..])'spec | ||
|
||
syntax function ([_..]) "(seq.extract %1 %2 (- (seq.len %1) %2))" | ||
meta "encoding:ignore_polymorphism_ls" function ([_..]) | ||
remove prop ([_..])'def | ||
meta "encoding:ignore_polymorphism_pr" prop ([_..])'def | ||
|
||
syntax function ([.._]) "(seq.extract %1 0 %2)" | ||
meta "encoding:ignore_polymorphism_ls" function ([.._]) | ||
remove prop ([.._])'def | ||
meta "encoding:ignore_polymorphism_pr" prop ([.._])'def | ||
|
||
syntax function (++) "(seq.++ %1 %2)" | ||
meta "encoding:ignore_polymorphism_ls" function (++) | ||
remove prop (++)'spec'1 | ||
meta "encoding:ignore_polymorphism_pr" prop (++)'spec'1 | ||
remove prop (++)'spec'0 | ||
meta "encoding:ignore_polymorphism_pr" prop (++)'spec'0 | ||
remove prop (++)'spec | ||
meta "encoding:ignore_polymorphism_pr" prop (++)'spec | ||
end | ||
|
||
theory prelude.seq_ext.SeqExt | ||
use seq.Seq | ||
|
||
syntax function extract "(seq.extract %1 %2 %3)" | ||
meta "encoding:ignore_polymorphism_ls" function extract | ||
|
||
end |