let optimize_obj = function
| C.Constant (name, Some bo, ty, pars, attrs) ->
- let count_nodes = I.count_nodes ~implicit:false 0 in
+ let count_nodes = I.count_nodes ~meta:false 0 in
let st, c = {info = ""; dummy = ()}, [] in
let bo, ty = H.cic_bc c bo, H.cic_bc c ty in
let g st bo =
| C.AImplicit _ -> assert false
| C.AAppl (_, []) -> assert false
-and xats frm vs =
- let map v = F.fprintf frm "{%a}" xat v in
- List.iter map vs
+and xats frm = function
+ | [] -> F.fprintf frm "{}"
+ | vs ->
+ let map v = F.fprintf frm "{%a}" xat v in
+ List.iter map vs
in
xat frm t
and count_steps a = List.fold_left count_step a
-let count = I.count_nodes ~implicit:false
+let count = I.count_nodes ~meta:false
let rec count_node a = function
| Note _
let g a = a in
aux g t S.empty
-let count_nodes ~implicit n t =
+let count_nodes ~meta n t =
+ let offset = if meta then 1 else 0 in
let rec aux n = function
- | C.Implicit _ -> if implicit then succ n else n
+ | C.Implicit _ -> offset + n
| C.Sort _
| C.Rel _ -> succ n
- | C.Appl ts -> List.fold_left aux (succ n) ts
+ | C.Appl ts ->
+ List.fold_left aux (List.length ts - 1 + n) ts
| C.Const (_, ss)
| C.MutConstruct (_, _, _, ss)
| C.MutInd (_, _, ss)
| None -> n
| Some t -> aux n t
in
- List.fold_left map (succ n) ss
- | C.Cast (t1, t2)
+ List.fold_left map (n + offset) ss
+ | C.Cast (t1, t2) -> aux (aux (offset + n) t2) t1
| C.Lambda (_, t1, t2)
| C.Prod (_, t1, t2) -> aux (aux (succ n) t2) t1
- | C.LetIn (_, t1, ty, t2) -> aux (aux (aux (succ n) t2) ty) t1
+ | C.LetIn (_, t1, ty, t2) -> aux (aux (aux (offset + 1 + n) t2) ty) t1
| C.MutCase (_, _, t1, t2, ss) ->
- aux (aux (List.fold_left aux (succ n) ss) t2) t1
+ aux (aux (List.fold_left aux (offset + 1 + n) ss) t2) t1
| C.Fix (_, ss) ->
let map n (_, _, t1, t2) = aux (aux n t2) t1 in
- List.fold_left map (succ n) ss
+ List.fold_left map (2 + n) ss
| C.CoFix (_, ss) ->
let map n (_, t1, t2) = aux (aux n t2) t1 in
- List.fold_left map (succ n) ss
+ List.fold_left map (2 + n) ss
in
aux n t
val get_mutinds_of_uri: UriManager.uri -> Cic.term -> S.t
-(* count_nodes n t returns n + the number of nodes in t *)
-(* Cic.Implict nodes are counted if ~implicit:true *)
-val count_nodes: implicit:bool -> int -> Cic.term -> int
+(* count_nodes n t returns n + the number of nodes in t *)
+(* implicits, metas and casts are counted if ~meta:true *)
+(* if ~meta:false, complies with *)
+(* F.Guidi: Procedural representation of CIC Proof Terms. Last version *)
+val count_nodes: meta:bool -> int -> Cic.term -> int
(* *)
(**************************************************************************)
-include "Legacy-1/definitions.ma".
+include "Legacy-1/theory.ma".
default "equality"
cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/eq.ind
interpretation "Coq 7.3.1 exists" 'exists \eta.x = (cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/ex.ind#xpointer(1/1) _ x).
interpretation "Coq 7.3.1 natural 'less or equal to'" 'leq x y = (cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/le.ind#xpointer(1/1) x y).
interpretation "Coq 7.3.1 natural 'less than'" 'lt x y = (cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/lt.con x y).
-interpretation "Coq 7.3.1 leibnitz's equality" 'eq x y = (cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/eq.ind#xpointer(1/1) _ x y).
+interpretation "Coq 7.3.1 leibnitz's equality" 'eq t x y = (cic:/matita/LAMBDA-TYPES/Legacy-1/coq/defs/eq.ind#xpointer(1/1) t x y).
alias symbol "plus" = "Coq 7.3.1 natural plus".
alias symbol "minus" = "Coq 7.3.1 natural minus".
| t1: \forall i. P i \to T (i * 3)
| t2: \forall i. T i \to T (i * 3)
.
+
+inductive S: nat \to Prop \def
+ | s1: \forall i. P i \to S (i * 2)
+ | s2: \forall i. T i \to S (i * 2)
+.
[ lapply linear p_inv_O to H; decompose
| lapply linear t_inv_O to H; decompose
| inversion H1; clear H1; intros;
- [ destruct; autobatch depth = 3
+ [ destruct; autobatch depth = 3 width = 50 size = 50
| clear H3; lapply t_pos to H1; lapply p_pos to H2; decompose; destruct;
lapply linear plus_inv_S_S_S to H4; decompose;
lapply H to H4; lapply H to H3; clear H H4 H3; decompose; clear H3 H4;