ML ‹ local val _ = Outer_Syntax.command 🍋‹external_file› "formal dependency on external file" (Resources.provide_parse_file >> (fn get_file => Toplevel.theory (#2 o get_file)));
val _ = Outer_Syntax.command 🍋‹bibtex_file› "check bibtex database file in Prover IDE" (Resources.provide_parse_file >> (fn get_file => Toplevel.theory (fn thy => let val ({lines, pos, ...}, thy') = get_file thy; val _ = Bibtex.check_database_output pos (cat_lines lines); in thy' end)));
val _ = Outer_Syntax.command 🍋‹ROOTS_file› "session ROOTS file" (Resources.provide_parse_file >> (fn get_file => Toplevel.theory (fn thy => let val ({src_path, lines, pos = pos0, ...}, thy') = get_file thy; val ctxt = Proof_Context.init_global thy'; val dir = Path.dir (Path.expand (Resources.master_directory thy' + src_path)); val _ = (lines, pos0) |-> fold (fn line => fn pos1 => let val pos2 = Position.symbol_explode line pos1; val range = Position.range (pos1, pos2); val source = Input.source true line range; val _ = if line = " then ()
else if String.isPrefix "#" line then
Context_Position.report ctxt (#1 range) Markup.comment
else
(ignore (Resources.check_session_dir ctxt (SOME dir) source)
handle ERROR msg => Output.error_message msg);
in pos2 |> Position.symbol "\n" end);
in thy' end)));
val _ =
Outer_Syntax.local_theory 🍋‹generate_file›
"generate source file, with antiquotations"
(Parse.path_binding -- (🍋‹=› |-- Parse.embedded_input)
>> Generated_Files.generate_file_cmd);
val files_in_theory =
(Parse.underscore >> K [] || Scan.repeat1 Parse.path_binding) --
Scan.option (🍋‹(› |-- Parse.!!! (🍋‹in› |-- Parse.theory_name --| 🍋‹)›));
val _ =
Outer_Syntax.command 🍋‹export_generated_files›
"export generated files from given theories"
(Parse.and_list1 files_in_theory >> (fn args =>
Toplevel.keep (fn st =>
Generated_Files.export_generated_files_cmd (Toplevel.context_of st) args)));
_ =
Outer_Syntax.command 🍋‹ML_file_no_debug›
"read and evaluate Isabelle/ML file (no debugger information)"
(Resources.parse_file --| semi >> ML_File.ML (SOME false));
_ =
Outer_Syntax.command 🍋‹SML_file› "read and evaluate Standard ML file"
(Resources.parse_file --| semi >> ML_File.SML NONE);
_ =
Outer_Syntax.command 🍋‹SML_file_debug›
"read and evaluate Standard ML file (with debugger information)"
(Resources.parse_file --| semi >> ML_File.SML (SOME true));
_ =
Outer_Syntax.command 🍋‹SML_file_no_debug›
"read and evaluate Standard ML file (no debugger information)"
(Resources.parse_file --| semi >> ML_File.SML (SOME false));
_ =
Outer_Syntax.maybe_begin_local_theory 🍋‹open_bundle›
"define and open bundle of declarations" (bundle_cmd true) (bundle_begin true);
_ =
Outer_Syntax.local_theory 🍋‹unbundle›
"open bundle in local theory" (Parse_Spec.bundles >> Bundle.unbundle_cmd);
_ =
Outer_Syntax.command 🍋‹include›
"open bundle in proof body" (Parse_Spec.bundles >> (Toplevel.proof o Bundle.include_cmd));
_ =
Outer_Syntax.command 🍋‹including›
"open bundle in goal refinement" (Parse_Spec.bundles >> (Toplevel.proof o Bundle.including_cmd));
_ =
Outer_Syntax.command 🍋‹print_bundles›
"print bundles of declarations"
(Parse.opt_bang >> (fn b => Toplevel.keep (Bundle.print_bundles b o Toplevel.context_of)));
_ =
Outer_Syntax.local_theory_to_proof 🍋‹global_interpretation›
"prove interpretation of locale expression into global theory"
(interpretation_args_with_defs >> (fn (expr, defs) =>
Interpretation.global_interpretation_cmd expr defs));
_ =
Outer_Syntax.command 🍋‹sublocale›
"prove sublocale relation between a locale and a locale expression"
((Parse.name_position --| (🍋‹⊆› || 🍋‹<\<close>) --
interpretation_args_with_defs >> (fn (loc, (expr, defs)) =>
Toplevel.theory_to_proof (Interpretation.global_sublocale_cmd loc expr defs)))
|| interpretation_args_with_defs >> (fn (expr, defs) =>
Toplevel.local_theory_to_proof NONE NONE (Interpretation.sublocale_cmd expr defs)));
_ =
Outer_Syntax.command 🍋‹interpretation›
"prove interpretation of locale expression in local theory or into global theory"
(Parse.!!! Parse_Spec.locale_expression >> (fn expr =>
Toplevel.local_theory_to_proof NONE NONE
(Interpretation.isar_interpretation_cmd expr)));
_ =
Outer_Syntax.command 🍋‹have› "state local goal"
(structured_statement >> (fn (a, b, c, d) =>
Toplevel.proof' (fn int => Proof.have_cmd a NONE (K I) b c d int #> #2)));
_ =
Outer_Syntax.command 🍋‹show› "state local goal, to refine pending subgoals"
(structured_statement >> (fn (a, b, c, d) =>
Toplevel.proof' (fn int => Proof.show_cmd a NONE (K I) b c d int #> #2)));
_ =
Outer_Syntax.command 🍋‹hence› "old-style alias of \"then have\""
(structured_statement >> (fn (a, b, c, d) =>
Toplevel.proof' (fn int => Proof.chain #> Proof.have_cmd a NONE (K I) b c d int #> #2)));
_ =
Outer_Syntax.command 🍋‹thus› "old-style alias of \"then show\""
(structured_statement >> (fn (a, b, c, d) =>
Toplevel.proof' (fn int => Proof.chain #> Proof.show_cmd a NONE (K I) b c d int #> #2)));
_ =
Outer_Syntax.command 🍋‹fix› "fix local variables (Skolem constants)"
(Parse.vars >> (Toplevel.proof o Proof.fix_cmd));
_ =
Outer_Syntax.command 🍋‹assume› "assume propositions"
(structured_statement >> (fn (a, b, c) => Toplevel.proof (Proof.assume_cmd a b c)));
_ =
Outer_Syntax.command 🍋‹presume› "assume propositions, to be established later"
(structured_statement >> (fn (a, b, c) => Toplevel.proof (Proof.presume_cmd a b c)));
_ =
Outer_Syntax.command 🍋‹define› "local definition (non-polymorphic)"
((Parse.vars --| Parse.where_) -- Parse_Spec.statement -- Parse.for_fixes
>> (fn ((a, b), c) => Toplevel.proof (Proof.define_cmd a c b)));
_ =
Outer_Syntax.command 🍋‹consider› "state cases rule"
(Parse_Spec.obtains >> (Toplevel.proof' o Obtain.consider_cmd));
_ =
Outer_Syntax.command 🍋‹obtain› "generalized elimination"
(Parse.parbinding -- Scan.optional (Parse.vars --| Parse.where_) [] -- structured_statement
>> (fn ((a, b), (c, d, e)) => Toplevel.proof' (Obtain.obtain_cmd a b c d e)));
_ =
Outer_Syntax.command 🍋‹let› "bind text variables"
(Parse.and_list1 (Parse.and_list1 Parse.term -- (🍋‹=› |-- Parse.term))
>> (Toplevel.proof o Proof.let_bind_cmd));
_ =
Outer_Syntax.command 🍋‹apply› "initial goal refinement step (unstructured)"
(Method.parse >> (fn m => (Method.report m; Toplevel.proofs (Proof.apply m))));
_ =
Outer_Syntax.command 🍋‹apply_end› "terminal goal refinement step (unstructured)"
(Method.parse >> (fn m => (Method.report m; Toplevel.proofs (Proof.apply_end m))));
_ =
Outer_Syntax.command 🍋‹proof› "backward proof step"
(Scan.option Method.parse >> (fn m =>
(Option.map Method.report m;
Toplevel.proof (fn state =>
let
val state' = state |> Proof.proof m |> Seq.the_result "";
val _ =
Output.information
(Proof_Context.print_cases_proof (Proof.context_of state) (Proof.context_of state'));
in state' end))))
_ =
Outer_Syntax.command 🍋‹subgoal›
"focus on first subgoal within backward refinement"
(opt_fact_binding -- (Scan.option (🍋‹premises› |-- Parse.!!! opt_fact_binding)) --
for_params >> (fn ((a, b), c) =>
Toplevel.proofs (Seq.make_results o Seq.single o #2 o Subgoal.subgoal_cmd a b c)));
_ =
Outer_Syntax.command 🍋‹print_options› "print configuration options"
(Parse.opt_bang >> (fn b => Toplevel.keep (Attrib.print_options b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_context›
"print context of local theory target"
(Scan.succeed (Toplevel.keep (Pretty.writeln o Pretty.chunks o Toplevel.pretty_context)));
_ =
Outer_Syntax.command 🍋‹print_theory›
"print logical theory contents"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Pretty.writeln o Proof_Display.pretty_theory b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_definitions›
"print dependencies of definitional theory content"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Pretty.writeln o Proof_Display.pretty_definitions b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_syntax›
"print inner syntax of context"
(Scan.succeed (Toplevel.keep (Proof_Context.print_syntax o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_defn_rules›
"print definitional rewrite rules of context"
(Scan.succeed (Toplevel.keep (Local_Defs.print_rules o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_abbrevs›
"print constant abbreviations of context"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Proof_Context.print_abbrevs b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_theorems›
"print theorems of local theory or proof context"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Pretty.writeln o Pretty.chunks o Isar_Cmd.pretty_theorems b)));
_ =
Outer_Syntax.command 🍋‹print_locales›
"print locales of this theory"
(Parse.opt_bang >> (fn verbose =>
Toplevel.keep (fn state =>
let val thy = Toplevel.theory_of state
in Pretty.writeln (Locale.pretty_locales thy verbose) end)));
_ =
Outer_Syntax.command 🍋‹print_classes›
"print classes of this theory"
(Scan.succeed (Toplevel.keep (Class.print_classes o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_locale›
"print locale of this theory"
(Parse.opt_bang -- Parse.name_position >> (fn (show_facts, raw_name) =>
Toplevel.keep (fn state =>
let
val thy = Toplevel.theory_of state;
val ctxt = Toplevel.context_of state;
val name = Locale.check ctxt raw_name;
in Pretty.writeln (Locale.pretty_locale thy show_facts name) end)));
_ =
Outer_Syntax.command 🍋‹print_interps›
"print interpretations of locale for this theory or proof context"
(Parse.name_position >> (fn raw_name =>
Toplevel.keep (fn state =>
let
val thy = Toplevel.theory_of state;
val ctxt = Toplevel.context_of state;
val name = Locale.check ctxt raw_name;
in Pretty.writeln (Locale.pretty_registrations ctxt name) end)));
_ =
Outer_Syntax.command 🍋‹print_attributes›
"print attributes of this theory"
(Parse.opt_bang >> (fn b => Toplevel.keep (Attrib.print_attributes b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_simpset›
"print context of Simplifier"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Pretty.writeln o Simplifier.pretty_simpset b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_methods› "print methods of this theory"
(Parse.opt_bang >> (fn b => Toplevel.keep (Method.print_methods b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_antiquotations›
"print document antiquotations"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Document_Antiquotation.print_antiquotations b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_ML_antiquotations›
"print ML antiquotations"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (ML_Context.print_antiquotations b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹locale_deps› "visualize locale dependencies"
(Scan.succeed (Toplevel.keep (fn state =>
let
val thy = Toplevel.theory_of state;
val ctxt = Toplevel.context_of state;
in
Locale.pretty_locale_deps thy
|> map (fn {name, parents, body} =>
((name, Graph_Display.content_node (Locale.extern ctxt name) [body]), parents))
|> Graph_Display.display_graph_old
end)));
_ =
Outer_Syntax.command 🍋‹print_term_bindings›
"print term bindings of proof context"
(Scan.succeed
(Toplevel.keep
(Pretty.writeln o Pretty.chunks o Proof_Context.pretty_term_bindings o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_facts› "print facts of proof context"
(Parse.opt_bang >> (fn b =>
Toplevel.keep (Proof_Context.print_local_facts b o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_cases› "print cases of proof context"
(Scan.succeed
(Toplevel.keep
(Pretty.writeln o Pretty.chunks o Proof_Context.pretty_cases o Toplevel.context_of)));
_ =
Outer_Syntax.command 🍋‹print_statement›
"print theorems as long statements"
(opt_modes -- Parse.thms1 >> Isar_Cmd.print_stmts);
_ =
Outer_Syntax.command 🍋‹print_context_tracing›
"print result of context tracing from ML heap"
(Scan.repeat Parse.name_position >> (fn raw_names => Toplevel.keep (fn st =>
let
val pred =
if null raw_names then K true
else
let
val ctxt = Toplevel.context_of st;
val insert = Symset.insert o Context.theory_long_name o Thy_Info.check_theory ctxt;
val names = Symset.build (fold insert raw_names);
in Symset.member names o Context.theory_long_name o Context.theory_of end;
in Session.print_context_tracing pred end)));
_ =
Outer_Syntax.command 🍋‹print_state›
"print current proof state (if present)"
(opt_modes >> (fn modes =>
Toplevel.keep
(Print_Mode.with_modes modes
(Output.writelns o Pretty.strings_of o Pretty.chunks o Toplevel.pretty_state))));
_ =
Outer_Syntax.command 🍋‹thm_deps›
"print theorem dependencies (immediate non-transitive)"
(Parse.thms1 >> (fn args =>
Toplevel.keep (fn st =>
let val ctxt = Toplevel.context_of st
in Pretty.writeln (Thm_Deps.pretty_thm_deps ctxt (Attrib.eval_thms ctxt args)) end)));
_ =
Outer_Syntax.command 🍋‹thm_oracles›
"print all oracles used in theorems (full graph of transitive dependencies)"
(Parse.thms1 >> (fn args =>
Toplevel.keep (fn st =>
let
val ctxt = Toplevel.context_of st;
val thms = Attrib.eval_thms ctxt args;
in Pretty.writeln (Thm_Deps.pretty_thm_oracles ctxt thms) end)));
meta_mp:
assumes "PROP P ==> PROP Q" and "PROP P"
shows "PROP Q"
by (rule ‹PROP P ==> PROP Q› [OF ‹PROP P›])
meta_impE = meta_mp [elim_format]
meta_spec:
assumes "∧x. PROP P x"
shows "PROP P x"
by (rule ‹∧x. PROP P x›)
meta_allE = meta_spec [elim_format]
swap_params:
"(∧x y. PROP P x y) ≡ (∧y x. PROP P x y)" ..
equal_allI: ‹(∧x. PROP P x) ≡ (∧x. PROP Q x)› if ‹∧x. PROP P x ≡ PROP Q x›
by (simp only: that)
‹Meta-level conjunction›
all_conjunction:
"(∧x. PROP A x &&& PROP B x) ≡ ((∧x. PROP A x) &&& (∧x. PROP B x))"
assume conj: "∧x. PROP A x &&& PROP B x"
show "(∧x. PROP A x) &&& (∧x. PROP B x)"
proof -
fix x
from conj show "PROP A x" by (rule conjunctionD1)
from conj show "PROP B x" by (rule conjunctionD2)
qed
assume conj: "(∧x. PROP A x) &&& (∧x. PROP B x)"
fix x
show "PROP A x &&& PROP B x"
proof -
show "PROP A x" by (rule conj [THEN conjunctionD1, rule_format])
show "PROP B x" by (rule conj [THEN conjunctionD2, rule_format])
qed
imp_conjunction:
"(PROP A ==> PROP B &&& PROP C) ≡ ((PROP A ==> PROP B) &&& (PROP A yle='font-size: 18px;'>==> PROP C))"
assume conj: "PROP A ==> PROP B &&& PROP C"
show "(PROP A ==> PROP B) &&& (PROP A ==> PROP C)"
proof -
assume "PROP A"
from conj [OF ‹PROP A›] show "PROP B" by (rule conjunctionD1)
from conj [OF ‹PROP A›] show "PROP C" by (rule conjunctionD2)
qed
assume conj: "(PROP A ==> PROP B) &&& (PROP A ==> PROP C)"
assume "PROP A"
show "PROP B &&& PROP C"
proof -
from ‹PROP A› show "PROP B" by (rule conj [THEN conjunctionD1])
from ‹PROP A› show "PROP C" by (rule conj [THEN conjunctionD2])
qed
conjunction_imp:
"(PROP A &&& PROP B ==> PROP C) ≡ (PROP A ==> PROP B ==> PROP C)"
assume r: "PROP A &&& PROP B ==> PROP C"
assume ab: "PROP A" "PROP B"
show "PROP C"
proof (rule r)
from ab show "PROP A &&& PROP B" .
qed
assume r: "PROP A ==> PROP B ==> PROP C"
assume conj: "PROP A &&& PROP B"
show "PROP C"
proof (rule r)
from conj show "PROP A" by (rule conjunctionD1)
from conj show "PROP B" by (rule conjunctionD2)
qed
‹Misc›
constrain_space_syntax ― ‹type constraints with spacing›
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.