Imandra_interactive.Imandra
set_lockdown uid
enables lockdown mode. It will restrict what functions are in scope, and will Unix.setuid
to the given user ID. NOTE: must be called before do_init
or loop
val do_init :
?scope:Opentelemetry.Trace.scope ->
?linenoise:bool ->
?syntax:Imandra_syntax.Syntax.t ->
unit ->
unit
Initialize the toplevel environment. Can be safely called several times but will only do something on the first call
Event triggered on every source code string evaluated. This may NOT include calls to #use
and others.
Event triggered for every top phrase evaluated, including program mode ones.
val use_iml :
?scope:Opentelemetry.Trace.scope ->
?syntax:Imandra_syntax.Syntax.t ->
?batch:bool ->
?quiet:bool ->
string ->
unit
use_iml file
loads the file in imandra, as #use "file"
would do.
val eval_string :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?syntax:Imandra_syntax.Syntax.t ->
?batch:bool ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?filename:string ->
string ->
Imandra_surface.Top_result.t list
eval_string "1+1;;"
will evaluate the given string as an Imandra statement.
val eval :
?scope:Opentelemetry.Trace.scope ->
?interrupted:Imandra_util.Switch.t ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?loc:Imandra_util.Iloc.t ->
input:Imandra_util.Iloc.Input.t ->
Parsetree.toplevel_phrase ->
Imandra_surface.Top_result.t list
evaluate the given toplevel phrase.
val eval_string_result :
?scope:Opentelemetry.Trace.scope ->
?batch:bool ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?filename:string ->
string ->
( Imandra_surface.Top_result.t list, exn ) Stdlib.result
eval_string_result "1+1;;"
will evaluate the given string as an Imandra statement.
val eval_string_iter :
?scope:Opentelemetry.Trace.scope ->
?out:Stdlib.Format.formatter ->
?quiet:bool ->
?interrupted:Imandra_util.Switch.t ->
filename:string ->
string ->
( (Imandra_util.Iloc.t list
* Imandra_util.Console.Capture.t
* ( Imandra_surface.Event.t list, string ) Stdlib.result) ->
unit ) ->
unit
eval_string_iter code f
evaluates code
into a list of events, processes these events one by one, calling f
on the result of each event. Each result is: (locations, console, res)
Precondition: do_init ()
was called.
Results of validating some events using logical reasoning, termination analysis, theorem proving, etc.
val process_events :
?scope:Opentelemetry.Trace.scope ->
?console_cap:bool ->
?interrupted:Imandra_util.Switch.t ->
?batch:bool ->
Imandra_surface.Event.t list ->
validate_result_async list
Process events so as to validate them on the reasoning side. Returns a list of future results.
val wait_block_for_validate_res_async :
?scope:Opentelemetry.Trace.scope ->
?quiet:bool ->
validate_result_async ->
( Imandra_surface.Event.op list, exn ) Stdlib.result
* Imandra_util.Console.Capture.t
Wait for a validation result
val wait_for_validate_res_async :
validate_result_async ->
(( Imandra_surface.Event.op list, exn ) Stdlib.result
* Imandra_util.Console.Capture.t)
Imandra_thread_util.Fut.t
eval_string_returning_string s
evaluates s
, which must be a code fragment returning a string, and returns the resulting string value.
Example:
# Imandra.eval_string_returning_string {| "hello " ^ "world" |};;
- : string = "hello world"
# Imandra.eval_string_returning_string {| Printf.sprintf "%B" true |};;
- : string = "true"
val parse_file :
?syntax:Imandra_syntax.Syntax.t ->
string ->
( Parsetree.toplevel_phrase list * Imandra_util.Iloc.Input.t, exn )
Stdlib.result
Parse given file
val parse_string :
?syntax:Imandra_syntax.Syntax.t ->
?filename:string ->
string ->
( Parsetree.toplevel_phrase list
* Imandra_util.Iloc.Input.t
* Imandra_util.Iloc.t,
Imandra_util.Iloc.t Imandra_util.List1.t * exn )
Stdlib.result
Parse given string.
port ~var expr
ports the content of expr
, typically a variable (which must have a logic type) into logic mode, into the new variable var
.
module Gc_stat : sig ... end
Add the given plugin and apply it to history retroactively. From now on all events will be processed by this plugin. It blocks until all code fragments have been executed.
It is simpler to call this as early as possible if one wants to use #reset
or #undo
.
See Plugin
for more information.
Run the plugin on all events so far, but instead of executing its code fragments, just collect them
Define a custom extension point
val interactive_loop :
?scope:Opentelemetry.Trace.scope ->
?init:bool ->
?syntax:Imandra_syntax.Syntax.t ->
?linenoise:bool ->
unit ->
unit
Main loop for a toplevel that reads on stdin and prints on stdout.
val process_file :
?scope:Opentelemetry.Trace.scope ->
?init:bool ->
?syntax:Imandra_syntax.Syntax.t ->
string ->
Parsetree.toplevel_phrase list
* Imandra_surface.Event.t list
* Imandra_surface.Top_result.t list
process_file path
parses the file and returns its content and a list of events. This is useful for batch compilation.
val import_file :
?scope:Opentelemetry.Trace.scope ->
?loc:Imandra_util.Iloc.t ->
?syntax:Imandra_syntax.Syntax.t ->
?quiet:bool ->
string ->
unit
Import given module (and its dependencies, recursively) by its file name
val require_lib :
?scope:Opentelemetry.Trace.scope ->
?loc:Imandra_util.Iloc.t ->
?meth:[ `Mod_use | `Import | `Use ] ->
?syntax:Imandra_syntax.Syntax.t ->
string ->
unit
Require an ocamlfind library and its Imandra attachment, using either import
or mod_use
to load its content.
module Gist : sig ... end