walther@60096
|
1 |
(* Title: src/Tools/isac/BridgeJEdit/Calculation.thy
|
walther@60095
|
2 |
Author: Walther Neuper, JKU Linz
|
walther@60095
|
3 |
|
Walther@60431
|
4 |
Outer syntax for Isabelle/Isac's Calculation interactive via Isabelle/PIDE.
|
Walther@60431
|
5 |
Second trial following Makarius' definition of "problem" already existing in this repository.
|
walther@60095
|
6 |
*)
|
walther@60095
|
7 |
|
walther@60095
|
8 |
theory Calculation
|
Walther@60434
|
9 |
imports
|
Walther@60434
|
10 |
(**)"$ISABELLE_ISAC/Knowledge/Build_Thydata" (*remove after devel.of BridgeJEdit*)
|
Walther@60434
|
11 |
(**)"$ISABELLE_ISAC/MathEngine/MathEngine"
|
Walther@60434
|
12 |
(** )"SPARK_FDL" ( * remove after devel.of BridgeJEdit*)
|
Walther@60434
|
13 |
keywords "Example" :: thy_decl
|
Walther@60431
|
14 |
|
walther@60095
|
15 |
begin
|
wenzelm@60200
|
16 |
|
Walther@60431
|
17 |
ML_file "parseC.sml"
|
Walther@60431
|
18 |
ML_file "preliminary.sml"
|
walther@60095
|
19 |
|
Walther@60434
|
20 |
section \<open>new code for Outer_Syntax Example ...\<close>
|
Walther@60434
|
21 |
text \<open> UPDATE:
|
Walther@60434
|
22 |
1. The code re-uses Makarius' \<open>Outer_Syntax.command..problem ..\<close> to a maximal extent.
|
Walther@60434
|
23 |
2. GOON
|
Walther@60434
|
24 |
\<close>
|
walther@60123
|
25 |
|
Walther@60434
|
26 |
ML \<open>
|
Walther@60434
|
27 |
\<close> ML \<open>
|
Walther@60434
|
28 |
\<close> ML \<open>
|
Walther@60434
|
29 |
structure Data = Theory_Data
|
Walther@60434
|
30 |
(
|
Walther@60434
|
31 |
type T = Rule_Set.T option;
|
Walther@60434
|
32 |
val empty = NONE;
|
Walther@60434
|
33 |
val extend = I;
|
Walther@60434
|
34 |
fun merge _ = NONE;
|
Walther@60434
|
35 |
);
|
walther@60150
|
36 |
|
Walther@60434
|
37 |
val set_data = Data.put o SOME;
|
Walther@60434
|
38 |
val the_data = the o Data.get;
|
Walther@60434
|
39 |
|
Walther@60434
|
40 |
\<close> ML \<open>
|
Walther@60434
|
41 |
\<close> ML \<open>
|
Walther@60434
|
42 |
\<close> ML \<open>
|
Walther@60434
|
43 |
|
Walther@60434
|
44 |
\<close> ML \<open>
|
Walther@60434
|
45 |
local
|
Walther@60434
|
46 |
|
Walther@60434
|
47 |
(*this assigns code to the keyword ---vvvvvvvvv, without error message here but
|
Walther@60434
|
48 |
with error message in Demo_Example ?!? *)
|
Walther@60434
|
49 |
val _ =
|
Walther@60434
|
50 |
Outer_Syntax.command \<^command_keyword>\<open>Example\<close>
|
Walther@60434
|
51 |
"prepare ISAC problem type and register it to Knowledge Store"
|
Walther@60434
|
52 |
(Parse.name -- Parse.!!! (\<^keyword>\<open>:\<close> |-- Parse.name --
|
Walther@60434
|
53 |
Parse.!!! (\<^keyword>\<open>=\<close> |-- Parse.ML_source -- Problem.parse_authors --
|
Walther@60434
|
54 |
Problem.parse_methods -- Problem.parse_cas -- Problem.parse_model_input)) >>
|
Walther@60434
|
55 |
(fn (name, (id, ((((source, maa), mets), cas), model_input))) =>
|
Walther@60434
|
56 |
Toplevel.theory (fn thy =>
|
Walther@60434
|
57 |
let
|
Walther@60434
|
58 |
val pblID = References_Def.explode_id id;
|
Walther@60434
|
59 |
val metIDs = map References_Def.explode_id mets;
|
Walther@60434
|
60 |
val set_data =
|
Walther@60434
|
61 |
ML_Context.expression (Input.pos_of source)
|
Walther@60434
|
62 |
(Problem.ml "Theory.setup (Problem.set_data ("
|
Walther@60434
|
63 |
@ ML_Lex.read_source source @ Problem.ml "))")
|
Walther@60434
|
64 |
|> Context.theory_map;
|
Walther@60434
|
65 |
val input = the_data (set_data thy);
|
Walther@60434
|
66 |
val arg = Problem.prep_input thy name maa Problem.id_empty (pblID, model_input, input, cas, metIDs);
|
Walther@60434
|
67 |
in KEStore_Elems.add_pbts [arg] thy end)))
|
Walther@60434
|
68 |
|
Walther@60434
|
69 |
in end;
|
Walther@60434
|
70 |
\<close> ML \<open>
|
Walther@60434
|
71 |
\<close> ML \<open>
|
Walther@60434
|
72 |
\<close> ML \<open>
|
Walther@60434
|
73 |
\<close>
|
Walther@60434
|
74 |
|
Walther@60434
|
75 |
|
Walther@60434
|
76 |
end
|