Skip to content

Commit

Permalink
fix pp typo; fix wrong arity handling for join
Browse files Browse the repository at this point in the history
  • Loading branch information
David Chemouil committed May 23, 2024
1 parent 4e04783 commit 578eda0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
28 changes: 13 additions & 15 deletions src/Raw_to_ast.ml
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,6 @@ let refine_identifiers unseen_shifts raw_pb =
* Check arities
*******************************************************************************)

(* computes the arity of a join *)
let join_arity ar1 ar2 =
match (ar1, ar2) with
| Some a1, Some a2 ->
let res = a1 + a2 - 2 in
if res > 0 then Some res else None
| Some _, None | None, Some _ | None, None -> None

let str_exp = Fmtc.to_to_string (Fmtc.hbox2 Ast.pp_exp)

let compute_arities elo =
Expand Down Expand Up @@ -675,13 +667,19 @@ let compute_arities elo =
let ar = Some (a1 + a2) in
return_exp exp ar @@ rbinary e1' op e2'
| None, _ | _, None -> return_exp exp None @@ rbinary e1' op e2')
| Join ->
let ar_join = join_arity ar1 ar2 in
if Option.is_none ar_join then
Result.fail
@@ Fmtc.str "wrong arities for the dot join of %s and %s"
(str_exp e1') (str_exp e2')
else return_exp exp ar_join @@ rbinary e1' op e2')
| Join -> (
match (ar1, ar2) with
| Some _, None | None, Some _ | None, None ->
return_exp exp None @@ rbinary e1' op e2'
| Some a1, Some a2 ->
let res = a1 + a2 - 2 in
if res < 0 then
Result.fail
@@ Fmtc.str "wrong arities for the dot join of %s and %s"
(str_exp e1') (str_exp e2')
else
return_exp exp (if res > 0 then Some res else None)
@@ rbinary e1' op e2'))
| RIte (c, t, e) -> (
let c' = walk_fml ctx c in
let t' = walk_exp ctx t in
Expand Down
2 changes: 1 addition & 1 deletion src/Smv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ module Make_SMV_file_format (Ltl : Solver.LTL) :
pf out "%s@\n" elo_str;
stratified_fml
|> List.iter
(pf out "TRANS@\n[<hv2>%a@];@\n@\n"
(pf out "TRANS@\n@[<hv2>%a@];@\n@\n"
(Ltl.pp_gather_variables ~next_is_X:false bitwidth auxiliaries
variables)))
trans;
Expand Down

0 comments on commit 578eda0

Please sign in to comment.