diff options
author | Aria <me@aria.rip> | 2023-11-07 22:25:18 +0000 |
---|---|---|
committer | Aria <me@aria.rip> | 2023-11-07 22:25:18 +0000 |
commit | c6be430616e97a5bca0ee56f71908589b174a8ff (patch) | |
tree | 382857e2b9ac41881d58dad5d33670101f177752 /src/racket_specs/container-setup.rkt | |
parent | 71236e6332507ef18d14876d200ac83bf895496a (diff) |
refactor(all): shorter directory names
Diffstat (limited to 'src/racket_specs/container-setup.rkt')
-rw-r--r-- | src/racket_specs/container-setup.rkt | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/racket_specs/container-setup.rkt b/src/racket_specs/container-setup.rkt new file mode 100644 index 0000000..0d5cd79 --- /dev/null +++ b/src/racket_specs/container-setup.rkt @@ -0,0 +1,55 @@ +#lang rosette + +(define (check-spec-len prop pre spec xs) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs))))) + +(define (check-spec-is-empty prop pre spec xs) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs))))) + +(define (check-spec-first prop pre spec xs) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs))))) + +(define (check-spec-last prop pre spec xs) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs))))) + +(define (check-spec-contains prop pre spec xs x) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs x))))) + +(define (check-spec-insert prop pre spec xs x) + (assume (and (prop xs) (pre xs))) + (assert (prop (spec xs x)))) + +(define (check-spec-remove prop pre spec xs x) + (assume (and (prop xs) (pre xs))) + (assert (prop (car (spec xs x))))) + +(define (check-spec-clear prop pre spec xs) + (assume (and (prop xs) (pre xs))) + (assert (prop (spec xs)))) + +(define (check-not-contradict prop pre xs) + (assert (and (prop xs) (pre xs) (> (length xs) 1)))) + +(define (check prop pres specs xs x) + (cond + [(or (unsat? (solve (check-not-contradict prop (first pres) xs))) + (unsat? (solve (check-not-contradict prop (second pres) xs))) + (unsat? (solve (check-not-contradict prop (third pres) xs))) + (unsat? (solve (check-not-contradict prop (fourth pres) xs))) + (unsat? (solve (check-not-contradict prop (fifth pres) xs))) + (unsat? (solve (check-not-contradict prop (sixth pres) xs))) + ) #f] + [else (and (unsat? (verify (check-spec-clear prop (first pres) (first specs) xs))) + (unsat? (verify (check-spec-contains prop (second pres) (second specs) xs x))) + (unsat? (verify (check-spec-insert prop (third pres) (third specs) xs x))) + (unsat? (verify (check-spec-is-empty prop (fourth pres) (fourth specs) xs))) + (unsat? (verify (check-spec-len prop (fifth pres) (fifth specs) xs))) + (unsat? (verify (check-spec-remove prop (sixth pres) (sixth specs) xs x))) + )])) + +(provide check)
\ No newline at end of file |