Commit d59e09d9 authored by POTTIER Francois's avatar POTTIER Francois

Renamed [freshh] to [fresh].

parent 64ecdb42
...@@ -243,8 +243,8 @@ let () = ...@@ -243,8 +243,8 @@ let () =
TApp (subst1 u x t1, subst1 u x t2)) TApp (subst1 u x t1, subst1 u x t2))
end end
); );
let x = Atom.freshh "x" let x = Atom.fresh "x"
and y = Atom.freshh "y" in and y = Atom.fresh "y" in
let u = generate_nominal atoms size_of_u in let u = generate_nominal atoms size_of_u in
assert (subst1 u x (TVar x) = u); assert (subst1 u x (TVar x) = u);
assert (subst1 u x (TVar y) = TVar y); assert (subst1 u x (TVar y) = TVar y);
...@@ -330,10 +330,10 @@ let () = ...@@ -330,10 +330,10 @@ let () =
(* Sample terms. *) (* Sample terms. *)
let x = let x =
Atom.freshh "x" Atom.fresh "x"
let y = let y =
Atom.freshh "y" Atom.fresh "y"
let id = let id =
TLambda (x, TVar x) TLambda (x, TVar x)
......
...@@ -89,7 +89,7 @@ let rec atoms accu k = ...@@ -89,7 +89,7 @@ let rec atoms accu k =
if k = 0 then if k = 0 then
accu accu
else else
let a = AlphaLib.Atom.freshh "a" in let a = AlphaLib.Atom.fresh "a" in
atoms (AtomSet.add a accu) (k - 1) atoms (AtomSet.add a accu) (k - 1)
let atoms = let atoms =
......
...@@ -72,11 +72,11 @@ let allocate () = ...@@ -72,11 +72,11 @@ let allocate () =
assert (number >= 0); assert (number >= 0);
number number
(* [freshh hint] produces a fresh atom. *) (* [fresh hint] produces a fresh atom. *)
(* The argument [hint] must not be a string of digits. *) (* The argument [hint] must not be a string of digits. *)
let freshh hint = let fresh hint =
let identity = allocate() let identity = allocate()
and hint = share (remove_trailing_digits hint) in and hint = share (remove_trailing_digits hint) in
{ identity; hint } { identity; hint }
...@@ -84,7 +84,7 @@ let freshh hint = ...@@ -84,7 +84,7 @@ let freshh hint =
(* [fresha a] returns a fresh atom modeled after the atom [a]. *) (* [fresha a] returns a fresh atom modeled after the atom [a]. *)
let fresha a = let fresha a =
freshh a.hint fresh a.hint
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
...@@ -14,7 +14,7 @@ val print: out_channel -> atom -> unit ...@@ -14,7 +14,7 @@ val print: out_channel -> atom -> unit
(* Producing fresh atoms. *) (* Producing fresh atoms. *)
val freshh: string -> atom val fresh: string -> atom
val fresha: atom -> atom val fresha: atom -> atom
(* Comparison of atoms. *) (* Comparison of atoms. *)
......
(* This kit serves to construct an [import] function for terms, that is, a (* This kit serves to construct an [import] function for terms, that is, a
function that transforms strings to atoms. *) function that transforms strings to atoms. *)
(* We impose the GUH by mapping each binding occurrence to a fresh atom. *) (* We map every binding occurrence to a fresh atom, so the term that we
produce satisfies global uniqueness. *)
module StringMap = module StringMap =
Map.Make(String) Map.Make(String)
...@@ -13,7 +14,7 @@ let empty = ...@@ -13,7 +14,7 @@ let empty =
StringMap.empty StringMap.empty
let extend (x : string) (env : env) : Atom.t * env = let extend (x : string) (env : env) : Atom.t * env =
let a = Atom.freshh x in let a = Atom.fresh x in
let env = StringMap.add x a env in let env = StringMap.add x a env in
a, env a, env
...@@ -26,6 +27,6 @@ let lookup (env : env) (x : string) : Atom.t = ...@@ -26,6 +27,6 @@ let lookup (env : env) (x : string) : Atom.t =
raise (Unbound x) raise (Unbound x)
class ['self] map = object (_ : 'self) class ['self] map = object (_ : 'self)
method private extend = extend method private extend x env = extend x env
method private visit_'fn = lookup method private visit_'fn env x = lookup env x
end end
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