Fixed Karr domain
This commit is contained in:
parent
2808f0bd8c
commit
63f0e88788
1 changed files with 5 additions and 4 deletions
|
@ -161,7 +161,8 @@ module Karr : DOMAIN = struct
|
||||||
|
|
||||||
exception Cant_assign
|
exception Cant_assign
|
||||||
|
|
||||||
let init n = E (Matrix.zero 0 n, Matrix.zero 0 1)
|
let init n =
|
||||||
|
E (Matrix.zero 0 n, Matrix.zero 0 1)
|
||||||
let bottom = Bot
|
let bottom = Bot
|
||||||
|
|
||||||
let rec explore e n =
|
let rec explore e n =
|
||||||
|
@ -189,7 +190,7 @@ module Karr : DOMAIN = struct
|
||||||
else raise Cant_assign
|
else raise Cant_assign
|
||||||
| AST_MODULO -> raise Cant_assign)
|
| AST_MODULO -> raise Cant_assign)
|
||||||
| CFG_int_var var ->
|
| CFG_int_var var ->
|
||||||
( Matrix.init 1 n (fun i j -> if j = var.var_id then Q.one else Q.zero),
|
( Matrix.init 1 n (fun i j -> if j = var.var_id - 1 then Q.one else Q.zero),
|
||||||
Q.zero )
|
Q.zero )
|
||||||
| CFG_int_const const -> (Matrix.zero 1 n, Q.make const Z.one)
|
| CFG_int_const const -> (Matrix.zero 1 n, Q.make const Z.one)
|
||||||
| CFG_int_rand (_, _) -> raise Cant_assign
|
| CFG_int_rand (_, _) -> raise Cant_assign
|
||||||
|
@ -201,8 +202,8 @@ module Karr : DOMAIN = struct
|
||||||
let n = Matrix.width vars in
|
let n = Matrix.width vars in
|
||||||
try
|
try
|
||||||
let new_line, new_const = explore expr n in
|
let new_line, new_const = explore expr n in
|
||||||
Matrix.set new_line 0 var.var_id
|
Matrix.set new_line 0 (var.var_id - 1)
|
||||||
(Q.add (Matrix.get new_line 0 var.var_id) Q.one);
|
(Q.add (Matrix.get new_line 0 (var.var_id - 1)) Q.one);
|
||||||
let new_vars = Matrix.extend vars new_line in
|
let new_vars = Matrix.extend vars new_line in
|
||||||
let new_consts =
|
let new_consts =
|
||||||
Matrix.extend consts (Matrix.init 1 1 (fun _ _ -> new_const))
|
Matrix.extend consts (Matrix.init 1 1 (fun _ _ -> new_const))
|
||||||
|
|
Loading…
Reference in a new issue