src/Pure/Isar/isar_syn.ML
changeset 12006 72fd225a5aa2
parent 11890 28e42a90bea8
child 12044 d6294ebfff24
equal deleted inserted replaced
12005:291593391010 12006:72fd225a5aa2
   282 
   282 
   283 (** proof commands **)
   283 (** proof commands **)
   284 
   284 
   285 (* statements *)
   285 (* statements *)
   286 
   286 
   287 fun statement f = P.opt_thm_name ":" -- P.propp -- P.marg_comment >> f;
   287 val locale = Scan.option (P.$$$ "(" |-- P.!!! (P.$$$ "in" |-- P.xname --| P.$$$ ")"));
       
   288 val statement = P.opt_thm_name ":" -- P.propp -- P.marg_comment;
   288 
   289 
   289 val theoremP =
   290 val theoremP =
   290   OuterSyntax.command "theorem" "state theorem" K.thy_goal
   291   OuterSyntax.command "theorem" "state theorem" K.thy_goal
   291     (statement (IsarThy.theorem Drule.theoremK) >> (Toplevel.print oo Toplevel.theory_to_proof));
   292     (locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o
       
   293       uncurry (IsarThy.theorem Drule.theoremK)));
   292 
   294 
   293 val lemmaP =
   295 val lemmaP =
   294   OuterSyntax.command "lemma" "state lemma" K.thy_goal
   296   OuterSyntax.command "lemma" "state lemma" K.thy_goal
   295     (statement (IsarThy.theorem Drule.lemmaK) >> (Toplevel.print oo Toplevel.theory_to_proof));
   297     (locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o
       
   298       uncurry (IsarThy.theorem Drule.lemmaK)));
   296 
   299 
   297 val corollaryP =
   300 val corollaryP =
   298   OuterSyntax.command "corollary" "state corollary" K.thy_goal
   301   OuterSyntax.command "corollary" "state corollary" K.thy_goal
   299     (statement (IsarThy.theorem Drule.corollaryK) >> (Toplevel.print oo Toplevel.theory_to_proof));
   302     (locale -- statement >> ((Toplevel.print oo Toplevel.theory_to_proof) o
       
   303       uncurry (IsarThy.theorem Drule.corollaryK)));
   300 
   304 
   301 val showP =
   305 val showP =
   302   OuterSyntax.command "show" "state local goal, solving current obligation" K.prf_goal
   306   OuterSyntax.command "show" "state local goal, solving current obligation" K.prf_goal
   303     (statement IsarThy.show >> (fn f => Toplevel.print o Toplevel.proof' f));
   307     (statement >> ((Toplevel.print oo Toplevel.proof') o IsarThy.show));
   304 
   308 
   305 val haveP =
   309 val haveP =
   306   OuterSyntax.command "have" "state local goal" K.prf_goal
   310   OuterSyntax.command "have" "state local goal" K.prf_goal
   307     (statement IsarThy.have >> (fn f => Toplevel.print o Toplevel.proof f));
   311     (statement >> ((Toplevel.print oo Toplevel.proof) o  IsarThy.have));
   308 
   312 
   309 val thusP =
   313 val thusP =
   310   OuterSyntax.command "thus" "abbreviates \"then show\"" K.prf_goal
   314   OuterSyntax.command "thus" "abbreviates \"then show\"" K.prf_goal
   311     (statement IsarThy.thus >> (fn f => Toplevel.print o Toplevel.proof' f));
   315     (statement >> ((Toplevel.print oo Toplevel.proof') o IsarThy.thus));
   312 
   316 
   313 val henceP =
   317 val henceP =
   314   OuterSyntax.command "hence" "abbreviates \"then have\"" K.prf_goal
   318   OuterSyntax.command "hence" "abbreviates \"then have\"" K.prf_goal
   315     (statement IsarThy.hence >> (fn f => Toplevel.print o Toplevel.proof f));
   319     (statement >> ((Toplevel.print oo Toplevel.proof) o IsarThy.hence));
   316 
   320 
   317 
   321 
   318 (* facts *)
   322 (* facts *)
   319 
   323 
   320 val facts = P.and_list1 (P.xthms1 -- P.marg_comment);
   324 val facts = P.and_list1 (P.xthms1 -- P.marg_comment);