23 text {* Inference of parameter types *} |
23 text {* Inference of parameter types *} |
24 |
24 |
25 locale param1 = fixes p |
25 locale param1 = fixes p |
26 print_locale! param1 |
26 print_locale! param1 |
27 |
27 |
28 locale param2 = fixes p :: 'a |
28 locale param2 = fixes p :: 'b |
29 print_locale! param2 |
29 print_locale! param2 |
30 |
30 |
31 (* |
31 (* |
32 locale param_top = param2 r for r :: "'b :: {}" |
32 locale param_top = param2 r for r :: "'b :: {}" |
33 print_locale! param_top |
33 print_locale! param_top |
89 text {* Alternative expression, obtaining nicer names in @{text "semi f"}. *} |
89 text {* Alternative expression, obtaining nicer names in @{text "semi f"}. *} |
90 locale pert_hom' = semi f + d1: perturbation f d1 + d2: perturbation f d2 for f d1 d2 |
90 locale pert_hom' = semi f + d1: perturbation f d1 + d2: perturbation f d2 for f d1 d2 |
91 print_locale! pert_hom' thm pert_hom'_def |
91 print_locale! pert_hom' thm pert_hom'_def |
92 |
92 |
93 |
93 |
94 text {* Logic *} |
94 text {* Syntax declarations *} |
95 |
95 |
96 locale logic = |
96 locale logic = |
97 fixes land (infixl "&&" 55) |
97 fixes land (infixl "&&" 55) |
98 and lnot ("-- _" [60] 60) |
98 and lnot ("-- _" [60] 60) |
99 assumes assoc: "(x && y) && z = x && (y && z)" |
99 assumes assoc: "(x && y) && z = x && (y && z)" |
107 print_locale! logic |
107 print_locale! logic |
108 |
108 |
109 locale use_decl = logic + semi "op ||" |
109 locale use_decl = logic + semi "op ||" |
110 print_locale! use_decl thm use_decl_def |
110 print_locale! use_decl thm use_decl_def |
111 |
111 |
112 (* |
112 |
|
113 text {* Theorem statements *} |
|
114 |
113 lemma (in lgrp) lcancel: |
115 lemma (in lgrp) lcancel: |
114 "x ** y = x ** z <-> y = z" |
116 "x ** y = x ** z <-> y = z" |
115 proof |
117 proof |
116 assume "x ** y = x ** z" |
118 assume "x ** y = x ** z" |
117 then have "inv(x) ** x ** y = inv(x) ** x ** z" by (simp add: assoc) |
119 then have "inv(x) ** x ** y = inv(x) ** x ** z" by (simp add: assoc) |
118 then show "y = z" by (simp add: lone linv) |
120 then show "y = z" by (simp add: lone linv) |
119 qed simp |
121 qed simp |
120 *) |
122 print_locale! lgrp |
|
123 |
121 |
124 |
122 locale rgrp = semi + |
125 locale rgrp = semi + |
123 fixes one and inv |
126 fixes one and inv |
124 assumes rone: "x ** one = x" |
127 assumes rone: "x ** one = x" |
125 and rinv: "x ** inv(x) = one" |
128 and rinv: "x ** inv(x) = one" |
|
129 begin |
126 |
130 |
127 (* |
131 lemma rcancel: |
128 lemma (in rgrp) rcancel: |
|
129 "y ** x = z ** x <-> y = z" |
132 "y ** x = z ** x <-> y = z" |
130 proof |
133 proof |
131 assume "y ** x = z ** x" |
134 assume "y ** x = z ** x" |
132 then have "y ** (x ** inv(x)) = z ** (x ** inv(x))" |
135 then have "y ** (x ** inv(x)) = z ** (x ** inv(x))" |
133 by (simp add: assoc [symmetric]) |
136 by (simp add: assoc [symmetric]) |
134 then show "y = z" by (simp add: rone rinv) |
137 then show "y = z" by (simp add: rone rinv) |
135 qed simp |
138 qed simp |
136 *) |
|
137 |
|
138 |
139 |
139 end |
140 end |
|
141 print_locale! rgrp |
|
142 |
|
143 end |