871 subsection \<open>Command \<^verbatim>\<open>use_theories\<close> \label{sec:command-use-theories}\<close> |
871 subsection \<open>Command \<^verbatim>\<open>use_theories\<close> \label{sec:command-use-theories}\<close> |
872 |
872 |
873 text \<open> |
873 text \<open> |
874 \begin{tabular}{ll} |
874 \begin{tabular}{ll} |
875 argument: & \<open>use_theories_arguments\<close> \\ |
875 argument: & \<open>use_theories_arguments\<close> \\ |
876 regular result: & \<^verbatim>\<open>OK\<close> \<open>use_theories_results\<close> \\ |
876 immediate result: & \<^verbatim>\<open>OK\<close> \<open>task\<close> \\ |
|
877 regular result: & \<^verbatim>\<open>FINISHED\<close> \<open>use_theories_results\<close> \\ |
877 \end{tabular} |
878 \end{tabular} |
878 |
879 |
879 \begin{tabular}{ll} |
880 \begin{tabular}{ll} |
880 \<^bold>\<open>type\<close> \<open>use_theories_arguments =\<close> \\ |
881 \<^bold>\<open>type\<close> \<open>use_theories_arguments =\<close> \\ |
881 \quad\<open>{session_id: uuid,\<close> \\ |
882 \quad\<open>{session_id: uuid,\<close> \\ |
904 implicitly. The command succeeds eventually, when all theories have been |
905 implicitly. The command succeeds eventually, when all theories have been |
905 \<^emph>\<open>consolidated\<close> in the sense the formal \<open>node_status\<close> |
906 \<^emph>\<open>consolidated\<close> in the sense the formal \<open>node_status\<close> |
906 (\secref{sec:json-types}): the outermost command structure has finished (or |
907 (\secref{sec:json-types}): the outermost command structure has finished (or |
907 failed) and the final \<^theory_text>\<open>end\<close> command of each theory has been checked. |
908 failed) and the final \<^theory_text>\<open>end\<close> command of each theory has been checked. |
908 |
909 |
909 Already used theories persist in the session until purged explicitly. This |
910 Already used theories persist in the session until purged explicitly |
910 also means that repeated invocations of \<^verbatim>\<open>use_theories\<close> are idempotent: it |
911 (\secref{sec:command-purge-theories}). This also means that repeated |
911 could make sense to do that with different values for \<open>pretty_margin\<close> or |
912 invocations of \<^verbatim>\<open>use_theories\<close> are idempotent: it could make sense to do |
912 \<open>unicode_symbols\<close> to get different formatting for \<open>errors\<close> or \<open>messages\<close>. |
913 that with different values for \<open>pretty_margin\<close> or \<open>unicode_symbols\<close> to get |
|
914 different formatting for \<open>errors\<close> or \<open>messages\<close>. |
913 \<close> |
915 \<close> |
914 |
916 |
915 |
917 |
916 subsubsection \<open>Arguments\<close> |
918 subsubsection \<open>Arguments\<close> |
917 |
919 |
921 |
923 |
922 \<^medskip> |
924 \<^medskip> |
923 The \<open>theories\<close> field specifies theory names as in theory \<^theory_text>\<open>imports\<close> or in |
925 The \<open>theories\<close> field specifies theory names as in theory \<^theory_text>\<open>imports\<close> or in |
924 ROOT \<^bold>\<open>theories\<close>. |
926 ROOT \<^bold>\<open>theories\<close>. |
925 |
927 |
926 \<^medskip> The \<open>master_dir\<close> field specifies the master directory of imported |
928 \<^medskip> |
927 theories: it acts like the ``current working directory'' for locating theory |
929 The \<open>master_dir\<close> field specifies the master directory of imported theories: |
928 files. This may be omitted if all entries of \<open>theories\<close> use a |
930 it acts like the ``current working directory'' for locating theory files. |
929 session-qualified theory name (e.g.\ \<^verbatim>\<open>"HOL-Library.AList"\<close>) or absolute |
931 This may be omitted if all entries of \<open>theories\<close> use a session-qualified |
930 path name (e.g.\ \<^verbatim>\<open>"~~/src/HOL/ex/Seq"\<close>). |
932 theory name (e.g.\ \<^verbatim>\<open>"HOL-Library.AList"\<close>) or absolute path name (e.g.\ |
|
933 \<^verbatim>\<open>"~~/src/HOL/ex/Seq"\<close>). |
931 |
934 |
932 \<^medskip> |
935 \<^medskip> |
933 The \<open>pretty_margin\<close> field specifies the line width for pretty-printing. The |
936 The \<open>pretty_margin\<close> field specifies the line width for pretty-printing. The |
934 default is suitable for classic console output. Formatting happens at the |
937 default is suitable for classic console output. Formatting happens at the |
935 end of \<^verbatim>\<open>use_theories\<close>, when all prover messages are exported to the client. |
938 end of \<^verbatim>\<open>use_theories\<close>, when all prover messages are exported to the client. |
994 @{verbatim [display] \<open>session_start {"session": "HOL", "include_sessions": ["HOL-Unix"]} |
997 @{verbatim [display] \<open>session_start {"session": "HOL", "include_sessions": ["HOL-Unix"]} |
995 use_theories {"session_id": ..., "theories": ["HOL-Unix.Unix"]} |
998 use_theories {"session_id": ..., "theories": ["HOL-Unix.Unix"]} |
996 session_stop {"session_id": ...}\<close>} |
999 session_stop {"session_id": ...}\<close>} |
997 \<close> |
1000 \<close> |
998 |
1001 |
|
1002 |
|
1003 subsection \<open>Command \<^verbatim>\<open>purge_theories\<close> \label{sec:command-purge-theories}\<close> |
|
1004 |
|
1005 text \<open> |
|
1006 \begin{tabular}{ll} |
|
1007 argument: & \<open>purge_theories_arguments\<close> \\ |
|
1008 regular result: & \<^verbatim>\<open>OK\<close> \<open>purge_theories_result\<close> \\ |
|
1009 \end{tabular} |
|
1010 |
|
1011 \begin{tabular}{ll} |
|
1012 \<^bold>\<open>type\<close> \<open>purge_theories_arguments =\<close> \\ |
|
1013 \quad\<open>{session_id: uuid,\<close> \\ |
|
1014 \quad~~\<open>theories: [string],\<close> \\ |
|
1015 \quad~~\<open>master_dir?: string,\<close> \\ |
|
1016 \quad~~\<open>all?: bool}\<close> \\[2ex] |
|
1017 \end{tabular} |
|
1018 |
|
1019 \begin{tabular}{ll} |
|
1020 \<^bold>\<open>type\<close> \<open>purge_theories_result = {purged: [string]}\<close> \\ |
|
1021 \end{tabular} |
|
1022 |
|
1023 \<^medskip> |
|
1024 The \<^verbatim>\<open>purge_theories\<close> command updates the identified session by removing |
|
1025 theories that are no longer required: theories that are used in pending |
|
1026 \<^verbatim>\<open>use_theories\<close> tasks or imported by other theories are retained. |
|
1027 \<close> |
|
1028 |
|
1029 |
|
1030 subsubsection \<open>Arguments\<close> |
|
1031 |
|
1032 text \<open> |
|
1033 The \<open>session_id\<close> is the identifier provided by the server, when the session |
|
1034 was created (possibly on a different client connection). |
|
1035 |
|
1036 \<^medskip> |
|
1037 The \<open>theories\<close> field specifies theory names to be purged: imported |
|
1038 dependencies are \<^emph>\<open>not\<close> completed. Instead it is possible to provide the |
|
1039 already completed import graph returned by \<^verbatim>\<open>use_theories\<close> as \<open>nodes\<close> / |
|
1040 \<open>node_name\<close>. |
|
1041 |
|
1042 \<^medskip> |
|
1043 The \<open>master_dir\<close> field specifies the master directory as in \<^verbatim>\<open>use_theories\<close>; |
|
1044 by passing its \<open>nodes\<close> / \<open>node_name\<close> results, the \<open>master_dir\<close> is redundant. |
|
1045 |
|
1046 \<^medskip> |
|
1047 The \<open>all\<close> field set to \<^verbatim>\<open>true\<close> attempts to purge all presently loaded |
|
1048 theories. |
|
1049 \<close> |
|
1050 |
|
1051 |
|
1052 subsubsection \<open>Results\<close> |
|
1053 |
|
1054 text \<open> |
|
1055 The \<open>purged\<close> field reveals the \<open>node_name\<close> of each theory that was actually |
|
1056 removed. |
|
1057 \<close> |
|
1058 |
999 end |
1059 end |