author | ballarin |
Thu, 24 Mar 2005 17:03:37 +0100 | |
changeset 15624 | 484178635bd8 |
parent 15598 | 4ab52355bb53 |
child 15696 | 1da4ce092c0b |
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 |
|
15624
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
23 |
interpretation test [simp]: L print_interps M . |
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 |
|
15624
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
55 |
(* possible accesses |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
56 |
thm p1.a.asm_A thm LocaleTest.p1.a.asm_A |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
57 |
thm LocaleTest.asm_A thm p1.asm_A |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
58 |
*) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
59 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
60 |
(* without prefix *) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
61 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
62 |
interpretation C ["W::'b" "Z::'b"] by (auto intro: A.intro C_axioms.intro) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
63 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
64 |
print_interps A |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
65 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
66 |
(* possible accesses |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
67 |
thm a.asm_A thm asm_A thm LocaleTest.a.asm_A thm LocaleTest.asm_A |
15598
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 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
70 |
interpretation p2: D [X Y "Y = X"] by (auto intro: A.intro simp: eq_commute) |
15596 | 71 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
72 |
print_interps D |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
73 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
74 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
75 |
thm p2.a.asm_A |
15596 | 76 |
*) |
77 |
||
15624
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
78 |
interpretation p3: D [X Y] . |
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
79 |
|
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
80 |
(* duplicate: not registered *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
81 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
82 |
thm p3.a.asm_A |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
83 |
*) |
15596 | 84 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
85 |
print_interps A |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
86 |
print_interps B |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
87 |
print_interps C |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
88 |
print_interps D |
15596 | 89 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
90 |
(* not permitted *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
91 |
(* |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
92 |
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
|
93 |
*) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
94 |
print_interps A |
15596 | 95 |
|
15598
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
96 |
(* without a prefix *) |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
97 |
(* TODO!!! |
4ab52355bb53
Registrations of global locale interpretations: improved, better naming.
ballarin
parents:
15596
diff
changeset
|
98 |
interpretation A [Z] apply - apply (auto intro: A.intro) done |
15596 | 99 |
*) |
100 |
||
15624
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
101 |
theorem True |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
102 |
proof - |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
103 |
fix alpha::i and beta::i and gamma::i |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
104 |
assume "A(alpha)" |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
105 |
then interpret p5: A [alpha] . |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
106 |
print_interps A |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
107 |
interpret p6: C [alpha beta] by (auto intro: C_axioms.intro) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
108 |
print_interps A (* p6 not added! *) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
109 |
print_interps C |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
110 |
qed rule |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
111 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
112 |
(* lemma "bla.bla": True by rule *) |
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
113 |
|
484178635bd8
Further work on interpretation commands. New command `interpret' for
ballarin
parents:
15598
diff
changeset
|
114 |
|
15596 | 115 |
end |