Skip to content

Theory syntax #1364

Open
Open
@digama0

Description

@digama0

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 the Theory suffix).
  • It is mandatory that there be no non-whitespace text between the beginning of the file and the Theory command, except for Import declarations. In particular, that means that all opens have to happen at the beginning of the file, and there cannot be additional commands before new_theory. This happens occasionally (e.g. temp_delsimps is often before new_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 using Theory syntax.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions