author | ballarin |
Thu, 10 Mar 2005 17:48:36 +0100 | |
changeset 15598 | 4ab52355bb53 |
parent 15596 | 8665d08085df |
child 15624 | 484178635bd8 |
permissions | -rw-r--r-- |
15596 | 1 |
(* Title: FOL/ex/LocaleTest.thy |
2 |
ID: $Id$ |
|
3 |
Author: Clemens Ballarin |
|
4 |
Copyright (c) 2005 by Clemens Ballarin |
|
5 |
||
6 |
Collection of regression tests for locales. |
|
7 |
*) |
|
8 |
||
9 |
header {* Test of Locale instantiation *} |
|
10 |
||
11 |
theory LocaleTest = FOL: |
|
12 |
||
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
13 |
(* interpretation input syntax *) |
15596 | 14 |
|
15 |
locale L |
|
16 |
locale M = fixes a and b and c |
|
17 |
||
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
18 |
interpretation test [simp]: L + M a b c [x y z] . |
15596 | 19 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
20 |
print_interps L |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
21 |
print_interps M |
15596 | 22 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
23 |
interpretation test [simp]: L . |
15596 | 24 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
25 |
interpretation L . |
15596 | 26 |
|
27 |
(* processing of locale expression *) |
|
28 |
||
29 |
ML {* reset show_hyps *} |
|
30 |
||
31 |
locale A = fixes a assumes asm_A: "a = a" |
|
32 |
||
33 |
locale (open) B = fixes b assumes asm_B [simp]: "b = b" |
|
34 |
||
35 |
locale C = A + B + assumes asm_C: "c = c" |
|
36 |
(* TODO: independent type var in c, prohibit locale declaration *) |
|
37 |
||
38 |
locale D = A + B + fixes d defines def_D: "d == (a = b)" |
|
39 |
||
40 |
ML {* set show_sorts *} |
|
41 |
||
42 |
typedecl i |
|
43 |
arities i :: "term" |
|
44 |
||
45 |
ML {* set Toplevel.debug *} |
|
46 |
||
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
47 |
ML {* set show_hyps *} |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
48 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
49 |
interpretation p1: C ["X::'b" "Y::'b"] by (auto intro: A.intro C_axioms.intro) |
15596 | 50 |
(* both X and Y get type 'b since 'b is the internal type of parameter b, |
51 |
not wanted, but put up with for now. *) |
|
52 |
||
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
53 |
print_interps A |
15596 | 54 |
|
55 |
(* |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
56 |
thm asm_A a.asm_A p1.a.asm_A |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
57 |
*) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
58 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
59 |
interpretation p2: D [X Y "Y = X"] by (auto intro: A.intro simp: eq_commute) |
15596 | 60 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
61 |
print_interps D |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
62 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
63 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
64 |
thm p2.a.asm_A |
15596 | 65 |
*) |
66 |
||
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
67 |
interpretation p3: D [X Y] by (auto intro: A.intro) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
68 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
69 |
(* duplicate: not registered *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
70 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
71 |
thm p3.a.asm_A |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
72 |
*) |
15596 | 73 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
74 |
print_interps A |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
75 |
print_interps B |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
76 |
print_interps C |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
77 |
print_interps D |
15596 | 78 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
79 |
(* not permitted *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
80 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
81 |
interpretation p4: A ["x::?'a1"] apply (rule A.intro) apply rule done |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
82 |
*) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
83 |
print_interps A |
15596 | 84 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
85 |
(* without a prefix *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
86 |
(* TODO!!! |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
87 |
interpretation A [Z] apply - apply (auto intro: A.intro) done |
15596 | 88 |
*) |
89 |
||
90 |
end |