@@ -283,25 +283,31 @@ and cons_seqs (fs:exp list) (es:exp list) =
283283 variant_dnf neg vc1 @ variant_dnf neg vc2
284284 | OpAnd (vc1 ,vc2 ) ->
285285 let d1 = variant_dnf neg vc1
286- and d2 = variant_dnf neg vc2 in
286+ and d2 = variant_dnf neg vc2 in
287287 List. fold_right
288288 (fun a1 k ->
289289 List. fold_right
290290 (fun a2 k -> (a1@ a2)::k) d2 k)
291291 d1 []
292292
293+ let pp_atom = function
294+ | Pos s -> sprintf " \\ Variant{%s}" s
295+ | Neg s -> sprintf " \\ NotVariant{%s}" s
296+
293297 let pp_dnf d =
294298 List. map
295299 (fun a ->
296- List. map
297- (function
298- | Pos s -> sprintf " \\ Variant{%s}" s
299- | Neg s -> sprintf " \\ NotVariant{%s}" s)
300- a |> String. concat " and " )
300+ List. map pp_atom a |> String. concat " and " )
301301 d |> String. concat " or "
302302
303303 let pp_vc vc = variant_dnf false vc |> pp_dnf
304304
305+ let vc_to_items vc =
306+ match variant_dnf false vc with
307+ | [conjs] -> List. map (fun a -> Item (pp_atom a)) conjs
308+ | [] -> Warn. fatal " variant_dnf returned empty list"
309+ | d -> [Item (pp_dnf d)]
310+
305311 let do_pp_rel_id e1 e2 id =
306312 sprintf " \\ %s{%s}{%s}" id (pp_evt e1) (pp_evt e2)
307313
@@ -381,11 +387,11 @@ and cons_seqs (fs:exp list) (es:exp list) =
381387 | If (_ ,VariantCond vc ,Konst (_ ,Empty _ ),e ) ->
382388 let op = Inter in
383389 mk_list op
384- [ Item (pp_vc (OpNot vc)); tr_rel e1 e2 e;]
390+ (vc_to_items (OpNot vc) @ [ tr_rel e1 e2 e;])
385391 | If (_ ,VariantCond vc ,e ,Konst (_ ,Empty _ )) ->
386392 let op = Inter in
387393 mk_list op
388- [ Item (pp_vc vc); tr_rel e1 e2 e;]
394+ (vc_to_items vc @ [ tr_rel e1 e2 e;])
389395 | If (_ ,VariantCond vc ,a ,b ) ->
390396 let c = pp_vc vc
391397 and a = tr_rel e1 e2 a
@@ -551,11 +557,11 @@ and cons_seqs (fs:exp list) (es:exp list) =
551557 | If (_ ,VariantCond vc ,Konst (_ ,Empty _ ),e ) ->
552558 let op = Inter in
553559 mk_list op
554- [ Item (pp_vc (OpNot vc)); tr_evts e1 e;]
560+ (vc_to_items (OpNot vc) @ [ tr_evts e1 e;])
555561 | If (_ ,VariantCond vc ,e ,Konst (_ ,Empty _ )) ->
556562 let op = Inter in
557563 mk_list op
558- [ Item (pp_vc vc); tr_evts e1 e;]
564+ (vc_to_items vc @ [ tr_evts e1 e;])
559565 | If (_ ,VariantCond vc ,a ,b ) ->
560566 let c = pp_vc vc
561567 and a = tr_evts e1 a
0 commit comments