src/Pure/Isar/isar_syn.ML
changeset 5937 a777d702e81f
parent 5924 b9d5f5901b59
child 5944 dcc446da8e19
equal deleted inserted replaced
5936:406eb27fe53c 5937:a777d702e81f
   244 
   244 
   245 (** proof commands **)
   245 (** proof commands **)
   246 
   246 
   247 (* statements *)
   247 (* statements *)
   248 
   248 
   249 fun statement f = opt_thm_name ":" -- prop >> (fn ((x, y), z) => f x y z);
   249 val is_props = $$$ "(" |-- !!! (Scan.repeat1 ($$$ "is" |-- prop) --| $$$ ")");
       
   250 val propp = prop -- Scan.optional is_props [];
       
   251 fun statement f = opt_thm_name ":" -- propp >> (fn ((x, y), z) => f x y z);
   250 
   252 
   251 val theoremP =
   253 val theoremP =
   252   OuterSyntax.parser false "theorem" "state theorem"
   254   OuterSyntax.parser false "theorem" "state theorem"
   253     (statement IsarThy.theorem >> (fn f => Toplevel.print o Toplevel.theory_to_proof f));
   255     (statement IsarThy.theorem >> (fn f => Toplevel.print o Toplevel.theory_to_proof f));
   254 
   256 
   282 
   284 
   283 (* proof context *)
   285 (* proof context *)
   284 
   286 
   285 val assumeP =
   287 val assumeP =
   286   OuterSyntax.parser false "assume" "assume propositions"
   288   OuterSyntax.parser false "assume" "assume propositions"
   287     (opt_thm_name ":" -- Scan.repeat1 prop >>
   289     (opt_thm_name ":" -- Scan.repeat1 propp >>
   288       (fn ((x, y), z) => Toplevel.print o Toplevel.proof (IsarThy.assume x y z)));
   290       (fn ((x, y), z) => Toplevel.print o Toplevel.proof (IsarThy.assume x y z)));
   289 
   291 
   290 val fixP =
   292 val fixP =
   291   OuterSyntax.parser false "fix" "fix variables (Skolem constants)"
   293   OuterSyntax.parser false "fix" "fix variables (Skolem constants)"
   292     (Scan.repeat1 (name -- Scan.option ($$$ "::" |-- typ))
   294     (Scan.repeat1 (name -- Scan.option ($$$ "::" |-- typ))
   293       >> (fn xs => Toplevel.print o Toplevel.proof (IsarThy.fix xs)));
   295       >> (fn xs => Toplevel.print o Toplevel.proof (IsarThy.fix xs)));
   294 
   296 
   295 val letP =
   297 val letP =
   296   OuterSyntax.parser false "let" "bind text variables"
   298   OuterSyntax.parser false "let" "bind text variables"
   297     (enum1 "and" (term -- ($$$ "=" |-- term))
   299     (enum1 "and" (enum1 "as" term -- ($$$ "=" |-- term))
   298       >> (fn bs => Toplevel.print o Toplevel.proof (IsarThy.match_bind bs)));
   300       >> (fn bs => Toplevel.print o Toplevel.proof (IsarThy.match_bind bs)));
   299 
   301 
   300 
   302 
   301 (* proof structure *)
   303 (* proof structure *)
   302 
   304 
   480 (*keep keywords consistent with the parsers, including those in
   482 (*keep keywords consistent with the parsers, including those in
   481   outer_parse.ML, otherwise be prepared for unexpected errors*)
   483   outer_parse.ML, otherwise be prepared for unexpected errors*)
   482 
   484 
   483 val keywords =
   485 val keywords =
   484  ["(", ")", "*", "+", ",", ":", "::", ";", "<", "<=", "=", "==", "=>",
   486  ["(", ")", "*", "+", ",", ":", "::", ";", "<", "<=", "=", "==", "=>",
   485   "?", "[", "]", "and", "binder", "infixl", "infixr", "mixfix", "output",
   487   "?", "[", "]", "and", "as", "binder", "infixl", "infixr", "is",
   486   "{", "|", "}"];
   488   "mixfix", "output", "{", "|", "}"];
   487 
   489 
   488 val parsers = [
   490 val parsers = [
   489   (*theory structure*)
   491   (*theory structure*)
   490   contextP, theoryP, endP,
   492   contextP, theoryP, endP,
   491   (*theory sections*)
   493   (*theory sections*)