aboutsummaryrefslogtreecommitdiff
path: root/vernac/assumptions.ml
diff options
context:
space:
mode:
authorHugo Herbelin2018-04-06 09:55:42 +0200
committerHugo Herbelin2018-10-12 22:23:57 +0200
commita623c11adac7c34aae92dbeb0c5b7ecc863ce6fd (patch)
tree9e3e46d5bdc7f34085ba7edc64ace9c4ce62d368 /vernac/assumptions.ml
parent235cb6e6c243863b7270d273ceeef681eb350247 (diff)
Moving local copy fold_constr_with_full_binders in assumptions.ml to constr.ml.
This is to move a standard combinator to the place it belongs to. An alternative could have been to put it in termops.ml, but termops.ml is now about econstr, so, even if it makes the kernel "bigger", constr.ml seems to be the best place for this combinator. After all, this combinator is canonical.
Diffstat (limited to 'vernac/assumptions.ml')
-rw-r--r--vernac/assumptions.ml25
1 files changed, 2 insertions, 23 deletions
diff --git a/vernac/assumptions.ml b/vernac/assumptions.ml
index 15c0278f47..6beac2032d 100644
--- a/vernac/assumptions.ml
+++ b/vernac/assumptions.ml
@@ -162,27 +162,6 @@ let label_of = function
| ConstructRef ((kn,_),_) -> MutInd.label kn
| VarRef id -> Label.of_id id
-let fold_constr_with_full_binders g f n acc c =
- let open Context.Rel.Declaration in
- match Constr.kind c with
- | Rel _ | Meta _ | Var _ | Sort _ | Const _ | Ind _ | Construct _ -> acc
- | Cast (c,_, t) -> f n (f n acc c) t
- | Prod (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
- | Lambda (na,t,c) -> f (g (LocalAssum (na,t)) n) (f n acc t) c
- | LetIn (na,b,t,c) -> f (g (LocalDef (na,b,t)) n) (f n (f n acc b) t) c
- | App (c,l) -> Array.fold_left (f n) (f n acc c) l
- | Proj (p,c) -> f n acc c
- | Evar (_,l) -> Array.fold_left (f n) acc l
- | Case (_,p,c,bl) -> Array.fold_left (f n) (f n (f n acc p) c) bl
- | Fix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c n t -> g (LocalAssum (n,t)) c) n lna tl in
- let fd = Array.map2 (fun t b -> (t,b)) tl bl in
- Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
- | CoFix (_,(lna,tl,bl)) ->
- let n' = CArray.fold_left2 (fun c n t -> g (LocalAssum (n,t)) c) n lna tl in
- let fd = Array.map2 (fun t b -> (t,b)) tl bl in
- Array.fold_left (fun acc (t,b) -> f n' (f n acc t) b) acc fd
-
let rec traverse current ctx accu t = match Constr.kind t with
| Var id ->
let body () = id |> Global.lookup_named |> NamedDecl.get_value in
@@ -205,10 +184,10 @@ let rec traverse current ctx accu t = match Constr.kind t with
traverse_object
~inhabits:(current,ctx,Vars.subst1 mkProp oty) accu body (ConstRef kn)
| _ ->
- fold_constr_with_full_binders
+ Constr.fold_with_full_binders
Context.Rel.add (traverse current) ctx accu t
end
-| _ -> fold_constr_with_full_binders
+| _ -> Constr.fold_with_full_binders
Context.Rel.add (traverse current) ctx accu t
and traverse_object ?inhabits (curr, data, ax2ty) body obj =