@[export lean_add_protected]
Equations
- Lean.addProtected env n = Lean.protectedExt.tag env n
Instances For
@[export lean_is_protected]
Equations
- Lean.isProtected env n = Lean.protectedExt.isTagged env n
Instances For
Private name support. #
Suppose the user marks as declaration n
as private. Then, we create
the name: _private.<module_name>.0 ++ n
.
We say _private.<module_name>.0
is the "private prefix"
We assume that n
is a valid user name and does not contain
Name.num
constructors. Thus, we can easily convert from
private internal name to the user given name.
Equations
- Lean.mkPrivateName env n = (Lean.privateHeader ++ env.mainModule).mkNum 0 ++ n
Instances For
Equations
- Lean.isPrivateName (p.str str) = (p.str str == Lean.privateHeader || Lean.isPrivateName p)
- Lean.isPrivateName (p.num i) = Lean.isPrivateName p
- Lean.isPrivateName x = false
Instances For
@[export lean_is_private_name]
Equations
Instances For
Return true
if n
is of the form _private.<module_name>.0
See comment above.
Equations
- Lean.isPrivatePrefix n = match n with | p.num 0 => Lean.isPrivatePrefix.go p | x => false
Instances For
Equations
- Lean.isPrivatePrefix.go (p.str str) = (p.str str == Lean.privateHeader || Lean.isPrivatePrefix.go p)
- Lean.isPrivatePrefix.go n = (n == Lean.privateHeader || false)
Instances For
@[export lean_private_to_user_name]
Equations
- Lean.privateToUserName? n = if Lean.isPrivateName n = true then some (Lean.privateToUserNameAux n) else none
Instances For
Equations
- Lean.isPrivateNameFromImportedModule env n = match Lean.privateToUserName? n with | some userName => Lean.mkPrivateName env userName != n | x => false
Instances For
@[export lean_private_prefix]
Equations
- Lean.privatePrefix? n = if Lean.isPrivateName n = true then some (Lean.privatePrefixAux n) else none