Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 50c49ee1 authored by Andrei Paskevich's avatar Andrei Paskevich
Browse files

optimisaton in [tf]_abst

parent 88b10949
...@@ -651,12 +651,10 @@ let f_any_unsafe prT prF f = ...@@ -651,12 +651,10 @@ let f_any_unsafe prT prF f =
(* replaces variables with de Bruijn indices in term [t] using map [m] *) (* replaces variables with de Bruijn indices in term [t] using map [m] *)
let bnd_add i (lvl,rb) = rb := Sint.add (i + lvl) !rb
let rec t_abst m l lvl t = t_label_copy t (match t.t_node with let rec t_abst m l lvl t = t_label_copy t (match t.t_node with
| Tvar u -> begin try | Tvar u -> begin try
let i = Mvs.find u m in let i = Mvs.find u m in
List.iter (bnd_add i) l; l := Sint.add i !l;
t_bvar (i + lvl) t.t_ty t_bvar (i + lvl) t.t_ty
with Not_found -> t end with Not_found -> t end
| Tlet (e, (u,b,t1)) -> | Tlet (e, (u,b,t1)) ->
...@@ -684,27 +682,32 @@ and f_abst m l lvl f = f_label_copy f (match f.f_node with ...@@ -684,27 +682,32 @@ and f_abst m l lvl f = f_label_copy f (match f.f_node with
f_map_unsafe (t_abst m l lvl) (f_abst m l lvl) f) f_map_unsafe (t_abst m l lvl) (f_abst m l lvl) f)
and bnd_t_abst m l lvl bv t = and bnd_t_abst m l lvl bv t =
let rb = ref bv.bv_open in let l' = ref Sint.empty in
let bv = bnd_map (t_abst m l lvl) bv in let bv = bnd_map (t_abst m l lvl) bv in
let t = t_abst m ((lvl,rb) :: l) (lvl + bv.bv_bound) t in let t = t_abst m l' (lvl + bv.bv_bound) t in
{ bv with bv_open = !rb }, t update_open lvl l l' bv, t
and bnd_f_abst m l lvl bv f = and bnd_f_abst m l lvl bv f =
let rb = ref bv.bv_open in let l' = ref Sint.empty in
let bv = bnd_map (t_abst m l lvl) bv in let bv = bnd_map (t_abst m l lvl) bv in
let f = f_abst m ((lvl,rb) :: l) (lvl + bv.bv_bound) f in let f = f_abst m l' (lvl + bv.bv_bound) f in
{ bv with bv_open = !rb }, f update_open lvl l l' bv, f
and bnd_q_abst m l lvl (vl,bv,tl,f) = and bnd_q_abst m l lvl (vl,bv,tl,f) =
let rb = ref bv.bv_open in let l' = ref Sint.empty in
let lvl' = lvl + bv.bv_bound in
let bv = bnd_map (t_abst m l lvl) bv in let bv = bnd_map (t_abst m l lvl) bv in
let l = (lvl,rb) :: l in let lvl = lvl + bv.bv_bound in let tl = tr_map (t_abst m l' lvl') (f_abst m l' lvl') tl in
let tl = tr_map (t_abst m l lvl) (f_abst m l lvl) tl in let f = f_abst m l' lvl' f in
let f = f_abst m l lvl f in vl, update_open lvl l l' bv, tl, f
vl, { bv with bv_open = !rb }, tl, f
and update_open lvl l l' bv =
l := Sint.union !l' !l;
let add i acc = Sint.add (i + lvl) acc in
{ bv with bv_open = Sint.fold add !l' bv.bv_open }
let t_abst m t = t_abst m [] 0 t let t_abst m t = t_abst m (ref Sint.empty) 0 t
let f_abst m f = f_abst m [] 0 f let f_abst m f = f_abst m (ref Sint.empty) 0 f
(* replaces de Bruijn indices with variables in term [t] using map [m] *) (* replaces de Bruijn indices with variables in term [t] using map [m] *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment