Skip to content

Commit dee1939

Browse files
committed
Add argument "fullname" in function "command_inductive".
The function "translateFullName" now takes a "KerName.t" argument.
1 parent a546bfa commit dee1939

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/declare_translation.ml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -309,23 +309,21 @@ and declare_module ?(continuation = ignore) ?name arity mb =
309309
let command_variable ?(continuation = default_continuation) arity variable names =
310310
error (Pp.str "Cannot translate an axiom nor a variable. Please use the 'Parametricity Realizer' command.")
311311

312-
let translateFullName ~fullname arity (constant : Names.constant) : string =
312+
let translateFullName ~fullname arity (kername : Names.KerName.t) : string =
313313
let nstr =
314314
(translate_string arity
315315
@@ Names.Label.to_string
316-
@@ Names.Constant.label
317-
@@ constant)in
316+
@@ Names.KerName.label
317+
@@ kername) in
318318
let pstr =
319319
(Names.ModPath.to_string
320320
@@ Names.modpath
321-
@@ Names.canonical_con
322-
@@ constant) in
321+
@@ kername) in
323322
let plstr = Str.split (Str.regexp ("\.")) pstr in
324323
if fullname then
325324
(String.concat "_o_" (plstr@[nstr]))
326325
else nstr
327326

328-
329327
let command_constant ?(continuation = default_continuation) ~fullname arity constant names =
330328
let poly, opaque =
331329
let cb = Global.lookup_constant constant in
@@ -337,7 +335,10 @@ let command_constant ?(continuation = default_continuation) ~fullname arity cons
337335
(match cb.const_body with Def _ -> false | _ -> true)
338336
in
339337
let name = match names with
340-
| None -> Names.id_of_string (translateFullName ~fullname arity constant)
338+
| None -> Names.id_of_string
339+
@@ translateFullName ~fullname arity
340+
@@ Names.Constant.canonical
341+
@@ constant
341342
| Some name -> name
342343
in
343344
let kind = Decl_kinds.(Global, poly, DefinitionBody Definition) in
@@ -348,25 +349,23 @@ let command_constant ?(continuation = default_continuation) ~fullname arity cons
348349
let constr = mkConstU (fst pconst, EInstance.make @@ snd pconst) in
349350
declare_abstraction ~continuation ~opaque ~kind arity (ref evd) env constr name
350351

351-
let command_inductive ?(continuation = default_continuation) arity inductive names =
352+
let command_inductive ?(continuation = default_continuation) ~fullname arity inductive names =
352353
let (evd, env) = Lemmas.get_current_context () in
353354
let evd, pind =
354355
Evd.(with_context_set univ_rigid evd (Universes.fresh_inductive_instance env inductive))
355356
in
356357
let name = match names with
357358
| None ->
358359
Names.id_of_string
359-
@@ translate_string arity
360-
@@ Names.Label.to_string
361-
@@ Names.MutInd.label
360+
@@ translateFullName ~fullname arity
361+
@@ Names.MutInd.canonical
362362
@@ fst
363363
@@ fst
364364
@@ pind
365365
| Some name -> name
366366
in
367367
declare_inductive name ~continuation arity (ref evd) env pind
368368

369-
370369
let command_constructor ?(continuation = default_continuation) arity gref names =
371370
let open Pp in
372371
error ((str "'")
@@ -382,7 +381,7 @@ let command_reference ?(continuation = default_continuation) ?(fullname = false)
382381
| ConstRef constant ->
383382
command_constant ~continuation ~fullname arity constant names
384383
| IndRef inductive ->
385-
command_inductive ~continuation arity inductive names
384+
command_inductive ~continuation ~fullname arity inductive names
386385
| ConstructRef constructor ->
387386
command_constructor ~continuation arity gref names
388387

0 commit comments

Comments
 (0)