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