File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -744,3 +744,14 @@ let get_invariant_messages
744744 let inv = invio#get_invariant invindex in
745745 let p = LBLOCK [STR " [" ; INT k; STR " ] " ; inv#value_to_pretty] in
746746 p::acci) acc ilist) [] l
747+
748+
749+ let prioritize_invariants (f : invariant_int -> bool ) (invs : invariant_int list ) =
750+ List. stable_sort
751+ (fun inv1 inv2 ->
752+ if f inv1 && f inv2 then
753+ 0
754+ else if f inv1 then
755+ - 1
756+ else
757+ 1 ) invs
Original file line number Diff line number Diff line change @@ -72,3 +72,15 @@ val mk_invariant_io:
7272
7373val get_invariant_messages :
7474 invariant_io_int -> (int * int list ) list -> pretty_t list
75+
76+
77+ (* * [prioritize_invariants f invs] returns the invariants in [invs]
78+ sorted such that the invariants for which [(f inv)] is true are
79+ listed before other invariants.
80+
81+ This is useful in the application of invariants in the checkers,
82+ where multiple invariants apply to discharge a proof obligation,
83+ but some invariants may be preferred over others.
84+ *)
85+ val prioritize_invariants :
86+ (invariant_int -> bool ) -> invariant_int list -> invariant_int list
You can’t perform that action at this time.
0 commit comments