Open
Description
I would like to implement a new syntax for the new_theory
command and the prelude. This will ensure more consistent use of the header and also make it more introspectable by HOL tooling like IDEs. Proposal:
(*
Module documentation
*)
Import fooLib barTheory
Import[open] bazTheory
Theory bla
Definition foo:
foo = T
End
is equivalent to
(*
Module documentation
*)
local open fooLib barTheory in end
open bazTheory
val _ = new_theory "bla";
Definition foo:
foo = T
End
val _ = export_theory ();
Some points of interest:
- I'd like to remove the
Theory
suffix from the theory imports, since HOL itself tends to refer to theories without this suffix in e.g. qualified constant names, but I don't think it can be implemented as long as quote-filter is a preprocessor which runs without any filesystem context (unless we change the structure name itself to drop theTheory
suffix). - It is mandatory that there be no non-whitespace text between the beginning of the file and the
Theory
command, except forImport
declarations. In particular, that means that all opens have to happen at the beginning of the file, and there cannot be additional commands beforenew_theory
. This happens occasionally (e.g.temp_delsimps
is often beforenew_theory
), but it doesn't seem to make a difference. - For now, holdep will continue to work as it does currently, but I would like to transition this to a warning and deprecate mid-file holdeps (e.g. using qualified identifiers for unimported files).
- The
export_theory
at the end of the file is implicit when usingTheory
syntax.