Skip to content

Commit bac76d4

Browse files
committed
clean code and comments
1 parent c93dda5 commit bac76d4

File tree

8 files changed

+28
-34
lines changed

8 files changed

+28
-34
lines changed

core/KaSa_rep/reachability_analysis/bdu_static_views.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ let collect_site_to_renamed_site_list parameters error store_remanent_triple
585585
let rec aux error site list output =
586586
match list with
587587
| [] -> error, output
588-
| Ckappa_sig.Guard_p _ :: _ -> error, output
588+
| Ckappa_sig.Guard_p _ :: _ ->
589+
(*only sites are converted to a new index*) error, output
589590
| Ckappa_sig.Site h :: t ->
590591
let h =
591592
Ckappa_sig.mvbdu_var_of_site_or_guard_p (Ckappa_sig.Site h)

core/KaSa_rep/reachability_analysis/parallel_bonds.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ module Domain = struct
4343
}
4444

4545
(*--------------------------------------------------------------*)
46-
(* One map: for each tuple: Yes mvbdu, No mvbdu
47-
- Yes: for these values of the guards, when the sites x and y are bound with sites of
48-
the good type, then they are bound to the same B.
49-
- No: for these values of the guards, when the sites x and y are bound with sites of the good
50-
type, then they are never bound to the same B.
51-
- Otherwise: both cases may happen.*)
46+
(* The map `store_value` maps each tuple of sites ((x,y),(a,b)) to a mvbdu whose variables are the guard parameters and an additional variable (the "first variable").
47+
Given a valuation for the guard parameters:
48+
- if the "first variable" must be true in order to satisfy the mvbdu: it means that when the sites x and y are bound with sites of the types a and b, then they are always bound to the same agent.
49+
- if the "first variable" must be false in order to satisfy the mvbdu: it means that when when the sites x and y are bound with sites of the types a and b, then they are never bound to the same agent.
50+
- if the first variable may be both true or false: both cases may happen.*)
5251

5352
type local_dynamic_information = {
5453
dummy: unit;

core/KaSa_rep/reachability_analysis/parallel_bonds_static.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type local_static_information = {
6262
store_sites_to_tuple:
6363
Parallel_bonds_type.PairAgentSitesStates_map_and_set.Set.t
6464
Parallel_bonds_type.AgentSite_map_and_set.Map.t;
65-
(*the same as the global restriction mvbdu, but it contains one additional variable at the end.*)
65+
(*the same as the global restriction mvbdu, but it contains an additional "first variable" at the beginning.*)
6666
restriction_mvbdu: Ckappa_sig.Views_bdu.mvbdu;
6767
}
6868

core/KaSa_rep/reachability_analysis/parallel_bonds_type.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ let add_value_lattice parameters error x value store_result =
593593
error, store_result
594594
)
595595

596-
(*TODO merge with above*)
597596
let add_value_mvbdu parameters error x bdu_handler store_result mvbdu
598597
restriction_mvbdu =
599598
let error, bdu_handler, mvbdu_false =
@@ -607,10 +606,6 @@ let add_value_mvbdu parameters error x bdu_handler store_result mvbdu
607606
| error, None -> error, mvbdu_false
608607
| error, Some old_mvbdu -> error, old_mvbdu
609608
in
610-
(* let error, bdu_handler, mvbdu_refined =
611-
add_first_variable_to_mvbdu parameters bdu_handler error bool
612-
mvbdu
613-
in *)
614609
let error, bdu_handler, new_mvbdu =
615610
Ckappa_sig.mvbdu_or_for_guards parameters bdu_handler error old_mvbdu mvbdu
616611
restriction_mvbdu

core/KaSa_rep/reachability_analysis/site_across_bonds_domain.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ module Domain = struct
4848
}
4949

5050
(*--------------------------------------------------------------*)
51-
(* Maps each such tuples (A,x,y,B,z,t) to a mvbdu with (n + 2) variables.
51+
(* The map `store_value` maps each tuples (A,x,y,B,z,t) to a mvbdu with (n + 2) variables.
5252
The last n variables describe the boolean value of the guard parameters.
53-
Tha first two variables describe the relation between the state of y and the state of t,
53+
The first two variables describe the relation between the state of y and the state of t,
5454
when both agents are connected via x and z.
5555
*)
5656
(*--------------------------------------------------------------*)
@@ -1823,7 +1823,7 @@ module Domain = struct
18231823
let error, handler =
18241824
Site_across_bonds_domain_type.PairAgentSitesState_map_and_set.Map.fold
18251825
(fun (x, y) mvbdu (error, handler) ->
1826-
Site_across_bonds_domain_type.print_site_across_domain
1826+
Site_across_bonds_domain_type.print_site_across_bonds_domain
18271827
~verbose:true ~sparse:true ~final_result:true ~dump_any:true
18281828
parameters error kappa_handler handler (x, y) mvbdu
18291829
restriction_bdu)

core/KaSa_rep/reachability_analysis/site_across_bonds_domain_type.ml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ let print_guard_mvbdu parameters error handler kappa_handler mvbdu
324324
error, handler
325325
)
326326

327-
let print_site_across_domain_raw parameters error kappa_handler handler log
328-
final_result pair_list nsites agent_id1 site_type1' agent_id2 site_type2'
329-
pattern restriction_bdu =
327+
let print_site_across_bonds_domain_raw parameters error kappa_handler handler
328+
log final_result pair_list nsites agent_id1 site_type1' agent_id2
329+
site_type2' pattern restriction_bdu =
330330
let error =
331331
(*do not print the precondition if it is not the final result*)
332332
if final_result then (
@@ -414,9 +414,10 @@ let print_site_across_domain_raw parameters error kappa_handler handler log
414414
in
415415
error, handler
416416

417-
let print_site_across_domain_natural_language parameters error kappa_handler
418-
handler log pair_list nsites prefix site1 site2 site1' agent1 site2' agent2
419-
agent_type1 site_type1 agent_type2 site_type2 restriction_bdu =
417+
let print_site_across_bonds_domain_natural_language parameters error
418+
kappa_handler handler log pair_list nsites prefix site1 site2 site1' agent1
419+
site2' agent2 agent_type1 site_type1 agent_type2 site_type2 restriction_bdu
420+
=
420421
let () =
421422
Loggers.fprintf log
422423
"%sWhenever the site %s of %s and the site %s of %s are bound together, \
@@ -468,7 +469,7 @@ let print_site_across_domain_natural_language parameters error kappa_handler
468469
error, handler)
469470
(error, handler) pair_list
470471

471-
let print_site_across_domain ?verbose:(_verbose = true) ?(sparse = false)
472+
let print_site_across_bonds_domain ?verbose:(_verbose = true) ?(sparse = false)
472473
?(final_result = false) ?dump_any:(_dump_any = false) parameters error
473474
kappa_handler handler tuple mvbdu restriction_bdu =
474475
let prefix = Remanent_parameters.get_prefix parameters in
@@ -528,11 +529,11 @@ let print_site_across_domain ?verbose:(_verbose = true) ?(sparse = false)
528529
Site_graphs.KaSa_site_graph.add_bond parameters error kappa_handler
529530
agent_id1 site_type1 agent_id2 site_type2 pattern
530531
in
531-
print_site_across_domain_raw parameters error kappa_handler handler
532-
log final_result pair_list nsites agent_id1 site_type1' agent_id2
533-
site_type2' pattern restriction_bdu
532+
print_site_across_bonds_domain_raw parameters error kappa_handler
533+
handler log final_result pair_list nsites agent_id1 site_type1'
534+
agent_id2 site_type2' pattern restriction_bdu
534535
| Remanent_parameters_sig.Natural_language ->
535-
print_site_across_domain_natural_language parameters error
536+
print_site_across_bonds_domain_natural_language parameters error
536537
kappa_handler handler log pair_list nsites prefix site1 site2 site1'
537538
agent1 site2' agent2 agent_type1 site_type1 agent_type2 site_type2
538539
restriction_bdu
@@ -570,8 +571,8 @@ let add_link parameter error bdu_false handler kappa_handler pair mvbdu
570571
let parameter =
571572
Remanent_parameters.update_prefix parameter " "
572573
in
573-
print_site_across_domain ~verbose:false ~dump_any:true parameter error
574-
kappa_handler handler pair mvbdu restriction_mvbdu
574+
print_site_across_bonds_domain ~verbose:false ~dump_any:true parameter
575+
error kappa_handler handler pair mvbdu restriction_mvbdu
575576
) else
576577
error, handler
577578
in
@@ -628,8 +629,8 @@ let add_link_and_check parameter error bdu_false handler kappa_handler bool
628629
else
629630
dump_title ()
630631
in
631-
print_site_across_domain ~verbose:false ~dump_any:true parameter error
632-
kappa_handler handler x mvbdu restriction_mvbdu
632+
print_site_across_bonds_domain ~verbose:false ~dump_any:true parameter
633+
error kappa_handler handler x mvbdu restriction_mvbdu
633634
) else
634635
error, handler
635636
in

core/KaSa_rep/type_interface/public_data.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let hyp = "site graph"
3232
let refinement = "site graph list"
3333
let domain_name = "domain name"
3434
let refinements_list = "refinements list"
35-
let refinement_lemmas = "lemmas"
35+
let refinement_lemmas = "refinement lemmas"
3636
let rule_id = "id"
3737
let agent_id = "id"
3838
let label = "label"

examples/boolean_predicates/example_double_bonds_all_cases.ka

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ A(x[.],y[.]), A(x[.],y[.]) -> A(x[1],y[.]), A(x[1],y[.]) @ 1
2626

2727
// Measure amount of A double bonds
2828
%obs: 'Trimer' |A(x[1],y[2]),A(x[1],y[2])|
29-
30-
// Static analysis must show that P => no double bonds

0 commit comments

Comments
 (0)