273 |-> (fn (const as Const (c, _), _) => same_shape ? |
273 |-> (fn (const as Const (c, _), _) => same_shape ? |
274 (Proof_Context.generic_revert_abbrev (#1 prmode) c #> |
274 (Proof_Context.generic_revert_abbrev (#1 prmode) c #> |
275 Morphism.form (Proof_Context.generic_notation true prmode [(const, mx)])))) |
275 Morphism.form (Proof_Context.generic_notation true prmode [(const, mx)])))) |
276 end; |
276 end; |
277 |
277 |
|
278 fun standard_const prmode ((b, mx), rhs) phi = |
|
279 let |
|
280 val b' = Morphism.binding phi b; |
|
281 val rhs' = Morphism.term phi rhs; |
|
282 val same_shape = Term.aconv_untyped (rhs, rhs'); |
|
283 in generic_const same_shape prmode ((b', mx), rhs') end; |
|
284 |
278 fun const pred prmode ((b, mx), rhs) = |
285 fun const pred prmode ((b, mx), rhs) = |
279 standard_declaration pred (fn phi => |
286 standard_declaration pred (standard_const prmode ((b, mx), rhs)); |
280 let |
|
281 val b' = Morphism.binding phi b; |
|
282 val rhs' = Morphism.term phi rhs; |
|
283 val same_shape = Term.aconv_untyped (rhs, rhs'); |
|
284 in generic_const same_shape prmode ((b', mx), rhs') end); |
|
285 |
287 |
286 fun locale_const locale prmode ((b, mx), rhs) = |
288 fun locale_const locale prmode ((b, mx), rhs) = |
287 locale_declaration locale true (fn phi => |
289 locale_declaration locale true (standard_const prmode ((b, mx), rhs)) |
288 let |
|
289 val b' = Morphism.binding phi b; |
|
290 val rhs' = Morphism.term phi rhs; |
|
291 val same_shape = Term.aconv_untyped (rhs, rhs'); |
|
292 in generic_const same_shape prmode ((b', mx), rhs') end) |
|
293 #> const (fn (this, other) => other <> 0 andalso this <> other) prmode ((b, mx), rhs); |
290 #> const (fn (this, other) => other <> 0 andalso this <> other) prmode ((b, mx), rhs); |
294 |
291 |
295 |
292 |
296 (* registrations and dependencies *) |
293 (* registrations and dependencies *) |
297 |
294 |