src/Pure/Isar/isar_syn.ML
changeset 6404 2daaf2943c79
parent 6370 e71ac23a9111
child 6501 392333eb31cb
equal deleted inserted replaced
6403:86e9d24f4238 6404:2daaf2943c79
    31   OuterSyntax.command "theory" "begin theory"
    31   OuterSyntax.command "theory" "begin theory"
    32     (OuterSyntax.theory_header >> (Toplevel.print oo IsarThy.theory));
    32     (OuterSyntax.theory_header >> (Toplevel.print oo IsarThy.theory));
    33 
    33 
    34 (*end current theory / sub-proof / excursion*)
    34 (*end current theory / sub-proof / excursion*)
    35 val endP =
    35 val endP =
    36   OuterSyntax.command "end" "end current theory / sub-proof / excursion"
    36   OuterSyntax.command "end" "end current block / theory / excursion"
    37     (Scan.succeed (Toplevel.print o Toplevel.exit o Toplevel.proof IsarThy.end_block));
    37     (Scan.succeed (Toplevel.print o Toplevel.exit o Toplevel.proof IsarThy.end_block));
    38 
    38 
    39 val contextP =
    39 val contextP =
    40   OuterSyntax.improper_command "context" "switch theory context"
    40   OuterSyntax.improper_command "context" "switch theory context"
    41     (name >> (Toplevel.print oo IsarThy.context));
    41     (name >> (Toplevel.print oo IsarThy.context));
   306     (Scan.succeed (Toplevel.print o Toplevel.proof IsarThy.next_block));
   306     (Scan.succeed (Toplevel.print o Toplevel.proof IsarThy.next_block));
   307 
   307 
   308 
   308 
   309 (* end proof *)
   309 (* end proof *)
   310 
   310 
   311 val qedP =
       
   312   OuterSyntax.command "qed" "conclude proof"
       
   313     (Scan.succeed (Toplevel.proof_to_theory IsarThy.qed));
       
   314 
       
   315 val qed_withP =
       
   316   OuterSyntax.improper_command "qed_with" "conclude proof, may patch name and attributes"
       
   317     (Scan.option name -- Scan.option attribs >> (Toplevel.proof_to_theory o IsarThy.qed_with));
       
   318 
       
   319 val kill_proofP =
   311 val kill_proofP =
   320   OuterSyntax.improper_command "kill" "abort current proof"
   312   OuterSyntax.improper_command "kill" "abort current proof"
   321     (Scan.succeed (Toplevel.print o Toplevel.proof_to_theory IsarThy.kill_proof));
   313     (Scan.succeed (Toplevel.print o Toplevel.proof_to_theory IsarThy.kill_proof));
   322 
   314 
   323 
   315 val qed_withP =
   324 (* proof steps *)
   316   OuterSyntax.improper_command "qed_with" "conclude proof, may patch name and attributes"
   325 
   317     (Scan.option name -- Scan.option attribs -- Scan.option method
   326 fun gen_stepP meth int name cmt f =
   318       >> (uncurry IsarThy.global_qed_with));
   327   OuterSyntax.parser int name cmt
   319 
   328     (meth >> (fn txt => Toplevel.print o Toplevel.proof (f txt)));
   320 val qedP =
   329 
   321   OuterSyntax.command "qed" "conclude (sub-)proof"
   330 val stepP = gen_stepP method;
   322     (Scan.option method >> IsarThy.qed);
   331 
   323 
   332 val refineP = stepP true "refine" "unstructured backward proof step, ignoring facts" IsarThy.tac;
   324 val terminal_proofP =
   333 val then_refineP =
   325   OuterSyntax.command "by" "terminal backward proof"
   334   stepP true "then_refine" "unstructured backward proof step, using facts" IsarThy.then_tac;
   326     (method >> (Toplevel.print oo IsarThy.terminal_proof));
   335 
       
   336 
       
   337 val proofP = gen_stepP (Scan.option method) false "proof" "backward proof" IsarThy.proof;
       
   338 val terminal_proofP = stepP false "by" "terminal backward proof" IsarThy.terminal_proof;
       
   339 
   327 
   340 val immediate_proofP =
   328 val immediate_proofP =
   341   OuterSyntax.command "." "immediate proof"
   329   OuterSyntax.command "." "immediate proof"
   342     (Scan.succeed (Toplevel.print o Toplevel.proof IsarThy.immediate_proof));
   330     (Scan.succeed (Toplevel.print o IsarThy.immediate_proof));
   343 
   331 
   344 val default_proofP =
   332 val default_proofP =
   345   OuterSyntax.command ".." "default proof"
   333   OuterSyntax.command ".." "default proof"
   346     (Scan.succeed (Toplevel.print o Toplevel.proof IsarThy.default_proof));
   334     (Scan.succeed (Toplevel.print o IsarThy.default_proof));
       
   335 
       
   336 
       
   337 (* proof steps *)
       
   338 
       
   339 val refineP =
       
   340   OuterSyntax.improper_command "refine" "unstructured backward proof step, ignoring facts"
       
   341     (method >> (Toplevel.print oo (Toplevel.proof o IsarThy.tac)));
       
   342 
       
   343 val then_refineP =
       
   344   OuterSyntax.improper_command "then_refine" "unstructured backward proof step, using facts"
       
   345     (method >> (Toplevel.print oo (Toplevel.proof o IsarThy.then_tac)));
       
   346 
       
   347 val proofP =
       
   348   OuterSyntax.command "proof" "backward proof"
       
   349     (Scan.option method >> (Toplevel.print oo (Toplevel.proof o IsarThy.proof)));
   347 
   350 
   348 
   351 
   349 (* proof history *)
   352 (* proof history *)
   350 
   353 
   351 val clear_undoP =
   354 val clear_undoP =
   505   setupP, parse_ast_translationP, parse_translationP,
   508   setupP, parse_ast_translationP, parse_translationP,
   506   print_translationP, typed_print_translationP,
   509   print_translationP, typed_print_translationP,
   507   print_ast_translationP, token_translationP, oracleP,
   510   print_ast_translationP, token_translationP, oracleP,
   508   (*proof commands*)
   511   (*proof commands*)
   509   theoremP, lemmaP, showP, haveP, assumeP, fixP, letP, thenP, fromP,
   512   theoremP, lemmaP, showP, haveP, assumeP, fixP, letP, thenP, fromP,
   510   factsP, beginP, nextP, qedP, qed_withP, kill_proofP, refineP,
   513   factsP, beginP, nextP, kill_proofP, qed_withP, qedP,
   511   then_refineP, proofP, terminal_proofP, immediate_proofP,
   514   terminal_proofP, immediate_proofP, default_proofP, refineP,
   512   default_proofP, clear_undoP, undoP, redoP, undosP, redosP, backP,
   515   then_refineP, proofP, clear_undoP, undoP, redoP, undosP, redosP,
   513   prevP, upP, topP,
   516   backP, prevP, upP, topP,
   514   (*diagnostic commands*)
   517   (*diagnostic commands*)
   515   print_commandsP, print_theoryP, print_syntaxP, print_attributesP,
   518   print_commandsP, print_theoryP, print_syntaxP, print_attributesP,
   516   print_methodsP, print_theoremsP, print_bindsP, print_lthmsP,
   519   print_methodsP, print_theoremsP, print_bindsP, print_lthmsP,
   517   print_thmsP, print_propP, print_termP, print_typeP,
   520   print_thmsP, print_propP, print_termP, print_typeP,
   518   (*system commands*)
   521   (*system commands*)