Commit cf8b2b9e by Kim Nguyễn

### More factorisation between Bool and BoolVar modules.

parent 79ce2417
 ... ... @@ -126,17 +126,21 @@ struct | c -> [ fun ppf -> print f ppf c ] let rec get accu pos neg = function | True -> (pos,neg) :: accu let rec get_aux rev accu pos neg = function | True -> let x = if rev then (List.rev pos, List.rev neg) else (pos,neg) in x :: accu | False -> accu | Split (_,x, p,i,n) -> (*OPT: can avoid creating this list cell when pos or neg =False *) let accu = get accu (x::pos) neg p in let accu = get accu pos (x::neg) n in let accu = get accu pos neg i in let accu = get_aux rev accu (x::pos) neg p in let accu = get_aux rev accu pos (x::neg) n in let accu = get_aux rev accu pos neg i in accu let get x = get [] [] [] x let get x = get_aux false [] [] [] x let rec get' accu pos neg = function | True -> (pos,neg) :: accu ... ... @@ -346,22 +350,13 @@ struct let h = compute_hash v a False False in (Split (h,`Var v, a, False, False) :> t ) let get x = let rec aux accu pos neg = function | True -> (List.rev pos, List.rev neg) :: accu | False -> accu | Split (_,x, p,i,n) -> let accu = aux accu (x::pos) neg p in let accu = aux accu pos (x::neg) n in let accu = aux accu pos neg i in accu in aux [] [] [] x let get x = get_aux true [] [] [] x let leafconj x = let rec aux accu = function | True -> accu | False -> accu | Split (_,`Atm x, True,False,False) -> x :: accu | Split (_,`Atm x, True,False,False) -> T.cup x accu | Split (_,`Atm x, _,_,_) -> assert false | Split (_,`Var x, p,i,n) -> let accu = aux accu p in ... ... @@ -369,25 +364,11 @@ struct let accu = aux accu i in accu in List.fold_left T.cup T.empty (aux [] x) (aux T.empty x) let compute ~empty ~full ~cup ~cap ~diff ~atom b = let rec aux = function | True -> full | False -> empty | Split (_,`Atm x,True,_,_) when T.equal x T.empty -> empty | Split (_,`Atm x,True,_,_) when T.equal x T.full -> full | Split(_,x, p,i,n) -> let x1 = atom x in let p = cap x1 (aux p) in let i = aux i in let n = diff (aux n) x1 in cup (cup p i) n in aux b let empty = False let full = split0 (`Atm T.full) True False False let is_empty = function False -> true | _ -> false let rec split x p i n = ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!