Skip to content
Snippets Groups Projects
Commit 7821800c authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[wp] more determinism during split tactic

parent b1c2c782
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ sig ...@@ -29,6 +29,7 @@ sig
type t type t
val dummy : t val dummy : t
val equal : t -> t -> bool val equal : t -> t -> bool
val compare : t -> t -> int
end end
module Make(T : Type) = module Make(T : Type) =
...@@ -79,7 +80,7 @@ struct ...@@ -79,7 +80,7 @@ struct
if cmp <> 0 then cmp else if cmp <> 0 then cmp else
let cmp = Stdlib.compare x.vrank y.vrank in let cmp = Stdlib.compare x.vrank y.vrank in
if cmp <> 0 then cmp else if cmp <> 0 then cmp else
Stdlib.compare x.vid y.vid T.compare x.vtau y.vtau
(* POOL *) (* POOL *)
......
...@@ -29,6 +29,7 @@ sig ...@@ -29,6 +29,7 @@ sig
type t type t
val dummy : t val dummy : t
val equal : t -> t -> bool val equal : t -> t -> bool
val compare : t -> t -> int
end end
module Make(T : Type) : module Make(T : Type) :
......
...@@ -45,6 +45,7 @@ struct ...@@ -45,6 +45,7 @@ struct
type t = tau type t = tau
let dummy = Prop let dummy = Prop
let equal = Kind.eq_tau Field.equal ADT.equal let equal = Kind.eq_tau Field.equal ADT.equal
let compare = Kind.compare_tau Field.compare ADT.compare
end) end)
open POOL open POOL
......
...@@ -29,7 +29,7 @@ module PartitionsQQ : sig ...@@ -29,7 +29,7 @@ module PartitionsQQ : sig
Lang.F.Vars.t * Lang.F.QED.term Lang.F.Vars.t * Lang.F.QED.term
val get : vars:Lang.F.Vars.t -> Lang.F.term list -> val get : vars:Lang.F.Vars.t -> Lang.F.term list ->
int * Lang.F.Tset.t list int * Lang.F.term list list
end end
= struct = struct
let dkey = Wp_parameters.register_category "tac_split_quantifiers" (* debugging key *) let dkey = Wp_parameters.register_category "tac_split_quantifiers" (* debugging key *)
...@@ -147,7 +147,11 @@ end ...@@ -147,7 +147,11 @@ end
r r
let get ~vars es = let get ~vars es =
extract (partitions ~vars es) let nbparts, parts = extract (partitions ~vars es) in
let sorted_ts e = List.sort Lang.F.compare @@ Lang.F.Tset.elements e in
let sort_es = List.sort (Extlib.list_compare Lang.F.compare) in
let parts = sort_es @@ List.map sorted_ts parts in
nbparts, parts
end end
open Lang.F open Lang.F
...@@ -260,7 +264,7 @@ class split = ...@@ -260,7 +264,7 @@ class split =
feedback#set_descr feedback#set_descr
"Decompose the quantifier into %d parts." nb_parts ; "Decompose the quantifier into %d parts." nb_parts ;
let bind es = let bind es =
bind Exists ~vars (F.e_and (F.Tset.elements es)) in bind Exists ~vars (F.e_and es) in
let goal i n es = let goal i n es =
Printf.sprintf "Goal %d/%d" i n , F.p_bool (bind es) in Printf.sprintf "Goal %d/%d" i n , F.p_bool (bind es) in
Applicable (Tactical.split (Tactical.mapi goal parts)) Applicable (Tactical.split (Tactical.mapi goal parts))
...@@ -352,7 +356,7 @@ class split = ...@@ -352,7 +356,7 @@ class split =
else begin else begin
feedback#set_title "Split (forall or)" ; feedback#set_title "Split (forall or)" ;
feedback#set_descr "Decompose the quantifier between %d parts of the disjunction." nb_parts ; feedback#set_descr "Decompose the quantifier between %d parts of the disjunction." nb_parts ;
let bind es = bind Forall ~vars (F.e_or (F.Tset.elements es)) in let bind es = bind Forall ~vars (F.e_or es) in
let goal i n es = Printf.sprintf "Goal %d/%d" i n , When (F.p_bool (bind es)) in let goal i n es = Printf.sprintf "Goal %d/%d" i n , When (F.p_bool (bind es)) in
let cases = Tactical.mapi goal parts in let cases = Tactical.mapi goal parts in
Applicable (Tactical.replace ~at:step.id cases) Applicable (Tactical.replace ~at:step.id cases)
......
...@@ -475,7 +475,7 @@ ...@@ -475,7 +475,7 @@
typed_test_step_fa_or_ensures subgoal: typed_test_step_fa_or_ensures subgoal:
Goal Wp.Tactical.typed_test_step_fa_or_ensures-0 (generated): Goal Wp.Tactical.typed_test_step_fa_or_ensures-0 (generated):
Assume { (* Goal 1/2 *) When: forall i : Z. P_Pi(i) \/ P_Qi(i). } Assume { (* Goal 1/2 *) When: P_P \/ P_Q \/ P_R. }
Prove: P_S. Prove: P_S.
------------------------------------------------------------ ------------------------------------------------------------
...@@ -483,7 +483,7 @@ ...@@ -483,7 +483,7 @@
typed_test_step_fa_or_ensures subgoal: typed_test_step_fa_or_ensures subgoal:
Goal Wp.Tactical.typed_test_step_fa_or_ensures-1 (generated): Goal Wp.Tactical.typed_test_step_fa_or_ensures-1 (generated):
Assume { (* Goal 2/2 *) When: P_P \/ P_Q \/ P_R. } Assume { (* Goal 2/2 *) When: forall i : Z. P_Pi(i) \/ P_Qi(i). }
Prove: P_S. Prove: P_S.
------------------------------------------------------------ ------------------------------------------------------------
...@@ -691,7 +691,7 @@ ...@@ -691,7 +691,7 @@
Goal Wp.Tactical.typed_test_goal_ex_and_ensures-0 (generated): Goal Wp.Tactical.typed_test_goal_ex_and_ensures-0 (generated):
Assume { (* Pre-condition *) Have: P_S. } Assume { (* Pre-condition *) Have: P_S. }
Prove: exists i : Z. P_Pi(i) /\ P_Qi(i). Prove: P_P /\ P_Q.
------------------------------------------------------------ ------------------------------------------------------------
[wp:script:allgoals] [wp:script:allgoals]
...@@ -699,7 +699,7 @@ ...@@ -699,7 +699,7 @@
Goal Wp.Tactical.typed_test_goal_ex_and_ensures-1 (generated): Goal Wp.Tactical.typed_test_goal_ex_and_ensures-1 (generated):
Assume { (* Pre-condition *) Have: P_S. } Assume { (* Pre-condition *) Have: P_S. }
Prove: P_P /\ P_Q. Prove: exists i : Z. P_Pi(i) /\ P_Qi(i).
------------------------------------------------------------ ------------------------------------------------------------
[wp] [Unsuccess] typed_test_goal_ex_and_ensures (Tactic) (Qed) [wp] [Unsuccess] typed_test_goal_ex_and_ensures (Tactic) (Qed)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment