test/Tools/isac/Bridge/ISAC_Test.thy
author Walther Neuper <wneuper@ist.tugraz.at>
Sat, 26 May 2018 11:26:43 +0200
changeset 59433 c61ca93ef13b
child 59434 c6131f7e5fb3
permissions -rw-r--r--
bridge: introduce Isabelle/jEdit as Isac front-end, begin
wneuper@59433
     1
(* Introduce Isabelle/jEdit as Isac front-end.
wneuper@59433
     2
   Trials due to suggestions by Makarius Wenzel
wneuper@59433
     3
   Walther Neuper 2018
wneuper@59433
     4
   (c) due to copyright terms
wneuper@59433
     5
 *)
wneuper@59433
     6
wneuper@59433
     7
theory ISAC_Test
wneuper@59433
     8
imports Main
wneuper@59433
     9
wneuper@59433
    10
keywords
wneuper@59433
    11
  "ISAC" :: (* ? correct...*)thy_decl
wneuper@59433
    12
wneuper@59433
    13
begin
wneuper@59433
    14
ML \<open>
wneuper@59433
    15
val _ =
wneuper@59433
    16
  Outer_Syntax.command @{command_keyword ISAC} (* dummy parser *) ""
wneuper@59433
    17
    (Parse.cartouche >> (fn s =>
wneuper@59433
    18
      Toplevel.keep (fn _ => writeln s)))
wneuper@59433
    19
\<close>
wneuper@59433
    20
wneuper@59433
    21
ISAC \<open>1 + 2 = 3\<close>
wneuper@59433
    22
ISAC \<open>
wneuper@59433
    23
Problem ("Biegelinie", ["Biegelinien"])
wneuper@59433
    24
  Specification:
wneuper@59433
    25
    Model:
wneuper@59433
    26
      Given: "Traegerlaenge L", "Streckenlast q_0"
wneuper@59433
    27
      Where: "q_0 ist_integrierbar_auf {| 0, L |}", "0 < L"
wneuper@59433
    28
      Find: "Biegelinie y"
wneuper@59433
    29
      Relate: "Randbedingungen [ Q_0 = q_0 * L, M_b L = 0, y_0 = 0, d_d x y_0 = 0 ]"
wneuper@59433
    30
    References:
wneuper@59433
    31
      Theory: "Biegelinie"
wneuper@59433
    32
      Problem: ["Biegelinien"]
wneuper@59433
    33
      Method: ["Integrieren", "KonstanteBestimmen2"]
wneuper@59433
    34
  Solution:
wneuper@59433
    35
    Problem ("Biegelinie", ["vonBelastungZu", "Biegelinien"])
wneuper@59433
    36
    "[Q x = c + -1 * q_0 * x, M_b x = c_2 + c * x + -1 * q_0 / 2 * x ^ 2,  y' x =  c_3 + 1 / (-1 * EI) * (c_2 * x + c / 2 * x ^ 2 + -1 * q_0 / 6 * x ^ 3),  y x =  c_4 + c_3 * x +  1 / (-1 * EI) *  (c_2 / 2 * x ^ 2 + c / 6 * x ^ 3 + -1 * q_0 / 24 * x ^ 4)]"
wneuper@59433
    37
    Problem ("Biegelinie", ["setzeRandbedingungen", "Biegelinien"])
wneuper@59433
    38
    "[L * q_0 = c, 0 = (2 * c_2 + 2 * L * c + -1 * L ^ 2 * q_0) / 2, 0 = c_4,  0 = c_3]"
wneuper@59433
    39
    "solveSystem [L * q_0 = c, 0 = (2 * c_2 + 2 * L * c + -1 * L ^ 2 * q_0) / 2, 0 = c_4,  0 = c_3] [c, c_1, c_2, c_4]"
wneuper@59433
    40
    "[c = -1 * L * q_0 / -1, c_2 = -1 * L ^ 2 * q_0 / 2, c_3 = 0, c_4 = 0]"
wneuper@59433
    41
    "y x = c_4 + c_3 * x + 1 / (-1 * EI) * (c_2 / 2 * x ^ 2 + c / 6 * x ^ 3 + -1 * q_0 / 24 * x ^ 4)"
wneuper@59433
    42
        (*tactic...*) Substitute "c_4 + c_3 * x +  1 / (-1 * EI) *  (c_2 / 2 * x ^ 2 + c / 6 * x ^ 3 + -1 * q_0 / 24 * x ^ 4)" "[c, c_1, c_2, c_4]"
wneuper@59433
    43
    "y x = 0 + 0 * x + 1 / (-1 * EI) * (-1 * L ^ 2 * q_0 / 2 / 2 * x ^ 2 + -1 * L * q_0 / -1 / 6 * x ^ 3 +  -1 * q_0 / 24 * x ^ 4)"
wneuper@59433
    44
        (*tactic...*) Rewrite_Set_Inst "[(bdv, x)]" "make_ratpoly_in" "y x"
wneuper@59433
    45
    "y x = -6 * q_0 * L ^ 2 / (-24 * EI) * x ^ 2 + 4 * L * q_0 / (-24 * EI) * x ^ 3 + -1 * q_0 / (-24 * EI) * x ^ 4"
wneuper@59433
    46
        (*tactic...*) Check_Postcond ["Biegelinien"]
wneuper@59433
    47
"y x = -6 * q_0 * L ^ 2 / (-24 * EI) * x ^ 2 + 4 * L * q_0 / (-24 * EI) * x ^ 3 + -1 * q_0 / (-24 * EI) * x ^ 4"
wneuper@59433
    48
\<close>
wneuper@59433
    49
text \<open>
wneuper@59433
    50
A "Specification" consists exactly of the keywords given in the example
wneuper@59433
    51
(while the "terms" vary from example to example).
wneuper@59433
    52
wneuper@59433
    53
A "Solution" consists of steps of calculation; each step occupies 1 or 2 lines,
wneuper@59433
    54
depending whether the respective "tactic" is displayed or not.
wneuper@59433
    55
wneuper@59433
    56
This simple structure gives cause for hope, that specific keywords can be omitted
wneuper@59433
    57
by some trickery in the front-end.
wneuper@59433
    58
\<close>
wneuper@59433
    59
wneuper@59433
    60
end