Skip to content

Commit 670632d

Browse files
committed
Fix comparison of fixpoints
Do take recursive calls (i.e. the fixpoints names) into account.
1 parent 98e393a commit 670632d

File tree

8 files changed

+280
-191
lines changed

8 files changed

+280
-191
lines changed

src/ecDecl.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ and ty_body = [
2525
| `Concrete of EcTypes.ty
2626
| `Abstract of Sp.t
2727
| `Datatype of ty_dtype
28-
| `Record of EcCoreFol.form * (EcSymbols.symbol * EcTypes.ty) list
28+
| `Record of ty_record
2929
]
3030

31+
and ty_record =
32+
EcCoreFol.form * (EcSymbols.symbol * EcTypes.ty) list
33+
34+
and ty_dtype_ctor =
35+
EcSymbols.symbol * EcTypes.ty list
36+
3137
and ty_dtype = {
32-
tydt_ctors : (EcSymbols.symbol * EcTypes.ty list) list;
38+
tydt_ctors : ty_dtype_ctor list;
3339
tydt_schelim : EcCoreFol.form;
3440
tydt_schcase : EcCoreFol.form;
3541
}
@@ -87,6 +93,7 @@ and prbody =
8793
| PR_Ind of prind
8894

8995
and opfix = {
96+
opf_recp : EcPath.path;
9097
opf_args : (EcIdent.t * EcTypes.ty) list;
9198
opf_resty : EcTypes.ty;
9299
opf_struct : int list * int;

src/ecDecl.mli

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ and ty_body = [
2121
| `Concrete of EcTypes.ty
2222
| `Abstract of Sp.t
2323
| `Datatype of ty_dtype
24-
| `Record of form * (EcSymbols.symbol * EcTypes.ty) list
24+
| `Record of ty_record
2525
]
2626

27+
and ty_record =
28+
EcCoreFol.form * (EcSymbols.symbol * EcTypes.ty) list
29+
30+
and ty_dtype_ctor =
31+
EcSymbols.symbol * EcTypes.ty list
32+
2733
and ty_dtype = {
28-
tydt_ctors : (EcSymbols.symbol * EcTypes.ty list) list;
29-
tydt_schelim : form;
30-
tydt_schcase : form;
34+
tydt_ctors : ty_dtype_ctor list;
35+
tydt_schelim : EcCoreFol.form;
36+
tydt_schcase : EcCoreFol.form;
3137
}
3238

3339
val tydecl_as_concrete : tydecl -> EcTypes.ty option
@@ -60,6 +66,7 @@ and prbody =
6066
| PR_Ind of prind
6167

6268
and opfix = {
69+
opf_recp : EcPath.path;
6370
opf_args : (EcIdent.t * EcTypes.ty) list;
6471
opf_resty : EcTypes.ty;
6572
opf_struct : int list * int;

src/ecPrinting.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ let pp_modtype1 (ppe : PPEnv.t) fmt mty =
620620

621621
(* -------------------------------------------------------------------- *)
622622
let pp_local (ppe : PPEnv.t) fmt x =
623-
Format.fprintf fmt "%s" (PPEnv.local_symb ppe x)
623+
Format.fprintf fmt "%s" (EcIdent.tostring x)
624624

625625
(* -------------------------------------------------------------------- *)
626626
let pp_local ?fv (ppe : PPEnv.t) fmt x =

src/ecScope.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ module Op = struct
11431143
| `Plain e -> Some (OP_Plain (fs e))
11441144
| `Fix opfx ->
11451145
Some (OP_Fix {
1146+
opf_recp = EcPath.pqname (EcEnv.root eenv) (EcIdent.name opfx.EHI.mf_name);
11461147
opf_args = opfx.EHI.mf_args;
11471148
opf_resty = opfx.EHI.mf_codom;
11481149
opf_struct = (opfx.EHI.mf_recs, List.length opfx.EHI.mf_args);

src/ecSection.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ let generalize_opdecl to_gen prefix (name, operator) =
853853
let (l,i) = opfix.opf_struct in
854854
(List.map (fun i -> i + nb_extra) l, i + nb_extra) in
855855
OP_Fix {
856+
opf_recp = opfix.opf_recp;
856857
opf_args = extra_a @ opfix.opf_args;
857858
opf_resty = opfix.opf_resty;
858859
opf_struct;

src/ecSubst.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ and subst_op_body (s : subst) (bd : opbody) =
899899
| OP_Fix opfix ->
900900
let (es, args) = fresh_elocals s opfix.opf_args in
901901

902-
OP_Fix { opf_args = args;
902+
OP_Fix { opf_recp = subst_path s opfix.opf_recp;
903+
opf_args = args;
903904
opf_resty = subst_ty s opfix.opf_resty;
904905
opf_struct = opfix.opf_struct;
905906
opf_branches = subst_branches es opfix.opf_branches; }

src/ecSubst.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ val freshen_type : (ty_params * ty) -> (ty_params * ty)
4242
val subst_theory : subst -> theory -> theory
4343
val subst_ax : subst -> axiom -> axiom
4444
val subst_op : subst -> operator -> operator
45+
val subst_op_body : subst -> opbody -> opbody
4546
val subst_tydecl : subst -> tydecl -> tydecl
4647
val subst_tc : subst -> typeclass -> typeclass
4748
val subst_theory : subst -> theory -> theory

0 commit comments

Comments
 (0)