LSome of 'a
| LNone of G.loc
-type ast_statement =
- (N.term, N.term, N.term G.reduction, N.term N.obj, string) G.statement
+type ast_statement = G.statement
type 'status statement =
?never_include:bool ->
let loc,t = mk_rec_corec ind_kind defs loc in
G.NObj (loc,t)
-let mk_rec_corec ind_kind defs loc =
- let loc,t = mk_rec_corec ind_kind defs loc in
- G.Obj (loc,t)
-
+(*
let npunct_of_punct = function
| G.Branch loc -> G.NBranch loc
| G.Shift loc -> G.NShift loc
| G.Merge loc -> G.NMerge loc
| G.Semicolon loc -> G.NSemicolon loc
| G.Dot loc -> G.NDot loc
-;;
+;;
+
let nnon_punct_of_punct = function
| G.Skip loc -> G.NSkip loc
| G.Unfocus loc -> G.NUnfocus loc
| G.Focus (loc,l) -> G.NFocus (loc,l)
-;;
-let npunct_of_punct = function
- | G.Branch loc -> G.NBranch loc
- | G.Shift loc -> G.NShift loc
- | G.Pos (loc, i) -> G.NPos (loc, i)
- | G.Wildcard loc -> G.NWildcard loc
- | G.Merge loc -> G.NMerge loc
- | G.Semicolon loc -> G.NSemicolon loc
- | G.Dot loc -> G.NDot loc
-;;
+;; *)
+
let cons_ntac t p =
match t with
| G.NTactic(loc,[t]) -> G.NTactic(loc,[t;p])
| SYMBOL "*"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
]
];
+(*
tactic: [
[ IDENT "absurd"; t = tactic_term ->
G.Absurd (loc, t)
| IDENT "symmetry" ->
G.Symmetry loc
| IDENT "transitivity"; t = tactic_term ->
- G.Transitivity (loc, t)
+ G.Transitivity (loc, t)
(* Produzioni Aggiunte *)
| IDENT "assume" ; id = IDENT ; SYMBOL ":" ; t = tactic_term ->
G.Assume (loc, id, t)
| IDENT "proof" -> `Proof
| params = auto_params -> `Auto params];
cont = rewriting_step_continuation ->
- G.RewritingStep(loc, None, t1, t2, cont)
- ]
-];
+ G.RewritingStep(loc, None, t1, t2, cont)
+ ]
+]; *)
auto_fixed_param: [
[ IDENT "demod"
| IDENT "fast_paramod"
]
];
+(*
inline_params:[
[ params = LIST0
[ IDENT "prefix"; SYMBOL "="; prefix = QSTRING -> G.IPPrefix prefix
| IDENT "cr" -> G.IPCR
] -> params
]
-];
+];*)
by_continuation: [
[ WEPROVED; ty = tactic_term ; LPAREN ; id = IDENT ; RPAREN ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] -> BYC_weproved (ty,Some id,t1)
| WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
| -> false
]
];
+(*
atomic_tactical:
[ "sequence" LEFTA
[ t1 = SELF; SYMBOL ";"; t2 = SELF ->
| tac = tactic -> tac
]
];
+*)
npunctuation_tactical:
[
[ SYMBOL "[" -> G.NBranch loc
| SYMBOL "." -> G.NDot loc
]
];
+(*
punctuation_tactical:
[
[ SYMBOL "[" -> G.Branch loc
| IDENT "skip" -> G.Skip loc
]
];
+*)
+ nnon_punctuation_tactical:
+ [ "simple" NONA
+ [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
+ | IDENT "unfocus" -> G.NUnfocus loc
+ | IDENT "skip" -> G.NSkip loc
+ ]
+ ];
ntheorem_flavour: [
[ [ IDENT "ndefinition" ] -> `Definition
| [ IDENT "nfact" ] -> `Fact
(params,name,typ,fields)
] ];
- macro: [
- [ [ IDENT "check" ]; t = term ->
- G.Check (loc, t)
- | [ IDENT "eval" ]; kind = reduction_kind; "on"; t = tactic_term ->
- G.Eval (loc, kind, t)
- | IDENT "inline"; suri = QSTRING; params = inline_params ->
- G.Inline (loc, suri, params)
- | [ IDENT "hint" ]; rew = OPT (IDENT "rewrite") ->
- if rew = None then G.Hint (loc, false) else G.Hint (loc,true)
- | IDENT "auto"; params = auto_params ->
- G.AutoInteractive (loc,params)
- ]
- ];
alias_spec: [
[ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
let alpha = "[a-zA-Z]" in
List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
]];
- grafite_command: [ [
- IDENT "set"; n = QSTRING; v = QSTRING ->
- G.Set (loc, n, v)
- | IDENT "drop" -> G.Drop loc
- | IDENT "print"; s = IDENT -> G.Print (loc,s)
- | IDENT "qed" -> G.Qed loc
- | IDENT "variant" ; name = IDENT; SYMBOL ":";
- typ = term; SYMBOL <:unicode<def>> ; newname = IDENT ->
- G.Obj (loc,
- N.Theorem
- (`Variant,name,typ,Some (N.Ident (newname, None)), `Regular))
- | flavour = theorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
- body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
- G.Obj (loc, N.Theorem (flavour, name, typ, body,`Regular))
- | flavour = theorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
- body = term ->
- G.Obj (loc,
- N.Theorem (flavour, name, N.Implicit `JustOne, Some body,`Regular))
- | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
- G.Obj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
- | LETCOREC ; defs = let_defs ->
- mk_rec_corec `CoInductive defs loc
- | LETREC ; defs = let_defs ->
- mk_rec_corec `Inductive defs loc
- | IDENT "inductive"; spec = inductive_spec ->
- let (params, ind_types) = spec in
- G.Obj (loc, N.Inductive (params, ind_types))
- | IDENT "coinductive"; 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
- G.Obj (loc, N.Inductive (params, ind_types))
- | IDENT "coercion" ;
- t = [ u = URI -> N.Uri (u,None) | t = tactic_term ; OPT "with" -> t ] ;
- arity = OPT int ; saturations = OPT int;
- composites = OPT (IDENT "nocomposites") ->
- let arity = match arity with None -> 0 | Some x -> x in
- let saturations = match saturations with None -> 0 | Some x -> x in
- let composites = match composites with None -> true | Some _ -> false in
- G.Coercion
- (loc, t, composites, arity, saturations)
- | IDENT "prefer" ; IDENT "coercion"; t = tactic_term ->
- G.PreferCoercion (loc, t)
- | IDENT "pump" ; steps = int ->
- G.Pump(loc,steps)
- | IDENT "inverter"; name = IDENT; IDENT "for";
- indty = tactic_term; paramspec = inverter_param_list ->
- G.Inverter
- (loc, name, indty, paramspec)
- | IDENT "record" ; (params,name,ty,fields) = record_spec ->
- G.Obj (loc, N.Record (params,name,ty,fields))
- | IDENT "default" ; what = QSTRING ; uris = LIST1 URI ->
- let uris = List.map UriManager.uri_of_string uris in
- G.Default (loc,what,uris)
- | IDENT "relation" ; aeq = tactic_term ; "on" ; a = tactic_term ;
- refl = OPT [ IDENT "reflexivity" ; IDENT "proved" ; IDENT "by" ;
- refl = tactic_term -> refl ] ;
- sym = OPT [ IDENT "symmetry" ; IDENT "proved" ; IDENT "by" ;
- sym = tactic_term -> sym ] ;
- trans = OPT [ IDENT "transitivity" ; IDENT "proved" ; IDENT "by" ;
- trans = tactic_term -> trans ] ;
- "as" ; id = IDENT ->
- G.Relation (loc,id,a,aeq,refl,sym,trans)
- ]];
lexicon_command: [ [
IDENT "alias" ; spec = alias_spec ->
L.Alias (loc, spec)
L.Interpretation (loc, id, (symbol, args), l3)
]];
executable: [
- [ cmd = grafite_command; SYMBOL "." -> G.Command (loc, cmd)
- | ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
- | tac = atomic_tactical LEVEL "loops"; punct = punctuation_tactical ->
- G.Tactic (loc, Some tac, punct)
- | punct = punctuation_tactical -> G.Tactic (loc, None, punct)
+ [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
+(* | tac = atomic_tactical LEVEL "loops"; punct = punctuation_tactical ->
+ G.Tactic (loc, Some tac, punct) *)
+(* | punct = punctuation_tactical -> G.Tactic (loc, None, punct) *)
| tac = ntactic; OPT [ SYMBOL "#" ; SYMBOL "#" ] ;
- punct = punctuation_tactical ->
- cons_ntac tac (npunct_of_punct punct)
+ punct = npunctuation_tactical -> cons_ntac tac punct
(*
| tac = ntactic; punct = punctuation_tactical ->
cons_ntac tac (npunct_of_punct punct)
*)
| SYMBOL "#" ; SYMBOL "#" ; punct = npunctuation_tactical ->
G.NTactic (loc, [punct])
- | tac = non_punctuation_tactical; punct = punctuation_tactical ->
- G.NonPunctuationTactical (loc, tac, punct)
- | SYMBOL "#" ; SYMBOL "#" ; tac = non_punctuation_tactical;
- SYMBOL "#" ; SYMBOL "#" ; punct = punctuation_tactical ->
- G.NTactic (loc, [nnon_punct_of_punct tac; npunct_of_punct punct])
- | SYMBOL "#" ; SYMBOL "#" ; tac = non_punctuation_tactical;
- punct = punctuation_tactical ->
- G.NTactic (loc, [nnon_punct_of_punct tac; npunct_of_punct punct])
- | mac = macro; SYMBOL "." -> G.Macro (loc, mac)
+ | SYMBOL "#" ; SYMBOL "#" ; tac = nnon_punctuation_tactical;
+ SYMBOL "#" ; SYMBOL "#" ; punct = npunctuation_tactical ->
+ G.NTactic (loc, [tac; punct])
+ | SYMBOL "#" ; SYMBOL "#" ; tac = nnon_punctuation_tactical;
+ punct = npunctuation_tactical ->
+ G.NTactic (loc, [tac; punct])
]
];
comment: [
begin
let stm =
G.Executable
- (loc, G.Command (loc, G.Include (iloc,normal,`OldAndNew,fname))) in
+ (loc, G.Command (loc, G.Include (iloc,fname))) in
!grafite_callback stm;
let status =
LE.eval_command status (L.Include (iloc,buri,mode,fullpath)) in
let stm =
G.Executable
- (loc,G.Command (loc,G.Include (iloc,normal,`OldAndNew,buri)))
+ (loc,G.Command (loc,G.Include (iloc,buri)))
in
status, LSome stm
end