cleaning up checksum code (will change checksums)

parent da8262dc
......@@ -1781,7 +1781,7 @@ let print_external_proof fmt p =
module AssoGoals : sig
val associate : 'a goal list -> 'b goal list ->
('b goal * ('a goal option) * bool) list
('b goal * ('a goal * bool) option) list
end = struct
(** When Why3 will require 3.12 put all of that in a function using
explicit type argument "(type t)" and remove all the Obj.magic *)
......@@ -1805,19 +1805,19 @@ end = struct
let name g = g.goal_name
end
module AssoGoals = Tc.AssoMake2(FromGoal)(ToGoal)
module AssoGoals = Tc.Pairing(FromGoal)(ToGoal)
open ToGoal
open FromGoal
let associate (from_goals: 'ffrom goal list) (to_goals: 'tto goal list) :
('tto goal * ('ffrom goal option) * bool) list =
('tto goal * ('ffrom goal * bool) option) list =
let from_goals : ffrom goal list =
Obj.magic (from_goals : 'ffrom goal list) in
let to_goals : tto goal list =
Obj.magic (to_goals : 'tto goal list) in
let associated : (tto goal * (ffrom goal option) * bool) list =
let associated : (tto goal * (ffrom goal * bool) option) list =
AssoGoals.associate from_goals to_goals in
(Obj.magic associated : ('tto goal * ('ffrom goal option) * bool) list)
(Obj.magic associated : ('tto goal * ('ffrom goal * bool) option) list)
end
......@@ -1881,9 +1881,9 @@ and merge_trans ~keygen ~theories env to_goal _ from_transf =
env.session.session_shape_version;
AssoGoals.associate from_transf.transf_goals to_transf.transf_goals in
List.iter (function
| (to_goal, Some from_goal, obsolete) ->
| (to_goal, Some (from_goal, obsolete)) ->
merge_any_goal ~keygen ~theories env obsolete from_goal to_goal
| (_, None, _) -> ()
| (_, None) -> ()
) associated
with Exit -> ()
......@@ -2270,9 +2270,9 @@ and add_transf_to_goal ~keygen env to_goal from_transf =
env.session.session_shape_version;
AssoGoals.associate from_transf.transf_goals to_transf.transf_goals in
List.iter (function
| (to_goal, Some from_goal, _obsolete) ->
| (to_goal, Some (from_goal, _obsolete)) ->
add_goal_to_parent ~keygen env from_goal to_goal
| (_, None, _) -> ()
| (_, None) -> ()
) associated;
to_transf
......
This diff is collapsed.
......@@ -9,52 +9,30 @@
(* *)
(********************************************************************)
val current_shape_version : int
(** Shapes *)
type checksum
val print_checksum: Format.formatter -> checksum -> unit
val string_of_checksum: checksum -> string
val checksum_of_string: string -> checksum
val equal_checksum: checksum -> checksum -> bool
val dumb_checksum: checksum
val current_shape_version : int
type shape
val print_shape: Format.formatter -> shape -> unit
val string_of_shape: shape -> string
val shape_of_string: string -> shape
(*
val t_dist : term -> term -> float
(** returns an heuristic distance between the two given terms. The
result is always between 0.0 and 1.0. It is guaranteed that if
the result is 0.0 then the terms are equal modulo alpha *)
*)
(*
[t_shape t] provides a traversal of the term structure, generally
in the order root-left-right, except for nodes Tquant and Tbin
which are traversed in the order right-root-left, so that in "A ->
B" we see B first, and if "Forall x,A" we see A first
*)
val t_shape_buf : ?version:int -> Term.term -> shape
(** returns a shape of the given term *)
(*
val t_shape_list : Term.term -> string list
(** returns a shape of the given term *)
(** Checksums *)
val pr_shape_list : Format.formatter -> Term.term -> unit
*)
type checksum
val print_checksum: Format.formatter -> checksum -> unit
val string_of_checksum: checksum -> string
val checksum_of_string: string -> checksum
val equal_checksum: checksum -> checksum -> bool
val dumb_checksum: checksum
val task_checksum : ?version:int -> Task.task -> checksum
(** Pairing using shape and checksum *)
(** Pairing algorithm *)
module type S = sig
type t
......@@ -63,18 +41,14 @@ module type S = sig
val name : t -> Ident.ident
end
module AssoMake (Old : S) (New : S) : sig
val associate : Old.t list -> New.t list -> (New.t * Old.t option *bool) list
(** associate the new things {New.t} to old things {Old.t}.
(n,o,b) means if [o,b] is:
- [Some o, false] the old thing [o] have the same checksum that the new
thing [n].
- [Some o, true] no old things have the same checksum
than [n]. The new thing [o] has a shape similar to [n]
- [None] no old thing were similar enough. *)
end
module Pairing(Old: S)(New: S) : sig
val associate:
Old.t list -> New.t list -> (New.t * (Old.t * bool) option) list
(** Associate new goals to (possibly) old goals
Each new goal is mapped either to
- [None]: no pairing at all
- [Some (h, false)]: exact matching (equal checksums)
- [Some (h, true)]: inexact matching (goal obsolete)
module AssoMake2 (Old : S) (New : S) : sig
val associate : Old.t list -> New.t list -> (New.t * Old.t option *bool) list
(* note: in the output, goals appear in the same order as in [newgoals] *)
Note: in the output, goals appear in the same order as in [newgoals] *)
end
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