equal
deleted
inserted
replaced
603 val opt_goal = try (Proof.simple_goal o Toplevel.proof_of) state |> Option.map #goal; |
603 val opt_goal = try (Proof.simple_goal o Toplevel.proof_of) state |> Option.map #goal; |
604 in pretty_theorems ctxt opt_goal opt_lim rem_dups spec end; |
604 in pretty_theorems ctxt opt_goal opt_lim rem_dups spec end; |
605 |
605 |
606 |
606 |
607 |
607 |
608 (** command syntax **) |
608 (** Isar command syntax **) |
609 |
609 |
610 local |
610 local |
611 |
611 |
612 val criterion = |
612 val criterion = |
613 Parse.reserved "name" |-- Parse.!!! (Parse.$$$ ":" |-- Parse.xname) >> Name || |
613 Parse.reserved "name" |-- Parse.!!! (Parse.$$$ ":" |-- Parse.xname) >> Name || |
645 |
645 |
646 end; |
646 end; |
647 |
647 |
648 |
648 |
649 |
649 |
650 (** print function **) |
650 (** PIDE query operation **) |
651 |
651 |
652 val find_theoremsN = "find_theorems"; |
652 val _ = |
653 |
653 Query_Operation.register "find_theorems" (fn state => fn query => |
654 val _ = Command.print_function find_theoremsN |
654 Pretty.string_of (pretty_theorems_cmd state NONE false (maps parse_query query))); |
655 (fn {args, ...} => |
|
656 (case args of |
|
657 [instance, query] => |
|
658 SOME {delay = NONE, pri = 0, persistent = false, |
|
659 print_fn = fn _ => fn state => |
|
660 let |
|
661 val msg = |
|
662 XML.Elem ((Markup.writelnN, []), |
|
663 [XML.Text |
|
664 (Pretty.string_of (pretty_theorems_cmd state NONE false (parse_query query)))]) |
|
665 handle exn => |
|
666 if Exn.is_interrupt exn then reraise exn |
|
667 else XML.Elem ((Markup.errorN, []), [XML.Text (ML_Compiler.exn_message exn)]); |
|
668 in |
|
669 Output.result [(Markup.kindN, find_theoremsN), (Markup.instanceN, instance)] |
|
670 (YXML.string_of msg) |
|
671 end} |
|
672 | _ => NONE)); |
|
673 |
655 |
674 end; |
656 end; |