Commit c0e0858f authored by François Bobot's avatar François Bobot

Session : inititialize correctly _verified

parent 0eacf898
...@@ -442,20 +442,14 @@ let get_explanation id task = ...@@ -442,20 +442,14 @@ let get_explanation id task =
type 'a notify = 'a any -> unit type 'a notify = 'a any -> unit
let notify : 'a notify = fun _ -> () let notify : 'a notify = fun _ -> ()
let check_file_verified notify f = let file_verified f =
let b = List.for_all (fun t -> t.theory_verified) f.file_theories in List.for_all (fun t -> t.theory_verified) f.file_theories
if f.file_verified <> b then begin
f.file_verified <- b;
notify (File f)
end
let check_theory_proved notify t = let theory_verified t =
let b = List.for_all (fun g -> g.goal_verified) t.theory_goals in List.for_all (fun g -> g.goal_verified) t.theory_goals
if t.theory_verified <> b then begin
t.theory_verified <- b; let transf_verified t =
notify (Theory t); List.for_all (fun g -> g.goal_verified) t.transf_goals
check_file_verified notify t.theory_parent
end
let proof_verified a = let proof_verified a =
(not a.proof_obsolete) && (not a.proof_obsolete) &&
...@@ -463,8 +457,7 @@ let proof_verified a = ...@@ -463,8 +457,7 @@ let proof_verified a =
| Done { Call_provers.pr_answer = Call_provers.Valid} -> true | Done { Call_provers.pr_answer = Call_provers.Valid} -> true
| _ -> false | _ -> false
let rec check_goal_proved notify g = let goal_verified g =
let b =
try try
PHprover.iter PHprover.iter
(fun _ a -> (fun _ a ->
...@@ -476,7 +469,24 @@ let rec check_goal_proved notify g = ...@@ -476,7 +469,24 @@ let rec check_goal_proved notify g =
g.goal_transformations; g.goal_transformations;
false false
with Exit -> true with Exit -> true
in
let check_file_verified notify f =
let b = file_verified f in
if f.file_verified <> b then begin
f.file_verified <- b;
notify (File f)
end
let check_theory_proved notify t =
let b = theory_verified t in
if t.theory_verified <> b then begin
t.theory_verified <- b;
notify (Theory t);
check_file_verified notify t.theory_parent
end
let rec check_goal_proved notify g =
let b = goal_verified g in
if g.goal_verified <> b then begin if g.goal_verified <> b then begin
g.goal_verified <- b; g.goal_verified <- b;
notify (Goal g); notify (Goal g);
...@@ -486,7 +496,7 @@ let rec check_goal_proved notify g = ...@@ -486,7 +496,7 @@ let rec check_goal_proved notify g =
end end
and check_transf_proved notify t = and check_transf_proved notify t =
let b = List.for_all (fun g -> g.goal_verified) t.transf_goals in let b = transf_verified t in
if t.transf_verified <> b then begin if t.transf_verified <> b then begin
t.transf_verified <- b; t.transf_verified <- b;
notify (Transf t); notify (Transf t);
...@@ -726,6 +736,7 @@ let rec load_goal ~old_provers parent acc g = ...@@ -726,6 +736,7 @@ let rec load_goal ~old_provers parent acc g =
let exp = bool_attribute "expanded" g true in let exp = bool_attribute "expanded" g true in
let mg = raw_add_no_task ~keygen parent gname expl sum shape exp in let mg = raw_add_no_task ~keygen parent gname expl sum shape exp in
List.iter (load_proof_or_transf ~old_provers mg) g.Xml.elements; List.iter (load_proof_or_transf ~old_provers mg) g.Xml.elements;
mg.goal_verified <- goal_verified mg;
mg::acc mg::acc
| "label" -> acc | "label" -> acc
| s -> | s ->
...@@ -777,7 +788,7 @@ and load_proof_or_transf ~old_provers mg a = ...@@ -777,7 +788,7 @@ and load_proof_or_transf ~old_provers mg a =
[] a.Xml.elements); [] a.Xml.elements);
(* already done by raw_add_transformation (* already done by raw_add_transformation
Hashtbl.add mg.transformations trname mtr *) Hashtbl.add mg.transformations trname mtr *)
() mtr.transf_verified <- transf_verified mtr
| "label" -> () | "label" -> ()
| s -> | s ->
eprintf eprintf
...@@ -795,6 +806,7 @@ let load_theory ~old_provers mf acc th = ...@@ -795,6 +806,7 @@ let load_theory ~old_provers mf acc th =
(List.fold_left (List.fold_left
(load_goal ~old_provers (Parent_theory mth)) (load_goal ~old_provers (Parent_theory mth))
[] th.Xml.elements); [] th.Xml.elements);
mth.theory_verified <- theory_verified mth;
mth::acc mth::acc
| s -> | s ->
eprintf "[Warning] Session.load_theory: unexpected element '%s'@." s; eprintf "[Warning] Session.load_theory: unexpected element '%s'@." s;
...@@ -810,6 +822,7 @@ let load_file session old_provers f = ...@@ -810,6 +822,7 @@ let load_file session old_provers f =
List.rev List.rev
(List.fold_left (List.fold_left
(load_theory ~old_provers mf) [] f.Xml.elements); (load_theory ~old_provers mf) [] f.Xml.elements);
mf.file_verified <- file_verified mf;
old_provers old_provers
| "prover" -> | "prover" ->
(** The id is just for the session file *) (** The id is just for the session file *)
...@@ -906,6 +919,7 @@ let raw_add_file ~x_keygen ~x_goal ~x_fold_theory ~x_fold_file = ...@@ -906,6 +919,7 @@ let raw_add_file ~x_keygen ~x_goal ~x_fold_theory ~x_fold_file =
let parent = Parent_theory rtheory in let parent = Parent_theory rtheory in
let goals = x_fold_theory (add_goal parent) [] theory in let goals = x_fold_theory (add_goal parent) [] theory in
rtheory.theory_goals <- List.rev goals; rtheory.theory_goals <- List.rev goals;
rtheory.theory_verified <- theory_verified rtheory;
rtheory::acc rtheory::acc
in in
let theories = x_fold_file add_theory [] file in let theories = x_fold_file add_theory [] file in
...@@ -1002,6 +1016,7 @@ end) = (struct ...@@ -1002,6 +1016,7 @@ end) = (struct
let g = let g =
raw_add_task ~keygen:X.keygen parent raw_add_task ~keygen:X.keygen parent
name expl task false in name expl task false in
(** no verified since that can't be empty (no proof no transf) and true *)
g::acc g::acc
let add_transformation g name transf = let add_transformation g name transf =
...@@ -1010,6 +1025,7 @@ end) = (struct ...@@ -1010,6 +1025,7 @@ end) = (struct
let parent = Parent_transf rtransf in let parent = Parent_transf rtransf in
let goals = X.fold_transf (add_goal parent) [] task transf in let goals = X.fold_transf (add_goal parent) [] task transf in
rtransf.transf_goals <- List.rev goals; rtransf.transf_goals <- List.rev goals;
rtransf.transf_verified <- transf_verified rtransf;
rtransf rtransf
end : sig end : sig
...@@ -1025,6 +1041,7 @@ let add_transformation ~keygen ~goal transfn g goals = ...@@ -1025,6 +1041,7 @@ let add_transformation ~keygen ~goal transfn g goals =
g::acc in g::acc in
let goals = List.fold_left add_goal [] goals in let goals = List.fold_left add_goal [] goals in
rtransf.transf_goals <- List.rev goals; rtransf.transf_goals <- List.rev goals;
rtransf.transf_verified <- transf_verified rtransf;
rtransf rtransf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment