Skip to content

Commit 7066af3

Browse files
committed
Rework import mechanism.
The import mechanism is currently brittle, buggy, interact wrongly with the cloning mechanism. Moreover, some declarations duplicate it by reimplementing an ad-hoc, "non-import" mechanism. This commit fixes this issues.
1 parent 46099ed commit 7066af3

19 files changed

+345
-384
lines changed

src/ecDecl.ml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ type ty_params = ty_param list
1616
type ty_pctor = [ `Int of int | `Named of ty_params ]
1717

1818
type tydecl = {
19-
tyd_params : ty_params;
20-
tyd_type : ty_body;
21-
tyd_loca : locality;
22-
tyd_resolve : bool;
19+
tyd_params : ty_params;
20+
tyd_type : ty_body;
21+
tyd_loca : locality;
2322
}
2423

2524
and ty_body = [
@@ -48,7 +47,7 @@ let tydecl_as_record (td : tydecl) =
4847
match td.tyd_type with `Record x -> Some x | _ -> None
4948

5049
(* -------------------------------------------------------------------- *)
51-
let abs_tydecl ?(resolve = true) ?(tc = Sp.empty) ?(params = `Int 0) lc =
50+
let abs_tydecl ?(tc = Sp.empty) ?(params = `Int 0) lc =
5251
let params =
5352
match params with
5453
| `Named params ->
@@ -60,7 +59,7 @@ let abs_tydecl ?(resolve = true) ?(tc = Sp.empty) ?(params = `Int 0) lc =
6059
(EcUid.NameGen.bulk ~fmt n)
6160
in
6261

63-
{ tyd_params = params; tyd_type = `Abstract tc; tyd_resolve = resolve; tyd_loca = lc; }
62+
{ tyd_params = params; tyd_type = `Abstract tc; tyd_loca = lc; }
6463

6564
(* -------------------------------------------------------------------- *)
6665
let ty_instanciate (params : ty_params) (args : ty list) (ty : ty) =
@@ -137,13 +136,11 @@ and opopaque = { smt: bool; reduction: bool; }
137136
type axiom_kind = [`Axiom of (Ssym.t * bool) | `Lemma]
138137

139138
type axiom = {
140-
ax_tparams : ty_params;
141-
ax_spec : EcCoreFol.form;
142-
ax_kind : axiom_kind;
143-
ax_loca : locality;
144-
ax_visibility : ax_visibility; }
145-
146-
and ax_visibility = [`Visible | `NoSmt | `Hidden]
139+
ax_tparams : ty_params;
140+
ax_spec : EcCoreFol.form;
141+
ax_kind : axiom_kind;
142+
ax_loca : locality;
143+
ax_smt : bool; }
147144

148145
let is_axiom (x : axiom_kind) = match x with `Axiom _ -> true | _ -> false
149146
let is_lemma (x : axiom_kind) = match x with `Lemma -> true | _ -> false
@@ -272,11 +269,11 @@ let axiomatized_op ?(nargs = 0) ?(nosmt = false) path (tparams, axbd) lc =
272269
let op = f_app op opargs axbd.f_ty in
273270
let axspec = f_forall args (f_eq op axbd) in
274271

275-
{ ax_tparams = axpm;
276-
ax_spec = axspec;
277-
ax_kind = `Axiom (Ssym.empty, false);
278-
ax_loca = lc;
279-
ax_visibility = if nosmt then `NoSmt else `Visible; }
272+
{ ax_tparams = axpm;
273+
ax_spec = axspec;
274+
ax_kind = `Axiom (Ssym.empty, false);
275+
ax_loca = lc;
276+
ax_smt = not nosmt; }
280277

281278
(* -------------------------------------------------------------------- *)
282279
type typeclass = {

src/ecDecl.mli

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ type ty_params = ty_param list
1212
type ty_pctor = [ `Int of int | `Named of ty_params ]
1313

1414
type tydecl = {
15-
tyd_params : ty_params;
16-
tyd_type : ty_body;
17-
tyd_loca : locality;
18-
tyd_resolve : bool;
15+
tyd_params : ty_params;
16+
tyd_type : ty_body;
17+
tyd_loca : locality;
1918
}
2019

2120
and ty_body = [
@@ -36,7 +35,7 @@ val tydecl_as_abstract : tydecl -> Sp.t option
3635
val tydecl_as_datatype : tydecl -> ty_dtype option
3736
val tydecl_as_record : tydecl -> (form * (EcSymbols.symbol * EcTypes.ty) list) option
3837

39-
val abs_tydecl : ?resolve:bool -> ?tc:Sp.t -> ?params:ty_pctor -> locality -> tydecl
38+
val abs_tydecl : ?tc:Sp.t -> ?params:ty_pctor -> locality -> tydecl
4039

4140
val ty_instanciate : ty_params -> ty list -> ty -> ty
4241

@@ -135,15 +134,13 @@ val operator_as_prind : operator -> prind
135134
type axiom_kind = [`Axiom of (Ssym.t * bool) | `Lemma]
136135

137136
type axiom = {
138-
ax_tparams : ty_params;
139-
ax_spec : form;
140-
ax_kind : axiom_kind;
141-
ax_loca : locality;
142-
ax_visibility : ax_visibility;
137+
ax_tparams : ty_params;
138+
ax_spec : form;
139+
ax_kind : axiom_kind;
140+
ax_loca : locality;
141+
ax_smt : bool;
143142
}
144143

145-
and ax_visibility = [`Visible | `NoSmt | `Hidden]
146-
147144
(* -------------------------------------------------------------------- *)
148145
val is_axiom : axiom_kind -> bool
149146
val is_lemma : axiom_kind -> bool

0 commit comments

Comments
 (0)