1 (* Title: src/Tools/isac/BridgeJEdit/Demo_Example.thy
2 Author: Walther Neuper, JKU Linz
3 (c) due to copyright terms
5 Runnig example for developing Isabelle/Isac via Isabelle/PIDE in BridgeJEdit
12 section \<open>Boilerplate, the example from Isabelle Workshop 2022\<close>
14 subsection \<open>Specification Phase\<close>
15 text \<open>Goal for Isabelle Workshop 2022: this part of the example should be ready for demonstration:
16 1. The keyword \<open>Example\<close> inserts the template underneath
17 2. The template is filled from a (hidden) formalisation with the following items in the
18 2.1. \<open>Model\<close>:
19 * Constants _ ("_" indicates some kind of place holder for input)
20 * the complete Where-field (the pre-condition), items marked as True | False
21 * Maximum _, AdditionalValues _
22 * Extremum _, SideCondition _
23 2.2 \<open>References\<close>:
24 * place holders "_" for input
25 * The toggle switch before \<open>RProblem\<close> | \<open>RMethod\<close> is set to \<open>RProblem\<close>
26 This might be postponed after the Isabelle Workshop.
28 * type checked and marked as Type-Error
29 * marked as Correct | Superfluous | Incomplete | Unknown (compare Specify/p-model.sml)
30 4. Input to 2.2 by selection from a list / tree
31 5. On update of \<open>RProblem\<close> (in the root problem) also \<open>Problem\<close> is updated;
32 The argument of \<open>Problem\<close> comes with the template and is read-only.
35 subsubsection \<open>Complete Specification\<close>
37 Example \<open>No.123 a\<close>
38 Problem ''univariate_calculus/Optimisation''
41 Given: "Constants r = 7"
43 Find: "Maximum A" "AdditionalValues u, v"
44 Relate: "Extremum A = 2 \<sqdot> u \<sqdot> v − u \<up> 2" "SideCondition (u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2"
47 x RProblem: ''univariate_calculus/Optimisation''
48 RMethod: ''Optimisation/by_univariate_calculus''
52 subsubsection \<open>Empty Specification\<close>
54 Example \<open>No.123 a\<close>
55 Problem ''univariate_calculus/Optimisation''
60 Find: "Maximum _" "AdditionalValues _"
61 Relate: "Extremum _ "SideCondition _"
69 section \<open>Stepwise Development\<close>
71 subsection \<open>Specification Phase\<close>
73 1. The \<open>Example\<close> below is a minimal adaptation of \<open>problem pbl_bieg : "Biegelinien" ..\<close>
74 in Knowledge/Biegelinie.thy.
79 vvvvvvv why raises \<open>Example\<close> exception Option raised (line 82 of "General/basics.ML")? Although
80 * code (Outer_Syntax.command..Example..) and
81 * application (Example pbl_bieg : "Biegelinien".) are exact copies from Makarius?
82 * Although the application below with \<open>problem\<close> works?
83 * Although \<open>ExampleSPARK\<close> is disambiguated in Calculation_OLD.thy ?!?
84 HOW CAN SUCH AN ERROR BE INVESTIGATED ? debugger ? .. ?
86 problem pbl_bieg : "Biegelinien" =
87 \<open>Rule_Set.append_rules "empty" Rule_Set.empty []\<close>
88 Method: "IntegrierenUndKonstanteBestimmen2"
89 Given: "Traegerlaenge l_l" "Streckenlast q_q"
90 (* Where: "0 < l_l" ...wait for < and handling Arbfix*)
91 Find: "Biegelinie b_b"
92 Relate: "Randbedingungen r_b"
94 text \<open> (*Output from: Example pbl_bieg : "Biegelinien" = .. *)
95 === Outer_Syntax.command 4
96 === the_data thy \<Rightarrow> NONE
98 (*Output from: problem pbl_bieg : "Biegelinien" = .. *)
99 --- Outer_Syntax.command 4
100 --- the_data thy \<Rightarrow> (Rule_Def.Repeat {id = empty, preconds = [], rew_ord = (dummy_ord, _: fn),
101 erls = _, srls = _, calc = _, errpatts = _, ,
104 --- Outer_Syntax.command 5
106 Rule_Set.append_rules "empty" Rule_Set.empty []
108 text \<open> (*Output from: Example pbl_bieg : "Biegelinien" = .. HERE*)
109 val it = Repeat {calc = [], erls = Empty, errpatts = [], id = "empty", preconds = [],
110 rew_ord = ("dummy_ord", fn), rules = [], scr = Empty_Prog, srls = Empty}: Rule_Def.rule_set
112 (*Output from: problem pbl_bieg : "Biegelinien" = .. HERE*)
113 val it = Repeat {calc = [], erls = Empty, errpatts = [], id = "empty", preconds = [],
114 rew_ord = ("dummy_ord", fn), rules = [], scr = Empty_Prog, srls = Empty}: Rule_Def.rule_set
116 (*Output from: problem pbl_bieg : "Biegelinien" = .. IN Biegelinie.thy*)
117 val it = Repeat {calc = [], erls = Empty, errpatts = [], id = "empty", preconds = [],
118 rew_ord = ("dummy_ord", fn), rules = [], scr = Empty_Prog, srls = Empty}: Rule_Def.rule_set