src/Tools/isac/BridgeJEdit/Demo_Example.thy
author wneuper <Walther.Neuper@jku.at>
Tue, 31 May 2022 09:16:12 +0200
changeset 60436 1c8263e775d4
parent 60434 d780a93d21b3
child 60437 023f3a30596a
permissions -rw-r--r--
Calculation 1'': ERROR in Demo_Example.thy, questions in TODO.md
     1 (*  Title:      src/Tools/isac/BridgeJEdit/Demo_Example.thy
     2     Author:     Walther Neuper, JKU Linz
     3     (c) due to copyright terms
     4 
     5 Runnig example for developing Isabelle/Isac via Isabelle/PIDE in BridgeJEdit
     6 *)
     7 
     8 theory Demo_Example 
     9   imports Calculation
    10 begin
    11 
    12 section \<open>Boilerplate, the example from Isabelle Workshop 2022\<close>
    13 
    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.
    27   3. Input to 2.1 is 
    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.
    33 \<close>
    34 
    35 subsubsection \<open>Complete Specification\<close>
    36 text \<open>
    37 Example \<open>No.123 a\<close>
    38   Problem ''univariate_calculus/Optimisation''
    39     Specification:
    40       Model:
    41         Given: "Constants r = 7"
    42         Where: "0 < r"
    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"
    45       References:
    46         RTheory: ''Diff_App''
    47       x RProblem: ''univariate_calculus/Optimisation''
    48         RMethod: ''Optimisation/by_univariate_calculus''
    49     Solution:
    50 \<close>
    51 
    52 subsubsection \<open>Empty Specification\<close>
    53 text \<open>
    54 Example \<open>No.123 a\<close>
    55   Problem ''univariate_calculus/Optimisation''
    56     Specification:
    57       Model:
    58         Given: "Constants _"
    59         Where: "_"
    60         Find:  "Maximum _" "AdditionalValues _"
    61         Relate: "Extremum _ "SideCondition _"
    62       References:
    63         RTheory: ''_''
    64       x RProblem: ''_''
    65         RMethod: ''_''
    66     Solution:
    67 \<close>
    68 
    69 section \<open>Stepwise Development\<close>
    70 
    71 subsection \<open>Specification Phase\<close>
    72 text \<open> UPDATE:
    73 1. The \<open>Example\<close> below is a minimal adaptation of \<open>problem pbl_bieg : "Biegelinien" ..\<close>
    74   in Knowledge/Biegelinie.thy.
    75 2. GOON
    76 \<close>
    77 
    78 (*
    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 ? .. ?         
    85 Example problem*)
    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 &lt; and handling Arbfix*)
    91   Find: "Biegelinie b_b"
    92   Relate: "Randbedingungen r_b"
    93 
    94 text \<open> (*Output from: Example pbl_bieg : "Biegelinien" = .. *)
    95 === Outer_Syntax.command 4 
    96 === the_data thy \<Rightarrow> NONE
    97 
    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 = _, ,
   102   rules = [],
   103   rules = Empty_Prog}) 
   104 --- Outer_Syntax.command 5
   105 \<close> ML \<open>
   106 Rule_Set.append_rules "empty" Rule_Set.empty []
   107 \<close> 
   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
   111 
   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
   115 
   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
   119 
   120        (*^^^ all the same*)
   121 \<close> ML \<open>
   122 \<close> ML \<open>
   123 \<close> ML \<open>
   124 \<close> ML \<open>
   125 \<close> ML \<open>
   126 \<close>
   127 
   128 end