-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add more test cases * Improve reconstruct
- Loading branch information
1 parent
84ecc53
commit fa92ce2
Showing
9 changed files
with
345 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(declare-sort Arr) | ||
(declare-sort Loc) | ||
(declare-sort Heap) | ||
|
||
(declare-fun slot (Arr Int) Loc) | ||
(declare-fun lookup (Heap Loc) Int) | ||
(declare-fun next (Loc) Loc) | ||
|
||
(declare-const h1 Heap) | ||
(declare-const h2 Heap) | ||
(declare-const a Arr) | ||
(declare-const size Int) | ||
(declare-const j Int) | ||
|
||
(assert (forall ((i Int)) (! | ||
(or (= (lookup h2 (slot a i)) (lookup h1 (slot a (- i 32)))) (< i 32) (>= i size)) | ||
))) | ||
|
||
(assert (>= j 1024)) | ||
(assert (>= size (+ j 1024))) | ||
(assert (not (= (lookup h1 (slot a j)) 42))) | ||
(check-sat) |
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,25 @@ | ||
(declare-sort Arr) | ||
(declare-sort Loc) | ||
(declare-sort Heap) | ||
|
||
(declare-fun slot (Arr Int) Loc) | ||
(declare-fun lookup (Heap Loc) Int) | ||
(declare-fun next (Loc) Loc) | ||
|
||
(declare-const h1 Heap) | ||
(declare-const a Arr) | ||
(declare-const size Int) | ||
(declare-const j Int) | ||
|
||
(assert (forall ((i Int)) (! | ||
(or (>= (lookup h1 (slot a i)) (lookup h1 (next (slot a i)))) (< i 0) (>= i size)) | ||
))) | ||
(assert (forall ((ar Arr) (i Int)) (! | ||
(= (next (slot a i)) (slot a (+ i 1))) | ||
:pattern ((next (slot ar i))) | ||
))) | ||
|
||
(assert (>= j 1024)) | ||
(assert (>= size (+ j 1024))) | ||
(assert (not (= (lookup h1 (slot a j)) 42))) | ||
(check-sat) |
69 changes: 69 additions & 0 deletions
69
smt-problems/handwritten/rfmig_talk/a_running-example.smt2
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,69 @@ | ||
; some z3 options | ||
(set-option :print-success false) | ||
(set-info :smt-lib-version 2.0) | ||
(set-option :auto_config false) | ||
(set-option :smt.mbqi false) | ||
(set-option :smt.QI.EAGER_THRESHOLD 100) | ||
(set-option :smt.refine_inj_axioms false) | ||
|
||
|
||
(declare-sort Slice) ; &[i32] | ||
(declare-sort Address) ; *const i32 | ||
(declare-sort Heap) | ||
|
||
; fn slot(slice: &[i32], idx: usize) -> *const i32 { | ||
; &slice[idx] as *const _ | ||
; } | ||
(declare-fun slot (Slice Int) Address) | ||
|
||
; unsafe fn lookup(address: *const i32) -> i32 { | ||
; unsafe { *address } | ||
; } | ||
(declare-fun lookup (Heap Address) Int) ; dereference on the heap | ||
|
||
; fn next(address: *const i32) -> *const i32 { | ||
; address.wrapping_offset(1) | ||
; } | ||
(declare-fun next (Address) Address) | ||
|
||
|
||
(assert (forall | ||
((slice Slice) (i Int) (j Int)) | ||
(! | ||
; ∀ slice, i, j. i != j ==> slot(slice, i) != slot(slice, j) | ||
(or (= i j) (not (= (slot slice i) (slot slice j)))) | ||
|
||
:pattern ((slot slice i) (slot slice j)) | ||
:qid injectivity | ||
) | ||
)) | ||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. next(slot(slice, i)) == slot(slice, i + 1) | ||
(= (next (slot slice i)) (slot slice (+ i 1)) ) | ||
|
||
:pattern ((slot slice i)) | ||
:qid next_def | ||
) | ||
)) | ||
|
||
(declare-const heap Heap) | ||
(declare-const s Slice) | ||
(declare-const idx Int) | ||
(declare-const len Int) | ||
|
||
(assert (forall | ||
((i Int)) | ||
(! | ||
; ∀ i. 0 <= i && i < len ==> lookup(heap, slot(s, i)) <= lookup(heap, next(slot(s, i))) | ||
(or (< i 0) (>= i len) (<= (lookup heap (slot s i)) (lookup heap (next (slot s i)))) ) | ||
|
||
:pattern ((lookup heap (slot s i))) | ||
:qid sortedness | ||
) | ||
)) | ||
|
||
(assert (and (>= idx 0) (< (+ idx 100) len))) | ||
(assert (not (< (lookup heap (slot s idx)) (lookup heap (next (slot s idx))) ))) | ||
(check-sat) |
69 changes: 69 additions & 0 deletions
69
smt-problems/handwritten/rfmig_talk/b_running-example.smt2
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,69 @@ | ||
; some z3 options | ||
(set-option :print-success false) | ||
(set-info :smt-lib-version 2.0) | ||
(set-option :auto_config false) | ||
(set-option :smt.mbqi false) | ||
(set-option :smt.QI.EAGER_THRESHOLD 100) | ||
(set-option :smt.refine_inj_axioms false) | ||
|
||
|
||
(declare-sort Slice) ; &[i32] | ||
(declare-sort Address) ; *const i32 | ||
(declare-sort Heap) | ||
|
||
; fn slot(slice: &[i32], idx: usize) -> *const i32 { | ||
; &slice[idx] as *const _ | ||
; } | ||
(declare-fun slot (Slice Int) Address) | ||
|
||
; unsafe fn lookup(address: *const i32) -> i32 { | ||
; unsafe { *address } | ||
; } | ||
(declare-fun lookup (Heap Address) Int) ; dereference on the heap | ||
|
||
; fn next(address: *const i32) -> *const i32 { | ||
; address.wrapping_offset(1) | ||
; } | ||
(declare-fun next (Address) Address) | ||
|
||
|
||
(assert (forall | ||
((slice Slice) (i Int) (j Int)) | ||
(! | ||
; ∀ slice, i, j. i != j ==> slot(slice, i) != slot(slice, j) | ||
(or (= i j) (not (= (slot slice i) (slot slice j)))) | ||
|
||
:pattern ((slot slice i) (slot slice j)) | ||
:qid injectivity | ||
) | ||
)) | ||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. next(slot(slice, i)) == slot(slice, i + 1) | ||
(= (next (slot slice i)) (slot slice (+ i 1)) ) | ||
|
||
:pattern ((next (slot slice i))) | ||
:qid next_def | ||
) | ||
)) | ||
|
||
(declare-const heap Heap) | ||
(declare-const s Slice) | ||
(declare-const idx Int) | ||
(declare-const len Int) | ||
|
||
(assert (forall | ||
((i Int)) | ||
(! | ||
; ∀ i. 0 <= i && i < len ==> lookup(heap, slot(s, i)) <= lookup(heap, next(slot(s, i))) | ||
(or (< i 0) (>= i len) (<= (lookup heap (slot s i)) (lookup heap (next (slot s i)))) ) | ||
|
||
:pattern ((lookup heap (slot s i))) | ||
:qid sortedness | ||
) | ||
)) | ||
|
||
(assert (and (>= idx 0) (< (+ idx 100) len))) | ||
(assert (not (< (lookup heap (slot s idx)) (lookup heap (next (slot s idx))) ))) | ||
(check-sat) |
74 changes: 74 additions & 0 deletions
74
smt-problems/handwritten/rfmig_talk/c_running-example.smt2
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,74 @@ | ||
; some z3 options | ||
(set-option :print-success false) | ||
(set-info :smt-lib-version 2.0) | ||
(set-option :auto_config false) | ||
(set-option :smt.mbqi false) | ||
(set-option :smt.QI.EAGER_THRESHOLD 100) | ||
(set-option :smt.refine_inj_axioms false) | ||
|
||
|
||
(declare-sort Slice) ; &[i32] | ||
(declare-sort Address) ; *const i32 | ||
(declare-sort Heap) | ||
|
||
; fn slot(slice: &[i32], idx: usize) -> *const i32 { | ||
; &slice[idx] as *const _ | ||
; } | ||
(declare-fun slot (Slice Int) Address) | ||
|
||
; fn slot_inverse(slice: &[i32], address: *const i32) -> usize { | ||
; ... | ||
; } | ||
(declare-fun slot_inverse (Slice Address) Int) | ||
|
||
; unsafe fn lookup(address: *const i32) -> i32 { | ||
; unsafe { *address } | ||
; } | ||
(declare-fun lookup (Heap Address) Int) ; dereference on the heap | ||
|
||
; fn next(address: *const i32) -> *const i32 { | ||
; address.wrapping_offset(1) | ||
; } | ||
(declare-fun next (Address) Address) | ||
|
||
|
||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. i == slot_inverse(slice, slot(slice, i)) | ||
(= i (slot_inverse slice (slot slice i)) ) | ||
|
||
:pattern ((slot slice i)) | ||
:qid injectivity | ||
) | ||
)) | ||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. next(slot(slice, i)) == slot(slice, i + 1) | ||
(= (next (slot slice i)) (slot slice (+ i 1)) ) | ||
|
||
:pattern ((next (slot slice i))) | ||
:qid next_def | ||
) | ||
)) | ||
|
||
(declare-const heap Heap) | ||
(declare-const s Slice) | ||
(declare-const idx Int) | ||
(declare-const len Int) | ||
|
||
(assert (forall | ||
((i Int)) | ||
(! | ||
; ∀ i. 0 <= i && i < len ==> lookup(heap, slot(s, i)) <= lookup(heap, next(slot(s, i))) | ||
(or (< i 0) (>= i len) (<= (lookup heap (slot s i)) (lookup heap (next (slot s i)))) ) | ||
|
||
:pattern ((lookup heap (slot s i))) | ||
:qid sortedness | ||
) | ||
)) | ||
|
||
(assert (and (>= idx 0) (< (+ idx 100) len))) | ||
(assert (not (< (lookup heap (slot s idx)) (lookup heap (next (slot s idx))) ))) | ||
(check-sat) |
74 changes: 74 additions & 0 deletions
74
smt-problems/handwritten/rfmig_talk/d_running-example.smt2
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,74 @@ | ||
; some z3 options | ||
(set-option :print-success false) | ||
(set-info :smt-lib-version 2.0) | ||
(set-option :auto_config false) | ||
(set-option :smt.mbqi false) | ||
(set-option :smt.QI.EAGER_THRESHOLD 100) | ||
(set-option :smt.refine_inj_axioms false) | ||
|
||
|
||
(declare-sort Slice) ; &[i32] | ||
(declare-sort Address) ; *const i32 | ||
(declare-sort Heap) | ||
|
||
; fn slot(slice: &[i32], idx: usize) -> *const i32 { | ||
; &slice[idx] as *const _ | ||
; } | ||
(declare-fun slot (Slice Int) Address) | ||
|
||
; fn slot_inverse(slice: &[i32], address: *const i32) -> usize { | ||
; ... | ||
; } | ||
(declare-fun slot_inverse (Slice Address) Int) | ||
|
||
; unsafe fn lookup(address: *const i32) -> i32 { | ||
; unsafe { *address } | ||
; } | ||
(declare-fun lookup (Heap Address) Int) ; dereference on the heap | ||
|
||
; fn next(address: *const i32) -> *const i32 { | ||
; address.wrapping_offset(1) | ||
; } | ||
(declare-fun next (Address) Address) | ||
|
||
|
||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. i == slot_inverse(slice, slot(slice, i)) | ||
(= i (slot_inverse slice (slot slice i)) ) | ||
|
||
:pattern ((slot slice i)) | ||
:qid injectivity | ||
) | ||
)) | ||
(assert (forall | ||
((slice Slice) (i Int)) | ||
(! | ||
; ∀ slice, i. next(slot(slice, i)) == slot(slice, i + 1) | ||
(= (next (slot slice i)) (slot slice (+ i 1)) ) | ||
|
||
:pattern ((next (slot slice i))) | ||
:qid next_def | ||
) | ||
)) | ||
|
||
(declare-const heap Heap) | ||
(declare-const s Slice) | ||
(declare-const idx Int) | ||
(declare-const len Int) | ||
|
||
(assert (forall | ||
((i Int) (j Int)) | ||
(! | ||
; ∀ i, j. 0 <= i && i < j && j < len ==> lookup(heap, slot(s, i)) <= lookup(heap, slot(s, j)) | ||
(or (< i 0) (>= i j) (>= j len) (<= (lookup heap (slot s i)) (lookup heap (slot s j))) ) | ||
|
||
:pattern ((lookup heap (slot s i)) (lookup heap (slot s j))) | ||
:qid sortedness | ||
) | ||
)) | ||
|
||
(assert (and (>= idx 0) (< (+ idx 100) len))) | ||
(assert (not (< (lookup heap (slot s idx)) (lookup heap (next (slot s idx))) ))) | ||
(check-sat) |