Documentation

Lean.ScopedEnvExtension

Instances For
    • state : σ
    • activeScopes : NameSet
    • delimitsLocal : Bool
    • scopeChanged : Bool

      Whether this state may differ from the enclosing scope's state because of changes made since this scope was pushed: local entries, entries of namespaces activated in this scope, and ScopedEnvExtension.modifyState. Popping a scope with this flag set bumps the generation to a fresh value (see PersistentEnvExtensionDescrCore.trackGen) and, for an extension with logWrites, logs scopeChangedDecls. Only tracked for extensions with Descr.tracksScopes.

    • scopeChangedDecls : Array Name

      The declarations of the entries added since this scope was pushed, which popping it removes again; collected only for extensions with Descr.entryDecl?.

    Instances For
      Instances For
        Instances For
          def Lean.ScopedEnvExtension.addImportedGlobals {σ α β : Type} (mkInitial : IO σ) (ofOLeanEntry : σ → α → ImportM β) (addImportedEntry : σ → β → σ) (as : Array (Array (Entry α))) :

          Adds the global entries of the imported modules, given in module order, one by one to mkInitial; the default of Descr.importGlobals.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            structure Lean.ScopedEnvExtension.Descr (α β σ : Type) :
            • name : Name
            • mkInitial : IO σ
            • ofOLeanEntry : σ → α → ImportM β
            • toOLeanEntry : β → α
            • addEntry : σ → β → σ
            • addImportedEntry : σ → β → σ

              Adds a global entry of an imported module.

            • finalizeImport : σ → σ
            • exportEntry? : Environment → α → OLeanEntries (Option α)
            • trackGen : Bool

              See PersistentEnvExtensionDescrCore.trackGen.

            • logWrites : Bool

              See EnvExtension.logWrites.

            • entryDecl? : Option (β → Name)

              The declaration an entry is about. Required with logWrites: adding an entry and scope operations adding or removing entries log their declarations (Environment.logDeclChange).

            • importGlobals : Array (Array (Entry α)) → ImportM σ

              Creates the initial state at import from the global entries of all imported modules, which are given in module order. The default adds them one by one to mkInitial using ofOLeanEntry and addImportedEntry. Environments without imports start from mkInitial.

            Instances For
              def Lean.ScopedEnvExtension.Descr.tracksScopes {α β σ : Type} (descr : Descr α β σ) :

              Whether scope operations that change the effective state must be recorded like content changes; see State.scopeChanged.

              Equations
              Instances For
                def Lean.ScopedEnvExtension.Descr.noteScopeChange {α β σ : Type} (descr : Descr α β σ) (s : State σ) (b : β) :

                Notes on s that the entry b was added to it; see State.scopeChanged.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[instance_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  def Lean.ScopedEnvExtension.mkInitial {α β σ : Type} (descr : Descr α β σ) :
                  IO (StateStack α β σ)
                  Equations
                  Instances For
                    def Lean.ScopedEnvExtension.ScopedEntries.insert {β : Type} (scopedEntries : ScopedEntries β) (ns : Name) (b : β) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Lean.ScopedEnvExtension.addImportedFn {α β σ : Type} (descr : Descr α β σ) (as : Array (Array (Entry α))) :
                      ImportM (StateStack α β σ)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Lean.ScopedEnvExtension.addEntryFn {α β σ : Type} (descr : Descr α β σ) (s : StateStack α β σ) (e : Entry β) :
                        StateStack α β σ
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Lean.ScopedEnvExtension.exportEntriesFn {α β σ : Type} (descr : Descr α β σ) (env : Environment) (s : StateStack α β σ) :
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            structure Lean.ScopedEnvExtension (α β σ : Type) :
                            Instances For
                              @[instance_reducible]
                              instance Lean.instInhabitedScopedEnvExtension {a✝ : Type} [Inhabited a✝] {a✝¹ a✝² : Type} :
                              Inhabited (ScopedEnvExtension a✝ a✝¹ a✝²)
                              Equations
                              unsafe def Lean.registerScopedEnvExtensionUnsafe {α β σ : Type} (descr : ScopedEnvExtension.Descr α β σ) :
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[implemented_by Lean.registerScopedEnvExtensionUnsafe]
                                opaque Lean.registerScopedEnvExtension {α β σ : Type} (descr : ScopedEnvExtension.Descr α β σ) :
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def Lean.ScopedEnvExtension.setDelimitsLocal {α β σ : Type} (ext : ScopedEnvExtension α β σ) (env : Environment) (depth : Nat) :

                                    Modifies delimitsLocal flag to false on the top depth entries of the state stack, to turn off delimiting of local entries across multiple implicit scope levels (e.g. those introduced by compound namespace A.B.C expansions).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def Lean.ScopedEnvExtension.addScopedEntry {α β σ : Type} (ext : ScopedEnvExtension α β σ) (env : Environment) (namespaceName : Name) (b : β) :
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        def Lean.stateStackModify {α β σ : Type} (ext : ScopedEnvExtension α β σ) (states : List (ScopedEnvExtension.State σ)) (b : β) :

                                        The following function is used to implement end_local_scope command.

                                        By default, all states have delimitsLocal set to true, and the following code modifies only the top element of the stack. If the top element’s delimitsLocal is false, the function instead traverses down the stack until it reaches the first state where delimitsLocal is true. Intuitively, delimitsLocal of each State determines whether local entries are delimited. When set to false, it allows traversal through implicit scopes where local entries are not delimited.

                                        Equations
                                        Instances For
                                          def Lean.ScopedEnvExtension.addLocalEntry {α β σ : Type} (ext : ScopedEnvExtension α β σ) (env : Environment) (b : β) :
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            def Lean.ScopedEnvExtension.addCore {α β σ : Type} (env : Environment) (ext : ScopedEnvExtension α β σ) (b : β) (kind : AttributeKind) (namespaceName : Name) :
                                            Equations
                                            Instances For
                                              def Lean.ScopedEnvExtension.add {m : Type → Type} {α β σ : Type} [Monad m] [MonadResolveName m] [MonadEnv m] (ext : ScopedEnvExtension α β σ) (b : β) (kind : AttributeKind := AttributeKind.global) :
                                              Equations
                                              Instances For
                                                def Lean.ScopedEnvExtension.getState {σ α β : Type} [Inhabited σ] (ext : ScopedEnvExtension α β σ) (env : Environment) (asyncMode : EnvExtension.AsyncMode := ext.ext.toEnvExtension.asyncMode) (genRecorded : Bool := false) :
                                                σ

                                                Returns the state in effect. For genRecorded, see EnvExtension.getState.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def Lean.ScopedEnvExtension.activateScoped {α β σ : Type} (ext : ScopedEnvExtension α β σ) (env : Environment) (namespaceName : Name) :
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    def Lean.ScopedEnvExtension.modifyState {α β σ : Type} (ext : ScopedEnvExtension α β σ) (env : Environment) (f : σ → σ) :
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          def Lean.setDelimitsLocal {m : Type → Type} [Monad m] [MonadEnv m] [MonadLiftT (ST IO.RealWorld) m] (depth : Nat) :

                                                          Used to implement end_local_scope command, that disables delimiting local entries of ScopedEnvExtension across depth scope levels.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            def Lean.activateScoped {m : Type → Type} [Monad m] [MonadEnv m] [MonadLiftT (ST IO.RealWorld) m] (namespaceName : Name) :
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              @[reducible, inline]
                                                              Equations
                                                              Instances For
                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    def Lean.registerSimpleScopedEnvExtensionWithSummaries {α σ ι : Type} (descr : SimpleScopedEnvExtension.Descr α σ) (build : Environment → Array α → ι) (addImported : σ → Array (Option ι × Array (ScopedEnvExtension.Entry α)) → ImportM σ) :

                                                                    Registers a simple scoped environment extension (see registerSimpleScopedEnvExtension) whose imported global entries are added using per-module summaries instead of one by one.

                                                                    When a module is exported, build summarizes the global entries it exports at each olean level, if any; the summaries are stored by a separate persistent extension. On import, addImported adds the global entries of all imported modules to the initial state, given in module order, each with its entries and its summary (none for modules without global entries).

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For