Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vernac/attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ let () = let open Goptions in
let program =
enable_attribute ~key:"program" ~default:(fun () -> !program_mode)

let guard_check = bool_attribute ~name:"Guard Checking" ~on:"guard" ~off:"unguard"

let locality = bool_attribute ~name:"Locality" ~on:"local" ~off:"global"

let option_locality =
Expand Down
1 change: 1 addition & 0 deletions vernac/attributes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ end

val polymorphic : bool attribute
val program : bool attribute
val guard_check : bool option attribute
val template : bool option attribute
val locality : bool option attribute
val option_locality : Goptions.option_locality attribute
Expand Down
14 changes: 12 additions & 2 deletions vernac/vernacentries.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1997,12 +1997,22 @@ let translate_vernac ~atts v = let open Vernacextend in match v with
| VernacInductive (finite, l) ->
VtDefault(fun () -> vernac_inductive ~atts finite l)
| VernacFixpoint (discharge, l) ->
let (atts, guard) = parse_with_extra guard_check atts in
let with_guard_check f _ =
match guard with
| Some b ->
let before = (Global.typing_flags ()).Declarations.check_guarded in
Global.set_check_guarded b;
let res = f () in
Global.set_check_guarded before;
res
| _ -> f () in
let opens = List.exists (fun { body_def } -> Option.is_empty body_def) l in
if opens then
VtOpenProof (fun () ->
VtOpenProof (with_guard_check @@ fun _ ->
with_def_attributes ~atts vernac_fixpoint_interactive discharge l)
else
VtDefault (fun () ->
VtDefault (with_guard_check @@ fun _ ->
with_def_attributes ~atts vernac_fixpoint discharge l)
| VernacCoFixpoint (discharge, l) ->
let opens = List.exists (fun { body_def } -> Option.is_empty body_def) l in
Expand Down