File: .lake/packages/lean4/src/lean/Lean/Elab/DeclModifiers.lean

full_name: Lean.Elab.checkNotAlreadyDeclared
code: /--
Ensure the environment does not contain a declaration with name `declName`.
Recall that a private declaration cannot shadow a non-private one and vice-versa, although
they internally have different names.
-/
def checkNotAlreadyDeclared {m} [Monad m] [MonadEnv m] [MonadError m] [MonadInfoTree m] (declName : Name) : m Unit 
goal: m Unit

full_name: Lean.Elab.Visibility.protected
code: /-- Declaration visibility modifier. That is, whether a declaration is regular, protected or private. -/
inductive Visibility where
  | regular | «protected» | «private»
  deriving Inhabited
goal: Lean.Elab.Visibility

full_name: Lean.Elab.Visibility
code: /-- Declaration visibility modifier. That is, whether a declaration is regular, protected or private. -/
inductive Visibility where
  | regular | «protected» | «private»
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Visibility.private
code: /-- Declaration visibility modifier. That is, whether a declaration is regular, protected or private. -/
inductive Visibility where
  | regular | «protected» | «private»
  deriving Inhabited
goal: Lean.Elab.Visibility

full_name: Lean.Elab.Visibility.regular
code: /-- Declaration visibility modifier. That is, whether a declaration is regular, protected or private. -/
inductive Visibility where
  | regular | «protected» | «private»
  deriving Inhabited
goal: Lean.Elab.Visibility

full_name: Lean.Elab.instInhabitedVisibility
code: /-- Declaration visibility modifier. That is, whether a declaration is regular, protected or private. -/
inductive Visibility where
  | regular | «protected» | «private»
  deriving Inhabited
goal: Inhabited Lean.Elab.Visibility

full_name: Lean.Elab.instToStringVisibility
code: instance : ToString Visibility 
goal: ToString Lean.Elab.Visibility

full_name: Lean.Elab.RecKind.default
code: /-- Whether a declaration is default, partial or nonrec. -/
inductive RecKind where
  | «partial» | «nonrec» | default
  deriving Inhabited
goal: Lean.Elab.RecKind

full_name: Lean.Elab.RecKind.partial
code: /-- Whether a declaration is default, partial or nonrec. -/
inductive RecKind where
  | «partial» | «nonrec» | default
  deriving Inhabited
goal: Lean.Elab.RecKind

full_name: Lean.Elab.RecKind.nonrec
code: /-- Whether a declaration is default, partial or nonrec. -/
inductive RecKind where
  | «partial» | «nonrec» | default
  deriving Inhabited
goal: Lean.Elab.RecKind

full_name: Lean.Elab.instInhabitedRecKind
code: /-- Whether a declaration is default, partial or nonrec. -/
inductive RecKind where
  | «partial» | «nonrec» | default
  deriving Inhabited
goal: Inhabited Lean.Elab.RecKind

full_name: Lean.Elab.RecKind
code: /-- Whether a declaration is default, partial or nonrec. -/
inductive RecKind where
  | «partial» | «nonrec» | default
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Modifiers.attrs
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Array Lean.Elab.Attribute

full_name: Lean.Elab.Modifiers.visibility
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Lean.Elab.Visibility

full_name: Lean.Elab.instInhabitedModifiers
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Inhabited Lean.Elab.Modifiers

full_name: Lean.Elab.Modifiers
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Modifiers.isUnsafe
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Bool

full_name: Lean.Elab.Modifiers.docString?
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Option String

full_name: Lean.Elab.Modifiers.isNoncomputable
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Bool

full_name: Lean.Elab.Modifiers.recKind
code: /-- Flags and data added to declarations (eg docstrings, attributes, `private`, `unsafe`, `partial`, ...). -/
structure Modifiers where
  docString?      : Option String := none
  visibility      : Visibility := Visibility.regular
  isNoncomputable : Bool := false
  recKind         : RecKind := RecKind.default
  isUnsafe        : Bool := false
  attrs           : Array Attribute := #[]
  deriving Inhabited
goal: Lean.Elab.RecKind

full_name: Lean.Elab.Modifiers.isPrivate
code: def Modifiers.isPrivate : Modifiers → Bool
  
goal: Lean.Elab.Modifiers → Bool

full_name: Lean.Elab.Modifiers.isProtected
code: def Modifiers.isProtected : Modifiers → Bool
  
goal: Lean.Elab.Modifiers → Bool

full_name: Lean.Elab.Modifiers.isPartial
code: def Modifiers.isPartial : Modifiers → Bool
  
goal: Lean.Elab.Modifiers → Bool

full_name: Lean.Elab.Modifiers.isNonrec
code: def Modifiers.isNonrec : Modifiers → Bool
  
goal: Lean.Elab.Modifiers → Bool

full_name: Lean.Elab.Modifiers.addAttr
code: /-- Adds attribute `attr` in `modifiers` -/
def Modifiers.addAttr (modifiers : Modifiers) (attr : Attribute) : Modifiers 
goal: Lean.Elab.Modifiers

full_name: Lean.Elab.Modifiers.filterAttrs
code: /-- Filters attributes using `p` -/
def Modifiers.filterAttrs (modifiers : Modifiers) (p : Attribute → Bool) : Modifiers 
goal: Lean.Elab.Modifiers

full_name: Lean.Elab.instToFormatModifiers
code: instance : ToFormat Modifiers 
goal: Lean.ToFormat Lean.Elab.Modifiers

full_name: Lean.Elab.instToStringModifiers
code: instance : ToString Modifiers 
goal: ToString Lean.Elab.Modifiers

full_name: Lean.Elab.expandOptDocComment?
code: /--
Retrieve doc string from `stx` of the form `(docComment)?`.
-/
def expandOptDocComment? [Monad m] [MonadError m] (optDocComment : Syntax) : m (Option String) 
goal: m (Option String)

full_name: Lean.Elab.elabModifiers
code: /-- Elaborate declaration modifiers (i.e., attributes, `partial`, `private`, `proctected`, `unsafe`, `noncomputable`, doc string)-/
def elabModifiers (stx : Syntax) : m Modifiers 
goal: m Lean.Elab.Modifiers

full_name: Lean.Elab.applyVisibility
code: /--
Ensure the function has not already been declared, and apply the given visibility setting to `declName`.
If `private`, return the updated name using our internal encoding for private names.
If `protected`, register `declName` as protected in the environment.
-/
def applyVisibility (visibility : Visibility) (declName : Name) : m Name 
goal: m Lean.Name

full_name: Lean.Elab.checkIfShadowingStructureField
code: def checkIfShadowingStructureField (declName : Name) : m Unit 
goal: m Unit

full_name: Lean.Elab.mkDeclName
code: def mkDeclName (currNamespace : Name) (modifiers : Modifiers) (shortName : Name) : m (Name × Name) 
goal: m (Lean.Name × Lean.Name)

full_name: Lean.Elab.expandDeclIdCore
code: /--
  `declId` is of the form
  ```
  leading_parser ident >> optional (".{" >> sepBy1 ident ", " >> "}")
  ```
  but we also accept a single identifier to users to make macro writing more convenient .
-/
def expandDeclIdCore (declId : Syntax) : Name × Syntax 
goal: Lean.Name × Lean.Syntax

full_name: Lean.Elab.ExpandDeclIdResult.shortName
code: /-- `expandDeclId` resulting type. -/
structure ExpandDeclIdResult where
  /-- Short name for recursively referring to the declaration. -/
  shortName  : Name
  /-- Fully qualified name that will be used to name the declaration in the kernel. -/
  declName   : Name
  /-- Universe parameter names provided using the `universe` command and `.{...}` notation. -/
  levelNames : List Name
goal: Lean.Name

full_name: Lean.Elab.ExpandDeclIdResult
code: /-- `expandDeclId` resulting type. -/
structure ExpandDeclIdResult where
  /-- Short name for recursively referring to the declaration. -/
  shortName  : Name
  /-- Fully qualified name that will be used to name the declaration in the kernel. -/
  declName   : Name
  /-- Universe parameter names provided using the `universe` command and `.{...}` notation. -/
  levelNames : List Name
goal: Type

full_name: Lean.Elab.ExpandDeclIdResult.levelNames
code: /-- `expandDeclId` resulting type. -/
structure ExpandDeclIdResult where
  /-- Short name for recursively referring to the declaration. -/
  shortName  : Name
  /-- Fully qualified name that will be used to name the declaration in the kernel. -/
  declName   : Name
  /-- Universe parameter names provided using the `universe` command and `.{...}` notation. -/
  levelNames : List Name
goal: List Lean.Name

full_name: Lean.Elab.ExpandDeclIdResult.declName
code: /-- `expandDeclId` resulting type. -/
structure ExpandDeclIdResult where
  /-- Short name for recursively referring to the declaration. -/
  shortName  : Name
  /-- Fully qualified name that will be used to name the declaration in the kernel. -/
  declName   : Name
  /-- Universe parameter names provided using the `universe` command and `.{...}` notation. -/
  levelNames : List Name
goal: Lean.Name

full_name: Lean.Elab.expandDeclId
code: /--
Given a declaration identifier (e.g., `ident (".{" ident,+ "}")?`) that may contain explicit universe parameters
- Ensure the new universe parameters do not shadow universe parameters declared using `universe` command.
- Create the fully qualified named for the declaration using the current namespace, and given `modifiers`
- Create a short version for recursively referring to the declaration. Recall that the `protected` modifier affects the generation of the short name.

The result also contains the universe parameters provided using `universe` command, and the `.{...}` notation.

This commands also stores the doc string stored in `modifiers`.
-/
def expandDeclId (currNamespace : Name) (currLevelNames : List Name) (declId : Syntax) (modifiers : Modifiers) : m ExpandDeclIdResult 
goal: m Lean.Elab.ExpandDeclIdResult