let default_associativity = Gramext.NonA
-let mk_rec_corec ind_kind defs loc =
+let mk_rec_corec ng ind_kind defs loc =
(* In case of mutual definitions here we produce just
the syntax tree for the first one. The others will be
generated from the completely specified term just before
else
`MutualDefinition
in
- GrafiteAst.Obj (loc, Ast.Theorem(flavour, name, ty,
+ if ng then
+ GrafiteAst.NObj (loc, Ast.Theorem(flavour, name, ty,
+ Some (Ast.LetRec (ind_kind, defs, body))))
+ else
+ GrafiteAst.Obj (loc, Ast.Theorem(flavour, name, ty,
Some (Ast.LetRec (ind_kind, defs, body))))
type by_continuation =
]
];
ntheorem_flavour: [
- [ [ IDENT "ntheorem" ] -> `Theorem
+ [ [ IDENT "ndefinition" ] -> `Definition
+ | [ IDENT "nfact" ] -> `Fact
+ | [ IDENT "nlemma" ] -> `Lemma
+ | [ IDENT "nremark" ] -> `Remark
+ | [ IDENT "ntheorem" ] -> `Theorem
]
];
theorem_flavour: [
Ast.Theorem (flavour, name, Ast.Implicit, Some body))
| IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
GrafiteAst.Obj (loc, Ast.Theorem (`Axiom, name, typ, None))
+ | IDENT "naxiom"; name = IDENT; SYMBOL ":"; typ = term ->
+ GrafiteAst.NObj (loc, Ast.Theorem (`Axiom, name, typ, None))
| LETCOREC ; defs = let_defs ->
- mk_rec_corec `CoInductive defs loc
+ mk_rec_corec false `CoInductive defs loc
| LETREC ; defs = let_defs ->
- mk_rec_corec `Inductive defs loc
+ mk_rec_corec false `Inductive defs loc
+ | NLETCOREC ; defs = let_defs ->
+ mk_rec_corec true `CoInductive defs loc
+ | NLETREC ; defs = let_defs ->
+ mk_rec_corec true `Inductive defs loc
| IDENT "inductive"; spec = inductive_spec ->
let (params, ind_types) = spec in
GrafiteAst.Obj (loc, Ast.Inductive (params, ind_types))
+ | IDENT "ninductive"; spec = inductive_spec ->
+ let (params, ind_types) = spec in
+ GrafiteAst.NObj (loc, Ast.Inductive (params, ind_types))
| IDENT "coinductive"; spec = inductive_spec ->
let (params, ind_types) = spec in
let ind_types = (* set inductive flags to false (coinductive) *)
ind_types
in
GrafiteAst.Obj (loc, Ast.Inductive (params, ind_types))
+ | IDENT "ncoinductive"; spec = inductive_spec ->
+ let (params, ind_types) = spec in
+ let ind_types = (* set inductive flags to false (coinductive) *)
+ List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
+ ind_types
+ in
+ GrafiteAst.NObj (loc, Ast.Inductive (params, ind_types))
| IDENT "coercion" ;
t = [ u = URI -> Ast.Uri (u,None) | t = tactic_term ; OPT "with" -> t ] ;
arity = OPT int ; saturations = OPT int;