(* *)(* This software is distributed under the terms of the GNU Lesser *)(* General Public License version 2.1, with the special exception *)(* on linking described in file LICENSE. *)(* *)(********************************************************************)

(** Any module of this signature should implement a scheduler, that allows the register functions to call, and call them depending on some time constraints: after a given delay, or simply when there is no more tasks with higher priority. *)

valtimeout:ms:int->(unit->bool)->unit(** [timeout ~ms f] registers the function [f] as a function to be called every [ms] milliseconds. The function is called repeatedly until it returns false. the [ms] delay is not strictly guaranteed: it is only a minimum delay between the end of the last call and the beginning of the next call. Several functions can be registered at the same time. *)validle:prio:int->(unit->bool)->unit(** [idle prio f] registers the function [f] as a function to be called whenever there is nothing else to do. Several functions can be registered at the same time. Several functions can be registered at the same time. Functions registered with higher priority will be called first. *)

valreload_files:controller->shape_version:intoption->bool*bool(** [reload_files] returns a pair [(o,d)]: [o] true means there are obsolete goals, [d] means there are missed objects (goals, transformations, theories or files) that are now detached in the session returned. If parsing or typing errors occurs, a list of errors is raised inside exception Errors_list. The detailed process of reloading the files of the given session is as follows.

- each file is parsed again and theories/goals extracted from it. If some syntax error or parsing error occurs, then the corresponding file is kept in the session, without any corresponding new theory,

- each new theory is associated to a theory of the former session if the names match exactly. In case of no match: . a new theory and its goals appear without any proof attempts in it in the new session . an unmatched old theory is kept in the new session together with its former goals, proof attempts and transformations, but without any tasks associated to goals and subgoals. - within a new theory with a corresponding old theory, each goal is in turn associated to a former goal if possible. the match is done either on the goal name, or if no name match exactly, on the goal shape. . a new goal without match is added with an empty set of proof attempts and transformations . an old goal without match is kept with all its former proof attempts and transformations, but no task is associated to it, neither to its subgoals. - on each new goal that has a matching old goal, old proof attempts are attached, with the status obsolete if the task has changed - on each new goal that has a matching old goal, old transformations are attached, and applied to the task, the generated subgoals are in turn matched to the old sub-goals, in the same manner as for goals in a theory

valremove_subtree:notification:notifier->removed:notifier->controller->any->unit(** remove a subtree of the session, taking care of not removing any proof attempt in progress. raise [RemoveError] if removal is not possible. *)

proof attempt for a goal specified by [id] with the prover [p] with time limit [timelimit]; the function [callback] will be called each time the proof attempt status changes. Typically at Scheduled, then Running, then Done. If there is already a proof attempt with [p] it

(** [schedule_edition c id pr ~callback ~notification] runs the editor for prover [pr] on proofnode [id] on a file whose name is automatically generated. It will runs callback each time the proof status changes and notification will be called each time a change is made to the proof_state (in the whole proof tree of the session). *)valprepare_edition:controller->?file:string->proofNodeID->Whyconf.prover->

notification:notifier->proofAttemptID*string*Call_provers.prover_resultoption(** [prepare_edition c ?file id pr] prepare for editing the proof of node [id] with prover [pr]. The editor is not launched. The result is [(pid,name,res)] where [pid] is the node id the proof_attempt, [name] is the name of the file to edit, made relative to the session directory, and [res] is the former result if any. *)

(** [schedule_transformation c id cb] schedules a transformation for a goal specified by [id]; the function [cb] will be called each time the transformation status changes. Typically at Scheduled, then Done tid.*)valrun_strategy_on_goal:controller->proofNodeID->Strategy.t->

strategy [strat] on the goal [id]. [callback_pa] is called for each proof attempted (as in [schedule_proof_attempt]) and [callback_tr] is called for each transformation applied (as in [schedule_transformation]). [callback] is called on each step of execution of the strategy. *)

The proofs are replayed asynchronously, and the states of these proofs are notified via [callback] similarly as for [schedule_proof_attempt]. The session state is changed, all changes are notified via the callback [notification]

(** [bisect_proof_attempt ~callback_tr ~callback_pa ~notification ~removed cont id] runs a bisection process based on the proof attempt [id] of the session managed by [cont]. The proof attempt [id] must be a successful one, otherwise, exception [CannotRunBisectionOn id] is raised. Bisection tries to remove from the context the largest number of definitions and axioms, using the `remove` transformation (bound to [Cut.remove_list]). It proceeeds by dichotomy of the context. Note that there is no garantee that the removed data at the end is globally maximal. During that process, [callback_tr] is called each time the `remove` transformation is added to the session, [callback_pa] is called each time the prover is called on a reduced task, [notification] is called when a proof node is created or modified, and [removed] is called when a node is removed. *)