193 else theory_notes kind global_facts local_facts) |
193 else theory_notes kind global_facts local_facts) |
194 |> ProofContext.note_thmss kind (Attrib.map_facts (Attrib.attribute_i thy) local_facts) |
194 |> ProofContext.note_thmss kind (Attrib.map_facts (Attrib.attribute_i thy) local_facts) |
195 end; |
195 end; |
196 |
196 |
197 |
197 |
198 (* mixfix notation *) |
198 (* consts in locales *) |
199 |
|
200 local |
|
201 |
|
202 fun fork_mixfix (Target {is_locale, is_class, ...}) mx = |
|
203 if not is_locale then (NoSyn, NoSyn, mx) |
|
204 else if not is_class then (NoSyn, mx, NoSyn) |
|
205 else (mx, NoSyn, NoSyn); |
|
206 |
|
207 in |
|
208 |
|
209 fun prep_mixfix ctxt ta (b, extra_tfrees) mx = |
|
210 let |
|
211 val mx' = |
|
212 if null extra_tfrees then mx |
|
213 else |
|
214 (warning |
|
215 ("Additional type variable(s) in specification of " ^ Binding.str_of b ^ ": " ^ |
|
216 commas (map (Syntax.string_of_typ ctxt o TFree) (sort_wrt #1 extra_tfrees)) ^ |
|
217 (if mx = NoSyn then "" |
|
218 else "\nDropping mixfix syntax " ^ Pretty.string_of (Syntax.pretty_mixfix mx))); |
|
219 NoSyn); |
|
220 in fork_mixfix ta mx' end; |
|
221 |
|
222 end; |
|
223 |
|
224 |
|
225 (* consts *) |
|
226 |
199 |
227 fun locale_const (Target {target, is_class, ...}) (prmode as (mode, _)) ((b, mx), rhs) phi = |
200 fun locale_const (Target {target, is_class, ...}) (prmode as (mode, _)) ((b, mx), rhs) phi = |
228 let |
201 let |
229 val b' = Morphism.binding phi b; |
202 val b' = Morphism.binding phi b; |
230 val rhs' = Morphism.term phi rhs; |
203 val rhs' = Morphism.term phi rhs; |
245 #-> (fn (lhs' as Const (d, _), _) => |
218 #-> (fn (lhs' as Const (d, _), _) => |
246 same_shape ? |
219 same_shape ? |
247 (Context.mapping (Sign.revert_abbrev mode d) (ProofContext.revert_abbrev mode d) #> |
220 (Context.mapping (Sign.revert_abbrev mode d) (ProofContext.revert_abbrev mode d) #> |
248 Morphism.form (ProofContext.target_notation true prmode [(lhs', mx)])))) |
221 Morphism.form (ProofContext.target_notation true prmode [(lhs', mx)])))) |
249 end; |
222 end; |
|
223 |
|
224 |
|
225 (* mixfix notation *) |
|
226 |
|
227 local |
|
228 |
|
229 fun fork_mixfix (Target {is_locale, is_class, ...}) mx = |
|
230 if not is_locale then (NoSyn, NoSyn, mx) |
|
231 else if not is_class then (NoSyn, mx, NoSyn) |
|
232 else (mx, NoSyn, NoSyn); |
|
233 |
|
234 in |
|
235 |
|
236 fun prep_mixfix ctxt ta (b, extra_tfrees) mx = |
|
237 let |
|
238 val mx' = |
|
239 if null extra_tfrees then mx |
|
240 else |
|
241 (warning |
|
242 ("Additional type variable(s) in specification of " ^ Binding.str_of b ^ ": " ^ |
|
243 commas (map (Syntax.string_of_typ ctxt o TFree) (sort_wrt #1 extra_tfrees)) ^ |
|
244 (if mx = NoSyn then "" |
|
245 else "\nDropping mixfix syntax " ^ Pretty.string_of (Syntax.pretty_mixfix mx))); |
|
246 NoSyn); |
|
247 in fork_mixfix ta mx' end; |
|
248 |
|
249 end; |
250 |
250 |
251 |
251 |
252 (* abbrev *) |
252 (* abbrev *) |
253 |
253 |
254 fun abbrev (ta as Target {target, is_locale, is_class, ...}) prmode ((b, mx), t) lthy = |
254 fun abbrev (ta as Target {target, is_locale, is_class, ...}) prmode ((b, mx), t) lthy = |