@@ -76,6 +76,8 @@ module D_Variables_list_skeleton :
7676
7777module Hash_1 = Int_storage. Nearly_inf_Imperatif (* site_type*)
7878module Hash_2 = Int_storage. Nearly_Inf_Int_Int_storage_Imperatif_Imperatif
79+ module Hash_3 = Int_storage. Nearly_Inf_Int_Int_Int_storage_Imperatif_Imperatif_Imperatif
80+
7981
8082type memo_unary = bool Mvbdu_sig .mvbdu Hash_1 .t
8183
@@ -103,6 +105,7 @@ type memo_tables = {
103105 boolean_mvbdu_redefine_range : bool Mvbdu_sig .mvbdu Hash_2 .t ;
104106 boolean_mvbdu_monotonicaly_rename : bool Mvbdu_sig .mvbdu Hash_2 .t ;
105107 boolean_mvbdu_project_keep_only : bool Mvbdu_sig .mvbdu Hash_2 .t ;
108+ boolean_mvbdu_project_keep_only_with_threshold : bool Mvbdu_sig .mvbdu Hash_3 .t ;
106109 boolean_mvbdu_project_abstract_away : bool Mvbdu_sig .mvbdu Hash_2 .t ;
107110 boolean_mvbdu_length_variables_list : int Hash_1 .t ;
108111 boolean_mvbdu_merge_variables_lists : unit List_sig .list Hash_2 .t ;
@@ -113,6 +116,7 @@ type memo_tables = {
113116 boolean_mvbdu_extensional_description_of_range_list :
114117 (int * (int option * int option )) list Hash_1 .t ;
115118 boolean_mvbdu_variables_of_mvbdu : unit List_sig .list Hash_1 .t ;
119+ boolean_mvbdu_variables_of_mvbdu_with_threshold : unit List_sig .list Hash_2 .t ;
116120 boolean_mvbdu_extensional_description_of_mvbdu :
117121 (int * int ) list list Hash_1 .t ;
118122 boolean_mvbdu_extensional_description_of_mvbdu_with_threshold :
@@ -329,6 +333,7 @@ let init_data parameters error =
329333 let error, mvbdu_redefine = Hash_2. create parameters error (0 , 0 ) in
330334 let error, mvbdu_redefine_range = Hash_2. create parameters error (0 , 0 ) in
331335 let error, mvbdu_project_keep_only = Hash_2. create parameters error (0 , 0 ) in
336+ let error, mvbdu_project_keep_only_with_threshold = Hash_3. create parameters error (0 ,(0 ,0 )) in
332337 let error, mvbdu_project_abstract_away =
333338 Hash_2. create parameters error (0 , 0 )
334339 in
@@ -343,6 +348,7 @@ let init_data parameters error =
343348 Hash_1. create parameters error 0
344349 in
345350 let error, mvbdu_variables_of = Hash_1. create parameters error 0 in
351+ let error, mvbdu_variables_of_with_threshold = Hash_2. create parameters error (0 ,0 ) in
346352 let error, mvbdu_extensional_description_of_mvbdu =
347353 Hash_1. create parameters error 0
348354 in
@@ -377,6 +383,7 @@ let init_data parameters error =
377383 boolean_mvbdu_redefine_range = mvbdu_redefine_range;
378384 boolean_mvbdu_monotonicaly_rename = mvbdu_rename;
379385 boolean_mvbdu_project_keep_only = mvbdu_project_keep_only;
386+ boolean_mvbdu_project_keep_only_with_threshold = mvbdu_project_keep_only_with_threshold;
380387 boolean_mvbdu_project_abstract_away = mvbdu_project_abstract_away;
381388 boolean_mvbdu_merge_variables_lists = mvbdu_merge;
382389 boolean_mvbdu_length_variables_list = mvbdu_length;
@@ -388,6 +395,7 @@ let init_data parameters error =
388395 boolean_mvbdu_extensional_description_of_range_list =
389396 mvbdu_extensional_range_list;
390397 boolean_mvbdu_variables_of_mvbdu = mvbdu_variables_of;
398+ boolean_mvbdu_variables_of_mvbdu_with_threshold = mvbdu_variables_of_with_threshold;
391399 boolean_mvbdu_extensional_description_of_mvbdu =
392400 mvbdu_extensional_description_of_mvbdu;
393401 boolean_mvbdu_extensional_description_of_mvbdu_with_threshold =
@@ -1045,6 +1053,46 @@ let gen_bin_mvbdu_list f get set parameters error handler mvbdu_input list_input
10451053 (mvbdu_allocate parameters)
10461054 memoized_fun error handler mvbdu_input list_input
10471055
1056+ let gen_bin_mvbdu_list_with_threshold
1057+ (f :'x -> 'y -> Exception_without_parameter.exceptions_caught_and_uncaught ->
1058+ Remanent_parameters_sig.parameters ->
1059+ (memo_tables, mvbdu_dic, association_list_dic, range_list_dic,
1060+ variables_list_dic, bool, 'a)
1061+ Memo_sig.handler ->
1062+ threshold:int ->
1063+ bool Mvbdu_sig.mvbdu ->
1064+ 'b List_sig.list ->
1065+ Exception_without_parameter.exceptions_caught_and_uncaught *
1066+ ((memo_tables, mvbdu_dic, association_list_dic, range_list_dic,
1067+ variables_list_dic, bool, 'a)
1068+ Memo_sig.handler * bool Mvbdu_sig.mvbdu option ))
1069+ get set parameters error handler ~threshold mvbdu_input list_input
1070+ =
1071+ let memoized_fun =
1072+ Mvbdu_algebra. recursive_memoize_with_threshold
1073+ (fun _parameters -> reset_handler)
1074+ get set
1075+ (fun parameters error handler (threshold ,(mvbdu , list )) d ->
1076+ let a, b =
1077+ Hash_3. unsafe_get parameters error
1078+ (threshold, (Mvbdu_core. id_of_mvbdu mvbdu, List_core. id_of_list list ))
1079+ d
1080+ in
1081+ a, (handler, b))
1082+ (fun parameters error _handler (threshold ,(mvbdu , list )) ->
1083+ Hash_3. set parameters error
1084+ (threshold, (Mvbdu_core. id_of_mvbdu mvbdu, List_core. id_of_list list )))
1085+ in
1086+ f
1087+ (mvbdu_allocate parameters)
1088+ memoized_fun
1089+ (error:Exception_without_parameter.exceptions_caught_and_uncaught )
1090+ parameters
1091+ (handler:(memo_tables, mvbdu_dic, association_list_dic, range_list_dic,
1092+ variables_list_dic, bool , 'a)
1093+ Memo_sig. handler)
1094+ ~threshold mvbdu_input list_input
1095+
10481096let redefine parameters error handler mvbdu_input list_input =
10491097 gen_bin_mvbdu_list Mvbdu_algebra. redefine
10501098 (fun x -> x.Memo_sig. data.boolean_mvbdu_redefine)
@@ -1089,6 +1137,38 @@ let project_keep_only parameters error handler mvbdu_input list_input =
10891137 })
10901138 parameters error handler mvbdu_input list_input
10911139
1140+ let project_keep_only_with_threshold parameters error handler ~threshold mvbdu_input list_input =
1141+ gen_bin_mvbdu_list_with_threshold
1142+ (fun (a :Exception_without_parameter.exceptions_caught_and_uncaught ->
1143+ (bool Mvbdu_sig.cell -> bool Mvbdu_sig.cell -> int) ->
1144+ D_mvbdu_skeleton.value ->
1145+ bool Mvbdu_sig.cell ->
1146+ (int -> bool Mvbdu_sig.mvbdu) ->
1147+ ('a, mvbdu_dic, association_list_dic, range_list_dic,
1148+ variables_list_dic, 'b, 'c)
1149+ Memo_sig.handler ->
1150+ Exception_without_parameter.exceptions_caught_and_uncaught *
1151+ (int * bool Mvbdu_sig.cell * bool Mvbdu_sig.mvbdu *
1152+ ('a, mvbdu_dic, association_list_dic, range_list_dic,
1153+ variables_list_dic, 'b, 'c)
1154+ Memo_sig.handler )
1155+ option )
1156+ (b :('aa, 'dd, 'ee, 'ff, 'gg,
1157+ (bool, mvbdu_dic, association_list_dic, range_list_dic,
1158+ variables_list_dic, ('h, bool) Mvbdu_sig.premvbdu, memo_tables,
1159+ 'i )
1160+ Memo_sig. reset , int * ('j Mvbdu_sig. mvbdu * 'k List_sig. list ), 'l ,
1161+ 'm , 'n )
1162+ Memo_sig. memoized_fun ) -> Mvbdu_algebra. project_keep_only_with_threshold a b boolean_mvbdu_true)
1163+ (fun x -> x.Memo_sig. data.boolean_mvbdu_project_keep_only_with_threshold)
1164+ (fun x h ->
1165+ {
1166+ h with
1167+ Memo_sig. data =
1168+ { h.Memo_sig. data with boolean_mvbdu_project_keep_only_with_threshold = x };
1169+ })
1170+ parameters error handler ~threshold mvbdu_input list_input
1171+
10921172let project_abstract_away parameters error handler mvbdu_input list_input =
10931173 gen_bin_mvbdu_list Mvbdu_algebra. project_abstract_away
10941174 (fun x -> x.Memo_sig. data.boolean_mvbdu_project_abstract_away)
@@ -1324,6 +1404,78 @@ let rec variables_of_mvbdu parameters error handler mvbdu =
13241404 Some output ) )
13251405 | None -> Exception. warn parameters error __POS__ Exit (handler, None ))
13261406
1407+ let rec variables_of_mvbdu_with_threshold parameters error handler ~threshold mvbdu =
1408+ match
1409+ Hash_2. unsafe_get parameters error (threshold,mvbdu.Mvbdu_sig. id)
1410+ handler.Memo_sig. data.boolean_mvbdu_variables_of_mvbdu_with_threshold
1411+ with
1412+ | error , Some output -> error, (handler, Some output)
1413+ | error , None ->
1414+ let error, (handler, output) =
1415+ match mvbdu.Mvbdu_sig. value with
1416+ | Mvbdu_sig. Leaf _ ->
1417+ let error, (handler, list ) =
1418+ List_algebra. build_reversed_sorted_list
1419+ (variables_list_allocate parameters)
1420+ parameters error handler []
1421+ in
1422+ error, (handler, Some list )
1423+ | Mvbdu_sig. Node a ->
1424+ if a.Mvbdu_sig. variable < = threshold then
1425+ let error, (handler, list_false) =
1426+ variables_of_mvbdu_with_threshold parameters error handler ~threshold a.Mvbdu_sig. branch_false
1427+ in
1428+ let error, (handler, list_true) =
1429+ variables_of_mvbdu_with_threshold parameters error handler ~threshold a.Mvbdu_sig. branch_true
1430+ in
1431+ let error, (handler, singleton) =
1432+ List_algebra. build_reversed_sorted_list
1433+ (variables_list_allocate parameters)
1434+ parameters error handler
1435+ [ a.Mvbdu_sig. variable, () ]
1436+ in
1437+ (match list_false, list_true with
1438+ | Some list_f , Some list_t ->
1439+ let error, (handler, list_sibblings) =
1440+ merge_variables_lists parameters error handler list_f list_t
1441+ in
1442+ let error, (handler, output) =
1443+ match list_sibblings with
1444+ | Some list_s ->
1445+ merge_variables_lists parameters error handler singleton list_s
1446+ | None ->
1447+ Exception. warn parameters error __POS__ Exit (handler, None )
1448+ in
1449+ error, (handler, output)
1450+ | None , _ | _ , None ->
1451+ Exception. warn parameters error __POS__ Exit (handler, None ))
1452+ else
1453+ let error, (handler, list ) =
1454+ List_algebra. build_reversed_sorted_list
1455+ (variables_list_allocate parameters)
1456+ parameters error handler []
1457+ in
1458+ error, (handler, Some list )
1459+ in
1460+ (match output with
1461+ | Some output ->
1462+ let error, memo =
1463+ Hash_2. set parameters error (threshold, mvbdu.Mvbdu_sig. id) output
1464+ handler.Memo_sig. data.boolean_mvbdu_variables_of_mvbdu_with_threshold
1465+ in
1466+ ( error,
1467+ ( {
1468+ handler with
1469+ Memo_sig. data =
1470+ {
1471+ handler.Memo_sig. data with
1472+ boolean_mvbdu_variables_of_mvbdu_with_threshold = memo;
1473+ };
1474+ },
1475+ Some output ) )
1476+ | None -> Exception. warn parameters error __POS__ Exit (handler, None ))
1477+
1478+
13271479let mvbdu_cartesian_decomposition_depth variables_list_of_mvbdu
13281480 extensional_of_variables_list build_sorted_variables_list
13291481 mvbdu_project_keep_only mvbdu_project_abstract_away mvbdu_and equal
0 commit comments