|
|
|
@ -11,7 +11,7 @@
|
|
|
|
|
|
|
|
|
|
open Signatures
|
|
|
|
|
|
|
|
|
|
module Make (UserS : STRUCTURE_LEAF) = struct
|
|
|
|
|
module Make (UserS : HSTRUCTURE) = struct
|
|
|
|
|
|
|
|
|
|
(* -------------------------------------------------------------------------- *)
|
|
|
|
|
|
|
|
|
@ -101,58 +101,8 @@ let fresh_mark : unit -> mark =
|
|
|
|
|
Rigid variables have abstract strucutres.
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
module S = struct
|
|
|
|
|
type 'a structure =
|
|
|
|
|
| Abstract of int
|
|
|
|
|
| User of 'a UserS.structure
|
|
|
|
|
|
|
|
|
|
exception InconsistentConjunction =
|
|
|
|
|
UserS.InconsistentConjunction
|
|
|
|
|
|
|
|
|
|
let conjunction f s1 s2 =
|
|
|
|
|
match s1, s2 with
|
|
|
|
|
| Abstract n1, Abstract n2 ->
|
|
|
|
|
if Int.equal n1 n2 then s1
|
|
|
|
|
else raise InconsistentConjunction
|
|
|
|
|
| User s1, User s2 ->
|
|
|
|
|
User (UserS.conjunction f s1 s2)
|
|
|
|
|
| Abstract n, User s
|
|
|
|
|
| User s, Abstract n ->
|
|
|
|
|
if UserS.is_leaf s then Abstract n
|
|
|
|
|
else
|
|
|
|
|
raise InconsistentConjunction
|
|
|
|
|
|
|
|
|
|
let iter f s =
|
|
|
|
|
match s with
|
|
|
|
|
| Abstract _ ->
|
|
|
|
|
()
|
|
|
|
|
| User s ->
|
|
|
|
|
UserS.iter f s
|
|
|
|
|
|
|
|
|
|
let fold f s acc =
|
|
|
|
|
match s with
|
|
|
|
|
| Abstract _ ->
|
|
|
|
|
acc
|
|
|
|
|
| User s ->
|
|
|
|
|
UserS.fold f s acc
|
|
|
|
|
|
|
|
|
|
let map f s =
|
|
|
|
|
match s with
|
|
|
|
|
| Abstract n ->
|
|
|
|
|
Abstract n
|
|
|
|
|
| User s ->
|
|
|
|
|
User (UserS.map f s)
|
|
|
|
|
|
|
|
|
|
let leaf = User (UserS.leaf)
|
|
|
|
|
|
|
|
|
|
let is_leaf s =
|
|
|
|
|
match s with
|
|
|
|
|
| Abstract _ ->
|
|
|
|
|
false
|
|
|
|
|
| User s ->
|
|
|
|
|
UserS.is_leaf s
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
module AS = Structure.AbstractS(UserS)
|
|
|
|
|
module S = Structure.OptionS(AS)
|
|
|
|
|
|
|
|
|
|
(* -------------------------------------------------------------------------- *)
|
|
|
|
|
|
|
|
|
@ -394,7 +344,7 @@ let fresh structure =
|
|
|
|
|
let fresh_rigid =
|
|
|
|
|
let fresh_abstract = Utils.gensym() in
|
|
|
|
|
fun () ->
|
|
|
|
|
let structure = S.Abstract (fresh_abstract ()) in
|
|
|
|
|
let structure = Some (Structure.Abstract (fresh_abstract ())) in
|
|
|
|
|
let rank = state.young in
|
|
|
|
|
let scope = rank in
|
|
|
|
|
let v = U.fresh (Data.make structure ~rank ~scope Active) in
|
|
|
|
@ -824,7 +774,7 @@ let instantiate { generics; quantifiers; root } =
|
|
|
|
|
let data = get v in
|
|
|
|
|
assert (data.status = Generic);
|
|
|
|
|
data.mark <- i;
|
|
|
|
|
fresh S.leaf
|
|
|
|
|
fresh None
|
|
|
|
|
)
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|