equal
deleted
inserted
replaced
388 |
388 |
389 (* for activating declarations only *) |
389 (* for activating declarations only *) |
390 fun eq_term_morphism _ [] = NONE |
390 fun eq_term_morphism _ [] = NONE |
391 | eq_term_morphism thy props = |
391 | eq_term_morphism thy props = |
392 let |
392 let |
|
393 (* FIXME proper morphism context *) |
393 fun decomp_simp prop = |
394 fun decomp_simp prop = |
394 let |
395 let |
395 val ctxt = Proof_Context.init_global thy; |
396 val ctxt = Proof_Context.init_global thy; |
396 val _ = Logic.no_prems prop orelse |
397 val _ = Logic.no_prems prop orelse |
397 error ("Bad conditional rewrite rule " ^ Syntax.string_of_term ctxt prop); |
398 error ("Bad conditional rewrite rule " ^ Syntax.string_of_term ctxt prop); |
400 in lhsrhs end; |
401 in lhsrhs end; |
401 val phi = |
402 val phi = |
402 Morphism.morphism "Element.eq_term_morphism" |
403 Morphism.morphism "Element.eq_term_morphism" |
403 {binding = [], |
404 {binding = [], |
404 typ = [], |
405 typ = [], |
405 term = [Pattern.rewrite_term thy (map decomp_simp props) []], |
406 term = [K (Pattern.rewrite_term thy (map decomp_simp props) [])], |
406 fact = [fn _ => error "Illegal application of Element.eq_term_morphism"]}; |
407 fact = [fn _ => fn _ => error "Illegal application of Element.eq_term_morphism"]}; |
407 in SOME phi end; |
408 in SOME phi end; |
408 |
409 |
409 fun eq_morphism _ [] = NONE |
410 fun eq_morphism _ [] = NONE |
410 | eq_morphism thy thms = |
411 | eq_morphism thy thms = |
411 let |
412 let |
412 (* FIXME proper context!? *) |
413 (* FIXME proper morphism context *) |
413 fun rewrite th = rewrite_rule (Proof_Context.init_global (Thm.theory_of_thm th)) thms th; |
414 fun rewrite th = rewrite_rule (Proof_Context.init_global (Thm.theory_of_thm th)) thms th; |
414 val phi = |
415 val phi = |
415 Morphism.morphism "Element.eq_morphism" |
416 Morphism.morphism "Element.eq_morphism" |
416 {binding = [], |
417 {binding = [], |
417 typ = [], |
418 typ = [], |
418 term = [Raw_Simplifier.rewrite_term thy thms []], |
419 term = [K (Raw_Simplifier.rewrite_term thy thms [])], |
419 fact = [map rewrite]}; |
420 fact = [K (map rewrite)]}; |
420 in SOME phi end; |
421 in SOME phi end; |
421 |
422 |
422 |
423 |
423 |
424 |
424 (** activate in context **) |
425 (** activate in context **) |