Skip to content

Commit 1aa01c8

Browse files
committed
progress
1 parent f3f3786 commit 1aa01c8

2 files changed

Lines changed: 12 additions & 37 deletions

File tree

src/ecEnv.ml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ module MC = struct
788788
let cs = dtype.tydt_ctors in
789789
let schelim = dtype.tydt_schelim in
790790
let schcase = dtype.tydt_schcase in
791-
let params = List.map (fun (x, _) -> tvar x) tyd.tyd_params in
791+
let params = List.map tvar tyd.tyd_params in
792792
let for1 i (c, aty) =
793793
let aty = EcTypes.toarrow aty (tconstr mypath params) in
794794
let aty = EcSubst.freshen_type (tyd.tyd_params, aty) in
@@ -829,7 +829,7 @@ module MC = struct
829829
) mc projs
830830

831831
| Record (scheme, fields) ->
832-
let params = List.map (fun (x, _) -> tvar x) tyd.tyd_params in
832+
let params = List.map tvar tyd.tyd_params in
833833
let nfields = List.length fields in
834834
let cfields =
835835
let for1 i (f, aty) =
@@ -911,7 +911,7 @@ module MC = struct
911911
let opname = EcIdent.name opid in
912912
let optype = EcSubst.subst_ty tsubst optype in
913913
let opdecl =
914-
mk_op ~opaque:optransparent [(self, Sp.singleton mypath)]
914+
mk_op ~opaque:optransparent [(self)]
915915
optype (Some OP_TC) loca
916916
in (opid, xpath opname, optype, opdecl)
917917
in
@@ -931,7 +931,7 @@ module MC = struct
931931
List.map
932932
(fun (x, ax) ->
933933
let ax = EcSubst.subst_form fsubst ax in
934-
(x, { ax_tparams = [(self, Sp.singleton mypath)];
934+
(x, { ax_tparams = [(self)];
935935
ax_spec = ax;
936936
ax_kind = `Lemma;
937937
ax_loca = loca;
@@ -1107,9 +1107,6 @@ module MC = struct
11071107
else
11081108
(add2mc _up_theory xsubth cth mc, None)
11091109

1110-
| Th_typeclass (x, tc) ->
1111-
(add2mc _up_typeclass x tc mc, None)
1112-
11131110
| Th_baserw (x, _) ->
11141111
(add2mc _up_rwbase x (expath x) mc, None)
11151112

@@ -1406,11 +1403,6 @@ module TypeClass = struct
14061403
let myself = EcPath.pqname (root env) name in
14071404
{ env with env_tc = TC.Graph.add ~src:myself ~dst:prt env.env_tc }
14081405
1409-
let bind ?(import = true) name tc env =
1410-
let env = rebind name tc env in
1411-
let item = Th_typeclass (name, tc) in
1412-
{ env with env_item = mkitem ~import item :: env.env_item }
1413-
14141406
let lookup qname (env : env) =
14151407
MC.lookup_typeclass qname env
14161408
@@ -2548,7 +2540,7 @@ module Ty = struct
25482540
match by_path_opt name env with
25492541
| Some ({ tyd_type = Concrete body } as tyd) ->
25502542
Tvar.subst
2551-
(Tvar.init (List.map fst tyd.tyd_params) args)
2543+
(Tvar.init tyd.tyd_params args)
25522544
body
25532545
| _ -> raise (LookupFailure (`Path name))
25542546
@@ -2609,8 +2601,8 @@ module Ty = struct
26092601
| Abstract tc ->
26102602
let myty =
26112603
let myp = EcPath.pqname (root env) name in
2612-
let typ = List.map (fst_map EcIdent.fresh) ty.tyd_params in
2613-
(typ, EcTypes.tconstr myp (List.map (tvar |- fst) typ)) in
2604+
let typ = List.map (EcIdent.fresh) ty.tyd_params in
2605+
(typ, EcTypes.tconstr myp (List.map tvar typ)) in
26142606
let instr =
26152607
Sp.fold
26162608
(fun p inst -> TypeClass.bind_instance myty (`General p) inst)
@@ -2722,7 +2714,7 @@ module Op = struct
27222714
27232715
let reduce ?mode ?nargs env p tys =
27242716
let op, f = core_reduce ?mode ?nargs env p in
2725-
Tvar.f_subst ~freshen:true (List.map fst op.op_tparams) tys f
2717+
Tvar.f_subst ~freshen:true op.op_tparams tys f
27262718
27272719
let is_projection env p =
27282720
try EcDecl.is_proj (by_path p env)
@@ -2815,7 +2807,7 @@ module Ax = struct
28152807
let instantiate p tys env =
28162808
match by_path_opt p env with
28172809
| Some ({ ax_spec = f } as ax) ->
2818-
Tvar.f_subst ~freshen:true (List.map fst ax.ax_tparams) tys f
2810+
Tvar.f_subst ~freshen:true ax.ax_tparams tys f
28192811
| _ -> raise (LookupFailure (`Path p))
28202812
28212813
let iter ?name f (env : env) =
@@ -2934,8 +2926,8 @@ module Theory = struct
29342926
match tyd.tyd_type with
29352927
| Abstract tc ->
29362928
let myty =
2937-
let typ = List.map (fst_map EcIdent.fresh) tyd.tyd_params in
2938-
(typ, EcTypes.tconstr (xpath x) (List.map (tvar |- fst) typ))
2929+
let typ = List.map (EcIdent.fresh) tyd.tyd_params in
2930+
(typ, EcTypes.tconstr (xpath x) (List.map tvar typ))
29392931
in
29402932
Sp.fold
29412933
(fun p inst -> TypeClass.bind_instance myty (`General p) inst)
@@ -2964,17 +2956,6 @@ module Theory = struct
29642956
end
29652957
| _ -> odfl base (tx path base item.ti_item)
29662958
2967-
(* ------------------------------------------------------------------ *)
2968-
let bind_tc_th =
2969-
let for1 path base = function
2970-
| Th_typeclass (x, tc) ->
2971-
tc.tc_prt |> omap (fun prt ->
2972-
let src = EcPath.pqname path x in
2973-
TC.Graph.add ~src ~dst:prt base)
2974-
| _ -> None
2975-
2976-
in bind_base_th for1
2977-
29782959
(* ------------------------------------------------------------------ *)
29792960
let bind_br_th =
29802961
let for1 path base = function
@@ -3047,14 +3028,13 @@ module Theory = struct
30473028
| _, `Concrete ->
30483029
let thname = EcPath.pqname (root env) cth.name in
30493030
let env_tci = bind_instance_th thname env.env_tci items in
3050-
let env_tc = bind_tc_th thname env.env_tc items in
30513031
let env_rwbase = bind_br_th thname env.env_rwbase items in
30523032
let env_atbase = bind_at_th thname env.env_atbase items in
30533033
let env_ntbase = bind_nt_th thname env.env_ntbase items in
30543034
let env_redbase = bind_rd_th thname env.env_redbase items in
30553035
let env =
30563036
{ env with
3057-
env_tci ; env_tc ; env_rwbase;
3037+
env_tci ; env_rwbase;
30583038
env_atbase; env_ntbase; env_redbase; }
30593039
in
30603040
add_restr_th thname env items
@@ -3106,9 +3086,6 @@ module Theory = struct
31063086
| Th_theory (x, ({cth_mode = `Abstract} as th)) ->
31073087
MC.import_theory (xpath x) th env
31083088
3109-
| Th_typeclass (x, tc) ->
3110-
MC.import_typeclass (xpath x) tc env
3111-
31123089
| Th_baserw (x, _) ->
31133090
MC.import_rwbase (xpath x) env
31143091
@@ -3265,7 +3242,6 @@ module Theory = struct
32653242
| `Concrete ->
32663243
{ env with
32673244
env_tci = bind_instance_th thpath env.env_tci cth.cth_items;
3268-
env_tc = bind_tc_th thpath env.env_tc cth.cth_items;
32693245
env_rwbase = bind_br_th thpath env.env_rwbase cth.cth_items;
32703246
env_atbase = bind_at_th thpath env.env_atbase cth.cth_items;
32713247
env_ntbase = bind_nt_th thpath env.env_ntbase cth.cth_items;

src/ecEnv.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ module TypeClass : sig
380380
type t = typeclass
381381

382382
val add : path -> env -> env
383-
val bind : ?import:bool -> symbol -> t -> env -> env
384383
val graph : env -> EcTypeClass.graph
385384

386385
val by_path : path -> env -> t

0 commit comments

Comments
 (0)