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 <module_name> 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.
Constructs a private name from a module name mainModule without number components and
a user name n.
Equations
- Lean.mkPrivateNameCore mainModule n = ((Lean.privateHeader.appendCore mainModule).num 0).appendCore n
Instances For
Return true if n is of the form _private.<module_name>.0, or equivalently
of the form mkPrivateNameCore moduleName .anonymous with moduleName.hasNum = false.
Equations
Instances For
Return true if n is a private name, that is, if n is equivalent to
mkPrivateNameCore mainModule userName with mainModule.hasNum = false.
Equations
- Lean.isPrivateName (p.str str) = Lean.isPrivateName p
- Lean.isPrivateName (p.num i) = (Lean.isPrivatePrefix (p.num i) || Lean.isPrivateName p)
- Lean.isPrivateName n = false
Instances For
Returns the user name corresponding to the private name n or none if n is not a private name.
Equations
- Lean.privateToUserName? n = if h : Lean.isPrivateName n = true then some (Lean.privateToUserNameAux✝ n h) else none
Instances For
Returns the user name corresponding to the private name n or n itself if n is not a
private name.
Equations
- Lean.privateToUserName n = if h : Lean.isPrivateName n = true then Lean.privateToUserNameAux✝ n h else n
Instances For
If n is a private name, returns some pfx such that pfx.appendCore (privateToUserName n) = n.
Otherwise, returns none.
Equations
- Lean.privatePrefix? (p.str str) = Lean.privatePrefix? p
- Lean.privatePrefix? (p.num i) = if Lean.isPrivatePrefix (p.num i) = true then some (p.num i) else Lean.privatePrefix? p
- Lean.privatePrefix? n = none