- [ (loc', flavour, name, typ, body) = theorem_cmd ->
- return_command loc (CommandAst.Theorem (loc', flavour, name, typ, body))
- | (loc') = proof_cmd -> return_command loc (CommandAst.Proof loc')
- | (loc, name) = qed_cmd -> return_command loc (CommandAst.Qed (loc, name))
- ]
- ];
- script_entry: [
- [ theorem = theorem_cmd;
- proof = OPT [
- proof_cmd; tacticals = LIST1 tactical0; qed = qed_cmd ->
- (tacticals, qed)
- ] ->
- let (loc', flavour, name', typ, body_verbatim) = theorem in
- let name'' =
- match proof with
- | None | Some (_, (_, None)) -> None
- | Some (_, (_, Some name)) -> Some name
- in
- let name =
- match (name', name'') with
- | Some name, None -> name
- | None, Some name -> name
- | None, None ->
- Stdpp.raise_with_loc loc (Failure "theorem's name is missing")
- | Some name', Some name'' when name' <> name'' ->
- Stdpp.raise_with_loc loc (Failure (sprintf
- "theorem's name mismatch: %s <> %s" name' name''))
- | Some name, _ -> name
- in
- let body =
- match (body_verbatim, proof) with
- | Some term, None -> CommandAst.Script.Verbatim (loc', term)
- | None, Some (tacticals, (loc'', _)) ->
- CommandAst.Script.Tactics (loc'', tacticals)
- | Some _, Some _ ->
- Stdpp.raise_with_loc loc (Failure (sprintf
- "theorem %s has too many proofs" name))
- | None, None ->
- Stdpp.raise_with_loc loc (Failure (sprintf
- "theorem %s has no proof" name))
- in
- return_script loc (CommandAst.Script.Theorem (flavour, name, typ, body))
+ [ [ IDENT "abort" | IDENT "Abort" ] -> return_command loc TacticAst.Abort
+ | [ IDENT "proof" | IDENT "Proof" ] -> return_command loc TacticAst.Proof
+ | [ IDENT "quit" | IDENT "Quit" ] -> return_command loc TacticAst.Quit
+ | [ IDENT "qed" | IDENT "Qed" ] ->
+ return_command loc (TacticAst.Qed None)
+ | [ IDENT "save" | IDENT "Save" ]; name = IDENT ->
+ return_command loc (TacticAst.Qed (Some name))
+ | flavour = theorem_flavour; name = OPT IDENT; SYMBOL ":"; typ = term;
+ body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
+ return_command loc (TacticAst.Theorem (flavour, name, typ, body))
+ | [ IDENT "goal" | IDENT "Goal" ]; typ = term;
+ body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
+ return_command loc (TacticAst.Theorem (`Goal, None, typ, body))
+ | [ IDENT "undo" | IDENT "Undo" ]; steps = OPT NUM ->
+ return_command loc (TacticAst.Undo (int_opt steps))
+ | [ IDENT "redo" | IDENT "Redo" ]; steps = OPT NUM ->
+ return_command loc (TacticAst.Redo (int_opt steps))
+ | [ IDENT "baseuri" | IDENT "Baseuri" ]; uri = OPT QSTRING ->
+ return_command loc (TacticAst.Baseuri uri)
+ | [ IDENT "check" | IDENT "Check" ]; t = term ->
+ return_command loc (TacticAst.Check t)