405 val interpretation_args = |
405 val interpretation_args = |
406 Parse.!!! Parse_Spec.locale_expression -- |
406 Parse.!!! Parse_Spec.locale_expression -- |
407 Scan.optional |
407 Scan.optional |
408 (@{keyword "rewrites"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
408 (@{keyword "rewrites"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []; |
409 |
409 |
|
410 val _ = |
|
411 Outer_Syntax.command @{command_keyword interpret} |
|
412 "prove interpretation of locale expression in proof context" |
|
413 (interpretation_args >> (fn (expr, equations) => |
|
414 Toplevel.proof' (Interpretation.interpret_cmd expr equations))); |
|
415 |
410 val interpretation_args_with_defs = |
416 val interpretation_args_with_defs = |
411 Parse.!!! Parse_Spec.locale_expression -- |
417 Parse.!!! Parse_Spec.locale_expression -- |
412 (Scan.optional (@{keyword "defines"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" |
418 (Scan.optional (@{keyword "defines"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" |
413 -- ((Parse.binding -- Parse.opt_mixfix') --| @{keyword "="} -- Parse.term))) [] -- |
419 -- ((Parse.binding -- Parse.opt_mixfix') --| @{keyword "="} -- Parse.term))) [] -- |
414 Scan.optional |
420 Scan.optional |
415 (@{keyword "rewrites"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []); |
421 (@{keyword "rewrites"} |-- Parse.and_list1 (Parse_Spec.opt_thm_name ":" -- Parse.prop)) []); |
|
422 |
|
423 val _ = |
|
424 Outer_Syntax.local_theory_to_proof @{command_keyword global_interpretation} |
|
425 "prove interpretation of locale expression into global theory" |
|
426 (interpretation_args_with_defs |
|
427 >> (fn (expr, (defs, equations)) => Interpretation.global_interpretation_cmd expr defs equations)); |
416 |
428 |
417 val _ = |
429 val _ = |
418 Outer_Syntax.command @{command_keyword sublocale} |
430 Outer_Syntax.command @{command_keyword sublocale} |
419 "prove sublocale relation between a locale and a locale expression" |
431 "prove sublocale relation between a locale and a locale expression" |
420 ((Parse.position Parse.xname --| (@{keyword "\<subseteq>"} || @{keyword "<"}) -- |
432 ((Parse.position Parse.xname --| (@{keyword "\<subseteq>"} || @{keyword "<"}) -- |
422 Toplevel.theory_to_proof (Interpretation.global_sublocale_cmd loc expr defs equations))) |
434 Toplevel.theory_to_proof (Interpretation.global_sublocale_cmd loc expr defs equations))) |
423 || interpretation_args_with_defs >> (fn (expr, (defs, equations)) => |
435 || interpretation_args_with_defs >> (fn (expr, (defs, equations)) => |
424 Toplevel.local_theory_to_proof NONE NONE (Interpretation.sublocale_cmd expr defs equations))); |
436 Toplevel.local_theory_to_proof NONE NONE (Interpretation.sublocale_cmd expr defs equations))); |
425 |
437 |
426 val _ = |
438 val _ = |
427 Outer_Syntax.local_theory_to_proof @{command_keyword permanent_interpretation} |
|
428 "prove interpretation of locale expression into named theory" |
|
429 (interpretation_args_with_defs |
|
430 >> (fn (expr, (defs, equations)) => Interpretation.permanent_interpretation_cmd expr defs equations)); |
|
431 |
|
432 val _ = |
|
433 Outer_Syntax.command @{command_keyword interpretation} |
439 Outer_Syntax.command @{command_keyword interpretation} |
434 "prove interpretation of locale expression in local theory" |
440 "prove interpretation of locale expression in local theory or into global theory" |
435 (interpretation_args >> (fn (expr, equations) => |
441 (interpretation_args >> (fn (expr, equations) => |
436 Toplevel.local_theory_to_proof NONE NONE (Interpretation.interpretation_cmd expr equations))); |
442 Toplevel.local_theory_to_proof NONE NONE (Interpretation.isar_interpretation_cmd expr equations))); |
437 |
443 |
438 val _ = |
|
439 Outer_Syntax.command @{command_keyword interpret} |
|
440 "prove interpretation of locale expression in proof context" |
|
441 (interpretation_args >> (fn (expr, equations) => |
|
442 Toplevel.proof' (Interpretation.interpret_cmd expr equations))); |
|
443 |
444 |
444 |
445 |
445 (* classes *) |
446 (* classes *) |
446 |
447 |
447 val class_val = |
448 val class_val = |