Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
91b5a4a
Add list generator to TestGen.ml
juliaofferman Jun 29, 2020
2bbf0a0
Add rev and list equality components
juliaofferman Jun 29, 2020
ece2990
Add real number type
juliaofferman Jun 29, 2020
a0ab6f5
Add real number value
juliaofferman Jun 29, 2020
242a7a3
Create RealComponents.ml
juliaofferman Jun 29, 2020
f28ac8b
change can_apply to is_argument_valid
juliaofferman Jun 30, 2020
c81c308
Update RealComponents.ml
juliaofferman Jun 30, 2020
7aee380
Update RealComponents.ml
juliaofferman Jun 30, 2020
f2add88
Update RealComponents.ml
juliaofferman Jun 30, 2020
6488ca2
Update RealComponents.ml
juliaofferman Jun 30, 2020
fdfdd4b
Update RealComponents.ml
juliaofferman Jul 1, 2020
3d974bd
Add Real components
juliaofferman Jul 1, 2020
67914a5
Add real type
juliaofferman Jul 1, 2020
ace86c6
Additional job examples
juliaofferman Jul 1, 2020
11c33b0
Update TestGen.ml
juliaofferman Jul 1, 2020
85c3494
Update TestGen.ml
juliaofferman Jul 1, 2020
cf97993
Update real constants
juliaofferman Jul 3, 2020
47131ad
Update Real component to_string's
juliaofferman Jul 3, 2020
3a2d80d
Update TestGen.ml
juliaofferman Jul 3, 2020
c633438
Update App.ml
juliaofferman Jul 3, 2020
427c2ff
Update App.ml
juliaofferman Jul 7, 2020
a92dd86
Tests for real components
juliaofferman Jul 31, 2020
0992af0
Update to include real component tests
juliaofferman Jul 31, 2020
3e54caa
Update Test_RealComponents.ml
juliaofferman Jul 31, 2020
e9746d5
Update Test_RealComponents.ml
juliaofferman Aug 6, 2020
105745e
Update Test_RealComponents.ml
juliaofferman Aug 6, 2020
189fb5c
Add additional tests
juliaofferman Aug 8, 2020
00cb3d7
Fix negation
juliaofferman Aug 13, 2020
80027a7
Adding "LRA" logic
juliaofferman Nov 19, 2020
c6ebeeb
Remove scaling from levels
juliaofferman Nov 19, 2020
c5b1c66
Various changes to support Real type
juliaofferman Nov 19, 2020
9524dd7
Add linear multiplication and division
juliaofferman Jan 22, 2021
c9981aa
Remove unnecessary log
juliaofferman Jan 22, 2021
a06b01b
Fix spacing
juliaofferman Jan 22, 2021
1eb5d93
Add real tests
juliaofferman Jan 22, 2021
f32bbcf
LRA benchmark
juliaofferman Jan 22, 2021
80687de
Add real benchmarks
juliaofferman Jan 22, 2021
b0f5170
Removie real ite component
juliaofferman Jan 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/App.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ let no_synth_PI () =


let () = with_synth_PI ()
; no_synth_PI ()
; no_synth_PI ()
14 changes: 14 additions & 0 deletions benchmarks/LRA/anfp_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(and (= x 1.0) (= y 0.0)))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (and (< y 1000.0) (= x! (+ x y))) (= y! (+ y 1.0))))
(define-fun post_fun ((x Int) (y Int)) Bool
(not (and (>= y 1000) (< x y))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/array-new_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real) (z Real)))

(define-fun pre_fun ((x Real) (y Real) (z Real)) Bool
(= x 0.))
(define-fun trans_fun ((x Real) (y Real) (z Real) (x! Real) (y! Real) (z! Real)) Bool
(or (and (= x! (+ x 1.)) (and (= y! z!) (and (<= z! y) (< x 500.)))) (and (= x! (+ x 1.)) (and (= y! y) (and (> z! y) (< x 500.))))))
(define-fun post_fun ((x Int) (y Int) (z Int)) Bool
(not (and (>= x 500.) (< z y))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/cegar1_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(and (and (>= x 0.) (and (<= x 2.) (<= y 2.))) (>= y 0.)))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (= x! (+ x 2.)) (= y! (+ y 2.))))
(define-fun post_fun ((x Real) (y Real)) Bool
(not (and (= x 4.) (= y 0.))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
15 changes: 15 additions & 0 deletions benchmarks/LRA/dec-simpl.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (n Real)))

(define-fun pre_fun ((x Real) (n Real)) Bool
(= x n))
(define-fun trans_fun ((x Real) (n Real) (x! Real) (n! Real)) Bool
(and (and (>= x 1.0) (= x! (- x 1.0))) (= n! (* n 2.))))
(define-fun post_fun ((x Real) (n Real)) Bool
(not (and (<= x 0.0) (and (not (= x 0.0)) (>= n 0.0)))))


(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
15 changes: 15 additions & 0 deletions benchmarks/LRA/div_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (n Real)))

(define-fun pre_fun ((x Real) (n Real)) Bool
(= x n))
(define-fun trans_fun ((x Real) (n Real) (x! Real) (n! Real)) Bool
(and (and (>= x 1.) (= x! (/ x 2.))) (= n! n)))
(define-fun post_fun ((x Real) (n Real)) Bool
(not (and (<= x 0.) (and (not (= x 0.)) (>= n 0.)))))


(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/ex11_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real) (lock Real)))

(define-fun pre_fun ((x Real) (y Real) (lock Real)) Bool
(or (and (= x y) (= lock 1.)) (and (= (+ x 1.) y) (= lock 0.))))
(define-fun trans_fun ((x Real) (y Real) (lock Real) (x! Real) (y! Real) (lock! Real)) Bool
(or (and (and (not (= x y)) (= lock! 1.)) (= x! y)) (and (and (and (not (= x y)) (= lock! 0)) (= x! y)) (= y! (+ y 1.)))))
(define-fun post_fun ((x Real) (y Real) (lock Real)) Bool
(not (and (= x y) (not (= lock 1.)))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/ex14_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(= x 1))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (and (<= x 10.) (= y! (- 10. x))) (= x! (+ x 1.))))
(define-fun post_fun ((x Real) (y Real)) Bool
(not (and (and (<= x 10.) (= y (- 10. x))) (or (>= y 10.) (> 0. y)))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/ex1_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real) (xa Real) (ya Real)))

(define-fun pre_fun ((x Real) (y Real) (xa Real) (ya Real)) Bool
(and (= xa 0.) (= ya 0.)))
(define-fun trans_fun ((x Real) (y Real) (xa Real) (ya Real) (x! Real) (y! Real) (xa! Real) (ya! Real)) Bool
(and (= x! (+ 1. (+ xa (* 2. ya)))) (or (= y! (+ (- ya (* 2. xa)) x!)) (= y! (- (- ya (* 2. xa)) x!))) (= xa! (- x! (* 2. y!))) (= ya! (+ (* 2. x!) y!))))
(define-fun post_fun ((x Real) (y Real) (xa Real) (ya Real)) Bool
(>= (+ xa (* 2. ya)) 0.))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/ex7_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real) (i Real)))

(define-fun pre_fun ((x Real) (y Real) (i Real)) Bool
(and (and (and (= i 0.) (>= x 0.)) (>= y 0.)) (>= x y)))
(define-fun trans_fun ((x Real) (y Real) (i Real) (x! Real) (y! Real) (i! Real)) Bool
(and (and (< i y) (= i! (+ i 1.))) (and (= y! y) (= x! x))))
(define-fun post_fun ((x Real) (y Real) (i Real)) Bool
(not (and (< i y) (or (>= i x) (> 0. i)))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
15 changes: 15 additions & 0 deletions benchmarks/LRA/fig1_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(= x (- 50.)))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (and (< x 0.) (= x! (+ x y))) (= y! (+ y 1.))))
(define-fun post_fun ((x Int) (y Int)) Bool
(not (and (>= x 0.) (<= y 0.))))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/fig9_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(and (= x 0.) (= y 0.)))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (= x! x) (and (<= 0. y) (= y! (+ x y)))))
(define-fun post_fun ((x Real) (y Real)) Bool
(>= y 0.))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
14 changes: 14 additions & 0 deletions benchmarks/LRA/mult2_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (y Real)))

(define-fun pre_fun ((x Real) (y Real)) Bool
(and (= x 0.) (= y 0.)))
(define-fun trans_fun ((x Real) (y Real) (x! Real) (y! Real)) Bool
(and (= x! x) (and (<= 0. y) (= y! (* 4. y)))))
(define-fun post_fun ((x Real) (y Real)) Bool
(= y 0.))

(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
15 changes: 15 additions & 0 deletions benchmarks/LRA/mult_r.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(set-logic LRA)

(synth-inv inv_fun ((x Real) (n Real)))

(define-fun pre_fun ((x Real) (n Real)) Bool
(= x (* 2. n)))
(define-fun trans_fun ((x Real) (n Real) (x! Real) (n! Real)) Bool
(and (and (>= x 1.0) (= x! (/ x 2.))) (= n! (/ n 2.))))
(define-fun post_fun ((x Real) (n Real)) Bool
(and (not (and (<= x 1.) (and (not (= x 1.)) (>= n 0.5)))) (= x (* 2. n))))


(inv-constraint inv_fun pre_fun trans_fun post_fun)

(check-synth)
23 changes: 21 additions & 2 deletions src/ListComponents.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,26 @@ let all_qf = [
evaluate = Value.(fun [@warning "-8"] [List (t,l)] -> List (t, (List.tl_exn l)));
to_string = (fun [@warning "-8"] [a] -> "(tl " ^ a ^ ")");
global_constraints = (fun _ -> [])
}
};
{
name = "rev";
codomain = Type.(LIST (TVAR "T1"));
domain = Type.[LIST (TVAR "T1")];
is_argument_valid = (function _ -> true);
evaluate = Value.(fun [@warning "-8"] [List (t,l)] -> List (t, (List.rev l)));
to_string = (fun [@warning "-8"] [a] -> "(rev " ^ a ^ ")");
global_constraints = (fun _ -> [])
};

{
name = "equal";
codomain = Type.BOOL;
domain = Type.[LIST (TVAR "T1"); LIST (TVAR "T1") ];
is_argument_valid = (function _ -> true);
evaluate = Value.(fun [@warning "-8"] [List (t, l1) ; List (_, l2)] -> Bool (List.equal Value.equal l1 l2));
to_string = (fun [@warning "-8"] [a ; b] -> "(= " ^ a ^ " " ^ b ^ ")");
global_constraints = (fun _ -> [])
} ;
]

let all = all_qf @ [
Expand Down Expand Up @@ -117,4 +136,4 @@ let all_transformed_int_binary =
~f:(fun c -> try Some (map_transform_binary c)
with _ -> None)))

let levels = [| all_qf ; all ; all_transformed_int_unary ; all_transformed_int_binary |]
let levels = [| all_qf ; all ; all_transformed_int_unary ; all_transformed_int_binary |]
8 changes: 6 additions & 2 deletions src/Logic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ let all_supported =
(* FIXME: The verification side for lists, especially with transformed components,
doesn't work as of now -- we need to emit valid SMTLIB expressions for them *)
components_per_level = ArrayComponents.levels ++ BooleanComponents.levels
++ IntegerComponents.non_linear_levels ++ ListComponents.levels ;
++ IntegerComponents.non_linear_levels ++ ListComponents.levels ++ RealComponents.levels ;
sample_set_size_multiplier = 8
}; {
name = "LRA" ;
components_per_level = RealComponents.levels ++ BooleanComponents.levels ;
sample_set_size_multiplier = 8
}]
; table

let of_string name = String.Table.find_exn all_supported name
let of_string name = String.Table.find_exn all_supported name
Loading