87 val put_local_simpset: simpset -> Proof.context -> Proof.context |
87 val put_local_simpset: simpset -> Proof.context -> Proof.context |
88 val simp_add_global: theory attribute |
88 val simp_add_global: theory attribute |
89 val simp_del_global: theory attribute |
89 val simp_del_global: theory attribute |
90 val simp_add_local: Proof.context attribute |
90 val simp_add_local: Proof.context attribute |
91 val simp_del_local: Proof.context attribute |
91 val simp_del_local: Proof.context attribute |
|
92 val simp_modifiers: (Args.T list -> (Proof.context attribute * Args.T list)) list |
92 val setup: (theory -> theory) list |
93 val setup: (theory -> theory) list |
93 end; |
94 end; |
94 |
95 |
95 structure Simplifier: SIMPLIFIER = |
96 structure Simplifier: SIMPLIFIER = |
96 struct |
97 struct |
400 |
401 |
401 (** concrete syntax of attributes **) |
402 (** concrete syntax of attributes **) |
402 |
403 |
403 (* add / del *) |
404 (* add / del *) |
404 |
405 |
405 val simp_addN = "add"; |
406 val simpN = "simp"; |
406 val simp_delN = "del"; |
407 val addN = "add"; |
407 val simp_ignoreN = "other"; |
408 val delN = "del"; |
|
409 val otherN = "other"; |
408 |
410 |
409 fun simp_att change = |
411 fun simp_att change = |
410 (Args.$$$ simp_addN >> K (op addsimps) || |
412 (Args.$$$ addN >> K (op addsimps) || |
411 Args.$$$ simp_delN >> K (op delsimps) || |
413 Args.$$$ delN >> K (op delsimps) || |
412 Scan.succeed (op addsimps)) |
414 Scan.succeed (op addsimps)) |
413 >> change |
415 >> change |
414 |> Scan.lift |
416 |> Scan.lift |
415 |> Attrib.syntax; |
417 |> Attrib.syntax; |
416 |
418 |
425 |
427 |
426 |
428 |
427 (* setup_attrs *) |
429 (* setup_attrs *) |
428 |
430 |
429 val setup_attrs = Attrib.add_attributes |
431 val setup_attrs = Attrib.add_attributes |
430 [("simp", simp_attr, "simplification rule"), |
432 [(simpN, simp_attr, "simplification rule"), |
431 ("simplify", conv_attr simplify, "simplify rule"), |
433 ("simplify", conv_attr simplify, "simplify rule"), |
432 ("asm_simplify", conv_attr asm_simplify, "simplify rule, using assumptions"), |
434 ("asm_simplify", conv_attr asm_simplify, "simplify rule, using assumptions"), |
433 ("full_simplify", conv_attr full_simplify, "fully simplify rule"), |
435 ("full_simplify", conv_attr full_simplify, "fully simplify rule"), |
434 ("asm_full_simplify", conv_attr asm_full_simplify, "fully simplify rule, using assumptions")]; |
436 ("asm_full_simplify", conv_attr asm_full_simplify, "fully simplify rule, using assumptions")]; |
435 |
437 |
437 |
439 |
438 (** proof methods **) |
440 (** proof methods **) |
439 |
441 |
440 (* simplification *) |
442 (* simplification *) |
441 |
443 |
442 val simp_args = |
444 val simp_modifiers = |
443 Method.only_sectioned_args |
445 [Args.$$$ simpN -- Args.$$$ addN >> K simp_add_local, |
444 [Args.$$$ simp_addN >> K simp_add_local, |
446 Args.$$$ simpN -- Args.$$$ delN >> K simp_del_local, |
445 Args.$$$ simp_delN >> K simp_del_local, |
447 Args.$$$ otherN >> K I]; (* FIXME ?? *) |
446 Args.$$$ simp_ignoreN >> K I]; |
448 |
|
449 val simp_modifiers' = |
|
450 [Args.$$$ addN >> K simp_add_local, |
|
451 Args.$$$ delN >> K simp_del_local, |
|
452 Args.$$$ otherN >> K I]; |
|
453 |
|
454 val simp_args = Method.only_sectioned_args simp_modifiers'; |
447 |
455 |
448 fun simp_meth tac ctxt = Method.METHOD (fn facts => |
456 fun simp_meth tac ctxt = Method.METHOD (fn facts => |
449 FIRSTGOAL (REPEAT_DETERM o etac Drule.thin_rl THEN' |
457 FIRSTGOAL (REPEAT_DETERM o etac Drule.thin_rl THEN' |
450 metacuts_tac (Attribute.thms_of facts) THEN' |
458 metacuts_tac (Attribute.thms_of facts) THEN' |
451 tac (get_local_simpset ctxt))); |
459 tac (get_local_simpset ctxt))); |
454 |
462 |
455 |
463 |
456 (* setup_methods *) |
464 (* setup_methods *) |
457 |
465 |
458 val setup_methods = Method.add_methods |
466 val setup_methods = Method.add_methods |
459 [("simp", simp_method asm_full_simp_tac, "simplification"), |
467 [(simpN, simp_method asm_full_simp_tac, "simplification"), |
460 ("simp_tac", simp_method simp_tac, "simp_tac"), |
468 ("simp_tac", simp_method simp_tac, "simp_tac"), |
461 ("asm_simp_tac", simp_method asm_simp_tac, "asm_simp_tac"), |
469 ("asm_simp_tac", simp_method asm_simp_tac, "asm_simp_tac"), |
462 ("full_simp_tac", simp_method full_simp_tac, "full_simp_tac"), |
470 ("full_simp_tac", simp_method full_simp_tac, "full_simp_tac"), |
463 ("asm_full_simp_tac", simp_method asm_full_simp_tac, "asm_full_simp_tac"), |
471 ("asm_full_simp_tac", simp_method asm_full_simp_tac, "asm_full_simp_tac"), |
464 ("asm_lr_simp_tac", simp_method asm_lr_simp_tac, "asm_lr_simp_tac")]; |
472 ("asm_lr_simp_tac", simp_method asm_lr_simp_tac, "asm_lr_simp_tac")]; |