@@ -1998,7 +1998,7 @@ module MutualEntry : sig
1998
1998
-> univs:UState. named_universes_entry
1999
1999
-> Names.GlobRef. t list
2000
2000
2001
- val declare_mutdef
2001
+ val declare_possibly_mutual_definitions
2002
2002
(* Common to all recthms *)
2003
2003
: pinfo:Proof_info. t
2004
2004
-> uctx:UState. t
@@ -2017,43 +2017,30 @@ end = struct
2017
2017
(body, ctx), eff
2018
2018
| _ -> assert false
2019
2019
2020
- let declare_mutdef ~uctx ~pinfo pe i CInfo. { name; impargs; typ; _} =
2021
- let { Proof_info. info; possible_guard; _ } = pinfo in
2022
- let { Info. hook; scope; clearbody; kind; typing_flags; user_warns; _ } = info in
2020
+ let update_mutual_entry i entry uctx typ =
2023
2021
(* if i = 0 , we don't touch the type; this is for compat
2024
2022
but not clear it is the right thing to do.
2025
2023
*)
2026
- let pe =
2027
- if i > 0 && Option. has_some possible_guard
2028
- then
2029
- let typ = UState. nf_universes uctx typ in
2030
- Internal. map_entry_type pe ~f: (fun _ -> Some typ)
2031
- else pe
2032
- in
2033
- (* We when possible_guard was [] in the previous step we should not
2034
- substitute the body *)
2035
- let pe = match possible_guard with
2036
- | None -> pe
2037
- | _ ->
2038
- Internal. map_entry_body pe
2039
- ~f: (fun ((body , ctx ), eff ) -> (select_body i body, ctx), eff)
2040
- in
2041
- declare_entry ~name ~scope ~clearbody ~kind ?hook ~impargs ~typing_flags ~user_warns ~uctx pe
2024
+ { entry with
2025
+ proof_entry_body = Future. chain entry.proof_entry_body (fun ((body , uctx ), eff ) -> ((select_body i body, uctx), eff));
2026
+ proof_entry_type = if i > 0 then Some (UState. nf_universes uctx typ) else entry.proof_entry_type }
2042
2027
2043
- let declare_mutdef ~pinfo ~uctx ~entry =
2044
- let pe = match pinfo.Proof_info. possible_guard with
2028
+ let declare_possibly_mutual_definitions ~pinfo ~uctx ~entry =
2029
+ let entries = match pinfo.Proof_info. possible_guard with
2045
2030
| None ->
2046
2031
(* Not a recursive statement *)
2047
- entry
2048
- | Some possible_indexes ->
2032
+ [ entry]
2033
+ | Some possible_guard ->
2049
2034
(* Try all combinations... not optimal *)
2050
2035
let env = Global. env() in
2051
2036
let typing_flags = pinfo.Proof_info. info.Info. typing_flags in
2052
2037
let env = Environ. update_typing_flags ?typing_flags env in
2053
- Internal. map_entry_body entry
2054
- ~f: (guess_decreasing env possible_indexes)
2038
+ let entry = Internal. map_entry_body entry ~f: (guess_decreasing env possible_guard) in
2039
+ List. map_i ( fun i CInfo. {typ} -> update_mutual_entry i entry uctx typ) 0 pinfo. Proof_info. cinfo
2055
2040
in
2056
- let refs = List. map_i (declare_mutdef ~pinfo ~uctx pe) 0 pinfo.Proof_info. cinfo in
2041
+ let { Proof_info. info = { Info. hook; scope; clearbody; kind; typing_flags; user_warns; _ } } = pinfo in
2042
+ let refs = List. map2 (fun CInfo. {name; impargs} ->
2043
+ declare_entry ~name ~scope ~clearbody ~kind ?hook ~impargs ~typing_flags ~user_warns ~uctx ) pinfo.Proof_info. cinfo entries in
2057
2044
let () =
2058
2045
(* We override the temporary notations used while proving, now using the global names *)
2059
2046
let local = pinfo.info.scope= Locality. Discharge in
@@ -2199,7 +2186,7 @@ let finalize_proof ~pm proof_obj proof_info =
2199
2186
match CEphemeron. default proof_info.Proof_info. proof_ending Regular with
2200
2187
| Regular ->
2201
2188
let entry, uctx = check_single_entry proof_obj " Proof.save" in
2202
- pm, MutualEntry. declare_mutdef ~entry ~uctx ~pinfo: proof_info
2189
+ pm, MutualEntry. declare_possibly_mutual_definitions ~entry ~uctx ~pinfo: proof_info
2203
2190
| End_obligation oinfo ->
2204
2191
let entry, uctx = check_single_entry proof_obj " Obligation.save" in
2205
2192
let entry = Internal. pmap_entry_body ~f: Future. force entry in
0 commit comments