1 (* Title: tests for mathml.sml
2 Author: Walther Neuper 060311
5 "-----------------------------------------------------------------";
6 "table of contents -----------------------------------------------";
7 "-----------------------------------------------------------------";
8 "within struct ---------------------------------------------------";
9 "-----------------------------------------------------------------";
10 "--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
11 "--------- create testdata for TestPIDE.java#testTermTransfer ----";
12 "-----------------------------------------------------------------";
13 "exported from struct --------------------------------------------";
14 "-----------------------------------------------------------------";
15 "--------- ... ---------------------------------------------------";
16 "-----------------------------------------------------------------";
20 "-----------------------------------------------------------------";
21 "within struct ---------------------------------------------------";
22 "-----------------------------------------------------------------";
23 (*==================================================================*)
26 "--------- fun xmlstr --------------------------------------------";
27 "--------- fun xmlstr --------------------------------------------";
28 "--------- fun xmlstr --------------------------------------------";
29 val term = @{term "aaa + bbb::real"};
30 val str = term |> xml_of_term_NEW |> xmlstr 0;
32 "(FORMULA)\n. (ISA)\n. . aaa + bbb\n. (/ISA)\n. (TERM)\n aaa + bbb\n(/TERM)\n(/FORMULA)\n"
33 then () else error "term |> xml_of_term_NEW |> xmlstr ..changed";
36 "--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
37 "--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
38 "--------- fun xml_of_term_NEW, xml_to_term_NEW ------------------";
39 (* xml_of_term_NEW o xml_to_term_NEW = id ... not valid,
40 as long as the latter (going: frontend \<longrightarrow> kernel) does only carry "ISA" string.
41 val t = @{term "aaa + bbb::real"};
42 if t = (t |> xml_of_term_NEW |> xml_to_term_NEW) then ()
43 else error "xml_of_term_NEW |> xml_to_term_NEW changed"
46 "--------- create testdata for TestPIDE.java#testTermTransfer ----";
47 "--------- create testdata for TestPIDE.java#testTermTransfer ----";
48 "--------- create testdata for TestPIDE.java#testTermTransfer ----";
49 val t = @{term "aaa + bbb::real"};
50 val ttt = HOLogic.mk_eq (t, Const ("processed_by_Isabelle_Isac", type_of t))
51 (* check the term structure *)
52 val Const ("HOL.eq", T1) $
53 (Const ("Groups.plus_class.plus", T2) $
56 Const ("processed_by_Isabelle_Isac", _) = ttt;
58 (* check the type structure *)
60 Type ("Real.real", []);
65 *** . Type (Real.real,[])
67 *** . . Type (Real.real,[])
68 *** . . Type (Real.real,[])
71 with this \<up> build the typ ...*)
73 Type ("Real.real", []),
75 Type ("Real.real", []),
76 Type ("Real.real", [])])]);
81 *** . Type (Real.real,[])
83 *** . . Type (Real.real,[])
84 *** . . Type (HOL.bool,[])
87 with this \<up> build the typ ...*)
89 Type ("Real.real", []),
91 Type ("Real.real", []),
92 Type ("HOL.bool", [])])]);
94 (* now compose term + typ *)
95 val Const ("HOL.eq", Type ("fun", [
96 Type ("Real.real", []),
98 Type ("Real.real", []),
99 Type ("HOL.bool", [])])])) $
100 (Const ("Groups.plus_class.plus", Type ("fun", [
101 Type ("Real.real", []),
103 Type ("Real.real", []),
104 Type ("Real.real", [])])])) $
105 Free ("aaa", Type ("Real.real", [])) $
106 Free ("bbb", Type ("Real.real", []))) $
107 Const ("processed_by_Isabelle_Isac", Type ("Real.real", [])) = ttt;
109 (* match out the original term from result*)
110 val Const ("HOL.eq", Type ("fun", [
111 Type ("Real.real", []),
113 Type ("Real.real", []),
114 Type ("HOL.bool", [])])])) $
116 Const ("processed_by_Isabelle_Isac", Type ("Real.real", [])) = ttt;
117 if t = t' then () else error "something with test_term changed"