test/Tools/isac/BridgeLibisabelle/mathml.sml
author wneuper <walther.neuper@jku.at>
Tue, 20 Apr 2021 17:10:02 +0200
changeset 60244 ac7426ab0491
parent 60242 73ee61385493
child 60309 70a1d102660d
permissions -rw-r--r--
remove de/encode for ^^^
akargl@42176
     1
(* Title: tests for mathml.sml
akargl@42176
     2
   Author: Walther Neuper 060311
neuper@37906
     3
   (c) isac-team 2006
neuper@37906
     4
*)
neuper@37906
     5
"-----------------------------------------------------------------";
neuper@37906
     6
"table of contents -----------------------------------------------";
neuper@37906
     7
"-----------------------------------------------------------------";
neuper@37906
     8
"within struct ---------------------------------------------------";
neuper@37906
     9
"-----------------------------------------------------------------";
wneuper@59213
    10
"--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
wneuper@59214
    11
"--------- create testdata for TestPIDE.java#testTermTransfer ----";
neuper@37906
    12
"-----------------------------------------------------------------";
neuper@37906
    13
"exported from struct --------------------------------------------";
neuper@37906
    14
"-----------------------------------------------------------------";
neuper@37906
    15
"--------- ... ---------------------------------------------------";
neuper@37906
    16
"-----------------------------------------------------------------";
neuper@37906
    17
neuper@37906
    18
neuper@37906
    19
neuper@37906
    20
"-----------------------------------------------------------------";
neuper@37906
    21
"within struct ---------------------------------------------------";
neuper@37906
    22
"-----------------------------------------------------------------";
neuper@37906
    23
(*==================================================================*)
neuper@37906
    24
wneuper@59177
    25
wneuper@59224
    26
"--------- fun xmlstr --------------------------------------------";
wneuper@59224
    27
"--------- fun xmlstr --------------------------------------------";
wneuper@59224
    28
"--------- fun xmlstr --------------------------------------------";
wneuper@59224
    29
val term = @{term "aaa + bbb::real"};
wneuper@59224
    30
val str = term |> xml_of_term_NEW |> xmlstr 0;
wneuper@59224
    31
if str =
walther@59617
    32
"(FORMULA)\n. (ISA)\n. . aaa + bbb\n. (/ISA)\n. (TERM)\n aaa + bbb\n(/TERM)\n(/FORMULA)\n"
wneuper@59224
    33
then () else error "term |> xml_of_term_NEW |> xmlstr ..changed";
wneuper@59224
    34
writeln str;
wneuper@59224
    35
wneuper@59213
    36
"--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
wneuper@59213
    37
"--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
wneuper@59213
    38
"--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
wneuper@59224
    39
(* xml_of_term_NEW o xml_to_term_NEW = id ... not valid, 
wneuper@59224
    40
  as long as the latter (going: frontend \<longrightarrow> kernel) does only carry "ISA" string.
wneuper@59213
    41
val t = @{term "aaa + bbb::real"};
wneuper@59213
    42
if t = (t |> xml_of_term_NEW |> xml_to_term_NEW) then ()
wneuper@59213
    43
else error "xml_of_term_NEW |> xml_to_term_NEW changed"
wneuper@59224
    44
*)
wneuper@59214
    45
wneuper@59214
    46
"--------- create testdata for TestPIDE.java#testTermTransfer ----";
wneuper@59214
    47
"--------- create testdata for TestPIDE.java#testTermTransfer ----";
wneuper@59214
    48
"--------- create testdata for TestPIDE.java#testTermTransfer ----";
wneuper@59214
    49
val t = @{term "aaa + bbb::real"};
wneuper@59214
    50
val ttt = HOLogic.mk_eq (t, Const ("processed_by_Isabelle_Isac", type_of t))
wneuper@59214
    51
(* check the term structure *)
wneuper@59214
    52
val Const ("HOL.eq", T1) $
wneuper@59214
    53
     (Const ("Groups.plus_class.plus", T2) $ 
wneuper@59214
    54
        Free ("aaa", T3) $ 
wneuper@59214
    55
        Free ("bbb", _)) $
wneuper@59214
    56
      Const ("processed_by_Isabelle_Isac", _) = ttt;
wneuper@59214
    57
wneuper@59214
    58
(* check the type structure *)
wneuper@59214
    59
atomtyp T3;
wneuper@59214
    60
Type ("Real.real", []);
wneuper@59214
    61
wneuper@59214
    62
atomtyp T2;
wneuper@59214
    63
(*
wneuper@59214
    64
*** Type (fun,[
wneuper@59214
    65
*** . Type (Real.real,[])
wneuper@59214
    66
*** . Type (fun,[
wneuper@59214
    67
*** . . Type (Real.real,[])
wneuper@59214
    68
*** . . Type (Real.real,[])
wneuper@59214
    69
*** . . ]
wneuper@59214
    70
*** . ]
walther@60242
    71
with this \<up> build the typ ...*)
wneuper@59214
    72
Type ("fun", [
wneuper@59214
    73
  Type ("Real.real", []), 
wneuper@59214
    74
  Type ("fun", [
wneuper@59214
    75
    Type ("Real.real", []), 
wneuper@59214
    76
    Type ("Real.real", [])])]);
wneuper@59214
    77
wneuper@59214
    78
atomtyp T1;
wneuper@59214
    79
(*
wneuper@59214
    80
*** Type (fun,[
wneuper@59214
    81
*** . Type (Real.real,[])
wneuper@59214
    82
*** . Type (fun,[
wneuper@59214
    83
*** . . Type (Real.real,[])
wneuper@59214
    84
*** . . Type (HOL.bool,[])
wneuper@59214
    85
*** . . ]
wneuper@59214
    86
*** . ]
walther@60242
    87
with this \<up> build the typ ...*)
wneuper@59214
    88
Type ("fun", [
wneuper@59214
    89
  Type ("Real.real", []), 
wneuper@59214
    90
  Type ("fun", [
wneuper@59214
    91
    Type ("Real.real", []), 
wneuper@59214
    92
    Type ("HOL.bool", [])])]);
wneuper@59214
    93
wneuper@59214
    94
(* now compose term + typ *)
wneuper@59214
    95
val Const ("HOL.eq", Type ("fun", [
wneuper@59214
    96
                       Type ("Real.real", []), 
wneuper@59214
    97
                       Type ("fun", [
wneuper@59214
    98
                         Type ("Real.real", []), 
wneuper@59214
    99
                         Type ("HOL.bool", [])])])) $
wneuper@59214
   100
     (Const ("Groups.plus_class.plus", Type ("fun", [
wneuper@59214
   101
                                         Type ("Real.real", []), 
wneuper@59214
   102
                                         Type ("fun", [
wneuper@59214
   103
                                           Type ("Real.real", []), 
wneuper@59214
   104
                                           Type ("Real.real", [])])])) $ 
wneuper@59214
   105
        Free ("aaa", Type ("Real.real", [])) $ 
wneuper@59214
   106
        Free ("bbb", Type ("Real.real", []))) $
wneuper@59214
   107
      Const ("processed_by_Isabelle_Isac", Type ("Real.real", [])) = ttt;
wneuper@59214
   108
wneuper@59214
   109
(* match out the original term from result*)
wneuper@59214
   110
val Const ("HOL.eq", Type ("fun", [
wneuper@59214
   111
                       Type ("Real.real", []), 
wneuper@59214
   112
                       Type ("fun", [
wneuper@59214
   113
                         Type ("Real.real", []), 
wneuper@59214
   114
                         Type ("HOL.bool", [])])])) $
wneuper@59214
   115
      t' $
wneuper@59214
   116
      Const ("processed_by_Isabelle_Isac", Type ("Real.real", [])) = ttt;
wneuper@59214
   117
if t = t' then () else error "something with test_term changed"