]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/acic_procedural/proceduralTypes.ml
- Procedural: generation of "exact" is now complete
[helm.git] / helm / software / components / acic_procedural / proceduralTypes.ml
index b194fbfa9fd9f5afce2bfa3f6384ec6d660ab85c..b30d6e86255c76486d85e0ce2c675bb7d162796d 100644 (file)
@@ -74,11 +74,13 @@ type step = Note of note
          | Statement of flavour * name * what * body * note
           | Qed of note
          | Id of note
+         | Exact of what * note
          | Intros of count option * name list * note
          | Cut of name * what * note
          | LetIn of name * what * note
          | Rewrite of how * what * where * pattern * note
          | Elim of what * using option * pattern * note
+         | Cases of what * pattern * note
          | Apply of what * note
          | Change of inferred * what * where * pattern * note 
          | Clear of hyp list * note
@@ -165,6 +167,10 @@ let mk_id punctation =
    let tactic = G.IdTac floc in
    mk_tactic tactic punctation
 
+let mk_exact t punctation =
+   let tactic = G.Exact (floc, t) in
+   mk_tactic tactic punctation
+
 let mk_intros xi xids punctation =
    let tactic = G.Intros (floc, (xi, xids)) in
    mk_tactic tactic punctation
@@ -194,6 +200,11 @@ let mk_elim what using pattern punctation =
    let tactic = G.Elim (floc, what, using, pattern, (Some 0, [])) in
    mk_tactic tactic punctation
 
+let mk_cases what pattern punctation =
+   let pattern = None, [], Some pattern in
+   let tactic = G.Cases (floc, what, pattern, (Some 0, [])) in
+   mk_tactic tactic punctation
+
 let mk_apply t punctation =
    let tactic = G.ApplyP (floc, t) in
    mk_tactic tactic punctation
@@ -233,12 +244,14 @@ let rec render_step sep a = function
    | Statement (f, n, t, v, s) -> mk_statement f n t v :: mk_thnote s a 
    | Inductive (lps, ts, s)    -> mk_inductive lps ts :: mk_thnote s a
    | Qed s                     -> mk_qed :: mk_tacnote s a
+   | Exact (t, s)              -> mk_exact t sep :: mk_tacnote s a   
    | Id s                      -> mk_id sep :: mk_tacnote s a
    | Intros (c, ns, s)         -> mk_intros c ns sep :: mk_tacnote s a
    | Cut (n, t, s)             -> mk_cut n t sep :: mk_tacnote s a
    | LetIn (n, t, s)           -> mk_letin n t sep :: mk_tacnote s a
    | Rewrite (b, t, w, e, s)   -> mk_rewrite b t w e sep :: mk_tacnote s a
    | Elim (t, xu, e, s)        -> mk_elim t xu e sep :: mk_tacnote s a
+   | Cases (t, e, s)           -> mk_cases t e sep :: mk_tacnote s a
    | Apply (t, s)              -> mk_apply t sep :: mk_tacnote s a
    | Change (t, _, w, e, s)    -> mk_change t w e sep :: mk_tacnote s a
    | Clear (ns, s)             -> mk_clear ns sep :: mk_tacnote s a
@@ -266,30 +279,41 @@ let render_steps a = render_steps mk_dot a
 
 let rec count_step a = function
    | Note _
-   | Statement _  
-   | Qed _           -> a
-   | Branch (pps, _) -> List.fold_left count_steps a pps
-   | _               -> succ a   
+   | Statement _
+   | Inductive _
+   | Qed _
+(* level 0 *)   
+   | Intros (Some 0, [], _)
+   | Id _
+   | Exact _
+   | Change _
+   | Clear _
+   | ClearBody _            -> a
+   | Branch (pps, _)        -> List.fold_left count_steps a pps
+(* level 1 *)   
+   | _                      -> succ a   
 
 and count_steps a = List.fold_left count_step a
 
+let count = I.count_nodes ~meta:false
+
 let rec count_node a = function
    | Note _
    | Inductive _
    | Statement _
-   | Qed _
+   | Qed _   
    | Id _
    | Intros _
    | Clear _
    | ClearBody _             -> a
+   | Exact (t, _) 
    | Cut (_, t, _)
    | LetIn (_, t, _)
-   | Apply (t, _)            -> I.count_nodes a (H.cic t)
+   | Apply (t, _)            -> count a (H.cic t)
    | Rewrite (_, t, _, p, _)
    | Elim (t, _, p, _)
-   | Change (t, _, _, p, _)  -> 
-      let a = I.count_nodes a (H.cic t) in
-      I.count_nodes a (H.cic p) 
+   | Cases (t, p, _)
+   | Change (t, _, _, p, _)  -> let a = count a (H.cic t) in count a (H.cic p) 
    | Branch (ss, _)          -> List.fold_left count_nodes a ss
 
 and count_nodes a = List.fold_left count_node a