current_theory : unit -> string
This latter component --- what has been stored in the current session --- embodies the second sense of ‘current theory’. It is more properly known as the ‘current theory segment’. The current segment is dynamic in nature, for its contents can be augmented and overwritten. It functions as a kind of scratchpad used to help build a static theory segment.
In a HOL session, there is always a single current theory segment. Its name is given by calling current_theory(). On startup, the current theory segment is called "scratch", which is just a default name. If one is just experimenting, or hacking about, then this segment can be used.
On the other hand, if one intends to build a static theory segment, one usually creates a new theory segment named thy by calling new_theory thy. This changes the value of current_theory to thy. Once such a theory segment has been built (which may take many sessions), one calls export_theory, which exports the stored elements to disk.
- current_theory(); > val it = "scratch" : string - new_theory "foo"; <<HOL message: Created theory "foo">> > val it = () : unit - current_theory(); > val it = "foo" : string