lean4-htt/src/Lean/Modifiers.lean
Sebastian Ullrich 4d8bc22228
feat: Environment.addConstAsync (#6691)
This PR introduces the central API for making parallel changes to the
environment
2025-01-19 02:00:16 +00:00

28 lines
808 B
Text

/-
Copyright (c) 2019 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
prelude
import Lean.Environment
import Lean.PrivateName
namespace Lean
builtin_initialize protectedExt : TagDeclarationExtension ← mkTagDeclarationExtension
def addProtected (env : Environment) (n : Name) : Environment :=
protectedExt.tag env n
def isProtected (env : Environment) (n : Name) : Bool :=
protectedExt.isTagged env n
def mkPrivateName (env : Environment) (n : Name) : Name :=
Name.mkNum (privateHeader ++ env.mainModule) 0 ++ n
def isPrivateNameFromImportedModule (env : Environment) (n : Name) : Bool :=
match privateToUserName? n with
| some userName => mkPrivateName env userName != n
| _ => false
end Lean