aboutsummaryrefslogtreecommitdiff
path: root/src/racket_specs/indexable-setup.rkt
diff options
context:
space:
mode:
authorAria <me@aria.rip>2023-11-07 22:25:18 +0000
committerAria <me@aria.rip>2023-11-07 22:25:18 +0000
commitc6be430616e97a5bca0ee56f71908589b174a8ff (patch)
tree382857e2b9ac41881d58dad5d33670101f177752 /src/racket_specs/indexable-setup.rkt
parent71236e6332507ef18d14876d200ac83bf895496a (diff)
refactor(all): shorter directory names
Diffstat (limited to 'src/racket_specs/indexable-setup.rkt')
-rw-r--r--src/racket_specs/indexable-setup.rkt31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/racket_specs/indexable-setup.rkt b/src/racket_specs/indexable-setup.rkt
new file mode 100644
index 0000000..ddd6239
--- /dev/null
+++ b/src/racket_specs/indexable-setup.rkt
@@ -0,0 +1,31 @@
+#lang rosette
+
+(define (check-not-contradict prop pre xs)
+ (assert (and (prop xs) (pre xs) (> (length xs) 1))))
+
+(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-nth prop pre spec xs n)
+ (assume (and (prop xs) (pre xs)))
+ (assert (prop (car (spec xs n)))))
+
+
+(define (check prop pres specs xs n)
+ (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)))
+ ) #f]
+ [else (and (unsat? (verify (check-spec-first prop (first pres) (first specs) xs)))
+ (unsat? (verify (check-spec-last prop (second pres) (second specs) xs)))
+ (unsat? (verify (check-spec-nth prop (third pres) (third specs) xs n)))
+ )]))
+
+(provide check) \ No newline at end of file