Skip to content

Commit

Permalink
Merge pull request #3314 from mtzguido/tac_ide_primtiive
Browse files Browse the repository at this point in the history
Tactics: introduce ide() to check if running interactively
  • Loading branch information
mtzguido authored Jun 12, 2024
2 parents 9bae47a + 6b42cb4 commit f09228e
Show file tree
Hide file tree
Showing 7 changed files with 229 additions and 182 deletions.
1 change: 1 addition & 0 deletions ocaml/fstar-lib/FStar_Tactics_V2_Builtins.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ let t_apply = from_tac_4 "B.t_apply" B.t_apply
let t_apply_lemma = from_tac_3 "B.t_apply_lemma" B.t_apply_lemma
let print = from_tac_1 "B.print" B.print
let debugging = from_tac_1 "B.debugging" B.debugging
let ide = from_tac_1 "B.ide" B.ide
let dump = from_tac_1 "B.dump" B.dump
let dump_all = from_tac_2 "B.dump_all" B.dump_all
let dump_uvars_of = from_tac_2 "B.dump_uvars_of" B.dump_uvars_of
Expand Down
35 changes: 27 additions & 8 deletions ocaml/fstar-lib/generated/FStar_Tactics_V2_Basic.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

360 changes: 188 additions & 172 deletions ocaml/fstar-lib/generated/FStar_Tactics_V2_Primops.ml

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/tactics/FStar.Tactics.V2.Basic.fst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ module Z = FStar.BigInt
module Core = FStar.TypeChecker.Core
module PO = FStar.TypeChecker.Primops

let dbg_Tac = Debug.get_toggle "Tac"
let dbg_TacUnify = Debug.get_toggle "TacUnify"
let dbg_2635 = Debug.get_toggle "2635"
let dbg_ReflTc = Debug.get_toggle "ReflTc"
Expand Down Expand Up @@ -132,11 +133,14 @@ let print (msg:string) : tac unit =
tacprint msg;
return ()

let dbg_Tac = Debug.get_toggle "Tac"
let debugging () : tac bool =
let! ps = get in
return ();! (* thunk *)
return !dbg_Tac

let ide () : tac bool =
return ();! (* thunk *)
return (Options.ide ())

let do_dump_ps (msg:string) (ps:proofstate) : unit =
let psc = ps.psc in
let subst = PO.psc_subst psc in
Expand Down
1 change: 1 addition & 0 deletions src/tactics/FStar.Tactics.V2.Basic.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ val t_apply : bool -> bool -> bool -> term -> tac unit
val t_apply_lemma : bool -> bool -> term -> tac unit
val print : string -> tac unit
val debugging : unit -> tac bool
val ide : unit -> tac bool
val dump : string -> tac unit
val dump_all : bool -> string -> tac unit
val dump_uvars_of : goal -> string -> tac unit
Expand Down
1 change: 1 addition & 0 deletions src/tactics/FStar.Tactics.V2.Primops.fst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ let ops = [
mk_tac_step_1 0 "addns" addns addns;
mk_tac_step_1 0 "print" print print;
mk_tac_step_1 0 "debugging" debugging debugging;
mk_tac_step_1 0 "ide" ide ide;
mk_tac_step_1 0 "dump" dump dump;
mk_tac_step_2 0 "dump_all" dump_all dump_all;
mk_tac_step_2 0 "dump_uvars_of" dump_uvars_of dump_uvars_of;
Expand Down
5 changes: 5 additions & 0 deletions ulib/FStar.Stubs.Tactics.V2.Builtins.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ val print : string -> Tac unit
on, i.e. when [--debug Tac] was passed in. *)
val debugging : unit -> Tac bool

(** [ide ()] return true if F* is running in interactive mode. This is
useful to only print diagnostics messages in interactive mode but not in
batch. *)
val ide : unit -> Tac bool

(** Similar to [print], but will dump a text representation of the proofstate
along with the message. *)
val dump : string -> Tac unit
Expand Down

0 comments on commit f09228e

Please sign in to comment.