Skip to content

Commit

Permalink
Clarify and add more documentation to SymbolicUtility.apply_case_to_s…
Browse files Browse the repository at this point in the history
…tate
  • Loading branch information
benozol committed Jan 17, 2020
1 parent 3c215ca commit ec62229
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/symbolic/symbolicUtility.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ let quantify_over_intermediate_root fs conj =
else
Clause.quantify_over_and_simplify fs.root conj

(** Update a state with a specification case and a new root [root'].
This may result in multiple states because the integration of the case clause in the
filesystem may result in multiple clauses. *)
let apply_case_to_state sta root' case : (state * bool) list =
(* First print the utility trace *)
let sta = print_utility_trace case.descr sta in
Expand All @@ -138,14 +142,16 @@ let apply_case_to_state sta root' case : (state * bool) list =
} in
(* (Optionally) print error message *)
let sta = print_error case.error_message sta in
(* Add the case specification to the current clause *)
(* Combine the case specification and the current filesystem clause *)
Clause.add_to_sat_conj case.spec sta.filesystem.clause
|> List.map (quantify_over_intermediate_root sta.filesystem)
|> List.flatten
(* And now update the filesystem with the new clause and root *)
|> List.map @@ fun clause ->
let filesystem = {sta.filesystem with clause; root=root'} in
{sta with filesystem}, case.result
(* ... now update the filesystem in the state with the new clauses and the new root *)
|> List.map (fun clause ->
let filesystem = {sta.filesystem with clause; root=root'} in
{sta with filesystem})
(* and combine each state with the case result *)
|> List.map (fun sta -> sta, case.result)

type specifications = root:Var.t -> root':Var.t -> case list

Expand Down

0 comments on commit ec62229

Please sign in to comment.