diff --git a/.github/workflows/build-template.yml b/.github/workflows/build-template.yml index 0849962d37..7f44afa3b8 100644 --- a/.github/workflows/build-template.yml +++ b/.github/workflows/build-template.yml @@ -199,7 +199,7 @@ jobs: path: pack/* - name: Lean stats run: | - build/stage1/bin/lean --stats src/Lean.lean + build/stage1/bin/lean --stats src/Lean.lean -Dexperimental.module=true if: ${{ !matrix.cross }} - name: Test id: test diff --git a/script/bench.sh b/script/bench.sh index 68ffe67fb9..8e4d28a98d 100755 --- a/script/bench.sh +++ b/script/bench.sh @@ -4,12 +4,12 @@ set -euo pipefail cmake --preset release -DUSE_LAKE=ON 1>&2 # We benchmark against stage 2 to test new optimizations. -timeout -s KILL 1h time make -C build/release -j$(nproc) stage2 1>&2 +timeout -s KILL 1h time make -C build/release -j$(nproc) stage3 1>&2 export PATH=$PWD/build/release/stage2/bin:$PATH # The extra opts used to be passed to the Makefile during benchmarking only but with Lake it is # easier to configure them statically. -cmake -B build/release/stage2 -S src -DLEAN_EXTRA_LAKEFILE_TOML='weakLeanArgs=["-Dprofiler=true", "-Dprofiler.threshold=9999999", "--stats"]' 1>&2 +cmake -B build/release/stage3 -S src -DLEAN_EXTRA_LAKEFILE_TOML='weakLeanArgs=["-Dprofiler=true", "-Dprofiler.threshold=9999999", "--stats"]' 1>&2 cd tests/bench timeout -s KILL 1h time temci exec --config speedcenter.yaml --in speedcenter.exec.velcom.yaml 1>&2 diff --git a/src/Init/Control/Basic.lean b/src/Init/Control/Basic.lean index 4766ef9f6f..cb7a69ca25 100644 --- a/src/Init/Control/Basic.lean +++ b/src/Init/Control/Basic.lean @@ -9,7 +9,7 @@ prelude public import Init.Core public import Init.BinderNameHint -public section +@[expose] public section universe u v w diff --git a/src/Init/Data/String/Basic.lean b/src/Init/Data/String/Basic.lean index 97403fe898..ac1ce40c95 100644 --- a/src/Init/Data/String/Basic.lean +++ b/src/Init/Data/String/Basic.lean @@ -301,7 +301,7 @@ Examples: * `"L∃∀N".atEnd ⟨7⟩ = false` * `"L∃∀N".atEnd ⟨8⟩ = true` -/ -@[extern "lean_string_utf8_at_end"] +@[extern "lean_string_utf8_at_end", expose] def atEnd : (@& String) → (@& Pos) → Bool | s, p => p.byteIdx ≥ utf8ByteSize s diff --git a/src/Lean.lean b/src/Lean.lean index c5190f3479..3e26f4ad7a 100644 --- a/src/Lean.lean +++ b/src/Lean.lean @@ -3,45 +3,47 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ -import Lean.Data -import Lean.Compiler -import Lean.Environment -import Lean.Modifiers -import Lean.ProjFns -import Lean.Runtime -import Lean.ResolveName -import Lean.Attributes -import Lean.Parser -import Lean.ReducibilityAttrs -import Lean.Elab -import Lean.Class -import Lean.LocalContext -import Lean.MetavarContext -import Lean.AuxRecursor -import Lean.Meta -import Lean.Util -import Lean.Structure -import Lean.PrettyPrinter -import Lean.CoreM -import Lean.ReservedNameAction -import Lean.InternalExceptionId -import Lean.Server -import Lean.ScopedEnvExtension -import Lean.DocString -import Lean.DeclarationRange -import Lean.LoadDynlib -import Lean.Widget -import Lean.Log -import Lean.Linter -import Lean.SubExpr -import Lean.LabelAttribute -import Lean.AddDecl -import Lean.Replay -import Lean.PrivateName -import Lean.PremiseSelection -import Lean.Namespace -import Lean.EnvExtension -import Lean.ErrorExplanation -import Lean.ErrorExplanations -import Lean.DefEqAttrib -import Lean.Shell +module + +public import Lean.Data +public import Lean.Compiler +public import Lean.Environment +public import Lean.Modifiers +public import Lean.ProjFns +public import Lean.Runtime +public import Lean.ResolveName +public import Lean.Attributes +public import Lean.Parser +public import Lean.ReducibilityAttrs +public import Lean.Elab +public import Lean.Class +public import Lean.LocalContext +public import Lean.MetavarContext +public import Lean.AuxRecursor +public import Lean.Meta +public import Lean.Util +public import Lean.Structure +public import Lean.PrettyPrinter +public import Lean.CoreM +public import Lean.ReservedNameAction +public import Lean.InternalExceptionId +public import Lean.Server +public import Lean.ScopedEnvExtension +public import Lean.DocString +public import Lean.DeclarationRange +public import Lean.LoadDynlib +public import Lean.Widget +public import Lean.Log +public import Lean.Linter +public import Lean.SubExpr +public import Lean.LabelAttribute +public import Lean.AddDecl +public import Lean.Replay +public import Lean.PrivateName +public import Lean.PremiseSelection +public import Lean.Namespace +public import Lean.EnvExtension +public import Lean.ErrorExplanation +public import Lean.ErrorExplanations +public import Lean.DefEqAttrib +public import Lean.Shell diff --git a/src/Lean/AddDecl.lean b/src/Lean/AddDecl.lean index 6795772366..03112b5d2e 100644 --- a/src/Lean/AddDecl.lean +++ b/src/Lean/AddDecl.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM -import Lean.Namespace -import Lean.Util.CollectAxioms +public import Lean.CoreM +public import Lean.Namespace +public import Lean.Util.CollectAxioms + +public section namespace Lean diff --git a/src/Lean/Attributes.lean b/src/Lean/Attributes.lean index c1fcea2664..8754f385dd 100644 --- a/src/Lean/Attributes.lean +++ b/src/Lean/Attributes.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM -import Lean.MonadEnv +public import Lean.CoreM +public import Lean.MonadEnv + +public section namespace Lean diff --git a/src/Lean/AuxRecursor.lean b/src/Lean/AuxRecursor.lean index a273a16472..077381f186 100644 --- a/src/Lean/AuxRecursor.lean +++ b/src/Lean/AuxRecursor.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.EnvExtension +public import Lean.EnvExtension + +public section namespace Lean diff --git a/src/Lean/BuiltinDocAttr.lean b/src/Lean/BuiltinDocAttr.lean index c3578b6ef6..f34fb52815 100644 --- a/src/Lean/BuiltinDocAttr.lean +++ b/src/Lean/BuiltinDocAttr.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Compiler.InitAttr -import Lean.DocString.Extension +public import Lean.Compiler.InitAttr +public import Lean.DocString.Extension + +public section namespace Lean diff --git a/src/Lean/Class.lean b/src/Lean/Class.lean index 60bf539401..aa930aad4b 100644 --- a/src/Lean/Class.lean +++ b/src/Lean/Class.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes +public import Lean.Attributes + +public section namespace Lean diff --git a/src/Lean/Compiler.lean b/src/Lean/Compiler.lean index 0fcd41c45b..c655df7011 100644 --- a/src/Lean/Compiler.lean +++ b/src/Lean/Compiler.lean @@ -3,17 +3,21 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.InlineAttrs -import Lean.Compiler.Specialize -import Lean.Compiler.ClosedTermCache -import Lean.Compiler.ExternAttr -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.NeverExtractAttr -import Lean.Compiler.IR -import Lean.Compiler.CSimpAttr -import Lean.Compiler.FFI -import Lean.Compiler.MetaAttr -import Lean.Compiler.NoncomputableAttr -import Lean.Compiler.Main -import Lean.Compiler.Old -- TODO: delete after we port code generator to Lean +public import Lean.Compiler.InlineAttrs +public import Lean.Compiler.Specialize +public import Lean.Compiler.ClosedTermCache +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.NeverExtractAttr +public import Lean.Compiler.IR +public import Lean.Compiler.CSimpAttr +public import Lean.Compiler.FFI +public import Lean.Compiler.MetaAttr +public import Lean.Compiler.NoncomputableAttr +public import Lean.Compiler.Main +public import Lean.Compiler.Old -- TODO: delete after we port code generator to Lean + +public section diff --git a/src/Lean/Compiler/BorrowedAnnotation.lean b/src/Lean/Compiler/BorrowedAnnotation.lean index 32e2898be6..eb7ec7e2f3 100644 --- a/src/Lean/Compiler/BorrowedAnnotation.lean +++ b/src/Lean/Compiler/BorrowedAnnotation.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean def markBorrowed (e : Expr) : Expr := diff --git a/src/Lean/Compiler/CSimpAttr.lean b/src/Lean/Compiler/CSimpAttr.lean index 98cd987e50..c6d1b1c198 100644 --- a/src/Lean/Compiler/CSimpAttr.lean +++ b/src/Lean/Compiler/CSimpAttr.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.Util.Recognizers -import Lean.Util.ReplaceExpr +public import Lean.ScopedEnvExtension +public import Lean.Util.Recognizers +public import Lean.Util.ReplaceExpr + +public section namespace Lean.Compiler namespace CSimp diff --git a/src/Lean/Compiler/ClosedTermCache.lean b/src/Lean/Compiler/ClosedTermCache.lean index 1cd5e37c8b..dbbcce9fc1 100644 --- a/src/Lean/Compiler/ClosedTermCache.lean +++ b/src/Lean/Compiler/ClosedTermCache.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment +public import Lean.Environment + +public section namespace Lean diff --git a/src/Lean/Compiler/ExportAttr.lean b/src/Lean/Compiler/ExportAttr.lean index 577845f67f..1d9590f473 100644 --- a/src/Lean/Compiler/ExportAttr.lean +++ b/src/Lean/Compiler/ExportAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes +public import Lean.Attributes + +public section namespace Lean diff --git a/src/Lean/Compiler/ExternAttr.lean b/src/Lean/Compiler/ExternAttr.lean index 155becd320..8260eda6d1 100644 --- a/src/Lean/Compiler/ExternAttr.lean +++ b/src/Lean/Compiler/ExternAttr.lean @@ -3,13 +3,17 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.List.BasicAux -import Lean.Expr -import Lean.Environment -import Lean.Attributes -import Lean.ProjFns -import Lean.Meta.Basic +public import Init.Data.List.BasicAux +public import Lean.Expr +public import Lean.Environment +public import Lean.Attributes +public import Lean.ProjFns +public import Lean.Meta.Basic + +public section namespace Lean diff --git a/src/Lean/Compiler/FFI.lean b/src/Lean/Compiler/FFI.lean index 8772db395b..2da0639148 100644 --- a/src/Lean/Compiler/FFI.lean +++ b/src/Lean/Compiler/FFI.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Init.Data.Array.Basic -import Init.System.FilePath +public import Init.Data.Array.Basic +public import Init.System.FilePath + +public section open System diff --git a/src/Lean/Compiler/IR.lean b/src/Lean/Compiler/IR.lean index 801925dd86..2bda784562 100644 --- a/src/Lean/Compiler/IR.lean +++ b/src/Lean/Compiler/IR.lean @@ -3,33 +3,37 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.AddExtern -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.Format -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.PushProj -import Lean.Compiler.IR.ElimDeadVars -import Lean.Compiler.IR.SimpCase -import Lean.Compiler.IR.ResetReuse -import Lean.Compiler.IR.NormIds -import Lean.Compiler.IR.Checker -import Lean.Compiler.IR.Borrow -import Lean.Compiler.IR.Boxing -import Lean.Compiler.IR.RC -import Lean.Compiler.IR.ExpandResetReuse -import Lean.Compiler.IR.UnboxResult -import Lean.Compiler.IR.ElimDeadBranches -import Lean.Compiler.IR.EmitC -import Lean.Compiler.IR.Sorry -import Lean.Compiler.IR.ToIR -import Lean.Compiler.IR.ToIRType -import Lean.Compiler.IR.Meta +public import Lean.Compiler.IR.AddExtern +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Format +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.PushProj +public import Lean.Compiler.IR.ElimDeadVars +public import Lean.Compiler.IR.SimpCase +public import Lean.Compiler.IR.ResetReuse +public import Lean.Compiler.IR.NormIds +public import Lean.Compiler.IR.Checker +public import Lean.Compiler.IR.Borrow +public import Lean.Compiler.IR.Boxing +public import Lean.Compiler.IR.RC +public import Lean.Compiler.IR.ExpandResetReuse +public import Lean.Compiler.IR.UnboxResult +public import Lean.Compiler.IR.ElimDeadBranches +public import Lean.Compiler.IR.EmitC +public import Lean.Compiler.IR.Sorry +public import Lean.Compiler.IR.ToIR +public import Lean.Compiler.IR.ToIRType +public import Lean.Compiler.IR.Meta -- The following imports are not required by the compiler. They are here to ensure that there -- are no orphaned modules. -import Lean.Compiler.IR.LLVMBindings -import Lean.Compiler.IR.EmitLLVM +public import Lean.Compiler.IR.LLVMBindings +public import Lean.Compiler.IR.EmitLLVM + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/AddExtern.lean b/src/Lean/Compiler/IR/AddExtern.lean index 8cd7675f26..2e6258b7b2 100644 --- a/src/Lean/Compiler/IR/AddExtern.lean +++ b/src/Lean/Compiler/IR/AddExtern.lean @@ -4,15 +4,19 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Cameron Zwarich -/ +module + prelude -import Lean.CoreM -import Lean.Compiler.BorrowedAnnotation -import Lean.Compiler.ExternAttr -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.Boxing -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.ToIRType -import Lean.Compiler.LCNF.MonoTypes +public import Lean.CoreM +public import Lean.Compiler.BorrowedAnnotation +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Boxing +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.ToIRType +public import Lean.Compiler.LCNF.MonoTypes + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/Basic.lean b/src/Lean/Compiler/IR/Basic.lean index a6d060ab39..4adb467177 100644 --- a/src/Lean/Compiler/IR/Basic.lean +++ b/src/Lean/Compiler/IR/Basic.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.KVMap -import Lean.Data.Name -import Lean.Data.Format -import Lean.Compiler.ExternAttr +public import Lean.Data.KVMap +public import Lean.Data.Name +public import Lean.Data.Format +public import Lean.Compiler.ExternAttr + +public section /-! Implements (extended) λPure and λRc proposed in the article "Counting Immutable Beans", Sebastian Ullrich and Leonardo de Moura. diff --git a/src/Lean/Compiler/IR/Borrow.lean b/src/Lean/Compiler/IR/Borrow.lean index 68809d0998..33028da3d8 100644 --- a/src/Lean/Compiler/IR/Borrow.lean +++ b/src/Lean/Compiler/IR/Borrow.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.ExportAttr -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.NormIds +public import Lean.Compiler.ExportAttr +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.NormIds + +public section namespace Lean namespace IR diff --git a/src/Lean/Compiler/IR/Boxing.lean b/src/Lean/Compiler/IR/Boxing.lean index 338992c415..645eb10235 100644 --- a/src/Lean/Compiler/IR/Boxing.lean +++ b/src/Lean/Compiler/IR/Boxing.lean @@ -3,16 +3,20 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Runtime -import Lean.Compiler.ClosedTermCache -import Lean.Compiler.ExternAttr -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.FreeVars -import Lean.Compiler.IR.ElimDeadVars -import Lean.Compiler.IR.ToIRType -import Lean.Data.AssocList +public import Lean.Runtime +public import Lean.Compiler.ClosedTermCache +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.FreeVars +public import Lean.Compiler.IR.ElimDeadVars +public import Lean.Compiler.IR.ToIRType +public import Lean.Data.AssocList + +public section namespace Lean.IR.ExplicitBoxing /-! diff --git a/src/Lean/Compiler/IR/Checker.lean b/src/Lean/Compiler/IR/Checker.lean index 6038c1168e..e9c0560f9a 100644 --- a/src/Lean/Compiler/IR/Checker.lean +++ b/src/Lean/Compiler/IR/Checker.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.Format +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.Format + +public section namespace Lean.IR.Checker diff --git a/src/Lean/Compiler/IR/CompilerM.lean b/src/Lean/Compiler/IR/CompilerM.lean index 681a7a182a..15afe91bc4 100644 --- a/src/Lean/Compiler/IR/CompilerM.lean +++ b/src/Lean/Compiler/IR/CompilerM.lean @@ -3,14 +3,18 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM -import Lean.Environment -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.Format -import Lean.Compiler.MetaAttr -import Lean.Compiler.ExportAttr -import Lean.Compiler.LCNF.PhaseExt +public import Lean.CoreM +public import Lean.Environment +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Format +public import Lean.Compiler.MetaAttr +public import Lean.Compiler.ExportAttr +public import Lean.Compiler.LCNF.PhaseExt + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/ElimDeadBranches.lean b/src/Lean/Compiler/IR/ElimDeadBranches.lean index baff23f174..238d3a4e80 100644 --- a/src/Lean/Compiler/IR/ElimDeadBranches.lean +++ b/src/Lean/Compiler/IR/ElimDeadBranches.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Format -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.Format +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.CompilerM + +public section namespace Lean.IR.UnreachableBranches diff --git a/src/Lean/Compiler/IR/ElimDeadVars.lean b/src/Lean/Compiler/IR/ElimDeadVars.lean index 80bd5044e4..d8be5dff9c 100644 --- a/src/Lean/Compiler/IR/ElimDeadVars.lean +++ b/src/Lean/Compiler/IR/ElimDeadVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.FreeVars +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.FreeVars + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/EmitC.lean b/src/Lean/Compiler/IR/EmitC.lean index ef0f1a6781..13b15b6322 100644 --- a/src/Lean/Compiler/IR/EmitC.lean +++ b/src/Lean/Compiler/IR/EmitC.lean @@ -3,16 +3,20 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Runtime -import Lean.Compiler.NameMangling -import Lean.Compiler.ExportAttr -import Lean.Compiler.InitAttr -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.EmitUtil -import Lean.Compiler.IR.NormIds -import Lean.Compiler.IR.SimpCase -import Lean.Compiler.IR.Boxing +public import Lean.Runtime +public import Lean.Compiler.NameMangling +public import Lean.Compiler.ExportAttr +public import Lean.Compiler.InitAttr +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.EmitUtil +public import Lean.Compiler.IR.NormIds +public import Lean.Compiler.IR.SimpCase +public import Lean.Compiler.IR.Boxing + +public section namespace Lean.IR.EmitC open ExplicitBoxing (requiresBoxedVersion mkBoxedName isBoxedName) diff --git a/src/Lean/Compiler/IR/EmitLLVM.lean b/src/Lean/Compiler/IR/EmitLLVM.lean index 55103dfbae..a188a3c126 100644 --- a/src/Lean/Compiler/IR/EmitLLVM.lean +++ b/src/Lean/Compiler/IR/EmitLLVM.lean @@ -3,18 +3,22 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Siddharth Bhat -/ +module + prelude -import Lean.Runtime -import Lean.Compiler.NameMangling -import Lean.Compiler.ExportAttr -import Lean.Compiler.InitAttr -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.EmitUtil -import Lean.Compiler.IR.NormIds -import Lean.Compiler.IR.SimpCase -import Lean.Compiler.IR.Boxing -import Lean.Compiler.IR.ResetReuse -import Lean.Compiler.IR.LLVMBindings +public import Lean.Runtime +public import Lean.Compiler.NameMangling +public import Lean.Compiler.ExportAttr +public import Lean.Compiler.InitAttr +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.EmitUtil +public import Lean.Compiler.IR.NormIds +public import Lean.Compiler.IR.SimpCase +public import Lean.Compiler.IR.Boxing +public import Lean.Compiler.IR.ResetReuse +public import Lean.Compiler.IR.LLVMBindings + +public section open Lean.IR.ExplicitBoxing (isBoxedName) diff --git a/src/Lean/Compiler/IR/EmitUtil.lean b/src/Lean/Compiler/IR/EmitUtil.lean index 0c78fda3f2..f05b5e347f 100644 --- a/src/Lean/Compiler/IR/EmitUtil.lean +++ b/src/Lean/Compiler/IR/EmitUtil.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.InitAttr -import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.InitAttr +public import Lean.Compiler.IR.CompilerM + +public section /-! # Helper functions for backend code generators -/ diff --git a/src/Lean/Compiler/IR/ExpandResetReuse.lean b/src/Lean/Compiler/IR/ExpandResetReuse.lean index aa0b60af72..dd8c080738 100644 --- a/src/Lean/Compiler/IR/ExpandResetReuse.lean +++ b/src/Lean/Compiler/IR/ExpandResetReuse.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.NormIds -import Lean.Compiler.IR.FreeVars +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.NormIds +public import Lean.Compiler.IR.FreeVars + +public section namespace Lean.IR.ExpandResetReuse /-- Mapping from variable to projections -/ diff --git a/src/Lean/Compiler/IR/Format.lean b/src/Lean/Compiler/IR/Format.lean index d53e19bc1e..b35bf54254 100644 --- a/src/Lean/Compiler/IR/Format.lean +++ b/src/Lean/Compiler/IR/Format.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Basic + +public section namespace Lean namespace IR @@ -13,7 +17,7 @@ private def formatArg : Arg → Format | Arg.var id => format id | Arg.erased => "◾" -instance : ToFormat Arg := ⟨formatArg⟩ +instance : ToFormat Arg := ⟨private_decl% formatArg⟩ def formatArray {α : Type} [ToFormat α] (args : Array α) : Format := args.foldl (fun r a => r ++ " " ++ format a) Format.nil @@ -22,7 +26,7 @@ private def formatLitVal : LitVal → Format | LitVal.num v => format v | LitVal.str v => format (repr v) -instance : ToFormat LitVal := ⟨formatLitVal⟩ +instance : ToFormat LitVal := ⟨private_decl% formatLitVal⟩ private def formatCtorInfo : CtorInfo → Format | { name := name, cidx := cidx, usize := usize, ssize := ssize, .. } => Id.run do @@ -33,7 +37,7 @@ private def formatCtorInfo : CtorInfo → Format r := f!"{r}[{name}]" r -instance : ToFormat CtorInfo := ⟨formatCtorInfo⟩ +instance : ToFormat CtorInfo := ⟨private_decl% formatCtorInfo⟩ private def formatExpr : Expr → Format | Expr.ctor i ys => format i ++ formatArray ys @@ -50,7 +54,7 @@ private def formatExpr : Expr → Format | Expr.lit v => format v | Expr.isShared x => "isShared " ++ format x -instance : ToFormat Expr := ⟨formatExpr⟩ +instance : ToFormat Expr := ⟨private_decl% formatExpr⟩ instance : ToString Expr := ⟨fun e => Format.pretty (format e)⟩ private partial def formatIRType : IRType → Format @@ -78,7 +82,7 @@ instance : ToString IRType := ⟨toString ∘ format⟩ private def formatParam : Param → Format | { x := name, borrow := b, ty := ty } => "(" ++ format name ++ " : " ++ (if b then "@& " else "") ++ format ty ++ ")" -instance : ToFormat Param := ⟨formatParam⟩ +instance : ToFormat Param := ⟨private_decl% formatParam⟩ def formatAlt (fmt : FnBody → Format) (indent : Nat) : Alt → Format | Alt.ctor i b => format i.name ++ " →" ++ Format.nest indent (Format.line ++ fmt b) diff --git a/src/Lean/Compiler/IR/FreeVars.lean b/src/Lean/Compiler/IR/FreeVars.lean index c9d04d07bc..f501ee9fc4 100644 --- a/src/Lean/Compiler/IR/FreeVars.lean +++ b/src/Lean/Compiler/IR/FreeVars.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Basic + +public section namespace Lean.IR @@ -25,7 +29,7 @@ abbrev Collector := Index → Index @[inline] private def collectJP (j : JoinPointId) : Collector := collect j.idx @[inline] private def seq (k₁ k₂ : Collector) : Collector := k₂ ∘ k₁ instance : AndThen Collector where - andThen a b := seq a (b ()) + andThen a b := private seq a (b ()) private def collectArg : Arg → Collector | .var x => collectVar x @@ -121,7 +125,7 @@ def insertParams (s : IndexSet) (ys : Array Param) : IndexSet := fun k₁ k₂ bv fv => k₂ bv (k₁ bv fv) instance : AndThen Collector where - andThen a b := seq a (b ()) + andThen a b := private seq a (b ()) private def collectArg : Arg → Collector | .var x => collectVar x diff --git a/src/Lean/Compiler/IR/LLVMBindings.lean b/src/Lean/Compiler/IR/LLVMBindings.lean index 0d5e63a81f..bb96623da6 100644 --- a/src/Lean/Compiler/IR/LLVMBindings.lean +++ b/src/Lean/Compiler/IR/LLVMBindings.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Siddharth Bhat -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section namespace LLVM /-! @@ -41,49 +45,49 @@ def AttributeIndex.AttributeFunctionIndex : AttributeIndex := { val := 184467440 structure BasicBlock (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (BasicBlock ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (BasicBlock ctx) := by exact ⟨{ ptr := default }⟩ structure Builder (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (Builder ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (Builder ctx) := by exact ⟨{ ptr := default }⟩ structure Context where private mk :: ptr : USize -instance : Nonempty Context := ⟨{ ptr := default }⟩ +instance : Nonempty Context := by exact ⟨{ ptr := default }⟩ structure LLVMType (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (LLVMType ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (LLVMType ctx) := by exact ⟨{ ptr := default }⟩ structure MemoryBuffer (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (MemoryBuffer ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (MemoryBuffer ctx) := by exact ⟨{ ptr := default }⟩ structure Module (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (Module ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (Module ctx) := by exact ⟨{ ptr := default }⟩ /- structure PassManager (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (PassManager ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (PassManager ctx) := by exact ⟨{ ptr := default }⟩ structure PassManagerBuilder (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (PassManagerBuilder ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (PassManagerBuilder ctx) := by exact ⟨{ ptr := default }⟩ -/ structure Target (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (Target ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (Target ctx) := by exact ⟨{ ptr := default }⟩ structure TargetMachine (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (TargetMachine ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (TargetMachine ctx) := by exact ⟨{ ptr := default }⟩ structure Value (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (Value ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (Value ctx) := by exact ⟨{ ptr := default }⟩ /-- Check if the value is a null pointer. --/ def Value.isNull (v : Value ctx) : Bool := v.ptr == 0 @@ -93,7 +97,7 @@ opaque Value.getName {ctx : Context} (value : Value ctx) : BaseIO String structure Attribute (ctx : Context) where private mk :: ptr : USize -instance : Nonempty (Attribute ctx) := ⟨{ ptr := default }⟩ +instance : Nonempty (Attribute ctx) := by exact ⟨{ ptr := default }⟩ @[extern "lean_llvm_initialize_target_info"] opaque llvmInitializeTargetInfo : BaseIO (Unit) diff --git a/src/Lean/Compiler/IR/LiveVars.lean b/src/Lean/Compiler/IR/LiveVars.lean index 49e1b950d6..972272c240 100644 --- a/src/Lean/Compiler/IR/LiveVars.lean +++ b/src/Lean/Compiler/IR/LiveVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.FreeVars +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.FreeVars + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/Meta.lean b/src/Lean/Compiler/IR/Meta.lean index e0363fddbc..e99cfc201c 100644 --- a/src/Lean/Compiler/IR/Meta.lean +++ b/src/Lean/Compiler/IR/Meta.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.MetaAttr +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.MetaAttr + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/NormIds.lean b/src/Lean/Compiler/IR/NormIds.lean index 4d80c412dc..9a056904b8 100644 --- a/src/Lean/Compiler/IR/NormIds.lean +++ b/src/Lean/Compiler/IR/NormIds.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Basic + +public section namespace Lean.IR.UniqueIds diff --git a/src/Lean/Compiler/IR/PushProj.lean b/src/Lean/Compiler/IR/PushProj.lean index d60f08bdd9..3d7f2d831c 100644 --- a/src/Lean/Compiler/IR/PushProj.lean +++ b/src/Lean/Compiler/IR/PushProj.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.FreeVars -import Lean.Compiler.IR.NormIds +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.FreeVars +public import Lean.Compiler.IR.NormIds + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/RC.lean b/src/Lean/Compiler/IR/RC.lean index f2ac446511..8d93e2d5f0 100644 --- a/src/Lean/Compiler/IR/RC.lean +++ b/src/Lean/Compiler/IR/RC.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Runtime -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.LiveVars +public import Lean.Runtime +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.LiveVars + +public section namespace Lean.IR.ExplicitRC /-! diff --git a/src/Lean/Compiler/IR/ResetReuse.lean b/src/Lean/Compiler/IR/ResetReuse.lean index d7330a4c65..5f0634944d 100644 --- a/src/Lean/Compiler/IR/ResetReuse.lean +++ b/src/Lean/Compiler/IR/ResetReuse.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.LiveVars -import Lean.Compiler.IR.Format +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.LiveVars +public import Lean.Compiler.IR.Format + +public section namespace Lean.IR.ResetReuse /-! diff --git a/src/Lean/Compiler/IR/SimpCase.lean b/src/Lean/Compiler/IR/SimpCase.lean index 2189509639..a0fcf0a562 100644 --- a/src/Lean/Compiler/IR/SimpCase.lean +++ b/src/Lean/Compiler/IR/SimpCase.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.Format +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Format + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/Sorry.lean b/src/Lean/Compiler/IR/Sorry.lean index 84e57909b6..afacb818e1 100644 --- a/src/Lean/Compiler/IR/Sorry.lean +++ b/src/Lean/Compiler/IR/Sorry.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.CompilerM + +public section namespace Lean.IR namespace Sorry diff --git a/src/Lean/Compiler/IR/ToIR.lean b/src/Lean/Compiler/IR/ToIR.lean index f755654934..dd725a48d7 100644 --- a/src/Lean/Compiler/IR/ToIR.lean +++ b/src/Lean/Compiler/IR/ToIR.lean @@ -3,15 +3,19 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Cameron Zwarich -/ +module + prelude -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.CompilerM -import Lean.Compiler.IR.ToIRType -import Lean.CoreM -import Lean.Environment +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.IR.ToIRType +public import Lean.CoreM +public import Lean.Environment + +public section namespace Lean.IR diff --git a/src/Lean/Compiler/IR/ToIRType.lean b/src/Lean/Compiler/IR/ToIRType.lean index 8b5f5df97e..d6ba927e1f 100644 --- a/src/Lean/Compiler/IR/ToIRType.lean +++ b/src/Lean/Compiler/IR/ToIRType.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment -import Lean.Compiler.IR.Format -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.MonoTypes -import Lean.Compiler.LCNF.Types +public import Lean.Environment +public import Lean.Compiler.IR.Format +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.Types + +public section namespace Lean namespace IR diff --git a/src/Lean/Compiler/IR/UnboxResult.lean b/src/Lean/Compiler/IR/UnboxResult.lean index eb3e6359f9..13ed1e1d43 100644 --- a/src/Lean/Compiler/IR/UnboxResult.lean +++ b/src/Lean/Compiler/IR/UnboxResult.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Format -import Lean.Compiler.IR.Basic +public import Lean.Data.Format +public import Lean.Compiler.IR.Basic + +public section namespace Lean.IR.UnboxResult diff --git a/src/Lean/Compiler/ImplementedByAttr.lean b/src/Lean/Compiler/ImplementedByAttr.lean index 3e486629c3..c85417202c 100644 --- a/src/Lean/Compiler/ImplementedByAttr.lean +++ b/src/Lean/Compiler/ImplementedByAttr.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes -import Lean.Declaration -import Lean.MonadEnv -import Lean.Elab.InfoTree -import Lean.Compiler.LCNF.PhaseExt +public import Lean.Attributes +public import Lean.Declaration +public import Lean.MonadEnv +public import Lean.Elab.InfoTree +public import Lean.Compiler.LCNF.PhaseExt + +public section namespace Lean.Compiler diff --git a/src/Lean/Compiler/InitAttr.lean b/src/Lean/Compiler/InitAttr.lean index ac40742d8c..895cdcf8c9 100644 --- a/src/Lean/Compiler/InitAttr.lean +++ b/src/Lean/Compiler/InitAttr.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.MonadEnv -import Lean.Elab.InfoTree.Main +public import Lean.AddDecl +public import Lean.MonadEnv +public import Lean.Elab.InfoTree.Main + +public section namespace Lean diff --git a/src/Lean/Compiler/InlineAttrs.lean b/src/Lean/Compiler/InlineAttrs.lean index c04e7e9054..5252024c7c 100644 --- a/src/Lean/Compiler/InlineAttrs.lean +++ b/src/Lean/Compiler/InlineAttrs.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes +public import Lean.Attributes + +public section namespace Lean.Compiler @@ -77,7 +81,7 @@ private def hasInlineAttrCore (env : Environment) (kind : InlineAttributeKind) ( | some k => kind == k | _ => false -abbrev hasInlineAttribute (env : Environment) (declName : Name) : Bool := +@[inline] def hasInlineAttribute (env : Environment) (declName : Name) : Bool := hasInlineAttrCore env .inline declName def hasInlineIfReduceAttribute (env : Environment) (declName : Name) : Bool := @@ -89,7 +93,7 @@ def hasNoInlineAttribute (env : Environment) (declName : Name) : Bool := def hasMacroInlineAttribute (env : Environment) (declName : Name) : Bool := hasInlineAttrCore env .macroInline declName -abbrev hasAlwaysInlineAttribute (env : Environment) (declName : Name) : Bool := +@[inline] def hasAlwaysInlineAttribute (env : Environment) (declName : Name) : Bool := hasInlineAttrCore env .alwaysInline declName end Lean.Compiler diff --git a/src/Lean/Compiler/LCNF.lean b/src/Lean/Compiler/LCNF.lean index 73ce55981f..bbd62ced6d 100644 --- a/src/Lean/Compiler/LCNF.lean +++ b/src/Lean/Compiler/LCNF.lean @@ -3,42 +3,46 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.AlphaEqv -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.Bind -import Lean.Compiler.LCNF.Check -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.CSE -import Lean.Compiler.LCNF.DependsOn -import Lean.Compiler.LCNF.ElimDead -import Lean.Compiler.LCNF.FixedParams -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.JoinPoints -import Lean.Compiler.LCNF.LCtx -import Lean.Compiler.LCNF.Level -import Lean.Compiler.LCNF.Main -import Lean.Compiler.LCNF.Passes -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.PullFunDecls -import Lean.Compiler.LCNF.PullLetDecls -import Lean.Compiler.LCNF.ReduceJpArity -import Lean.Compiler.LCNF.Simp -import Lean.Compiler.LCNF.Specialize -import Lean.Compiler.LCNF.SpecInfo -import Lean.Compiler.LCNF.Testing -import Lean.Compiler.LCNF.ToDecl -import Lean.Compiler.LCNF.ToExpr -import Lean.Compiler.LCNF.ToLCNF -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.Util -import Lean.Compiler.LCNF.ConfigOptions -import Lean.Compiler.LCNF.MonoTypes -import Lean.Compiler.LCNF.ToMono -import Lean.Compiler.LCNF.MonadScope -import Lean.Compiler.LCNF.Closure -import Lean.Compiler.LCNF.LambdaLifting -import Lean.Compiler.LCNF.ReduceArity -import Lean.Compiler.LCNF.Probing +public import Lean.Compiler.LCNF.AlphaEqv +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Bind +public import Lean.Compiler.LCNF.Check +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.CSE +public import Lean.Compiler.LCNF.DependsOn +public import Lean.Compiler.LCNF.ElimDead +public import Lean.Compiler.LCNF.FixedParams +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.JoinPoints +public import Lean.Compiler.LCNF.LCtx +public import Lean.Compiler.LCNF.Level +public import Lean.Compiler.LCNF.Main +public import Lean.Compiler.LCNF.Passes +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.PullFunDecls +public import Lean.Compiler.LCNF.PullLetDecls +public import Lean.Compiler.LCNF.ReduceJpArity +public import Lean.Compiler.LCNF.Simp +public import Lean.Compiler.LCNF.Specialize +public import Lean.Compiler.LCNF.SpecInfo +public import Lean.Compiler.LCNF.Testing +public import Lean.Compiler.LCNF.ToDecl +public import Lean.Compiler.LCNF.ToExpr +public import Lean.Compiler.LCNF.ToLCNF +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.Util +public import Lean.Compiler.LCNF.ConfigOptions +public import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.ToMono +public import Lean.Compiler.LCNF.MonadScope +public import Lean.Compiler.LCNF.Closure +public import Lean.Compiler.LCNF.LambdaLifting +public import Lean.Compiler.LCNF.ReduceArity +public import Lean.Compiler.LCNF.Probing + +public section diff --git a/src/Lean/Compiler/LCNF/AlphaEqv.lean b/src/Lean/Compiler/LCNF/AlphaEqv.lean index 7b964d6d06..052382516c 100644 --- a/src/Lean/Compiler/LCNF/AlphaEqv.lean +++ b/src/Lean/Compiler/LCNF/AlphaEqv.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/AuxDeclCache.lean b/src/Lean/Compiler/LCNF/AuxDeclCache.lean index 1e1347138b..d19f3bdc8a 100644 --- a/src/Lean/Compiler/LCNF/AuxDeclCache.lean +++ b/src/Lean/Compiler/LCNF/AuxDeclCache.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.DeclHash -import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.DeclHash +public import Lean.Compiler.LCNF.Internalize + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/BaseTypes.lean b/src/Lean/Compiler/LCNF/BaseTypes.lean index a6d96e2aef..7a0ea272f1 100644 --- a/src/Lean/Compiler/LCNF/BaseTypes.lean +++ b/src/Lean/Compiler/LCNF/BaseTypes.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.Types + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Basic.lean b/src/Lean/Compiler/LCNF/Basic.lean index 769710a61d..9a085e34df 100644 --- a/src/Lean/Compiler/LCNF/Basic.lean +++ b/src/Lean/Compiler/LCNF/Basic.lean @@ -3,14 +3,18 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.List.BasicAux -import Lean.Expr -import Lean.Meta.Instances -import Lean.Compiler.ExternAttr -import Lean.Compiler.InlineAttrs -import Lean.Compiler.Specialize -import Lean.Compiler.LCNF.Types +public import Init.Data.List.BasicAux +public import Lean.Expr +public import Lean.Meta.Instances +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.InlineAttrs +public import Lean.Compiler.Specialize +public import Lean.Compiler.LCNF.Types + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Bind.lean b/src/Lean/Compiler/LCNF/Bind.lean index 5844bcfca1..9629cee17a 100644 --- a/src/Lean/Compiler/LCNF/Bind.lean +++ b/src/Lean/Compiler/LCNF/Bind.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.InferType + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/CSE.lean b/src/Lean/Compiler/LCNF/CSE.lean index bf0cae5557..cb7a67fe29 100644 --- a/src/Lean/Compiler/LCNF/CSE.lean +++ b/src/Lean/Compiler/LCNF/CSE.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.ToExpr -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.NeverExtractAttr +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.ToExpr +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.NeverExtractAttr + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Check.lean b/src/Lean/Compiler/LCNF/Check.lean index 2b3a927e50..63f077b070 100644 --- a/src/Lean/Compiler/LCNF/Check.lean +++ b/src/Lean/Compiler/LCNF/Check.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.CompatibleTypes +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.CompatibleTypes + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Closure.lean b/src/Lean/Compiler/LCNF/Closure.lean index 321d7d84ef..7d780d5afc 100644 --- a/src/Lean/Compiler/LCNF/Closure.lean +++ b/src/Lean/Compiler/LCNF/Closure.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ForEachExprWhere -import Lean.Compiler.LCNF.CompilerM +public import Lean.Util.ForEachExprWhere +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF namespace Closure diff --git a/src/Lean/Compiler/LCNF/CompatibleTypes.lean b/src/Lean/Compiler/LCNF/CompatibleTypes.lean index 270d890af5..542e7c69f2 100644 --- a/src/Lean/Compiler/LCNF/CompatibleTypes.lean +++ b/src/Lean/Compiler/LCNF/CompatibleTypes.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.InferType + +public section namespace Lean.Compiler.LCNF @@ -21,7 +25,7 @@ We claim it is "defensible" to say this sanity checker is a linter. If the sanit and performance may suffer at runtime. Here is an example of code that "abuses" dependent types: ``` -def Tuple (α : Type u) : Nat → Type u +@[expose] def Tuple (α : Type u) : Nat → Type u | 0 => PUnit | 1 => α | n+2 => α × Tuple α (n+1) diff --git a/src/Lean/Compiler/LCNF/CompilerM.lean b/src/Lean/Compiler/LCNF/CompilerM.lean index 6a396ed7f8..a04a175263 100644 --- a/src/Lean/Compiler/LCNF/CompilerM.lean +++ b/src/Lean/Compiler/LCNF/CompilerM.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.LCtx -import Lean.Compiler.LCNF.ConfigOptions +public import Lean.CoreM +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.LCtx +public import Lean.Compiler.LCNF.ConfigOptions + +public section namespace Lean.Compiler.LCNF /-- @@ -315,8 +319,8 @@ Add the entry `fvarId ↦ fvarId'` to the free variable substitution. @[inline, inherit_doc normLetValueImp] def normLetValue [MonadFVarSubst m t] [Monad m] (e : LetValue) : m LetValue := return normLetValueImp (← getSubst) e t -@[inherit_doc normExprImp] -abbrev normExprCore (s : FVarSubst) (e : Expr) (translator : Bool) : Expr := +@[inherit_doc normExprImp, inline] +def normExprCore (s : FVarSubst) (e : Expr) (translator : Bool) : Expr := normExprImp s e translator /-- diff --git a/src/Lean/Compiler/LCNF/ConfigOptions.lean b/src/Lean/Compiler/LCNF/ConfigOptions.lean index d576473d4d..eae51318e2 100644 --- a/src/Lean/Compiler/LCNF/ConfigOptions.lean +++ b/src/Lean/Compiler/LCNF/ConfigOptions.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Options +public import Lean.Data.Options + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/DeclHash.lean b/src/Lean/Compiler/LCNF/DeclHash.lean index d5d164e9a2..1eee7d51c0 100644 --- a/src/Lean/Compiler/LCNF/DeclHash.lean +++ b/src/Lean/Compiler/LCNF/DeclHash.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/DependsOn.lean b/src/Lean/Compiler/LCNF/DependsOn.lean index 4e664bc767..6a0ca4ca82 100644 --- a/src/Lean/Compiler/LCNF/DependsOn.lean +++ b/src/Lean/Compiler/LCNF/DependsOn.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF @@ -42,10 +46,10 @@ private partial def depOn (c : Code) : M Bool := | .return fvarId => fvarDepOn fvarId | .unreach _ => return false -abbrev LetDecl.dependsOn (decl : LetDecl) (s : FVarIdSet) : Bool := +@[inline] def LetDecl.dependsOn (decl : LetDecl) (s : FVarIdSet) : Bool := decl.depOn s -abbrev FunDecl.dependsOn (decl : FunDecl) (s : FVarIdSet) : Bool := +@[inline] def FunDecl.dependsOn (decl : FunDecl) (s : FVarIdSet) : Bool := typeDepOn decl.type s || depOn decl.value s def CodeDecl.dependsOn (decl : CodeDecl) (s : FVarIdSet) : Bool := diff --git a/src/Lean/Compiler/LCNF/ElimDead.lean b/src/Lean/Compiler/LCNF/ElimDead.lean index fc848dd787..95533e3314 100644 --- a/src/Lean/Compiler/LCNF/ElimDead.lean +++ b/src/Lean/Compiler/LCNF/ElimDead.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/ElimDeadBranches.lean b/src/Lean/Compiler/LCNF/ElimDeadBranches.lean index 4ff02a8617..467e3395d0 100644 --- a/src/Lean/Compiler/LCNF/ElimDeadBranches.lean +++ b/src/Lean/Compiler/LCNF/ElimDeadBranches.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.InferType + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/ExtractClosed.lean b/src/Lean/Compiler/LCNF/ExtractClosed.lean index be50d5f5e7..88d31b3c46 100644 --- a/src/Lean/Compiler/LCNF/ExtractClosed.lean +++ b/src/Lean/Compiler/LCNF/ExtractClosed.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Cameron Zwarich -/ +module + prelude -import Lean.Compiler.ClosedTermCache -import Lean.Compiler.NeverExtractAttr -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.Internalize -import Lean.Compiler.LCNF.MonoTypes -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.ToExpr +public import Lean.Compiler.ClosedTermCache +public import Lean.Compiler.NeverExtractAttr +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.ToExpr + +public section namespace Lean.Compiler.LCNF namespace ExtractClosed diff --git a/src/Lean/Compiler/LCNF/FVarUtil.lean b/src/Lean/Compiler/LCNF/FVarUtil.lean index 8e8380df1b..a762cb5d4e 100644 --- a/src/Lean/Compiler/LCNF/FVarUtil.lean +++ b/src/Lean/Compiler/LCNF/FVarUtil.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Expr -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.CompilerM +public import Lean.Expr +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/FixedParams.lean b/src/Lean/Compiler/LCNF/FixedParams.lean index 7e1cb87ba1..f0b5db4b70 100644 --- a/src/Lean/Compiler/LCNF/FixedParams.lean +++ b/src/Lean/Compiler/LCNF/FixedParams.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Types + +public section namespace Lean.Compiler.LCNF namespace FixedParams diff --git a/src/Lean/Compiler/LCNF/FloatLetIn.lean b/src/Lean/Compiler/LCNF/FloatLetIn.lean index 38e44686cc..4fcc6bf4d2 100644 --- a/src/Lean/Compiler/LCNF/FloatLetIn.lean +++ b/src/Lean/Compiler/LCNF/FloatLetIn.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.FVarUtil -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.FVarUtil +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.Types + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/InferType.lean b/src/Lean/Compiler/LCNF/InferType.lean index 6247621ea7..b8665d4077 100644 --- a/src/Lean/Compiler/LCNF/InferType.lean +++ b/src/Lean/Compiler/LCNF/InferType.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.OtherDecl +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.OtherDecl + +public section namespace Lean.Compiler.LCNF /-! # Type inference for LCNF -/ diff --git a/src/Lean/Compiler/LCNF/Internalize.lean b/src/Lean/Compiler/LCNF/Internalize.lean index 946d75a2c9..22a1560c06 100644 --- a/src/Lean/Compiler/LCNF/Internalize.lean +++ b/src/Lean/Compiler/LCNF/Internalize.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.Bind -import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.Bind +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/JoinPoints.lean b/src/Lean/Compiler/LCNF/JoinPoints.lean index 6ecf4af863..58b48a7267 100644 --- a/src/Lean/Compiler/LCNF/JoinPoints.lean +++ b/src/Lean/Compiler/LCNF/JoinPoints.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PullFunDecls -import Lean.Compiler.LCNF.FVarUtil -import Lean.Compiler.LCNF.ScopeM -import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PullFunDecls +public import Lean.Compiler.LCNF.FVarUtil +public import Lean.Compiler.LCNF.ScopeM +public import Lean.Compiler.LCNF.InferType + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/LCtx.lean b/src/Lean/Compiler/LCNF/LCtx.lean index 7f7b8bda26..566398ca59 100644 --- a/src/Lean/Compiler/LCNF/LCtx.lean +++ b/src/Lean/Compiler/LCNF/LCtx.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.LocalContext -import Lean.Compiler.LCNF.Basic +public import Lean.LocalContext +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/LambdaLifting.lean b/src/Lean/Compiler/LCNF/LambdaLifting.lean index 2a9a465a1d..50a415494a 100644 --- a/src/Lean/Compiler/LCNF/LambdaLifting.lean +++ b/src/Lean/Compiler/LCNF/LambdaLifting.lean @@ -3,15 +3,19 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Instances -import Lean.Compiler.InlineAttrs -import Lean.Compiler.LCNF.Closure -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.MonadScope -import Lean.Compiler.LCNF.Internalize -import Lean.Compiler.LCNF.Level -import Lean.Compiler.LCNF.AuxDeclCache +public import Lean.Meta.Instances +public import Lean.Compiler.InlineAttrs +public import Lean.Compiler.LCNF.Closure +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.MonadScope +public import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.Level +public import Lean.Compiler.LCNF.AuxDeclCache + +public section namespace Lean.Compiler.LCNF namespace LambdaLifting diff --git a/src/Lean/Compiler/LCNF/Level.lean b/src/Lean/Compiler/LCNF/Level.lean index 042cdd89a7..1d72f98b93 100644 --- a/src/Lean/Compiler/LCNF/Level.lean +++ b/src/Lean/Compiler/LCNF/Level.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectLevelParams -import Lean.Compiler.LCNF.Basic +public import Lean.Util.CollectLevelParams +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Main.lean b/src/Lean/Compiler/LCNF/Main.lean index 49aed61b62..6cf48233d5 100644 --- a/src/Lean/Compiler/LCNF/Main.lean +++ b/src/Lean/Compiler/LCNF/Main.lean @@ -3,23 +3,27 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.Options -import Lean.Compiler.ExternAttr -import Lean.Compiler.IR -import Lean.Compiler.IR.Basic -import Lean.Compiler.IR.Checker -import Lean.Compiler.IR.ToIR -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.Passes -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.ToDecl -import Lean.Compiler.LCNF.Check -import Lean.Compiler.LCNF.PullLetDecls -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.CSE +public import Lean.Compiler.Options +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.IR +public import Lean.Compiler.IR.Basic +public import Lean.Compiler.IR.Checker +public import Lean.Compiler.IR.ToIR +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.Passes +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.ToDecl +public import Lean.Compiler.LCNF.Check +public import Lean.Compiler.LCNF.PullLetDecls +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.CSE public import Lean.Compiler.LCNF.Visibility +public section + namespace Lean.Compiler.LCNF /-- We do not generate code for `declName` if @@ -92,9 +96,11 @@ def run (declNames : Array Name) : CompilerM (Array IR.Decl) := withAtLeastMaxRe for declName in declNames do if let some fnName := Compiler.getImplementedBy? (← getEnv) declName then if !isDeclPublic (← getEnv) fnName then - if let some decl ← getLocalDecl? fnName then + if let some decl ← getLocalDeclAt? fnName .base then trace[Compiler.inferVisibility] m!"Marking {fnName} as opaque because it implements {declName}" LCNF.markDeclPublicRec .base decl + if let some decl ← getLocalDeclAt? fnName .mono then + LCNF.markDeclPublicRec .mono decl let declNames ← declNames.filterM (shouldGenerateCode ·) if declNames.isEmpty then return #[] for declName in declNames do diff --git a/src/Lean/Compiler/LCNF/MonadScope.lean b/src/Lean/Compiler/LCNF/MonadScope.lean index 752db34daf..b996c6856c 100644 --- a/src/Lean/Compiler/LCNF/MonadScope.lean +++ b/src/Lean/Compiler/LCNF/MonadScope.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF @@ -38,4 +42,4 @@ def inScope [MonadScope m] [Monad m] (fvarId : FVarId) : m Bool := @[inline] def withNewScope [MonadScope m] [Monad m] (x : m α) : m α := do withScope (fun _ => {}) x -end Lean.Compiler.LCNF \ No newline at end of file +end Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/MonoTypes.lean b/src/Lean/Compiler/LCNF/MonoTypes.lean index 8a25da267a..60750cbe6a 100644 --- a/src/Lean/Compiler/LCNF/MonoTypes.lean +++ b/src/Lean/Compiler/LCNF/MonoTypes.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.InferType -import Lean.Compiler.LCNF.Util -import Lean.Compiler.LCNF.BaseTypes -import Lean.Compiler.LCNF.CompilerM +public import Lean.Meta.InferType +public import Lean.Compiler.LCNF.Util +public import Lean.Compiler.LCNF.BaseTypes +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/OtherDecl.lean b/src/Lean/Compiler/LCNF/OtherDecl.lean index 6b508f0d49..479266e804 100644 --- a/src/Lean/Compiler/LCNF/OtherDecl.lean +++ b/src/Lean/Compiler/LCNF/OtherDecl.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.BaseTypes -import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.BaseTypes +public import Lean.Compiler.LCNF.MonoTypes + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/PassManager.lean b/src/Lean/Compiler/LCNF/PassManager.lean index 076695b3bc..f3a24713c0 100644 --- a/src/Lean/Compiler/LCNF/PassManager.lean +++ b/src/Lean/Compiler/LCNF/PassManager.lean @@ -3,15 +3,19 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Attributes -import Lean.Environment -import Lean.Meta.Basic -import Lean.Compiler.LCNF.CompilerM +public import Lean.Attributes +public import Lean.Environment +public import Lean.Meta.Basic +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF -def Phase.toNat : Phase → Nat +@[expose] def Phase.toNat : Phase → Nat | .base => 0 | .mono => 1 diff --git a/src/Lean/Compiler/LCNF/Passes.lean b/src/Lean/Compiler/LCNF/Passes.lean index 9b22447b09..ed1597dfd1 100644 --- a/src/Lean/Compiler/LCNF/Passes.lean +++ b/src/Lean/Compiler/LCNF/Passes.lean @@ -3,24 +3,28 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PullLetDecls -import Lean.Compiler.LCNF.CSE -import Lean.Compiler.LCNF.Simp -import Lean.Compiler.LCNF.PullFunDecls -import Lean.Compiler.LCNF.ReduceJpArity -import Lean.Compiler.LCNF.JoinPoints -import Lean.Compiler.LCNF.Specialize -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.ToMono -import Lean.Compiler.LCNF.LambdaLifting -import Lean.Compiler.LCNF.FloatLetIn -import Lean.Compiler.LCNF.ReduceArity -import Lean.Compiler.LCNF.ElimDeadBranches -import Lean.Compiler.LCNF.StructProjCases -import Lean.Compiler.LCNF.ExtractClosed -import Lean.Compiler.LCNF.Visibility +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PullLetDecls +public import Lean.Compiler.LCNF.CSE +public import Lean.Compiler.LCNF.Simp +public import Lean.Compiler.LCNF.PullFunDecls +public import Lean.Compiler.LCNF.ReduceJpArity +public import Lean.Compiler.LCNF.JoinPoints +public import Lean.Compiler.LCNF.Specialize +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.ToMono +public import Lean.Compiler.LCNF.LambdaLifting +public import Lean.Compiler.LCNF.FloatLetIn +public import Lean.Compiler.LCNF.ReduceArity +public import Lean.Compiler.LCNF.ElimDeadBranches +public import Lean.Compiler.LCNF.StructProjCases +public import Lean.Compiler.LCNF.ExtractClosed +public import Lean.Compiler.LCNF.Visibility + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/PhaseExt.lean b/src/Lean/Compiler/LCNF/PhaseExt.lean index de5a842994..9ebec46309 100644 --- a/src/Lean/Compiler/LCNF/PhaseExt.lean +++ b/src/Lean/Compiler/LCNF/PhaseExt.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PassManager + +public section namespace Lean.Compiler.LCNF @@ -91,7 +95,7 @@ private abbrev findAtSorted? (decls : Array Decl) (declName : Name) : Option Dec let tmpDecl := { tmpDecl with name := declName } decls.binSearch tmpDecl declLt -def DeclExt := PersistentEnvExtension Decl Decl DeclExtState +@[expose] def DeclExt := PersistentEnvExtension Decl Decl DeclExtState instance : Inhabited DeclExt := inferInstanceAs (Inhabited (PersistentEnvExtension Decl Decl DeclExtState)) @@ -163,11 +167,14 @@ def getDeclAt? (declName : Name) (phase : Phase) : CoreM (Option Decl) := def getDecl? (declName : Name) : CompilerM (Option Decl) := do getDeclAt? declName (← getPhase) -def getLocalDecl? (declName : Name) : CompilerM (Option Decl) := do - match (← getPhase) with +def getLocalDeclAt? (declName : Name) (phase : Phase) : CompilerM (Option Decl) := do + match phase with | .base => return baseExt.getState (← getEnv) |>.find? declName | .mono => return monoExt.getState (← getEnv) |>.find? declName +def getLocalDecl? (declName : Name) : CompilerM (Option Decl) := do + getLocalDeclAt? declName (← getPhase) + def getExt (phase : Phase) : DeclExt := match phase with | .base => baseExt diff --git a/src/Lean/Compiler/LCNF/PrettyPrinter.lean b/src/Lean/Compiler/LCNF/PrettyPrinter.lean index 499b182bfd..da87862571 100644 --- a/src/Lean/Compiler/LCNF/PrettyPrinter.lean +++ b/src/Lean/Compiler/LCNF/PrettyPrinter.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.PrettyPrinter.Delaborator.Options -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.Internalize +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.Internalize + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Probing.lean b/src/Lean/Compiler/LCNF/Probing.lean index dfbd548b93..e35be38a6b 100644 --- a/src/Lean/Compiler/LCNF/Probing.lean +++ b/src/Lean/Compiler/LCNF/Probing.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PhaseExt + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/PullFunDecls.lean b/src/Lean/Compiler/LCNF/PullFunDecls.lean index f1f201921d..f2ab4d0d41 100644 --- a/src/Lean/Compiler/LCNF/PullFunDecls.lean +++ b/src/Lean/Compiler/LCNF/PullFunDecls.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.DependsOn -import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.DependsOn +public import Lean.Compiler.LCNF.PassManager + +public section namespace Lean.Compiler.LCNF namespace PullFunDecls diff --git a/src/Lean/Compiler/LCNF/PullLetDecls.lean b/src/Lean/Compiler/LCNF/PullLetDecls.lean index 27e7ec117a..0b2d773cbb 100644 --- a/src/Lean/Compiler/LCNF/PullLetDecls.lean +++ b/src/Lean/Compiler/LCNF/PullLetDecls.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.DependsOn -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.DependsOn +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.PassManager + +public section namespace Lean.Compiler.LCNF namespace PullLetDecls diff --git a/src/Lean/Compiler/LCNF/ReduceArity.lean b/src/Lean/Compiler/LCNF/ReduceArity.lean index 1e25d4add8..42d7033237 100644 --- a/src/Lean/Compiler/LCNF/ReduceArity.lean +++ b/src/Lean/Compiler/LCNF/ReduceArity.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.Internalize + +public section namespace Lean.Compiler.LCNF /-! diff --git a/src/Lean/Compiler/LCNF/ReduceJpArity.lean b/src/Lean/Compiler/LCNF/ReduceJpArity.lean index 02802fd60b..b81241556b 100644 --- a/src/Lean/Compiler/LCNF/ReduceJpArity.lean +++ b/src/Lean/Compiler/LCNF/ReduceJpArity.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.PassManager + +public section namespace Lean.Compiler.LCNF /-! diff --git a/src/Lean/Compiler/LCNF/Renaming.lean b/src/Lean/Compiler/LCNF/Renaming.lean index 12c207bf1a..e0c0ea4501 100644 --- a/src/Lean/Compiler/LCNF/Renaming.lean +++ b/src/Lean/Compiler/LCNF/Renaming.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF /-- diff --git a/src/Lean/Compiler/LCNF/ScopeM.lean b/src/Lean/Compiler/LCNF/ScopeM.lean index 030122010c..5bc78059af 100644 --- a/src/Lean/Compiler/LCNF/ScopeM.lean +++ b/src/Lean/Compiler/LCNF/ScopeM.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Simp.lean b/src/Lean/Compiler/LCNF/Simp.lean index d3ed81f153..debe4c7f53 100644 --- a/src/Lean/Compiler/LCNF/Simp.lean +++ b/src/Lean/Compiler/LCNF/Simp.lean @@ -3,20 +3,24 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.ReduceJpArity -import Lean.Compiler.LCNF.Renaming -import Lean.Compiler.LCNF.Simp.Basic -import Lean.Compiler.LCNF.Simp.FunDeclInfo -import Lean.Compiler.LCNF.Simp.JpCases -import Lean.Compiler.LCNF.Simp.Config -import Lean.Compiler.LCNF.Simp.InlineCandidate -import Lean.Compiler.LCNF.Simp.SimpM -import Lean.Compiler.LCNF.Simp.Main -import Lean.Compiler.LCNF.Simp.InlineProj -import Lean.Compiler.LCNF.Simp.DefaultAlt -import Lean.Compiler.LCNF.Simp.SimpValue -import Lean.Compiler.LCNF.Simp.Used +public import Lean.Compiler.LCNF.ReduceJpArity +public import Lean.Compiler.LCNF.Renaming +public import Lean.Compiler.LCNF.Simp.Basic +public import Lean.Compiler.LCNF.Simp.FunDeclInfo +public import Lean.Compiler.LCNF.Simp.JpCases +public import Lean.Compiler.LCNF.Simp.Config +public import Lean.Compiler.LCNF.Simp.InlineCandidate +public import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.Main +public import Lean.Compiler.LCNF.Simp.InlineProj +public import Lean.Compiler.LCNF.Simp.DefaultAlt +public import Lean.Compiler.LCNF.Simp.SimpValue +public import Lean.Compiler.LCNF.Simp.Used + +public section namespace Lean.Compiler.LCNF open Simp diff --git a/src/Lean/Compiler/LCNF/Simp/Basic.lean b/src/Lean/Compiler/LCNF/Simp/Basic.lean index 7562f99281..35d0d55a21 100644 --- a/src/Lean/Compiler/LCNF/Simp/Basic.lean +++ b/src/Lean/Compiler/LCNF/Simp/Basic.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Instances -import Lean.Compiler.InlineAttrs -import Lean.Compiler.Specialize -import Lean.Compiler.LCNF.CompilerM +public import Lean.Meta.Instances +public import Lean.Compiler.InlineAttrs +public import Lean.Compiler.Specialize +public import Lean.Compiler.LCNF.CompilerM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/Config.lean b/src/Lean/Compiler/LCNF/Simp/Config.lean index 833078286f..262ef55c98 100644 --- a/src/Lean/Compiler/LCNF/Simp/Config.lean +++ b/src/Lean/Compiler/LCNF/Simp/Config.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Core +public import Init.Core + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/ConstantFold.lean b/src/Lean/Compiler/LCNF/Simp/ConstantFold.lean index 11c8bc5eab..90b6d24fd6 100644 --- a/src/Lean/Compiler/LCNF/Simp/ConstantFold.lean +++ b/src/Lean/Compiler/LCNF/Simp/ConstantFold.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Init.Data.UInt.Log2 -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.PassManager +public import Init.Data.UInt.Log2 +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.PassManager + +public section namespace Lean.Compiler.LCNF.Simp namespace ConstantFold diff --git a/src/Lean/Compiler/LCNF/Simp/DefaultAlt.lean b/src/Lean/Compiler/LCNF/Simp/DefaultAlt.lean index 0b2a5ea39d..63774e540c 100644 --- a/src/Lean/Compiler/LCNF/Simp/DefaultAlt.lean +++ b/src/Lean/Compiler/LCNF/Simp/DefaultAlt.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.SimpM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/DiscrM.lean b/src/Lean/Compiler/LCNF/Simp/DiscrM.lean index 588689cca5..f041300879 100644 --- a/src/Lean/Compiler/LCNF/Simp/DiscrM.lean +++ b/src/Lean/Compiler/LCNF/Simp/DiscrM.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.CompilerM -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.Simp.Basic +public import Lean.Compiler.LCNF.CompilerM +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.Simp.Basic + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/FunDeclInfo.lean b/src/Lean/Compiler/LCNF/Simp/FunDeclInfo.lean index 54c96f5518..5939a5a8ad 100644 --- a/src/Lean/Compiler/LCNF/Simp/FunDeclInfo.lean +++ b/src/Lean/Compiler/LCNF/Simp/FunDeclInfo.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.Basic +public import Lean.Compiler.LCNF.Simp.Basic + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/InlineCandidate.lean b/src/Lean/Compiler/LCNF/Simp/InlineCandidate.lean index b1a63a9081..df746b42a9 100644 --- a/src/Lean/Compiler/LCNF/Simp/InlineCandidate.lean +++ b/src/Lean/Compiler/LCNF/Simp/InlineCandidate.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.SimpM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/InlineProj.lean b/src/Lean/Compiler/LCNF/Simp/InlineProj.lean index 6f652b5dfd..a0e3c29dd5 100644 --- a/src/Lean/Compiler/LCNF/Simp/InlineProj.lean +++ b/src/Lean/Compiler/LCNF/Simp/InlineProj.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.SimpM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/JpCases.lean b/src/Lean/Compiler/LCNF/Simp/JpCases.lean index 86e0f5429d..66fd9a3e67 100644 --- a/src/Lean/Compiler/LCNF/Simp/JpCases.lean +++ b/src/Lean/Compiler/LCNF/Simp/JpCases.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.DependsOn -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.Internalize -import Lean.Compiler.LCNF.Simp.Basic -import Lean.Compiler.LCNF.Simp.DiscrM +public import Lean.Compiler.LCNF.DependsOn +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.Simp.Basic +public import Lean.Compiler.LCNF.Simp.DiscrM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/Main.lean b/src/Lean/Compiler/LCNF/Simp/Main.lean index 05923d8fd3..8fbf163765 100644 --- a/src/Lean/Compiler/LCNF/Simp/Main.lean +++ b/src/Lean/Compiler/LCNF/Simp/Main.lean @@ -3,19 +3,23 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.LCNF.ElimDead -import Lean.Compiler.LCNF.AlphaEqv -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.Bind -import Lean.Compiler.LCNF.Simp.FunDeclInfo -import Lean.Compiler.LCNF.Simp.InlineCandidate -import Lean.Compiler.LCNF.Simp.InlineProj -import Lean.Compiler.LCNF.Simp.Used -import Lean.Compiler.LCNF.Simp.DefaultAlt -import Lean.Compiler.LCNF.Simp.SimpValue -import Lean.Compiler.LCNF.Simp.ConstantFold +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.ElimDead +public import Lean.Compiler.LCNF.AlphaEqv +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.Bind +public import Lean.Compiler.LCNF.Simp.FunDeclInfo +public import Lean.Compiler.LCNF.Simp.InlineCandidate +public import Lean.Compiler.LCNF.Simp.InlineProj +public import Lean.Compiler.LCNF.Simp.Used +public import Lean.Compiler.LCNF.Simp.DefaultAlt +public import Lean.Compiler.LCNF.Simp.SimpValue +public import Lean.Compiler.LCNF.Simp.ConstantFold + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/SimpM.lean b/src/Lean/Compiler/LCNF/Simp/SimpM.lean index d0cf683979..856a06139e 100644 --- a/src/Lean/Compiler/LCNF/Simp/SimpM.lean +++ b/src/Lean/Compiler/LCNF/Simp/SimpM.lean @@ -3,18 +3,22 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.LCNF.Renaming -import Lean.Compiler.LCNF.ElimDead -import Lean.Compiler.LCNF.AlphaEqv -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.Bind -import Lean.Compiler.LCNF.Internalize -import Lean.Compiler.LCNF.Simp.JpCases -import Lean.Compiler.LCNF.Simp.DiscrM -import Lean.Compiler.LCNF.Simp.FunDeclInfo -import Lean.Compiler.LCNF.Simp.Config +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.Renaming +public import Lean.Compiler.LCNF.ElimDead +public import Lean.Compiler.LCNF.AlphaEqv +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.Bind +public import Lean.Compiler.LCNF.Internalize +public import Lean.Compiler.LCNF.Simp.JpCases +public import Lean.Compiler.LCNF.Simp.DiscrM +public import Lean.Compiler.LCNF.Simp.FunDeclInfo +public import Lean.Compiler.LCNF.Simp.Config + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/SimpValue.lean b/src/Lean/Compiler/LCNF/Simp/SimpValue.lean index 21089b0926..3801f62330 100644 --- a/src/Lean/Compiler/LCNF/Simp/SimpValue.lean +++ b/src/Lean/Compiler/LCNF/Simp/SimpValue.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.SimpM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/Simp/Used.lean b/src/Lean/Compiler/LCNF/Simp/Used.lean index e454a79b2d..30dfcf7c87 100644 --- a/src/Lean/Compiler/LCNF/Simp/Used.lean +++ b/src/Lean/Compiler/LCNF/Simp/Used.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Simp.SimpM +public import Lean.Compiler.LCNF.Simp.SimpM + +public section namespace Lean.Compiler.LCNF namespace Simp diff --git a/src/Lean/Compiler/LCNF/SpecInfo.lean b/src/Lean/Compiler/LCNF/SpecInfo.lean index b9a7970e25..adc6c518c7 100644 --- a/src/Lean/Compiler/LCNF/SpecInfo.lean +++ b/src/Lean/Compiler/LCNF/SpecInfo.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.Specialize -import Lean.Compiler.LCNF.FixedParams -import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.Specialize +public import Lean.Compiler.LCNF.FixedParams +public import Lean.Compiler.LCNF.InferType + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Specialize.lean b/src/Lean/Compiler/LCNF/Specialize.lean index 5943188341..d4635cafab 100644 --- a/src/Lean/Compiler/LCNF/Specialize.lean +++ b/src/Lean/Compiler/LCNF/Specialize.lean @@ -3,17 +3,22 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.Specialize -import Lean.Compiler.LCNF.Simp -import Lean.Compiler.LCNF.SpecInfo -import Lean.Compiler.LCNF.PrettyPrinter -import Lean.Compiler.LCNF.ToExpr -import Lean.Compiler.LCNF.Level -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.LCNF.MonadScope -import Lean.Compiler.LCNF.Closure -import Lean.Compiler.LCNF.FVarUtil +public import Lean.Compiler.Specialize +public import Lean.Compiler.LCNF.Simp +public import Lean.Compiler.LCNF.SpecInfo +public import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.ToExpr +public import Lean.Compiler.LCNF.Level +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.LCNF.MonadScope +public import Lean.Compiler.LCNF.Closure +public import Lean.Compiler.LCNF.FVarUtil +import all Lean.Compiler.LCNF.ToExpr + +public section namespace Lean.Compiler.LCNF namespace Specialize diff --git a/src/Lean/Compiler/LCNF/StructProjCases.lean b/src/Lean/Compiler/LCNF/StructProjCases.lean index 2c3600eb50..ae3ea733aa 100644 --- a/src/Lean/Compiler/LCNF/StructProjCases.lean +++ b/src/Lean/Compiler/LCNF/StructProjCases.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Cameron Zwarich -/ +module + prelude -import Lean.Compiler.LCNF.Basic -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.MonoTypes -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PrettyPrinter + +public section namespace Lean.Compiler.LCNF namespace StructProjCases diff --git a/src/Lean/Compiler/LCNF/Testing.lean b/src/Lean/Compiler/LCNF/Testing.lean index 29ab9005c0..b4ecc05c27 100644 --- a/src/Lean/Compiler/LCNF/Testing.lean +++ b/src/Lean/Compiler/LCNF/Testing.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Compiler.LCNF.PassManager -import Lean.Compiler.LCNF.PrettyPrinter +public import Lean.Compiler.LCNF.PassManager +public import Lean.Compiler.LCNF.PrettyPrinter + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/ToDecl.lean b/src/Lean/Compiler/LCNF/ToDecl.lean index 852d52a855..25ef2bc1ae 100644 --- a/src/Lean/Compiler/LCNF/ToDecl.lean +++ b/src/Lean/Compiler/LCNF/ToDecl.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Match.MatcherInfo -import Lean.Compiler.ExternAttr -import Lean.Compiler.InitAttr -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.LCNF.ToLCNF +public import Lean.Meta.Transform +public import Lean.Meta.Match.MatcherInfo +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.InitAttr +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.ToLCNF + +public section namespace Lean.Compiler.LCNF /-- diff --git a/src/Lean/Compiler/LCNF/ToExpr.lean b/src/Lean/Compiler/LCNF/ToExpr.lean index d307d94820..083c381254 100644 --- a/src/Lean/Compiler/LCNF/ToExpr.lean +++ b/src/Lean/Compiler/LCNF/ToExpr.lean @@ -3,14 +3,18 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF.Basic +public import Lean.Compiler.LCNF.Basic + +public section namespace Lean.Compiler.LCNF namespace ToExpr -private abbrev LevelMap := FVarIdMap Nat +abbrev LevelMap := FVarIdMap Nat private def _root_.Lean.FVarId.toExpr (offset : Nat) (m : LevelMap) (fvarId : FVarId) : Expr := match m.get? fvarId with @@ -33,7 +37,7 @@ where abbrev ToExprM := ReaderT Nat $ StateM LevelMap -abbrev mkLambdaM (params : Array Param) (e : Expr) : ToExprM Expr := +@[inline] def mkLambdaM (params : Array Param) (e : Expr) : ToExprM Expr := return go (← read) (← get) params.size e where go (offset : Nat) (m : LevelMap) (i : Nat) (e : Expr) : Expr := @@ -47,7 +51,7 @@ where private abbrev _root_.Lean.FVarId.toExprM (fvarId : FVarId) : ToExprM Expr := return fvarId.toExpr (← read) (← get) -abbrev abstractM (e : Expr) : ToExprM Expr := +@[inline] def abstractM (e : Expr) : ToExprM Expr := return e.abstract' (← read) (← get) @[inline] def withFVar (fvarId : FVarId) (k : ToExprM α) : ToExprM α := do @@ -104,10 +108,10 @@ partial def Code.toExprM (code : Code) : ToExprM Expr := do return mkAppN (mkConst `cases) (#[← c.discr.toExprM] ++ alts) end -def Code.toExpr (code : Code) (xs : Array FVarId := #[]) : Expr := +public def Code.toExpr (code : Code) (xs : Array FVarId := #[]) : Expr := run' code.toExprM xs -def FunDecl.toExpr (decl : FunDecl) (xs : Array FVarId := #[]) : Expr := +public def FunDecl.toExpr (decl : FunDecl) (xs : Array FVarId := #[]) : Expr := run' decl.toExprM xs end Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/ToLCNF.lean b/src/Lean/Compiler/LCNF/ToLCNF.lean index ca7a51124d..4e917aeb13 100644 --- a/src/Lean/Compiler/LCNF/ToLCNF.lean +++ b/src/Lean/Compiler/LCNF/ToLCNF.lean @@ -3,17 +3,21 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ProjFns -import Lean.Meta.CtorRecognizer -import Lean.Compiler.BorrowedAnnotation -import Lean.Compiler.CSimpAttr -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.LCNF.Types -import Lean.Compiler.LCNF.Bind -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.LCNF.Util -import Lean.Compiler.NeverExtractAttr +public import Lean.ProjFns +public import Lean.Meta.CtorRecognizer +public import Lean.Compiler.BorrowedAnnotation +public import Lean.Compiler.CSimpAttr +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.Types +public import Lean.Compiler.LCNF.Bind +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.LCNF.Util +public import Lean.Compiler.NeverExtractAttr + +public section namespace Lean.Compiler.LCNF namespace ToLCNF diff --git a/src/Lean/Compiler/LCNF/ToMono.lean b/src/Lean/Compiler/LCNF/ToMono.lean index fb0aa38940..34ae148b59 100644 --- a/src/Lean/Compiler/LCNF/ToMono.lean +++ b/src/Lean/Compiler/LCNF/ToMono.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.ExternAttr -import Lean.Compiler.ImplementedByAttr -import Lean.Compiler.LCNF.MonoTypes -import Lean.Compiler.LCNF.InferType -import Lean.Compiler.NoncomputableAttr +public import Lean.Compiler.ExternAttr +public import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.MonoTypes +public import Lean.Compiler.LCNF.InferType +public import Lean.Compiler.NoncomputableAttr + +public section namespace Lean.Compiler.LCNF diff --git a/src/Lean/Compiler/LCNF/Types.lean b/src/Lean/Compiler/LCNF/Types.lean index a434259a13..ede9f6346e 100644 --- a/src/Lean/Compiler/LCNF/Types.lean +++ b/src/Lean/Compiler/LCNF/Types.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.BorrowedAnnotation -import Lean.Meta.InferType +public import Lean.Compiler.BorrowedAnnotation +public import Lean.Meta.InferType + +public section namespace Lean.Compiler diff --git a/src/Lean/Compiler/LCNF/Util.lean b/src/Lean/Compiler/LCNF/Util.lean index 1a26a9f277..d992107dac 100644 --- a/src/Lean/Compiler/LCNF/Util.lean +++ b/src/Lean/Compiler/LCNF/Util.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.FloatArray.Basic -import Lean.CoreM -import Lean.MonadEnv -import Lean.Util.Recognizers +public import Init.Data.FloatArray.Basic +public import Lean.CoreM +public import Lean.MonadEnv +public import Lean.Util.Recognizers + +public section namespace Lean.Compiler.LCNF /-- diff --git a/src/Lean/Compiler/LCNF/Visibility.lean b/src/Lean/Compiler/LCNF/Visibility.lean index ded86f4da4..7f7e5a27c8 100644 --- a/src/Lean/Compiler/LCNF/Visibility.lean +++ b/src/Lean/Compiler/LCNF/Visibility.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Compiler.LCNF.PhaseExt -import Lean.Compiler.MetaAttr -import Lean.Compiler.ImplementedByAttr +public import Lean.Compiler.LCNF.PhaseExt +public import Lean.Compiler.MetaAttr +public import Lean.Compiler.ImplementedByAttr + +public section namespace Lean.Compiler.LCNF @@ -28,9 +32,8 @@ where -- TODO: refine? balance run time vs export size private def isBodyRelevant (decl : Decl) : CompilerM Bool := do - -- let opts := (← getOptions) - decl.isTemplateLike - -- <||> decl.value.isCodeAndM (pure <| ·.sizeLe (compiler.small.get opts)) + let opts := (← getOptions) + decl.isTemplateLike <||> decl.value.isCodeAndM (pure <| ·.sizeLe (compiler.small.get opts)) /-- Marks the given declaration as to be exported and recursively infers the correct visibility of its @@ -43,7 +46,7 @@ partial def markDeclPublicRec (phase : Phase) (decl : Decl) : CompilerM Unit := modifyEnv (setDeclTransparent · phase decl.name) decl.value.forCodeM fun code => for ref in collectUsedDecls code do - if let some refDecl ← getLocalDecl? ref then + if let some refDecl ← getLocalDeclAt? ref phase then if !isDeclPublic (← getEnv) ref then trace[Compiler.inferVisibility] m!"Marking {ref} as opaque because it is used by transparent {decl.name}" markDeclPublicRec phase refDecl diff --git a/src/Lean/Compiler/Main.lean b/src/Lean/Compiler/Main.lean index 2dad081e8d..8814683b91 100644 --- a/src/Lean/Compiler/Main.lean +++ b/src/Lean/Compiler/Main.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Compiler.LCNF +public import Lean.Compiler.LCNF + +public section namespace Lean.Compiler /-- diff --git a/src/Lean/Compiler/MetaAttr.lean b/src/Lean/Compiler/MetaAttr.lean index 918acff3bb..7d1a0a9a2b 100644 --- a/src/Lean/Compiler/MetaAttr.lean +++ b/src/Lean/Compiler/MetaAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.EnvExtension +public import Lean.EnvExtension + +public section namespace Lean diff --git a/src/Lean/Compiler/NameMangling.lean b/src/Lean/Compiler/NameMangling.lean index 4f799e57a2..5159ec4159 100644 --- a/src/Lean/Compiler/NameMangling.lean +++ b/src/Lean/Compiler/NameMangling.lean @@ -3,8 +3,12 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.Name +public import Lean.Data.Name + +public section namespace String diff --git a/src/Lean/Compiler/NeverExtractAttr.lean b/src/Lean/Compiler/NeverExtractAttr.lean index 30ec43f706..0d92d71bd8 100644 --- a/src/Lean/Compiler/NeverExtractAttr.lean +++ b/src/Lean/Compiler/NeverExtractAttr.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment -import Lean.Attributes +public import Lean.Environment +public import Lean.Attributes + +public section namespace Lean diff --git a/src/Lean/Compiler/NoncomputableAttr.lean b/src/Lean/Compiler/NoncomputableAttr.lean index 17edbeb3fc..d7cd36feaf 100644 --- a/src/Lean/Compiler/NoncomputableAttr.lean +++ b/src/Lean/Compiler/NoncomputableAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.EnvExtension +public import Lean.EnvExtension + +public section namespace Lean diff --git a/src/Lean/Compiler/Old.lean b/src/Lean/Compiler/Old.lean index 1d94cbf3f6..3b1bfad400 100644 --- a/src/Lean/Compiler/Old.lean +++ b/src/Lean/Compiler/Old.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment +public import Lean.Environment + +public section namespace Lean namespace Compiler diff --git a/src/Lean/Compiler/Options.lean b/src/Lean/Compiler/Options.lean index 379f4c5758..4f7bbb4fbd 100644 --- a/src/Lean/Compiler/Options.lean +++ b/src/Lean/Compiler/Options.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.Trace -import Lean.Data.Options +public import Lean.Util.Trace +public import Lean.Data.Options + +public section namespace Lean.Compiler diff --git a/src/Lean/Compiler/Specialize.lean b/src/Lean/Compiler/Specialize.lean index da34a21408..f3a9b9b000 100644 --- a/src/Lean/Compiler/Specialize.lean +++ b/src/Lean/Compiler/Specialize.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Attributes +public import Lean.Meta.Basic +public import Lean.Attributes + +public section namespace Lean.Compiler diff --git a/src/Lean/CoreM.lean b/src/Lean/CoreM.lean index b3b745df7d..4ac1e27b78 100644 --- a/src/Lean/CoreM.lean +++ b/src/Lean/CoreM.lean @@ -3,15 +3,19 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.RecDepth -import Lean.Util.Trace -import Lean.Log -import Lean.ResolveName -import Lean.Elab.InfoTree.Types -import Lean.MonadEnv -import Lean.Elab.Exception -import Lean.Language.Basic +public import Lean.Util.RecDepth +public import Lean.Util.Trace +public import Lean.Log +public import Lean.ResolveName +public import Lean.Elab.InfoTree.Types +public import Lean.MonadEnv +public import Lean.Elab.Exception +public import Lean.Language.Basic + +public section namespace Lean register_builtin_option diagnostics : Bool := { @@ -81,6 +85,9 @@ structure DeclNameGenerator where namespace DeclNameGenerator +def ofPrefix (namePrefix : Name) : DeclNameGenerator := + { namePrefix } + private def idxs (g : DeclNameGenerator) : List Nat := g.idx :: g.parentIdxs diff --git a/src/Lean/Data.lean b/src/Lean/Data.lean index 9c951729e9..4174bbf568 100644 --- a/src/Lean/Data.lean +++ b/src/Lean/Data.lean @@ -3,28 +3,32 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Data.AssocList -import Lean.Data.Format -import Lean.Data.Json -import Lean.Data.JsonRpc -import Lean.Data.KVMap -import Lean.Data.LBool -import Lean.Data.LOption -import Lean.Data.Lsp -import Lean.Data.Name -import Lean.Data.NameMap -import Lean.Data.OpenDecl -import Lean.Data.Options -import Lean.Data.PersistentArray -import Lean.Data.PersistentHashMap -import Lean.Data.PersistentHashSet -import Lean.Data.Position -import Lean.Data.PrefixTree -import Lean.Data.SMap -import Lean.Data.Trie -import Lean.Data.Xml -import Lean.Data.NameTrie -import Lean.Data.RBTree -import Lean.Data.RBMap -import Lean.Data.RArray +public import Lean.Data.AssocList +public import Lean.Data.Format +public import Lean.Data.Json +public import Lean.Data.JsonRpc +public import Lean.Data.KVMap +public import Lean.Data.LBool +public import Lean.Data.LOption +public import Lean.Data.Lsp +public import Lean.Data.Name +public import Lean.Data.NameMap +public import Lean.Data.OpenDecl +public import Lean.Data.Options +public import Lean.Data.PersistentArray +public import Lean.Data.PersistentHashMap +public import Lean.Data.PersistentHashSet +public import Lean.Data.Position +public import Lean.Data.PrefixTree +public import Lean.Data.SMap +public import Lean.Data.Trie +public import Lean.Data.Xml +public import Lean.Data.NameTrie +public import Lean.Data.RBTree +public import Lean.Data.RBMap +public import Lean.Data.RArray + +public section diff --git a/src/Lean/Data/Array.lean b/src/Lean/Data/Array.lean index 705eb93fc3..496dbb35d4 100644 --- a/src/Lean/Data/Array.lean +++ b/src/Lean/Data/Array.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Init.Data.Range.Polymorphic.Nat -import Init.Data.Range.Polymorphic.Iterators +public import Init.Data.Range.Polymorphic.Nat +public import Init.Data.Range.Polymorphic.Iterators + +public section namespace Array diff --git a/src/Lean/Data/AssocList.lean b/src/Lean/Data/AssocList.lean index b7dae70c38..c62d7eacbd 100644 --- a/src/Lean/Data/AssocList.lean +++ b/src/Lean/Data/AssocList.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Init.Control.Id -import Init.Data.List.Impl +public import Init.Control.Id +public import Init.Data.List.Impl + +public section universe u v w w' namespace Lean diff --git a/src/Lean/Data/DeclarationRange.lean b/src/Lean/Data/DeclarationRange.lean index cae8ab30da..d8ed17d01c 100644 --- a/src/Lean/Data/DeclarationRange.lean +++ b/src/Lean/Data/DeclarationRange.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Position +public import Lean.Data.Position + +public section /-! # Data types for declaration ranges diff --git a/src/Lean/Data/Format.lean b/src/Lean/Data/Format.lean index 3b9e1dddb7..747d26c715 100644 --- a/src/Lean/Data/Format.lean +++ b/src/Lean/Data/Format.lean @@ -3,8 +3,12 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.Options +public import Lean.Data.Options + +public section universe u v namespace Std diff --git a/src/Lean/Data/FuzzyMatching.lean b/src/Lean/Data/FuzzyMatching.lean index 62f22bad1c..a920a09aa8 100644 --- a/src/Lean/Data/FuzzyMatching.lean +++ b/src/Lean/Data/FuzzyMatching.lean @@ -8,12 +8,16 @@ used in LLVM with some modifications. The LLVM algorithm itself is based on VS code's client side filtering algorithm. For the LLVM implementation see https://clang.llvm.org/extra//doxygen/FuzzyMatch_8cpp_source.html -/ +module + prelude -import Init.Data.Range.Polymorphic.Iterators -import Init.Data.Range.Polymorphic.Nat -import Init.Data.OfScientific -import Init.Data.Option.Coe -import Init.Data.Range +public import Init.Data.Range.Polymorphic.Iterators +public import Init.Data.Range.Polymorphic.Nat +public import Init.Data.OfScientific +public import Init.Data.Option.Coe +public import Init.Data.Range + +public section namespace Lean namespace FuzzyMatching diff --git a/src/Lean/Data/Json.lean b/src/Lean/Data/Json.lean index 68e5015078..88fbd09f1a 100644 --- a/src/Lean/Data/Json.lean +++ b/src/Lean/Data/Json.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Lean.Data.Json.Stream -import Lean.Data.Json.Printer -import Lean.Data.Json.Parser -import Lean.Data.Json.FromToJson -import Lean.Data.Json.Elab +public import Lean.Data.Json.Stream +public import Lean.Data.Json.Printer +public import Lean.Data.Json.Parser +public import Lean.Data.Json.FromToJson +public import Lean.Data.Json.Elab + +public section diff --git a/src/Lean/Data/Json/Basic.lean b/src/Lean/Data/Json/Basic.lean index f4c650fed9..9a89bbdd4d 100644 --- a/src/Lean/Data/Json/Basic.lean +++ b/src/Lean/Data/Json/Basic.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Init.Data.Range -import Init.Data.OfScientific -import Init.Data.Hashable -import Init.Data.ToString.Macro -import Std.Data.TreeMap.Raw.Basic +public import Init.Data.Range +public import Init.Data.OfScientific +public import Init.Data.Hashable +public import Init.Data.ToString.Macro +public import Std.Data.TreeMap.Raw.Basic + +public section namespace Lean @@ -21,8 +25,8 @@ structure JsonNumber where namespace JsonNumber -protected def fromNat (n : Nat) : JsonNumber := ⟨n, 0⟩ -protected def fromInt (n : Int) : JsonNumber := ⟨n, 0⟩ +@[expose] protected def fromNat (n : Nat) : JsonNumber := ⟨n, 0⟩ +@[expose] protected def fromInt (n : Int) : JsonNumber := ⟨n, 0⟩ instance : Coe Nat JsonNumber := ⟨JsonNumber.fromNat⟩ instance : Coe Int JsonNumber := ⟨JsonNumber.fromInt⟩ diff --git a/src/Lean/Data/Json/Elab.lean b/src/Lean/Data/Json/Elab.lean index 6c882adf46..e24be2a214 100644 --- a/src/Lean/Data/Json/Elab.lean +++ b/src/Lean/Data/Json/Elab.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 E.W.Ayers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson -import Lean.Syntax +public import Lean.Data.Json.FromToJson +public meta import Lean.Syntax + +public section /-! # JSON-like syntax for Lean. diff --git a/src/Lean/Data/Json/FromToJson.lean b/src/Lean/Data/Json/FromToJson.lean index 2f8b20d707..944580bd20 100644 --- a/src/Lean/Data/Json/FromToJson.lean +++ b/src/Lean/Data/Json/FromToJson.lean @@ -4,6 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Lean.Data.Json.FromToJson.Extra +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Json.FromToJson.Extra + +public section diff --git a/src/Lean/Data/Json/FromToJson/Basic.lean b/src/Lean/Data/Json/FromToJson/Basic.lean index c3474c00b4..f2d2389eb9 100644 --- a/src/Lean/Data/Json/FromToJson/Basic.lean +++ b/src/Lean/Data/Json/FromToJson/Basic.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Lean.Data.Json.Basic -import Lean.Data.Json.Printer +public import Lean.Data.Json.Basic +public import Lean.Data.Json.Printer + +public section namespace Lean diff --git a/src/Lean/Data/Json/FromToJson/Extra.lean b/src/Lean/Data/Json/FromToJson/Extra.lean index da80268bd6..e7ef3a306d 100644 --- a/src/Lean/Data/Json/FromToJson/Extra.lean +++ b/src/Lean/Data/Json/FromToJson/Extra.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Std.Data.TreeMap.AdditionalOperations +public import Lean.Data.Json.FromToJson.Basic +public import Std.Data.TreeMap.AdditionalOperations + +public section /- This module exists to cut the dependency on `Std.Data.TreeMap.AdditionalOperations` from a large @@ -26,10 +30,10 @@ private def TreeMap.fromJson? {cmp} [FromJson α] (j : Json) : o.foldlM (fun x k v => x.insert k <$> Lean.fromJson? v) ∅ instance [ToJson α] : ToJson (Std.TreeMap String α compare) where - toJson := TreeMap.toJson + toJson := private TreeMap.toJson instance {cmp} [FromJson α] : FromJson (Std.TreeMap String α cmp) where - fromJson? := TreeMap.fromJson? + fromJson? := private TreeMap.fromJson? end Lean diff --git a/src/Lean/Data/Json/Parser.lean b/src/Lean/Data/Json/Parser.lean index f7cd1bda63..e27660c4dc 100644 --- a/src/Lean/Data/Json/Parser.lean +++ b/src/Lean/Data/Json/Parser.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga -/ +module + prelude -import Lean.Data.Json.Basic -import Std.Internal.Parsec +public import Lean.Data.Json.Basic +public import Std.Internal.Parsec + +public section open Std.Internal.Parsec open Std.Internal.Parsec.String diff --git a/src/Lean/Data/Json/Printer.lean b/src/Lean/Data/Json/Printer.lean index ac797179b0..d2038eb155 100644 --- a/src/Lean/Data/Json/Printer.lean +++ b/src/Lean/Data/Json/Printer.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Format -import Lean.Data.Json.Basic -import Init.Data.List.Impl +public import Lean.Data.Format +public import Lean.Data.Json.Basic +public import Init.Data.List.Impl + +public section namespace Lean namespace Json diff --git a/src/Lean/Data/Json/Stream.lean b/src/Lean/Data/Json/Stream.lean index 6f20da7b01..e8fa2f96ba 100644 --- a/src/Lean/Data/Json/Stream.lean +++ b/src/Lean/Data/Json/Stream.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Init.System.IO -import Lean.Data.Json.Parser -import Lean.Data.Json.Printer +public import Init.System.IO +public import Lean.Data.Json.Parser +public import Lean.Data.Json.Printer + +public section namespace IO.FS.Stream diff --git a/src/Lean/Data/JsonRpc.lean b/src/Lean/Data/JsonRpc.lean index cb8ea4dfc5..41d99e7ddf 100644 --- a/src/Lean/Data/JsonRpc.lean +++ b/src/Lean/Data/JsonRpc.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Init.System.IO -import Lean.Data.Json.Stream -import Lean.Data.Json.FromToJson.Basic +public import Init.System.IO +public import Lean.Data.Json.Stream +public import Lean.Data.Json.FromToJson.Basic + +public section /-! Implementation of JSON-RPC 2.0 (https://www.jsonrpc.org/specification) for use in the LSP server. -/ @@ -113,7 +117,7 @@ inductive Message where | responseError (id : RequestID) (code : ErrorCode) (message : String) (data? : Option Json) deriving Inhabited -def Batch := Array Message +@[expose] def Batch := Array Message /-- Generic version of `Message.request`. @@ -213,7 +217,7 @@ def ResponseError.ofMessage? : Message → Option (ResponseError Json) instance : Coe String RequestID := ⟨RequestID.str⟩ instance : Coe JsonNumber RequestID := ⟨RequestID.num⟩ -private def RequestID.lt : RequestID → RequestID → Bool +@[expose] def RequestID.lt : RequestID → RequestID → Bool | RequestID.str a, RequestID.str b => a < b | RequestID.num a, RequestID.num b => a < b | RequestID.null, RequestID.num _ => true @@ -221,7 +225,7 @@ private def RequestID.lt : RequestID → RequestID → Bool | RequestID.num _, RequestID.str _ => true | _, _ /- str < *, num < null, null < null -/ => false -private def RequestID.ltProp : LT RequestID := +@[expose] def RequestID.ltProp : LT RequestID := ⟨fun a b => RequestID.lt a b = true⟩ instance : LT RequestID := diff --git a/src/Lean/Data/KVMap.lean b/src/Lean/Data/KVMap.lean index 9c2ed4eebd..3b9e6757e5 100644 --- a/src/Lean/Data/KVMap.lean +++ b/src/Lean/Data/KVMap.lean @@ -3,9 +3,13 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.List.Impl -import Init.Data.Format.Syntax +public import Init.Data.List.Impl +public import Init.Data.Format.Syntax + +public section namespace Lean diff --git a/src/Lean/Data/LBool.lean b/src/Lean/Data/LBool.lean index aceb1d574f..0ec5656d12 100644 --- a/src/Lean/Data/LBool.lean +++ b/src/Lean/Data/LBool.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.ToString.Basic +public import Init.Data.ToString.Basic + +public section namespace Lean diff --git a/src/Lean/Data/LOption.lean b/src/Lean/Data/LOption.lean index 74c16e1123..40e3e9fad8 100644 --- a/src/Lean/Data/LOption.lean +++ b/src/Lean/Data/LOption.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.ToString.Basic +public import Init.Data.ToString.Basic + +public section universe u namespace Lean diff --git a/src/Lean/Data/Lsp.lean b/src/Lean/Data/Lsp.lean index be3167002a..dfd0d5b09b 100644 --- a/src/Lean/Data/Lsp.lean +++ b/src/Lean/Data/Lsp.lean @@ -4,20 +4,24 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Lsp.Basic -import Lean.Data.Lsp.CancelParams -import Lean.Data.Lsp.Capabilities -import Lean.Data.Lsp.Client -import Lean.Data.Lsp.Communication -import Lean.Data.Lsp.Diagnostics -import Lean.Data.Lsp.Extra -import Lean.Data.Lsp.InitShutdown -import Lean.Data.Lsp.Internal -import Lean.Data.Lsp.LanguageFeatures -import Lean.Data.Lsp.TextSync -import Lean.Data.Lsp.Utf16 -import Lean.Data.Lsp.Workspace -import Lean.Data.Lsp.Ipc -import Lean.Data.Lsp.CodeActions -import Lean.Data.Lsp.Window +public import Lean.Data.Lsp.Basic +public import Lean.Data.Lsp.CancelParams +public import Lean.Data.Lsp.Capabilities +public import Lean.Data.Lsp.Client +public import Lean.Data.Lsp.Communication +public import Lean.Data.Lsp.Diagnostics +public import Lean.Data.Lsp.Extra +public import Lean.Data.Lsp.InitShutdown +public import Lean.Data.Lsp.Internal +public import Lean.Data.Lsp.LanguageFeatures +public import Lean.Data.Lsp.TextSync +public import Lean.Data.Lsp.Utf16 +public import Lean.Data.Lsp.Workspace +public import Lean.Data.Lsp.Ipc +public import Lean.Data.Lsp.CodeActions +public import Lean.Data.Lsp.Window + +public section diff --git a/src/Lean/Data/Lsp/Basic.lean b/src/Lean/Data/Lsp/Basic.lean index 8b0ae443d4..06e72d05d5 100644 --- a/src/Lean/Data/Lsp/Basic.lean +++ b/src/Lean/Data/Lsp/Basic.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json -import Lean.Data.Lsp.BasicAux +public import Lean.Data.Json +public import Lean.Data.Lsp.BasicAux + +public section /-! Defines most of the 'Basic Structures' in the LSP specification (https://microsoft.github.io/language-server-protocol/specifications/specification-current/), @@ -117,7 +121,7 @@ structure TextEdit where deriving ToJson, FromJson /-- An array of `TextEdit`s to be performed in sequence. -/ -def TextEditBatch := Array TextEdit +@[expose] def TextEditBatch := Array TextEdit instance : FromJson TextEditBatch := ⟨@fromJson? (Array TextEdit) _⟩ @@ -318,7 +322,7 @@ structure DocumentFilter where pattern? : Option String := none deriving ToJson, FromJson -def DocumentSelector := Array DocumentFilter +@[expose] def DocumentSelector := Array DocumentFilter instance : FromJson DocumentSelector := ⟨@fromJson? (Array DocumentFilter) _⟩ diff --git a/src/Lean/Data/Lsp/BasicAux.lean b/src/Lean/Data/Lsp/BasicAux.lean index 52391a4622..4b68c15387 100644 --- a/src/Lean/Data/Lsp/BasicAux.lean +++ b/src/Lean/Data/Lsp/BasicAux.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Json.FromToJson.Basic + +public section /- This module exists to cut the dependency on `Std.Data.TreeMap.AdditionalOperations` from a large diff --git a/src/Lean/Data/Lsp/CancelParams.lean b/src/Lean/Data/Lsp/CancelParams.lean index 84e95838b4..3cb8bbccb9 100644 --- a/src/Lean/Data/Lsp/CancelParams.lean +++ b/src/Lean/Data/Lsp/CancelParams.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.JsonRpc +public import Lean.Data.JsonRpc + +public section /-! # Defines `Lean.Lsp.CancelParams`. diff --git a/src/Lean/Data/Lsp/Capabilities.lean b/src/Lean/Data/Lsp/Capabilities.lean index 4f8c2aad1e..403ba86525 100644 --- a/src/Lean/Data/Lsp/Capabilities.lean +++ b/src/Lean/Data/Lsp/Capabilities.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.JsonRpc -import Lean.Data.Lsp.TextSync -import Lean.Data.Lsp.LanguageFeatures -import Lean.Data.Lsp.CodeActions -import Lean.Data.Lsp.Extra +public import Lean.Data.JsonRpc +public import Lean.Data.Lsp.TextSync +public import Lean.Data.Lsp.LanguageFeatures +public import Lean.Data.Lsp.CodeActions +public import Lean.Data.Lsp.Extra + +public section /-! Minimal LSP servers/clients do not have to implement a lot of functionality. Most useful additional behavior is instead diff --git a/src/Lean/Data/Lsp/Client.lean b/src/Lean/Data/Lsp/Client.lean index bdd384c3f6..d8ffaf722b 100644 --- a/src/Lean/Data/Lsp/Client.lean +++ b/src/Lean/Data/Lsp/Client.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joscha Mennicken -/ +module + prelude -import Lean.Data.Lsp.Basic +public import Lean.Data.Lsp.Basic + +public section namespace Lean namespace Lsp diff --git a/src/Lean/Data/Lsp/CodeActions.lean b/src/Lean/Data/Lsp/CodeActions.lean index 99a03f91d9..5fca526697 100644 --- a/src/Lean/Data/Lsp/CodeActions.lean +++ b/src/Lean/Data/Lsp/CodeActions.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Data.Lsp.Basic -import Lean.Data.Lsp.Diagnostics +public import Lean.Data.Lsp.Basic +public import Lean.Data.Lsp.Diagnostics + +public section namespace Lean.Lsp diff --git a/src/Lean/Data/Lsp/Communication.lean b/src/Lean/Data/Lsp/Communication.lean index 638bbd96a1..535835c007 100644 --- a/src/Lean/Data/Lsp/Communication.lean +++ b/src/Lean/Data/Lsp/Communication.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Init.System.IO -import Lean.Data.JsonRpc +public import Init.System.IO +public import Lean.Data.JsonRpc + +public section /-! Reading/writing LSP messages from/to IO handles. -/ diff --git a/src/Lean/Data/Lsp/Diagnostics.lean b/src/Lean/Data/Lsp/Diagnostics.lean index 6d7c340590..41b1a814ec 100644 --- a/src/Lean/Data/Lsp/Diagnostics.lean +++ b/src/Lean/Data/Lsp/Diagnostics.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ -prelude -import Lean.Data.Lsp.Basic -import Lean.Data.Lsp.Utf16 +module -import Lean.Message +prelude +public import Lean.Data.Lsp.Basic +public import Lean.Data.Lsp.Utf16 + +public import Lean.Message + +public section /-! Definitions and functionality for emitting diagnostic information such as errors, warnings and #command outputs from the LSP server. diff --git a/src/Lean/Data/Lsp/Extra.lean b/src/Lean/Data/Lsp/Extra.lean index 94b8b95b13..d09aaec37e 100644 --- a/src/Lean/Data/Lsp/Extra.lean +++ b/src/Lean/Data/Lsp/Extra.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Lsp.Basic -import Lean.Data.Lsp.TextSync -import Lean.Server.Rpc.Basic +public import Lean.Data.Lsp.Basic +public import Lean.Data.Lsp.TextSync +public import Lean.Server.Rpc.Basic + +public section /-! This file contains Lean-specific extensions to LSP. See the structures below for which additional requests and notifications are supported. -/ diff --git a/src/Lean/Data/Lsp/InitShutdown.lean b/src/Lean/Data/Lsp/InitShutdown.lean index 92287c8f94..ee9fb2b272 100644 --- a/src/Lean/Data/Lsp/InitShutdown.lean +++ b/src/Lean/Data/Lsp/InitShutdown.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Lsp.Capabilities -import Lean.Data.Lsp.Workspace +public import Lean.Data.Lsp.Capabilities +public import Lean.Data.Lsp.Workspace + +public section /-! Functionality to do with initializing and shutting down the server ("General Messages" section of LSP spec). -/ diff --git a/src/Lean/Data/Lsp/Internal.lean b/src/Lean/Data/Lsp/Internal.lean index aca6dd44a9..abf17ce3b7 100644 --- a/src/Lean/Data/Lsp/Internal.lean +++ b/src/Lean/Data/Lsp/Internal.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joscha Mennicken -/ +module + prelude -import Lean.Expr -import Lean.Data.Lsp.Basic -import Lean.Data.JsonRpc +public import Lean.Expr +public import Lean.Data.Lsp.Basic +public import Lean.Data.JsonRpc + +public section set_option linter.missingDocs true -- keep it documented @@ -181,7 +185,7 @@ instance : FromJson RefInfo where pure { definition?, usages } /-- References from a single module/file -/ -def ModuleRefs := Std.TreeMap RefIdent RefInfo +@[expose] def ModuleRefs := Std.TreeMap RefIdent RefInfo deriving EmptyCollection instance : ForIn m ModuleRefs (RefIdent × RefInfo) where diff --git a/src/Lean/Data/Lsp/Ipc.lean b/src/Lean/Data/Lsp/Ipc.lean index 2fcea7f8b3..d4af54343b 100644 --- a/src/Lean/Data/Lsp/Ipc.lean +++ b/src/Lean/Data/Lsp/Ipc.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Init.System.IO -import Lean.Data.Json.Basic -import Lean.Data.Lsp.Communication -import Lean.Data.Lsp.Diagnostics -import Lean.Data.Lsp.Extra +public import Init.System.IO +public import Lean.Data.Json.Basic +public import Lean.Data.Lsp.Communication +public import Lean.Data.Lsp.Diagnostics +public import Lean.Data.Lsp.Extra + +public section /-! Provides an IpcM monad for interacting with an external LSP process. Used for testing the Lean server. -/ diff --git a/src/Lean/Data/Lsp/LanguageFeatures.lean b/src/Lean/Data/Lsp/LanguageFeatures.lean index 0824323075..79810b0789 100644 --- a/src/Lean/Data/Lsp/LanguageFeatures.lean +++ b/src/Lean/Data/Lsp/LanguageFeatures.lean @@ -4,9 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Lean.Data.Lsp.Basic +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Lsp.Basic +meta import Lean.Data.Json + +public section namespace Lean namespace Lsp diff --git a/src/Lean/Data/Lsp/TextSync.lean b/src/Lean/Data/Lsp/TextSync.lean index 69bb6aca42..d397d54cf1 100644 --- a/src/Lean/Data/Lsp/TextSync.lean +++ b/src/Lean/Data/Lsp/TextSync.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Lean.Data.Lsp.Basic +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Lsp.Basic + +public section /-! Section "Text Document Synchronization" of the LSP spec. -/ diff --git a/src/Lean/Data/Lsp/Utf16.lean b/src/Lean/Data/Lsp/Utf16.lean index 81d382ca40..1cebe55027 100644 --- a/src/Lean/Data/Lsp/Utf16.lean +++ b/src/Lean/Data/Lsp/Utf16.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Init.Data.String -import Lean.Data.Lsp.BasicAux -import Lean.Data.Position -import Lean.DeclarationRange +public import Init.Data.String +public import Lean.Data.Lsp.BasicAux +public import Lean.Data.Position +public import Lean.DeclarationRange + +public section /-! LSP uses UTF-16 for indexing, so we need to provide some primitives to interact with Lean strings using UTF-16 indices. -/ diff --git a/src/Lean/Data/Lsp/Window.lean b/src/Lean/Data/Lsp/Window.lean index 8ac35250f8..215323835c 100644 --- a/src/Lean/Data/Lsp/Window.lean +++ b/src/Lean/Data/Lsp/Window.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Json.FromToJson.Basic + +public section open Lean @@ -44,5 +48,5 @@ structure ShowMessageRequestParams where actions? : Option (Array MessageActionItem) deriving FromJson, ToJson -def ShowMessageResponse := Option MessageActionItem +@[expose] def ShowMessageResponse := Option MessageActionItem deriving FromJson, ToJson diff --git a/src/Lean/Data/Lsp/Workspace.lean b/src/Lean/Data/Lsp/Workspace.lean index 35cb4190e1..8f22f920fc 100644 --- a/src/Lean/Data/Lsp/Workspace.lean +++ b/src/Lean/Data/Lsp/Workspace.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Lsp.Basic -import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Lsp.Basic +public import Lean.Data.Json.FromToJson.Basic + +public section namespace Lean namespace Lsp diff --git a/src/Lean/Data/Name.lean b/src/Lean/Data/Name.lean index 9e1d59f5bc..8d856be454 100644 --- a/src/Lean/Data/Name.lean +++ b/src/Lean/Data/Name.lean @@ -3,8 +3,12 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Init.Data.Ord +public import Init.Data.Ord + +public section namespace Lean namespace Name diff --git a/src/Lean/Data/NameMap.lean b/src/Lean/Data/NameMap.lean index a6daa371e2..bbd529b6f7 100644 --- a/src/Lean/Data/NameMap.lean +++ b/src/Lean/Data/NameMap.lean @@ -3,6 +3,10 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.NameMap.Basic -import Lean.Data.NameMap.AdditionalOperations +public import Lean.Data.NameMap.Basic +public import Lean.Data.NameMap.AdditionalOperations + +public section diff --git a/src/Lean/Data/NameMap/AdditionalOperations.lean b/src/Lean/Data/NameMap/AdditionalOperations.lean index 341276d898..dd45fdda3d 100644 --- a/src/Lean/Data/NameMap/AdditionalOperations.lean +++ b/src/Lean/Data/NameMap/AdditionalOperations.lean @@ -3,9 +3,13 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.NameMap.Basic -import Std.Data.TreeSet.AdditionalOperations +public import Lean.Data.NameMap.Basic +public import Std.Data.TreeSet.AdditionalOperations + +public section namespace Lean namespace NameMap diff --git a/src/Lean/Data/NameMap/Basic.lean b/src/Lean/Data/NameMap/Basic.lean index 328bf16ac1..3b0e196702 100644 --- a/src/Lean/Data/NameMap/Basic.lean +++ b/src/Lean/Data/NameMap/Basic.lean @@ -3,15 +3,19 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Std.Data.HashSet.Basic -import Std.Data.TreeSet.Basic -import Lean.Data.SSet -import Lean.Data.Name +public import Std.Data.HashSet.Basic +public import Std.Data.TreeSet.Basic +public import Lean.Data.SSet +public import Lean.Data.Name + +public section namespace Lean -def NameMap (α : Type) := Std.TreeMap Name α Name.quickCmp +@[expose] def NameMap (α : Type) := Std.TreeMap Name α Name.quickCmp @[inline] def mkNameMap (α : Type) : NameMap α := Std.TreeMap.empty @@ -40,7 +44,7 @@ def filter (f : Name → α → Bool) (m : NameMap α) : NameMap α := Std.TreeM end NameMap -def NameSet := Std.TreeSet Name Name.quickCmp +@[expose] def NameSet := Std.TreeSet Name Name.quickCmp namespace NameSet def empty : NameSet := Std.TreeSet.empty @@ -79,7 +83,7 @@ def ofArray (l : Array Name) : NameSet := Std.TreeSet.ofArray l _ end NameSet -def NameSSet := SSet Name +@[expose] def NameSSet := SSet Name namespace NameSSet abbrev empty : NameSSet := SSet.empty @@ -89,7 +93,7 @@ abbrev insert (s : NameSSet) (n : Name) : NameSSet := SSet.insert s n abbrev contains (s : NameSSet) (n : Name) : Bool := SSet.contains s n end NameSSet -def NameHashSet := Std.HashSet Name +@[expose] def NameHashSet := Std.HashSet Name namespace NameHashSet @[inline] def empty : NameHashSet := (∅ : Std.HashSet Name) diff --git a/src/Lean/Data/NameTrie.lean b/src/Lean/Data/NameTrie.lean index d08d4c7faa..000bb835af 100644 --- a/src/Lean/Data/NameTrie.lean +++ b/src/Lean/Data/NameTrie.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.PrefixTree +public import Lean.Data.PrefixTree + +public section namespace Lean @@ -29,7 +33,7 @@ def NamePart.lt : NamePart → NamePart → Bool | NamePart.num _, NamePart.str _ => true | _, _ => false -def NameTrie (β : Type u) := PrefixTree NamePart β NamePart.cmp +@[expose] def NameTrie (β : Type u) := PrefixTree NamePart β NamePart.cmp private def toKey (n : Name) : List NamePart := loop n [] diff --git a/src/Lean/Data/OpenDecl.lean b/src/Lean/Data/OpenDecl.lean index ea197aafdf..c806171bde 100644 --- a/src/Lean/Data/OpenDecl.lean +++ b/src/Lean/Data/OpenDecl.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Meta +public import Init.Meta + +public section namespace Lean diff --git a/src/Lean/Data/Options.lean b/src/Lean/Data/Options.lean index 7adec36b77..f4d85253ae 100644 --- a/src/Lean/Data/Options.lean +++ b/src/Lean/Data/Options.lean @@ -3,14 +3,18 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich and Leonardo de Moura -/ +module + prelude -import Lean.ImportingFlag -import Lean.Data.KVMap -import Lean.Data.NameMap.Basic +public import Lean.ImportingFlag +public import Lean.Data.KVMap +public import Lean.Data.NameMap.Basic + +public section namespace Lean -def Options := KVMap +@[expose] def Options := KVMap def Options.empty : Options := {} instance : Inhabited Options where @@ -26,7 +30,7 @@ structure OptionDecl where descr : String := "" deriving Inhabited -def OptionDecls := NameMap OptionDecl +@[expose] def OptionDecls := NameMap OptionDecl instance : Inhabited OptionDecls := ⟨({} : NameMap OptionDecl)⟩ diff --git a/src/Lean/Data/PersistentArray.lean b/src/Lean/Data/PersistentArray.lean index c2b809f361..6e277c2b91 100644 --- a/src/Lean/Data/PersistentArray.lean +++ b/src/Lean/Data/PersistentArray.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Nat.Fold -import Init.Data.Array.Basic -import Init.NotationExtra -import Init.Data.ToString.Macro -import Init.Data.UInt.Basic +public import Init.Data.Nat.Fold +public import Init.Data.Array.Basic +public import Init.NotationExtra +public import Init.Data.ToString.Macro +public import Init.Data.UInt.Basic + +public section universe u v w diff --git a/src/Lean/Data/PersistentHashMap.lean b/src/Lean/Data/PersistentHashMap.lean index fdc0baf88c..72897f4a4e 100644 --- a/src/Lean/Data/PersistentHashMap.lean +++ b/src/Lean/Data/PersistentHashMap.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Array.BasicAux -import Init.Data.ToString.Macro -import Init.Data.UInt.Basic +public import Init.Data.Array.BasicAux +public import Init.Data.ToString.Macro +public import Init.Data.UInt.Basic + +public section namespace Lean universe u v w w' diff --git a/src/Lean/Data/PersistentHashSet.lean b/src/Lean/Data/PersistentHashSet.lean index fe6de94171..b5355990f4 100644 --- a/src/Lean/Data/PersistentHashSet.lean +++ b/src/Lean/Data/PersistentHashSet.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.PersistentHashMap +public import Lean.Data.PersistentHashMap + +public section namespace Lean universe u v diff --git a/src/Lean/Data/Position.lean b/src/Lean/Data/Position.lean index 6bb0925d80..82ac63ae62 100644 --- a/src/Lean/Data/Position.lean +++ b/src/Lean/Data/Position.lean @@ -3,10 +3,14 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Data.Format -import Lean.Data.Json.FromToJson.Basic -import Lean.ToExpr +public import Lean.Data.Format +public import Lean.Data.Json.FromToJson.Basic +public import Lean.ToExpr + +public section namespace Lean diff --git a/src/Lean/Data/PrefixTree.lean b/src/Lean/Data/PrefixTree.lean index 146ee95303..51d0f3329f 100644 --- a/src/Lean/Data/PrefixTree.lean +++ b/src/Lean/Data/PrefixTree.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Std.Data.TreeMap.Raw.Basic +public import Std.Data.TreeMap.Raw.Basic + +public section namespace Lean @@ -81,7 +85,7 @@ inductive WellFormed (cmp : α → α → Ordering) : PrefixTreeNode α β cmp end PrefixTreeNode -def PrefixTree (α : Type u) (β : Type v) (cmp : α → α → Ordering) : Type (max u v) := +@[expose] def PrefixTree (α : Type u) (β : Type v) (cmp : α → α → Ordering) : Type (max u v) := { t : PrefixTreeNode α β cmp // t.WellFormed cmp } open PrefixTreeNode diff --git a/src/Lean/Data/RArray.lean b/src/Lean/Data/RArray.lean index 36dcc9b62b..8f7528ea99 100644 --- a/src/Lean/Data/RArray.lean +++ b/src/Lean/Data/RArray.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Init.Data.RArray -import Lean.Meta.InferType -import Lean.Meta.DecLevel -import Lean.ToExpr +public import Init.Data.RArray +public import Lean.Meta.InferType +public import Lean.Meta.DecLevel +public import Lean.ToExpr + +public section /-! Auxiliary definitions related to `Lean.RArray` that are typically only used in meta-code, in diff --git a/src/Lean/Data/RBMap.lean b/src/Lean/Data/RBMap.lean index 2ac041f43c..c113229317 100644 --- a/src/Lean/Data/RBMap.lean +++ b/src/Lean/Data/RBMap.lean @@ -3,9 +3,13 @@ Copyright (c) 2017 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Ord -import Init.Data.Nat.Linear +public import Init.Data.Ord +public import Init.Data.Nat.Linear + +public section namespace Lean universe u v w w' @@ -253,7 +257,7 @@ open Lean.RBNode /- TODO(Leo): define dRBMap -/ -def RBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) : Type (max u v) := +@[expose] def RBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) : Type (max u v) := {t : RBNode α (fun _ => β) // t.WellFormed cmp } @[inline] def mkRBMap (α : Type u) (β : Type v) (cmp : α → α → Ordering) : RBMap α β cmp := diff --git a/src/Lean/Data/RBTree.lean b/src/Lean/Data/RBTree.lean index 4265bb1ace..5768c468b5 100644 --- a/src/Lean/Data/RBTree.lean +++ b/src/Lean/Data/RBTree.lean @@ -3,12 +3,16 @@ Copyright (c) 2017 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.RBMap +public import Lean.Data.RBMap + +public section namespace Lean universe u v w -def RBTree (α : Type u) (cmp : α → α → Ordering) : Type u := +@[expose] def RBTree (α : Type u) (cmp : α → α → Ordering) : Type u := RBMap α Unit cmp instance : Inhabited (RBTree α p) where diff --git a/src/Lean/Data/SMap.lean b/src/Lean/Data/SMap.lean index 6b031a2e12..80b2954bf0 100644 --- a/src/Lean/Data/SMap.lean +++ b/src/Lean/Data/SMap.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Std.Data.HashMap.Basic -import Lean.Data.PersistentHashMap +public import Std.Data.HashMap.Basic +public import Lean.Data.PersistentHashMap + +public section universe u v w w' namespace Lean diff --git a/src/Lean/Data/SSet.lean b/src/Lean/Data/SSet.lean index dafbfe9b39..5a73aa8cd1 100644 --- a/src/Lean/Data/SSet.lean +++ b/src/Lean/Data/SSet.lean @@ -3,13 +3,17 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.SMap +public import Lean.Data.SMap + +public section namespace Lean /-- Staged set. It is just a simple wrapper on top of Staged maps. -/ -def SSet (α : Type u) [BEq α] [Hashable α] := SMap α Unit +@[expose] def SSet (α : Type u) [BEq α] [Hashable α] := SMap α Unit namespace SSet variable {α : Type u} [BEq α] [Hashable α] diff --git a/src/Lean/Data/Trie.lean b/src/Lean/Data/Trie.lean index 566a8a1c80..9118d4dbc5 100644 --- a/src/Lean/Data/Trie.lean +++ b/src/Lean/Data/Trie.lean @@ -5,9 +5,13 @@ Author: Sebastian Ullrich, Leonardo de Moura, Joachim Breitner A string trie data structure, used for tokenizing the Lean language -/ +module + prelude -import Lean.Data.Format -import Init.Data.Option.Coe +public import Lean.Data.Format +public import Init.Data.Option.Coe + +public section namespace Lean namespace Data @@ -25,7 +29,7 @@ constructor. The code would be a bit less repetitive if we used something like the following ``` mutual -def Trie α := Option α × ByteAssoc α +@[expose] def Trie α := Option α × ByteAssoc α inductive ByteAssoc α where | leaf : Trie α diff --git a/src/Lean/Data/Xml.lean b/src/Lean/Data/Xml.lean index ee63449402..bf67c09098 100644 --- a/src/Lean/Data/Xml.lean +++ b/src/Lean/Data/Xml.lean @@ -3,6 +3,10 @@ Copyright (c) 2021 Daniel Fabian. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Daniel Fabian -/ +module + prelude -import Lean.Data.Xml.Basic -import Lean.Data.Xml.Parser +public import Lean.Data.Xml.Basic +public import Lean.Data.Xml.Parser + +public section diff --git a/src/Lean/Data/Xml/Basic.lean b/src/Lean/Data/Xml/Basic.lean index 3a86e6089f..21b254e915 100644 --- a/src/Lean/Data/Xml/Basic.lean +++ b/src/Lean/Data/Xml/Basic.lean @@ -3,14 +3,18 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Dany Fabian -/ +module + prelude -import Init.Data.ToString.Macro -import Std.Data.TreeMap.Basic +public import Init.Data.ToString.Macro +public import Std.Data.TreeMap.Basic + +public section namespace Lean namespace Xml -def Attributes := Std.TreeMap String String +@[expose] def Attributes := Std.TreeMap String String instance : ToString Attributes := ⟨λ as => as.foldl (λ s n v => s ++ s!" {n}=\"{v}\"") ""⟩ mutual diff --git a/src/Lean/Data/Xml/Parser.lean b/src/Lean/Data/Xml/Parser.lean index 8f39dce7bb..d9f0eceff8 100644 --- a/src/Lean/Data/Xml/Parser.lean +++ b/src/Lean/Data/Xml/Parser.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Dany Fabian -/ +module + prelude -import Std.Internal.Parsec -import Lean.Data.Xml.Basic +public import Std.Internal.Parsec +public import Lean.Data.Xml.Basic + +public section open System open Lean diff --git a/src/Lean/Declaration.lean b/src/Lean/Declaration.lean index b919d983a1..ed4b96ebf2 100644 --- a/src/Lean/Declaration.lean +++ b/src/Lean/Declaration.lean @@ -3,8 +3,12 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean /-- diff --git a/src/Lean/DeclarationRange.lean b/src/Lean/DeclarationRange.lean index aaf2a5129c..35b71b5650 100644 --- a/src/Lean/DeclarationRange.lean +++ b/src/Lean/DeclarationRange.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.DeclarationRange -import Lean.MonadEnv +public import Lean.Data.DeclarationRange +public import Lean.MonadEnv + +public section /-! # Environment extension for declaration ranges diff --git a/src/Lean/DefEqAttrib.lean b/src/Lean/DefEqAttrib.lean index 16be6de462..73cc090e5b 100644 --- a/src/Lean/DefEqAttrib.lean +++ b/src/Lean/DefEqAttrib.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.PrettyPrinter +public import Lean.PrettyPrinter + +public section namespace Lean open Meta diff --git a/src/Lean/DocString.lean b/src/Lean/DocString.lean index 453aaca395..60d8dd5e9a 100644 --- a/src/Lean/DocString.lean +++ b/src/Lean/DocString.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.DocString.Extension -import Lean.DocString.Links -import Lean.Parser.Tactic.Doc -import Lean.Parser.Term.Doc +public import Lean.DocString.Extension +public import Lean.DocString.Links +public import Lean.Parser.Tactic.Doc +public import Lean.Parser.Term.Doc + +public section set_option linter.missingDocs true diff --git a/src/Lean/DocString/Add.lean b/src/Lean/DocString/Add.lean index 42131d9e32..833298a0b9 100644 --- a/src/Lean/DocString/Add.lean +++ b/src/Lean/DocString/Add.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.Environment -import Lean.Exception -import Lean.Log -import Lean.DocString.Extension -import Lean.DocString.Links +public import Lean.Environment +public import Lean.Exception +public import Lean.Log +public import Lean.DocString.Extension +public import Lean.DocString.Links + +public section set_option linter.missingDocs true diff --git a/src/Lean/DocString/Extension.lean b/src/Lean/DocString/Extension.lean index 6120755abd..7365fde8c9 100644 --- a/src/Lean/DocString/Extension.lean +++ b/src/Lean/DocString/Extension.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.DeclarationRange -import Lean.DocString.Links -import Lean.MonadEnv -import Init.Data.String.Extra +public import Lean.DeclarationRange +public import Lean.DocString.Links +public import Lean.MonadEnv +public import Init.Data.String.Extra + +public section -- This module contains the underlying data for docstrings, with as few imports as possible, so that -- docstrings can be saved in as much of the compiler as possible. diff --git a/src/Lean/DocString/Links.lean b/src/Lean/DocString/Links.lean index d274b6b7bf..307033b8f3 100644 --- a/src/Lean/DocString/Links.lean +++ b/src/Lean/DocString/Links.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.Syntax +public import Lean.Syntax + +public section set_option linter.missingDocs true diff --git a/src/Lean/Elab.lean b/src/Lean/Elab.lean index 2433a0ba56..613c70bab9 100644 --- a/src/Lean/Elab.lean +++ b/src/Lean/Elab.lean @@ -3,58 +3,62 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Import -import Lean.Elab.Exception -import Lean.Elab.Config -import Lean.Elab.Command -import Lean.Elab.Term -import Lean.Elab.App -import Lean.Elab.Binders -import Lean.Elab.BinderPredicates -import Lean.Elab.LetRec -import Lean.Elab.Frontend -import Lean.Elab.BuiltinNotation -import Lean.Elab.Declaration -import Lean.Elab.Tactic -import Lean.Elab.Match +public import Lean.Elab.Import +public import Lean.Elab.Exception +public import Lean.Elab.Config +public import Lean.Elab.Command +public import Lean.Elab.Term +public import Lean.Elab.App +public import Lean.Elab.Binders +public import Lean.Elab.BinderPredicates +public import Lean.Elab.LetRec +public import Lean.Elab.Frontend +public import Lean.Elab.BuiltinNotation +public import Lean.Elab.Declaration +public import Lean.Elab.Tactic +public import Lean.Elab.Match -- HACK: must come after `Match` because builtin elaborators (for `match` in this case) do not take priorities -import Lean.Elab.Quotation -import Lean.Elab.Syntax -import Lean.Elab.Do -import Lean.Elab.StructInst -import Lean.Elab.StructInstHint -import Lean.Elab.MutualInductive -import Lean.Elab.Inductive -import Lean.Elab.Structure -import Lean.Elab.Print -import Lean.Elab.MutualDef -import Lean.Elab.AuxDef -import Lean.Elab.PreDefinition -import Lean.Elab.Deriving -import Lean.Elab.DeclarationRange -import Lean.Elab.Extra -import Lean.Elab.GenInjective -import Lean.Elab.BuiltinTerm -import Lean.Elab.Arg -import Lean.Elab.PatternVar -import Lean.Elab.ElabRules -import Lean.Elab.Macro -import Lean.Elab.Notation -import Lean.Elab.Mixfix -import Lean.Elab.MacroRules -import Lean.Elab.BuiltinCommand -import Lean.Elab.BuiltinEvalCommand -import Lean.Elab.RecAppSyntax -import Lean.Elab.Eval -import Lean.Elab.Calc -import Lean.Elab.InheritDoc -import Lean.Elab.ParseImportsFast -import Lean.Elab.GuardMsgs -import Lean.Elab.CheckTactic -import Lean.Elab.MatchExpr -import Lean.Elab.Tactic.Doc -import Lean.Elab.Time -import Lean.Elab.RecommendedSpelling -import Lean.Elab.InfoTrees -import Lean.Elab.ErrorExplanation +public import Lean.Elab.Quotation +public import Lean.Elab.Syntax +public import Lean.Elab.Do +public import Lean.Elab.StructInst +public import Lean.Elab.StructInstHint +public import Lean.Elab.MutualInductive +public import Lean.Elab.Inductive +public import Lean.Elab.Structure +public import Lean.Elab.Print +public import Lean.Elab.MutualDef +public import Lean.Elab.AuxDef +public import Lean.Elab.PreDefinition +public import Lean.Elab.Deriving +public import Lean.Elab.DeclarationRange +public import Lean.Elab.Extra +public import Lean.Elab.GenInjective +public import Lean.Elab.BuiltinTerm +public import Lean.Elab.Arg +public import Lean.Elab.PatternVar +public import Lean.Elab.ElabRules +public import Lean.Elab.Macro +public import Lean.Elab.Notation +public import Lean.Elab.Mixfix +public import Lean.Elab.MacroRules +public import Lean.Elab.BuiltinCommand +public import Lean.Elab.BuiltinEvalCommand +public import Lean.Elab.RecAppSyntax +public import Lean.Elab.Eval +public import Lean.Elab.Calc +public import Lean.Elab.InheritDoc +public import Lean.Elab.ParseImportsFast +public import Lean.Elab.GuardMsgs +public import Lean.Elab.CheckTactic +public import Lean.Elab.MatchExpr +public import Lean.Elab.Tactic.Doc +public import Lean.Elab.Time +public import Lean.Elab.RecommendedSpelling +public import Lean.Elab.InfoTrees +public import Lean.Elab.ErrorExplanation + +public section diff --git a/src/Lean/Elab/App.lean b/src/Lean/Elab/App.lean index 8ce1db8c7e..8273339480 100644 --- a/src/Lean/Elab/App.lean +++ b/src/Lean/Elab/App.lean @@ -3,19 +3,23 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.FindMVar -import Lean.Util.CollectFVars -import Lean.Parser.Term -import Lean.Meta.Hint -import Lean.Meta.KAbstract -import Lean.Meta.Tactic.ElimInfo -import Lean.Elab.Term -import Lean.Elab.Binders -import Lean.Elab.SyntheticMVars -import Lean.Elab.Arg -import Lean.Elab.RecAppSyntax -import Lean.Meta.Hint +public import Lean.Util.FindMVar +public import Lean.Util.CollectFVars +public import Lean.Parser.Term +public import Lean.Meta.Hint +public import Lean.Meta.KAbstract +public import Lean.Meta.Tactic.ElimInfo +public import Lean.Elab.Term +public import Lean.Elab.Binders +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.Arg +public import Lean.Elab.RecAppSyntax +public import Lean.Meta.Hint + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/Arg.lean b/src/Lean/Elab/Arg.lean index e476eebdb1..3ea3335244 100644 --- a/src/Lean/Elab/Arg.lean +++ b/src/Lean/Elab/Arg.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Term +public import Lean.Elab.Term + +public section namespace Lean.Elab.Term diff --git a/src/Lean/Elab/Attributes.lean b/src/Lean/Elab/Attributes.lean index 083af21296..06c9efd7e6 100644 --- a/src/Lean/Elab/Attributes.lean +++ b/src/Lean/Elab/Attributes.lean @@ -3,8 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Util +public import Lean.Elab.Util +import Lean.Parser.Term + +public section namespace Lean.Elab structure Attribute where diff --git a/src/Lean/Elab/AutoBound.lean b/src/Lean/Elab/AutoBound.lean index 23068a22f7..de97936ed4 100644 --- a/src/Lean/Elab/AutoBound.lean +++ b/src/Lean/Elab/AutoBound.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Options +public import Lean.Data.Options + +public section /-! # Basic support for auto bound implicit local names -/ diff --git a/src/Lean/Elab/AuxDef.lean b/src/Lean/Elab/AuxDef.lean index b5e6bca83b..d40d8cc565 100644 --- a/src/Lean/Elab/AuxDef.lean +++ b/src/Lean/Elab/AuxDef.lean @@ -3,8 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner -/ +module + prelude -import Lean.Elab.Command +public import Lean.Elab.Command +meta import Lean.Parser.Term + +public section namespace Lean.Elab.Command open Lean.Parser.Command @@ -28,7 +33,7 @@ def elabAuxDef : CommandElab -- create a private name that then breaks the macro below. We assume that `aux_def` is not used -- with the same arguments in parallel contexts. let env := (← getEnv).setExporting true - let (id, _) := { namePrefix := ns : DeclNameGenerator }.mkUniqueName env («infix» := Name.mkSimple id) + let (id, _) := DeclNameGenerator.ofPrefix ns |>.mkUniqueName env («infix» := Name.mkSimple id) let id := id.replacePrefix ns Name.anonymous -- TODO: replace with def _root_.id elabCommand <| ← `($[$doc?:docComment]? $[$attrs?:attributes]? diff --git a/src/Lean/Elab/BinderPredicates.lean b/src/Lean/Elab/BinderPredicates.lean index 6781e610e8..a5a9b327d0 100644 --- a/src/Lean/Elab/BinderPredicates.lean +++ b/src/Lean/Elab/BinderPredicates.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner -/ +module + prelude -import Init.BinderPredicates -import Lean.Parser.Syntax -import Lean.Elab.MacroArgUtil -import Lean.Linter.MissingDocs +public import Init.BinderPredicates +public import Lean.Elab.MacroArgUtil +public import Lean.Linter.MissingDocs +meta import Lean.Parser.Syntax + +public section namespace Lean.Elab.Command diff --git a/src/Lean/Elab/Binders.lean b/src/Lean/Elab/Binders.lean index 29b36f795e..cee155fd72 100644 --- a/src/Lean/Elab/Binders.lean +++ b/src/Lean/Elab/Binders.lean @@ -3,14 +3,19 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Quotation.Precheck -import Lean.Elab.Term -import Lean.Elab.BindersUtil -import Lean.Elab.SyntheticMVars -import Lean.Elab.PreDefinition.TerminationHint -import Lean.Elab.Match -import Lean.Compiler.MetaAttr +public import Lean.Elab.Quotation.Precheck +public import Lean.Elab.Term +public import Lean.Elab.BindersUtil +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.PreDefinition.TerminationHint +public import Lean.Elab.Match +public import Lean.Compiler.MetaAttr +meta import Lean.Parser.Term + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/BindersUtil.lean b/src/Lean/Elab/BindersUtil.lean index 1fabc4e143..01910f260e 100644 --- a/src/Lean/Elab/BindersUtil.lean +++ b/src/Lean/Elab/BindersUtil.lean @@ -3,8 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Term +public import Lean.Parser.Term +meta import Lean.Parser.Term + +public section namespace Lean.Elab.Term /-- diff --git a/src/Lean/Elab/BuiltinCommand.lean b/src/Lean/Elab/BuiltinCommand.lean index 3081946eb8..e5006c931a 100644 --- a/src/Lean/Elab/BuiltinCommand.lean +++ b/src/Lean/Elab/BuiltinCommand.lean @@ -3,17 +3,21 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectLevelParams -import Lean.Util.CollectAxioms -import Lean.Meta.Reduce -import Lean.Elab.DeclarationRange -import Lean.Elab.Eval -import Lean.Elab.Command -import Lean.Elab.Open -import Lean.Elab.SetOption -import Init.System.Platform -import Lean.Meta.Hint +public import Lean.Util.CollectLevelParams +public import Lean.Util.CollectAxioms +public import Lean.Meta.Reduce +public import Lean.Elab.DeclarationRange +public import Lean.Elab.Eval +public import Lean.Elab.Command +public import Lean.Elab.Open +public import Lean.Elab.SetOption +public import Init.System.Platform +public import Lean.Meta.Hint + +public section namespace Lean.Elab.Command diff --git a/src/Lean/Elab/BuiltinEvalCommand.lean b/src/Lean/Elab/BuiltinEvalCommand.lean index 1601f68dc6..7b872f3e1e 100644 --- a/src/Lean/Elab/BuiltinEvalCommand.lean +++ b/src/Lean/Elab/BuiltinEvalCommand.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Util.CollectAxioms -import Lean.Elab.Deriving.Basic -import Lean.Elab.MutualDef +public import Lean.Util.CollectAxioms +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.MutualDef + +public section /-! # Implementation of `#eval` command @@ -84,7 +88,7 @@ private def addAndCompileExprForEval (declName : Name) (value : Expr) (allowSorr -- An alternative design would be to make `elabTermForEval` into a term elaborator and elaborate the command all at once -- with `unsafe def _eval := term_for_eval% $t`, which we did try, but unwanted error messages -- such as "failed to infer definition type" can surface. - let defView := mkDefViewOfDef { isUnsafe := true } + let defView := mkDefViewOfDef { isUnsafe := true, visibility := .public } (← `(Parser.Command.definition| def $(mkIdent <| `_root_ ++ declName) := $(← Term.exprToSyntax value))) Term.elabMutualDef #[] { header := "" } #[defView] diff --git a/src/Lean/Elab/BuiltinNotation.lean b/src/Lean/Elab/BuiltinNotation.lean index 85d7435227..006ce5e78c 100644 --- a/src/Lean/Elab/BuiltinNotation.lean +++ b/src/Lean/Elab/BuiltinNotation.lean @@ -3,15 +3,20 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Gabriel Ebner -/ +module + prelude -import Lean.Compiler.BorrowedAnnotation -import Lean.Meta.KAbstract -import Lean.Meta.Closure -import Lean.Meta.MatchUtil -import Lean.Compiler.ImplementedByAttr -import Lean.Elab.SyntheticMVars -import Lean.Elab.Eval -import Lean.Elab.Binders +public import Lean.Compiler.BorrowedAnnotation +public import Lean.Meta.KAbstract +public import Lean.Meta.Closure +public import Lean.Meta.MatchUtil +public import Lean.Compiler.ImplementedByAttr +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.Eval +public import Lean.Elab.Binders +meta import Lean.Parser.Do + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/BuiltinTerm.lean b/src/Lean/Elab/BuiltinTerm.lean index f7744a044f..408dc3d145 100644 --- a/src/Lean/Elab/BuiltinTerm.lean +++ b/src/Lean/Elab/BuiltinTerm.lean @@ -3,12 +3,17 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Closure -import Lean.Meta.Diagnostics -import Lean.Elab.Open -import Lean.Elab.SetOption -import Lean.Elab.Eval +public import Lean.Meta.Closure +public import Lean.Meta.Diagnostics +public import Lean.Elab.Open +public import Lean.Elab.SetOption +public import Lean.Elab.Eval +meta import Lean.Parser.Command + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/Calc.lean b/src/Lean/Elab/Calc.lean index b379f59c8d..b90a49fba3 100644 --- a/src/Lean/Elab/Calc.lean +++ b/src/Lean/Elab/Calc.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.App +public import Lean.Elab.App + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/CheckTactic.lean b/src/Lean/Elab/CheckTactic.lean index 6f20ea865b..0ed4849ab7 100644 --- a/src/Lean/Elab/CheckTactic.lean +++ b/src/Lean/Elab/CheckTactic.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joe Hendrix -/ +module + prelude -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Command -import Lean.Elab.Tactic.Meta -import Lean.Meta.CheckTactic +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Command +public import Lean.Elab.Tactic.Meta +public import Lean.Meta.CheckTactic + +public section /-! Commands to validate tactic results. diff --git a/src/Lean/Elab/Command.lean b/src/Lean/Elab/Command.lean index 4bd4e77279..1b99ab4aa8 100644 --- a/src/Lean/Elab/Command.lean +++ b/src/Lean/Elab/Command.lean @@ -3,14 +3,19 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Gabriel Ebner -/ +module + prelude -import Init.Data.Range.Polymorphic.Stream -import Lean.Meta.Diagnostics -import Lean.Elab.Binders -import Lean.Elab.SyntheticMVars -import Lean.Elab.SetOption -import Lean.Language.Basic -import Lean.Meta.ForEachExpr +public import Init.Data.Range.Polymorphic.Stream +public import Lean.Meta.Diagnostics +public import Lean.Elab.Binders +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.SetOption +public import Lean.Language.Basic +public import Lean.Meta.ForEachExpr +public meta import Lean.Parser.Command + +public section namespace Lean.Elab.Command @@ -90,7 +95,7 @@ structure State where nextMacroScope : Nat := firstFrontendMacroScope + 1 maxRecDepth : Nat ngen : NameGenerator := {} - auxDeclNGen : DeclNameGenerator := {} + auxDeclNGen : DeclNameGenerator := .ofPrefix .anonymous infoState : InfoState := {} traceState : TraceState := {} snapshotTasks : Array (Language.SnapshotTask Language.SnapshotTree) := #[] @@ -162,7 +167,7 @@ def mkState (env : Environment) (messages : MessageLog := {}) (opts : Options := scopes := [{ header := "", opts }] maxRecDepth := maxRecDepth.get opts -- Outside of declarations, fall back to a module-specific prefix - auxDeclNGen := { namePrefix := mkPrivateName env .anonymous } + auxDeclNGen := .ofPrefix <| mkPrivateName env .anonymous } /- Linters should be loadable as plugins, so store in a global IO ref instead of an attribute managed by the @@ -691,7 +696,7 @@ consider using `runTermElabM`. Recall that `TermElabM` actions can automatically lift `MetaM` and `CoreM` actions. Example: ``` -import Lean +public import Lean open Lean Elab Command Meta @@ -731,7 +736,9 @@ command. Example: ``` -import Lean +public import Lean + +public section open Lean Elab Command Meta diff --git a/src/Lean/Elab/ComputedFields.lean b/src/Lean/Elab/ComputedFields.lean index 1167e4bf43..2df62b19af 100644 --- a/src/Lean/Elab/ComputedFields.lean +++ b/src/Lean/Elab/ComputedFields.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner -/ +module + prelude -import Lean.Meta.Constructions.CasesOn -import Lean.Compiler.ImplementedByAttr -import Lean.Elab.PreDefinition.WF.Eqns +public import Lean.Meta.Constructions.CasesOn +public import Lean.Compiler.ImplementedByAttr +public import Lean.Elab.PreDefinition.WF.Eqns + +public section /-! # Computed fields diff --git a/src/Lean/Elab/Config.lean b/src/Lean/Elab/Config.lean index ad643f215f..1d73e0ac74 100644 --- a/src/Lean/Elab/Config.lean +++ b/src/Lean/Elab/Config.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Elab.Term diff --git a/src/Lean/Elab/DeclModifiers.lean b/src/Lean/Elab/DeclModifiers.lean index 2f5df0d810..edaea4d289 100644 --- a/src/Lean/Elab/DeclModifiers.lean +++ b/src/Lean/Elab/DeclModifiers.lean @@ -3,10 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Structure -import Lean.Elab.Attributes -import Lean.DocString.Add +public import Lean.Structure +public import Lean.Elab.Attributes +public import Lean.DocString.Add +public import Lean.Parser.Command +meta import Lean.Parser.Command + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/DeclNameGen.lean b/src/Lean/Elab/DeclNameGen.lean index 74f39155be..8649dbaf06 100644 --- a/src/Lean/Elab/DeclNameGen.lean +++ b/src/Lean/Elab/DeclNameGen.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Elab.Command +public import Lean.Elab.Command + +public section /-! # Name generator for declarations @@ -187,7 +191,7 @@ This can be used to decide whether to further transform the generated name; in particular, this enables checking whether the generated name mentions declarations from the current module or project. -/ -def mkBaseName (e : Expr) : MkNameM String := do +private def mkBaseName (e : Expr) : MkNameM String := do let e ← instantiateMVars e visitNamespace (← getCurrNamespace) mkBaseNameAux (← winnowExpr e) diff --git a/src/Lean/Elab/DeclUtil.lean b/src/Lean/Elab/DeclUtil.lean index eb311ffc5b..822f98be35 100644 --- a/src/Lean/Elab/DeclUtil.lean +++ b/src/Lean/Elab/DeclUtil.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Check +public import Lean.Meta.Basic +public import Lean.Meta.Check + +public section namespace Lean.Meta diff --git a/src/Lean/Elab/Declaration.lean b/src/Lean/Elab/Declaration.lean index cb0b2cde0b..c96e15cb56 100644 --- a/src/Lean/Elab/Declaration.lean +++ b/src/Lean/Elab/Declaration.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Util.CollectLevelParams -import Lean.Elab.DeclUtil -import Lean.Elab.DefView -import Lean.Elab.MutualDef -import Lean.Elab.MutualInductive -import Lean.Elab.DeclarationRange +public import Lean.Util.CollectLevelParams +public import Lean.Elab.DeclUtil +public import Lean.Elab.DefView +public import Lean.Elab.MutualDef +public import Lean.Elab.MutualInductive +public import Lean.Elab.DeclarationRange + +public section namespace Lean.Elab.Command open Meta diff --git a/src/Lean/Elab/DeclarationRange.lean b/src/Lean/Elab/DeclarationRange.lean index 722474452c..53cbeb8b60 100644 --- a/src/Lean/Elab/DeclarationRange.lean +++ b/src/Lean/Elab/DeclarationRange.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Log -import Lean.Parser.Command -import Lean.DeclarationRange -import Lean.Data.Lsp.Utf16 +public import Lean.Log +public import Lean.Parser.Command +public import Lean.DeclarationRange +public import Lean.Data.Lsp.Utf16 + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/DefView.lean b/src/Lean/Elab/DefView.lean index 553100a97b..f08a581ea2 100644 --- a/src/Lean/Elab/DefView.lean +++ b/src/Lean/Elab/DefView.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Command -import Lean.Elab.DeclNameGen -import Lean.Elab.DeclUtil +public import Lean.Elab.Command +public import Lean.Elab.DeclNameGen +public import Lean.Elab.DeclUtil + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/Deriving.lean b/src/Lean/Elab/Deriving.lean index c119ae6273..66bcfe45da 100644 --- a/src/Lean/Elab/Deriving.lean +++ b/src/Lean/Elab/Deriving.lean @@ -3,17 +3,21 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util -import Lean.Elab.Deriving.Inhabited -import Lean.Elab.Deriving.Nonempty -import Lean.Elab.Deriving.TypeName -import Lean.Elab.Deriving.BEq -import Lean.Elab.Deriving.DecEq -import Lean.Elab.Deriving.Repr -import Lean.Elab.Deriving.FromToJson -import Lean.Elab.Deriving.SizeOf -import Lean.Elab.Deriving.Hashable -import Lean.Elab.Deriving.Ord -import Lean.Elab.Deriving.ToExpr +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util +public import Lean.Elab.Deriving.Inhabited +public import Lean.Elab.Deriving.Nonempty +public import Lean.Elab.Deriving.TypeName +public import Lean.Elab.Deriving.BEq +public import Lean.Elab.Deriving.DecEq +public import Lean.Elab.Deriving.Repr +public import Lean.Elab.Deriving.FromToJson +public import Lean.Elab.Deriving.SizeOf +public import Lean.Elab.Deriving.Hashable +public import Lean.Elab.Deriving.Ord +public import Lean.Elab.Deriving.ToExpr + +public section diff --git a/src/Lean/Elab/Deriving/BEq.lean b/src/Lean/Elab/Deriving/BEq.lean index 6e01a1c1c8..14dca9b4d6 100644 --- a/src/Lean/Elab/Deriving/BEq.lean +++ b/src/Lean/Elab/Deriving/BEq.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util +public import Lean.Meta.Transform +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util + +public section namespace Lean.Elab.Deriving.BEq open Lean.Parser.Term diff --git a/src/Lean/Elab/Deriving/Basic.lean b/src/Lean/Elab/Deriving/Basic.lean index ce2da3ce87..4d3854216a 100644 --- a/src/Lean/Elab/Deriving/Basic.lean +++ b/src/Lean/Elab/Deriving/Basic.lean @@ -3,9 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Wojciech Nawrocki -/ +module + prelude -import Lean.Elab.Command -import Lean.Elab.DeclarationRange +public import Lean.Elab.Command +public import Lean.Elab.DeclarationRange +public meta import Lean.Parser.Command + +public section namespace Lean.Elab open Command @@ -63,7 +68,7 @@ def processDefDeriving (className : Name) (declName : Name) : TermElabM Bool := end Term -def DerivingHandler := (typeNames : Array Name) → CommandElabM Bool +@[expose] def DerivingHandler := (typeNames : Array Name) → CommandElabM Bool builtin_initialize derivingHandlersRef : IO.Ref (NameMap (List DerivingHandler)) ← IO.mkRef {} diff --git a/src/Lean/Elab/Deriving/DecEq.lean b/src/Lean/Elab/Deriving/DecEq.lean index bb5c95d50f..fd772b1ad6 100644 --- a/src/Lean/Elab/Deriving/DecEq.lean +++ b/src/Lean/Elab/Deriving/DecEq.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Inductive -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util +public import Lean.Meta.Transform +public import Lean.Meta.Inductive +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util + +public section namespace Lean.Elab.Deriving.DecEq open Lean.Parser.Term diff --git a/src/Lean/Elab/Deriving/FromToJson.lean b/src/Lean/Elab/Deriving/FromToJson.lean index 26f0ef5770..0c8e51e71e 100644 --- a/src/Lean/Elab/Deriving/FromToJson.lean +++ b/src/Lean/Elab/Deriving/FromToJson.lean @@ -3,11 +3,16 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Dany Fabian -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util -import Lean.Data.Json.FromToJson.Basic +public import Lean.Meta.Transform +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util +public import Lean.Data.Json.FromToJson.Basic +meta import Lean.Parser.Do + +public section namespace Lean.Elab.Deriving.FromToJson open Lean.Elab.Command diff --git a/src/Lean/Elab/Deriving/Hashable.lean b/src/Lean/Elab/Deriving/Hashable.lean index 0fe992a5e7..e573739a28 100644 --- a/src/Lean/Elab/Deriving/Hashable.lean +++ b/src/Lean/Elab/Deriving/Hashable.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Lean.Meta.Inductive -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util +public import Lean.Meta.Inductive +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util + +public section namespace Lean.Elab.Deriving.Hashable open Command diff --git a/src/Lean/Elab/Deriving/Inhabited.lean b/src/Lean/Elab/Deriving/Inhabited.lean index 58a66a24f0..5f228be028 100644 --- a/src/Lean/Elab/Deriving/Inhabited.lean +++ b/src/Lean/Elab/Deriving/Inhabited.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ForEachExprWhere -import Lean.Elab.Deriving.Basic +public import Lean.Util.ForEachExprWhere +public import Lean.Elab.Deriving.Basic + +public section namespace Lean.Elab open Command Meta Parser Term diff --git a/src/Lean/Elab/Deriving/Nonempty.lean b/src/Lean/Elab/Deriving/Nonempty.lean index 8d7bc9fe4f..7259ab6081 100644 --- a/src/Lean/Elab/Deriving/Nonempty.lean +++ b/src/Lean/Elab/Deriving/Nonempty.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner -/ +module + prelude -import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Basic + +public section namespace Lean.Elab open Command Meta Parser Term diff --git a/src/Lean/Elab/Deriving/Ord.lean b/src/Lean/Elab/Deriving/Ord.lean index 34575c4202..e684c61048 100644 --- a/src/Lean/Elab/Deriving/Ord.lean +++ b/src/Lean/Elab/Deriving/Ord.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util +public import Lean.Meta.Transform +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util + +public section namespace Lean.Elab.Deriving.Ord open Lean.Parser.Term diff --git a/src/Lean/Elab/Deriving/Repr.lean b/src/Lean/Elab/Deriving/Repr.lean index 5f3e5c0ffe..26ae933e36 100644 --- a/src/Lean/Elab/Deriving/Repr.lean +++ b/src/Lean/Elab/Deriving/Repr.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Inductive -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util +public import Lean.Meta.Transform +public import Lean.Meta.Inductive +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util + +public section namespace Lean.Elab.Deriving.Repr open Lean.Parser.Term diff --git a/src/Lean/Elab/Deriving/SizeOf.lean b/src/Lean/Elab/Deriving/SizeOf.lean index 8c5057ed40..fdb38ed5ab 100644 --- a/src/Lean/Elab/Deriving/SizeOf.lean +++ b/src/Lean/Elab/Deriving/SizeOf.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.SizeOf -import Lean.Elab.Deriving.Basic +public import Lean.Meta.SizeOf +public import Lean.Elab.Deriving.Basic + +public section /-! Remark: `SizeOf` instances are automatically generated. We add support for `deriving instance` for `SizeOf` diff --git a/src/Lean/Elab/Deriving/ToExpr.lean b/src/Lean/Elab/Deriving/ToExpr.lean index bca54e85f1..c9e9e9a173 100644 --- a/src/Lean/Elab/Deriving/ToExpr.lean +++ b/src/Lean/Elab/Deriving/ToExpr.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.Deriving.Basic -import Lean.Elab.Deriving.Util -import Lean.ToLevel -import Lean.ToExpr +public import Lean.Meta.Transform +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Util +public import Lean.ToLevel +public import Lean.ToExpr + +public section /-! # `ToExpr` deriving handler diff --git a/src/Lean/Elab/Deriving/TypeName.lean b/src/Lean/Elab/Deriving/TypeName.lean index 09ec048de5..07c30e6448 100644 --- a/src/Lean/Elab/Deriving/TypeName.lean +++ b/src/Lean/Elab/Deriving/TypeName.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner -/ +module + prelude -import Lean.Elab.Deriving.Basic +public import Lean.Elab.Deriving.Basic + +public section namespace Lean.Elab open Command Std Parser Term diff --git a/src/Lean/Elab/Deriving/Util.lean b/src/Lean/Elab/Deriving/Util.lean index 5ce59897ec..7f757228c9 100644 --- a/src/Lean/Elab/Deriving/Util.lean +++ b/src/Lean/Elab/Deriving/Util.lean @@ -3,16 +3,20 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Term -import Lean.Elab.Term +public import Lean.Elab.Term +meta import Lean.Parser.Command + +public section namespace Lean.Elab.Deriving open Meta -def implicitBinderF := Parser.Term.implicitBinder -def instBinderF := Parser.Term.instBinder -def explicitBinderF := Parser.Term.explicitBinder +meta def implicitBinderF := Parser.Term.implicitBinder +meta def instBinderF := Parser.Term.instBinder +meta def explicitBinderF := Parser.Term.explicitBinder /-- Make fresh, hygienic names for every parameter and index of an inductive declaration. diff --git a/src/Lean/Elab/Do.lean b/src/Lean/Elab/Do.lean index 73f3fd3ef4..b785d99b89 100644 --- a/src/Lean/Elab/Do.lean +++ b/src/Lean/Elab/Do.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Term -import Lean.Elab.BindersUtil -import Lean.Elab.PatternVar -import Lean.Elab.Quotation.Util -import Lean.Parser.Do +public import Lean.Elab.Term +public import Lean.Elab.BindersUtil +public import Lean.Elab.PatternVar +public import Lean.Elab.Quotation.Util +meta import Lean.Parser.Do + +public section -- HACK: avoid code explosion until heuristics are improved set_option compiler.reuse false diff --git a/src/Lean/Elab/ElabRules.lean b/src/Lean/Elab/ElabRules.lean index d10066ce02..e6b54c0827 100644 --- a/src/Lean/Elab/ElabRules.lean +++ b/src/Lean/Elab/ElabRules.lean @@ -3,9 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.MacroArgUtil -import Lean.Elab.AuxDef +public import Lean.Elab.MacroArgUtil +public import Lean.Elab.AuxDef +meta import Lean.Parser.Syntax + +public section namespace Lean.Elab.Command open Lean.Syntax diff --git a/src/Lean/Elab/ErrorExplanation.lean b/src/Lean/Elab/ErrorExplanation.lean index d8400e765b..3b18b9a4b2 100644 --- a/src/Lean/Elab/ErrorExplanation.lean +++ b/src/Lean/Elab/ErrorExplanation.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation -import Lean.Meta.Eval -import Lean.Elab.Term -import Lean.Elab.Command -import Lean.Widget.UserWidget +public import Lean.ErrorExplanation +public import Lean.Meta.Eval +public import Lean.Elab.Term +public import Lean.Elab.Command +public import Lean.Widget.UserWidget + +public section namespace Lean.Elab.ErrorExplanation diff --git a/src/Lean/Elab/Eval.lean b/src/Lean/Elab/Eval.lean index 747acfe519..119d77e82b 100644 --- a/src/Lean/Elab/Eval.lean +++ b/src/Lean/Elab/Eval.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Eval -import Lean.Elab.SyntheticMVars +public import Lean.Meta.Eval +public import Lean.Elab.SyntheticMVars + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/Exception.lean b/src/Lean/Elab/Exception.lean index 0a27f965e2..7cf7fe6ef1 100644 --- a/src/Lean/Elab/Exception.lean +++ b/src/Lean/Elab/Exception.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.InternalExceptionId -import Lean.Exception +public import Lean.InternalExceptionId +public import Lean.Exception + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/Extra.lean b/src/Lean/Elab/Extra.lean index e2b529a65d..ca9724d719 100644 --- a/src/Lean/Elab/Extra.lean +++ b/src/Lean/Elab/Extra.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller, Sebastian Ullrich -/ +module + prelude -import Lean.Elab.App -import Lean.Elab.BuiltinNotation +public import Lean.Elab.App +public import Lean.Elab.BuiltinNotation + +public section /-! # Auxiliary elaboration functions: AKA custom elaborators -/ diff --git a/src/Lean/Elab/Frontend.lean b/src/Lean/Elab/Frontend.lean index f7a54c767c..1b52205228 100644 --- a/src/Lean/Elab/Frontend.lean +++ b/src/Lean/Elab/Frontend.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Language.Lean -import Lean.Util.Profile -import Lean.Server.References -import Lean.Util.Profiler +public import Lean.Language.Lean +public import Lean.Util.Profile +public import Lean.Server.References +public import Lean.Util.Profiler + +public section namespace Lean.Elab.Frontend diff --git a/src/Lean/Elab/GenInjective.lean b/src/Lean/Elab/GenInjective.lean index 1cd98882f9..4a503c3579 100644 --- a/src/Lean/Elab/GenInjective.lean +++ b/src/Lean/Elab/GenInjective.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Command -import Lean.Meta.Injective +public import Lean.Elab.Command +public import Lean.Meta.Injective + +public section namespace Lean.Elab.Command diff --git a/src/Lean/Elab/GuardMsgs.lean b/src/Lean/Elab/GuardMsgs.lean index 4961688449..2bf93881a0 100644 --- a/src/Lean/Elab/GuardMsgs.lean +++ b/src/Lean/Elab/GuardMsgs.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Kyle Miller. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Elab.Notation -import Lean.Util.Diff -import Lean.Server.CodeActions.Attr +public import Lean.Elab.Notation +public import Lean.Util.Diff +public import Lean.Server.CodeActions.Attr + +public section /-! `#guard_msgs` command for testing commands diff --git a/src/Lean/Elab/Import.lean b/src/Lean/Elab/Import.lean index 76c0769f42..06a2f65cc6 100644 --- a/src/Lean/Elab/Import.lean +++ b/src/Lean/Elab/Import.lean @@ -3,9 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Module -import Lean.CoreM +public import Lean.Parser.Module +public import Lean.CoreM +meta import Lean.Parser.Module + +public section + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/Inductive.lean b/src/Lean/Elab/Inductive.lean index 8f5cfffbd4..5493a968e9 100644 --- a/src/Lean/Elab/Inductive.lean +++ b/src/Lean/Elab/Inductive.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller -/ +module + prelude -import Lean.Elab.MutualInductive +public import Lean.Elab.MutualInductive + +public section namespace Lean.Elab.Command open Meta diff --git a/src/Lean/Elab/InfoTree.lean b/src/Lean/Elab/InfoTree.lean index a639d37d27..4f501419f5 100644 --- a/src/Lean/Elab/InfoTree.lean +++ b/src/Lean/Elab/InfoTree.lean @@ -4,6 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Elab.InfoTree.Types -import Lean.Elab.InfoTree.Main +public import Lean.Elab.InfoTree.Types +public import Lean.Elab.InfoTree.Main + +public section diff --git a/src/Lean/Elab/InfoTree/InlayHints.lean b/src/Lean/Elab/InfoTree/InlayHints.lean index 6a4a2adc90..0c00d2dfa1 100644 --- a/src/Lean/Elab/InfoTree/InlayHints.lean +++ b/src/Lean/Elab/InfoTree/InlayHints.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/InfoTree/Main.lean b/src/Lean/Elab/InfoTree/Main.lean index 6b875c2283..b9f331472b 100644 --- a/src/Lean/Elab/InfoTree/Main.lean +++ b/src/Lean/Elab/InfoTree/Main.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Init.Task -import Lean.Meta.PPGoal -import Lean.ReservedNameAction +public import Init.Task +public import Lean.Meta.PPGoal +public import Lean.ReservedNameAction + +public section namespace Lean.Elab.CommandContextInfo diff --git a/src/Lean/Elab/InfoTree/Types.lean b/src/Lean/Elab/InfoTree/Types.lean index 39d16ca050..da7e1d0235 100644 --- a/src/Lean/Elab/InfoTree/Types.lean +++ b/src/Lean/Elab/InfoTree/Types.lean @@ -4,14 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Data.DeclarationRange -import Lean.Data.OpenDecl -import Lean.MetavarContext -import Lean.Environment -import Lean.Data.Json.Basic -import Lean.Server.Rpc.Basic -import Lean.Widget.Types +public import Lean.Data.DeclarationRange +public import Lean.Data.OpenDecl +public import Lean.MetavarContext +public import Lean.Environment +public import Lean.Data.Json.Basic +public import Lean.Server.Rpc.Basic +public import Lean.Widget.Types + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/InfoTrees.lean b/src/Lean/Elab/InfoTrees.lean index dfcfeaed9a..3f2760b457 100644 --- a/src/Lean/Elab/InfoTrees.lean +++ b/src/Lean/Elab/InfoTrees.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Command +public import Lean.Elab.Command + +public section open Lean Elab Command diff --git a/src/Lean/Elab/InheritDoc.lean b/src/Lean/Elab/InheritDoc.lean index d313943817..49de426210 100644 --- a/src/Lean/Elab/InheritDoc.lean +++ b/src/Lean/Elab/InheritDoc.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Elab.InfoTree.Main -import Lean.DocString.Extension +public import Lean.Elab.InfoTree.Main +public import Lean.DocString.Extension + +public section namespace Lean diff --git a/src/Lean/Elab/LetRec.lean b/src/Lean/Elab/LetRec.lean index 16328235c4..fe70a98353 100644 --- a/src/Lean/Elab/LetRec.lean +++ b/src/Lean/Elab/LetRec.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Attributes -import Lean.Elab.Binders -import Lean.Elab.DeclModifiers -import Lean.Elab.SyntheticMVars -import Lean.Elab.DeclarationRange -import Lean.Elab.MutualDef +public import Lean.Elab.Attributes +public import Lean.Elab.Binders +public import Lean.Elab.DeclModifiers +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.DeclarationRange +public import Lean.Elab.MutualDef + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/Level.lean b/src/Lean/Elab/Level.lean index 2868a9cca8..5acc198755 100644 --- a/src/Lean/Elab/Level.lean +++ b/src/Lean/Elab/Level.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Log -import Lean.Parser.Level -import Lean.Elab.Exception -import Lean.Elab.AutoBound +public import Lean.Log +public import Lean.Parser.Level +public import Lean.Elab.Exception +public import Lean.Elab.AutoBound + +public section namespace Lean.Elab.Level diff --git a/src/Lean/Elab/Macro.lean b/src/Lean/Elab/Macro.lean index a814ce01c1..94004b726f 100644 --- a/src/Lean/Elab/Macro.lean +++ b/src/Lean/Elab/Macro.lean @@ -3,8 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.MacroArgUtil +public import Lean.Elab.MacroArgUtil +meta import Lean.Parser.Syntax + +public section namespace Lean.Elab.Command open Lean.Syntax diff --git a/src/Lean/Elab/MacroArgUtil.lean b/src/Lean/Elab/MacroArgUtil.lean index af29baca9f..0dab7e458b 100644 --- a/src/Lean/Elab/MacroArgUtil.lean +++ b/src/Lean/Elab/MacroArgUtil.lean @@ -3,8 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Syntax +public import Lean.Elab.Syntax +public import Lean.Parser.Syntax + +public section namespace Lean.Elab.Command open Lean.Syntax diff --git a/src/Lean/Elab/MacroRules.lean b/src/Lean/Elab/MacroRules.lean index 01a1aaba3b..64da1c98f4 100644 --- a/src/Lean/Elab/MacroRules.lean +++ b/src/Lean/Elab/MacroRules.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Syntax -import Lean.Elab.AuxDef +public import Lean.Elab.Syntax +public import Lean.Elab.AuxDef + +public section namespace Lean.Elab.Command open Lean.Syntax diff --git a/src/Lean/Elab/Match.lean b/src/Lean/Elab/Match.lean index 8e807511ce..39758db861 100644 --- a/src/Lean/Elab/Match.lean +++ b/src/Lean/Elab/Match.lean @@ -3,16 +3,20 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Mario Carneiro -/ +module + prelude -import Lean.Util.ForEachExprWhere -import Lean.Meta.CtorRecognizer -import Lean.Meta.Match.Match -import Lean.Meta.GeneralizeVars -import Lean.Meta.ForEachExpr -import Lean.Elab.BindersUtil -import Lean.Elab.PatternVar -import Lean.Elab.Quotation.Precheck -import Lean.Elab.SyntheticMVars +public import Lean.Util.ForEachExprWhere +public import Lean.Meta.CtorRecognizer +public import Lean.Meta.Match.Match +public import Lean.Meta.GeneralizeVars +public import Lean.Meta.ForEachExpr +public import Lean.Elab.BindersUtil +public import Lean.Elab.PatternVar +public import Lean.Elab.Quotation.Precheck +public import Lean.Elab.SyntheticMVars + +public section namespace Lean.Elab.Term open Meta diff --git a/src/Lean/Elab/MatchAltView.lean b/src/Lean/Elab/MatchAltView.lean index 273a9b8925..5002165ecf 100644 --- a/src/Lean/Elab/MatchAltView.lean +++ b/src/Lean/Elab/MatchAltView.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Term +public import Lean.Elab.Term + +public section namespace Lean.Elab.Term diff --git a/src/Lean/Elab/MatchExpr.lean b/src/Lean/Elab/MatchExpr.lean index 9886dcd358..87c1b04e93 100644 --- a/src/Lean/Elab/MatchExpr.lean +++ b/src/Lean/Elab/MatchExpr.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Term +public import Lean.Elab.Term + +public section namespace Lean.Elab.Term namespace MatchExpr diff --git a/src/Lean/Elab/Mixfix.lean b/src/Lean/Elab/Mixfix.lean index 4f64dafc25..5ba1f5398e 100644 --- a/src/Lean/Elab/Mixfix.lean +++ b/src/Lean/Elab/Mixfix.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Attributes +public import Lean.Elab.Attributes + +public section namespace Lean.Elab.Command diff --git a/src/Lean/Elab/MutualDef.lean b/src/Lean/Elab/MutualDef.lean index 4206e04456..0123def22e 100644 --- a/src/Lean/Elab/MutualDef.lean +++ b/src/Lean/Elab/MutualDef.lean @@ -3,20 +3,24 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Term -import Lean.Meta.Closure -import Lean.Meta.Check -import Lean.Meta.Transform -import Lean.PrettyPrinter.Delaborator.Options -import Lean.Elab.Command -import Lean.Elab.Match -import Lean.Elab.DefView -import Lean.Elab.Deriving.Basic -import Lean.Elab.PreDefinition.Main -import Lean.Elab.PreDefinition.TerminationHint -import Lean.Elab.DeclarationRange -import Lean.Elab.WhereFinally +public import Lean.Parser.Term +public import Lean.Meta.Closure +public import Lean.Meta.Check +public import Lean.Meta.Transform +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.Elab.Command +public import Lean.Elab.Match +public import Lean.Elab.DefView +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.PreDefinition.Main +public import Lean.Elab.PreDefinition.TerminationHint +public import Lean.Elab.DeclarationRange +public import Lean.Elab.WhereFinally + +public section namespace Lean.Elab open Lean.Parser.Term diff --git a/src/Lean/Elab/MutualInductive.lean b/src/Lean/Elab/MutualInductive.lean index 0e0bbf5607..45f80258a6 100644 --- a/src/Lean/Elab/MutualInductive.lean +++ b/src/Lean/Elab/MutualInductive.lean @@ -3,22 +3,26 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller -/ +module + prelude -import Lean.Util.ForEachExprWhere -import Lean.Util.ReplaceLevel -import Lean.Util.ReplaceExpr -import Lean.Util.CollectLevelParams -import Lean.Meta.Constructions -import Lean.Meta.CollectFVars -import Lean.Meta.SizeOf -import Lean.Meta.Injective -import Lean.Meta.IndPredBelow -import Lean.Elab.Command -import Lean.Elab.ComputedFields -import Lean.Elab.DefView -import Lean.Elab.DeclUtil -import Lean.Elab.Deriving.Basic -import Lean.Elab.DeclarationRange +public import Lean.Util.ForEachExprWhere +public import Lean.Util.ReplaceLevel +public import Lean.Util.ReplaceExpr +public import Lean.Util.CollectLevelParams +public import Lean.Meta.Constructions +public import Lean.Meta.CollectFVars +public import Lean.Meta.SizeOf +public import Lean.Meta.Injective +public import Lean.Meta.IndPredBelow +public import Lean.Elab.Command +public import Lean.Elab.ComputedFields +public import Lean.Elab.DefView +public import Lean.Elab.DeclUtil +public import Lean.Elab.Deriving.Basic +public import Lean.Elab.DeclarationRange + +public section /-! # Elaborator framework for (mutual) inductives diff --git a/src/Lean/Elab/Notation.lean b/src/Lean/Elab/Notation.lean index bb06eb252b..e3e9d596b3 100644 --- a/src/Lean/Elab/Notation.lean +++ b/src/Lean/Elab/Notation.lean @@ -3,10 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Syntax -import Lean.Elab.AuxDef -import Lean.Elab.BuiltinNotation +public import Lean.Elab.Syntax +public import Lean.Elab.AuxDef +public import Lean.Elab.BuiltinNotation +public import Lean.Parser.Syntax + +public section namespace Lean.Elab.Command open Lean.Syntax diff --git a/src/Lean/Elab/Open.lean b/src/Lean/Elab/Open.lean index e0279afe8b..372eaf1185 100644 --- a/src/Lean/Elab/Open.lean +++ b/src/Lean/Elab/Open.lean @@ -3,9 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Log -import Lean.Elab.Util +public import Lean.Log +public import Lean.Elab.Util +public import Lean.Parser.Command +meta import Lean.Parser.Command + +public section namespace Lean.Elab namespace OpenDecl diff --git a/src/Lean/Elab/ParseImportsFast.lean b/src/Lean/Elab/ParseImportsFast.lean index 9e0437dade..f7df04d0ad 100644 --- a/src/Lean/Elab/ParseImportsFast.lean +++ b/src/Lean/Elab/ParseImportsFast.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Module +public import Lean.Parser.Module + +public section namespace Lean namespace ParseImports @@ -20,7 +24,7 @@ structure State where importAll : Bool := false deriving Inhabited -def Parser := String → State → State +@[expose] def Parser := String → State → State instance : Inhabited Parser where default := fun _ s => s diff --git a/src/Lean/Elab/PatternVar.lean b/src/Lean/Elab/PatternVar.lean index 2777702265..8600009157 100644 --- a/src/Lean/Elab/PatternVar.lean +++ b/src/Lean/Elab/PatternVar.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Match.MatchPatternAttr -import Lean.Meta.Hint -import Lean.Elab.Arg -import Lean.Elab.MatchAltView +public import Lean.Meta.Match.MatchPatternAttr +public import Lean.Meta.Hint +public import Lean.Elab.Arg +public import Lean.Elab.MatchAltView + +public section namespace Lean.Elab.Term diff --git a/src/Lean/Elab/PreDefinition.lean b/src/Lean/Elab/PreDefinition.lean index 55116017a0..b19147401d 100644 --- a/src/Lean/Elab/PreDefinition.lean +++ b/src/Lean/Elab/PreDefinition.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Structural -import Lean.Elab.PreDefinition.Main -import Lean.Elab.PreDefinition.MkInhabitant -import Lean.Elab.PreDefinition.WF -import Lean.Elab.PreDefinition.Eqns -import Lean.Elab.PreDefinition.Nonrec.Eqns -import Lean.Elab.PreDefinition.EqUnfold +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Structural +public import Lean.Elab.PreDefinition.Main +public import Lean.Elab.PreDefinition.MkInhabitant +public import Lean.Elab.PreDefinition.WF +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Elab.PreDefinition.Nonrec.Eqns +public import Lean.Elab.PreDefinition.EqUnfold + +public section diff --git a/src/Lean/Elab/PreDefinition/Basic.lean b/src/Lean/Elab/PreDefinition/Basic.lean index 52b474ea4d..9d2c5d02d6 100644 --- a/src/Lean/Elab/PreDefinition/Basic.lean +++ b/src/Lean/Elab/PreDefinition/Basic.lean @@ -3,20 +3,24 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.ShareCommon -import Lean.Compiler.MetaAttr -import Lean.Compiler.NoncomputableAttr -import Lean.Util.CollectLevelParams -import Lean.Util.NumObjs -import Lean.Util.NumApps -import Lean.Meta.AbstractNestedProofs -import Lean.Meta.ForEachExpr -import Lean.Meta.Eqns -import Lean.Meta.LetToHave -import Lean.Elab.RecAppSyntax -import Lean.Elab.DefView -import Lean.Elab.PreDefinition.TerminationHint +public import Init.ShareCommon +public import Lean.Compiler.MetaAttr +public import Lean.Compiler.NoncomputableAttr +public import Lean.Util.CollectLevelParams +public import Lean.Util.NumObjs +public import Lean.Util.NumApps +public import Lean.Meta.AbstractNestedProofs +public import Lean.Meta.ForEachExpr +public import Lean.Meta.Eqns +public import Lean.Meta.LetToHave +public import Lean.Elab.RecAppSyntax +public import Lean.Elab.DefView +public import Lean.Elab.PreDefinition.TerminationHint + +public section namespace Lean.Elab open Meta diff --git a/src/Lean/Elab/PreDefinition/EqUnfold.lean b/src/Lean/Elab/PreDefinition/EqUnfold.lean index e801a0b350..edff0f3ccb 100644 --- a/src/Lean/Elab/PreDefinition/EqUnfold.lean +++ b/src/Lean/Elab/PreDefinition/EqUnfold.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Eqns -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Rfl -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Apply -import Lean.DefEqAttrib +public import Lean.Meta.Eqns +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Rfl +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Apply +public import Lean.DefEqAttrib + +public section namespace Lean.Meta diff --git a/src/Lean/Elab/PreDefinition/Eqns.lean b/src/Lean/Elab/PreDefinition/Eqns.lean index c979b442a1..1fb1a56f13 100644 --- a/src/Lean/Elab/PreDefinition/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/Eqns.lean @@ -3,16 +3,20 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Eqns -import Lean.Meta.CtorRecognizer -import Lean.Util.CollectFVars -import Lean.Util.ForEachExprWhere -import Lean.Meta.Tactic.Split -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Refl -import Lean.Meta.Match.MatchEqs -import Lean.DefEqAttrib +public import Lean.Meta.Eqns +public import Lean.Meta.CtorRecognizer +public import Lean.Util.CollectFVars +public import Lean.Util.ForEachExprWhere +public import Lean.Meta.Tactic.Split +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Match.MatchEqs +public import Lean.DefEqAttrib + +public section namespace Lean.Elab.Eqns open Meta diff --git a/src/Lean/Elab/PreDefinition/FixedParams.lean b/src/Lean/Elab/PreDefinition/FixedParams.lean index 225aa9de87..514b11e1c7 100644 --- a/src/Lean/Elab/PreDefinition/FixedParams.lean +++ b/src/Lean/Elab/PreDefinition/FixedParams.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Basic + +public section /-! This module contains the logic for figuring out, given mutually recursive predefinitions, diff --git a/src/Lean/Elab/PreDefinition/Main.lean b/src/Lean/Elab/PreDefinition/Main.lean index ad43d80eba..050fedc8b3 100644 --- a/src/Lean/Elab/PreDefinition/Main.lean +++ b/src/Lean/Elab/PreDefinition/Main.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.SCC -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Structural -import Lean.Elab.PreDefinition.WF.Main -import Lean.Elab.PreDefinition.MkInhabitant -import Lean.Elab.PreDefinition.PartialFixpoint +public import Lean.Util.SCC +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Structural +public import Lean.Elab.PreDefinition.WF.Main +public import Lean.Elab.PreDefinition.MkInhabitant +public import Lean.Elab.PreDefinition.PartialFixpoint + +public section namespace Lean.Elab open Meta diff --git a/src/Lean/Elab/PreDefinition/MkInhabitant.lean b/src/Lean/Elab/PreDefinition/MkInhabitant.lean index e0133a307a..4233a84252 100644 --- a/src/Lean/Elab/PreDefinition/MkInhabitant.lean +++ b/src/Lean/Elab/PreDefinition/MkInhabitant.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.PrettyPrinter +public import Lean.Meta.AppBuilder +public import Lean.PrettyPrinter + +public section namespace Lean.Elab open Meta diff --git a/src/Lean/Elab/PreDefinition/Mutual.lean b/src/Lean/Elab/PreDefinition/Mutual.lean index 6b150ff011..dd5afb5f43 100644 --- a/src/Lean/Elab/PreDefinition/Mutual.lean +++ b/src/Lean/Elab/PreDefinition/Mutual.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Basic + +public section /-! This module contains code common to mutual-via-fixedpoint constructions, i.e. diff --git a/src/Lean/Elab/PreDefinition/Nonrec/Eqns.lean b/src/Lean/Elab/PreDefinition/Nonrec/Eqns.lean index a4fcd1bdc4..1f8e350f91 100644 --- a/src/Lean/Elab/PreDefinition/Nonrec/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/Nonrec/Eqns.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Split -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Eqns -import Lean.Meta.ArgsPacker.Basic -import Init.Data.Array.Basic +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Split +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Meta.ArgsPacker.Basic +public import Init.Data.Array.Basic + +public section namespace Lean.Elab.Nonrec open Meta diff --git a/src/Lean/Elab/PreDefinition/PartialFixpoint.lean b/src/Lean/Elab/PreDefinition/PartialFixpoint.lean index 8d8a3e7358..b10e7d0bbe 100644 --- a/src/Lean/Elab/PreDefinition/PartialFixpoint.lean +++ b/src/Lean/Elab/PreDefinition/PartialFixpoint.lean @@ -3,7 +3,11 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.PartialFixpoint.Eqns -import Lean.Elab.PreDefinition.PartialFixpoint.Main -import Lean.Elab.PreDefinition.PartialFixpoint.Induction +public import Lean.Elab.PreDefinition.PartialFixpoint.Eqns +public import Lean.Elab.PreDefinition.PartialFixpoint.Main +public import Lean.Elab.PreDefinition.PartialFixpoint.Induction + +public section diff --git a/src/Lean/Elab/PreDefinition/PartialFixpoint/Eqns.lean b/src/Lean/Elab/PreDefinition/PartialFixpoint/Eqns.lean index dea65694ef..e8e6427e5d 100644 --- a/src/Lean/Elab/PreDefinition/PartialFixpoint/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/PartialFixpoint/Eqns.lean @@ -3,16 +3,20 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Conv -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Split -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Eqns -import Lean.Elab.PreDefinition.FixedParams -import Lean.Meta.ArgsPacker.Basic -import Init.Data.Array.Basic -import Init.Internal.Order.Basic +public import Lean.Elab.Tactic.Conv +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Split +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Meta.ArgsPacker.Basic +public import Init.Data.Array.Basic +public import Init.Internal.Order.Basic + +public section namespace Lean.Elab.PartialFixpoint open Meta diff --git a/src/Lean/Elab/PreDefinition/PartialFixpoint/Induction.lean b/src/Lean/Elab/PreDefinition/PartialFixpoint/Induction.lean index fca7bbc30a..9bc00a06cc 100644 --- a/src/Lean/Elab/PreDefinition/PartialFixpoint/Induction.lean +++ b/src/Lean/Elab/PreDefinition/PartialFixpoint/Induction.lean @@ -4,18 +4,22 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Match.MatcherApp.Transform -import Lean.Meta.Check -import Lean.Meta.Tactic.Subst -import Lean.Meta.Injective -- for elimOptParam -import Lean.Meta.ArgsPacker -import Lean.Meta.PProdN -import Lean.Meta.Tactic.Apply -import Lean.Elab.PreDefinition.PartialFixpoint.Eqns -import Lean.Elab.Command -import Lean.Meta.Tactic.ElimInfo +public import Lean.Meta.Basic +public import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Injective -- for elimOptParam +public import Lean.Meta.ArgsPacker +public import Lean.Meta.PProdN +public import Lean.Meta.Tactic.Apply +public import Lean.Elab.PreDefinition.PartialFixpoint.Eqns +public import Lean.Elab.Command +public import Lean.Meta.Tactic.ElimInfo + +public section namespace Lean.Elab.PartialFixpoint @@ -38,7 +42,7 @@ partial def mkAdmProj (packedInst : Expr) (i : Nat) (e : Expr) : MetaM Expr := d assert! i == 0 return e -def CCPOProdProjs (n : Nat) (inst : Expr) : Array Expr := Id.run do +@[expose] def CCPOProdProjs (n : Nat) (inst : Expr) : Array Expr := Id.run do let mut insts := #[inst] while insts.size < n do let inst := insts.back! diff --git a/src/Lean/Elab/PreDefinition/PartialFixpoint/Main.lean b/src/Lean/Elab/PreDefinition/PartialFixpoint/Main.lean index db8a2ceb43..7225429733 100644 --- a/src/Lean/Elab/PreDefinition/PartialFixpoint/Main.lean +++ b/src/Lean/Elab/PreDefinition/PartialFixpoint/Main.lean @@ -3,14 +3,18 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.MkInhabitant -import Lean.Elab.PreDefinition.Mutual -import Lean.Elab.PreDefinition.PartialFixpoint.Eqns -import Lean.Elab.Tactic.Monotonicity -import Init.Internal.Order.Basic -import Lean.Meta.PProdN -import Lean.Meta.Order +public import Lean.Elab.PreDefinition.MkInhabitant +public import Lean.Elab.PreDefinition.Mutual +public import Lean.Elab.PreDefinition.PartialFixpoint.Eqns +public import Lean.Elab.Tactic.Monotonicity +public import Init.Internal.Order.Basic +public import Lean.Meta.PProdN +public import Lean.Meta.Order + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/PreDefinition/Structural.lean b/src/Lean/Elab/PreDefinition/Structural.lean index a0b63b1cf6..0307c53dc5 100644 --- a/src/Lean/Elab/PreDefinition/Structural.lean +++ b/src/Lean/Elab/PreDefinition/Structural.lean @@ -3,5 +3,9 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.Structural.Main +public import Lean.Elab.PreDefinition.Structural.Main + +public section diff --git a/src/Lean/Elab/PreDefinition/Structural/BRecOn.lean b/src/Lean/Elab/PreDefinition/Structural/BRecOn.lean index 7831031879..493db37b2f 100644 --- a/src/Lean/Elab/PreDefinition/Structural/BRecOn.lean +++ b/src/Lean/Elab/PreDefinition/Structural/BRecOn.lean @@ -3,14 +3,18 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Util.HasConstCache -import Lean.Meta.PProdN -import Lean.Meta.Match.MatcherApp.Transform -import Lean.Elab.RecAppSyntax -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Elab.PreDefinition.Structural.RecArgInfo +public import Lean.Util.HasConstCache +public import Lean.Meta.PProdN +public import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Elab.RecAppSyntax +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Elab.PreDefinition.Structural.RecArgInfo + +public section namespace Lean.Elab.Structural open Meta diff --git a/src/Lean/Elab/PreDefinition/Structural/Basic.lean b/src/Lean/Elab/PreDefinition/Structural/Basic.lean index 904f4e3cc2..35ee3ae596 100644 --- a/src/Lean/Elab/PreDefinition/Structural/Basic.lean +++ b/src/Lean/Elab/PreDefinition/Structural/Basic.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.ForEachExpr +public import Lean.Meta.Basic +public import Lean.Meta.ForEachExpr + +public section namespace Lean.Elab.Structural diff --git a/src/Lean/Elab/PreDefinition/Structural/Eqns.lean b/src/Lean/Elab/PreDefinition/Structural/Eqns.lean index cc421866ff..339679d79d 100644 --- a/src/Lean/Elab/PreDefinition/Structural/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/Structural/Eqns.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Eqns -import Lean.Meta.Tactic.Split -import Lean.Meta.Tactic.Simp.Main -import Lean.Meta.Tactic.Apply -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Eqns -import Lean.Elab.PreDefinition.FixedParams -import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Meta.Eqns +public import Lean.Meta.Tactic.Split +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Apply +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Elab.PreDefinition.Structural.Basic + +public section namespace Lean.Elab open Meta diff --git a/src/Lean/Elab/PreDefinition/Structural/FindRecArg.lean b/src/Lean/Elab/PreDefinition/Structural/FindRecArg.lean index a87a830075..cd5234cbba 100644 --- a/src/Lean/Elab/PreDefinition/Structural/FindRecArg.lean +++ b/src/Lean/Elab/PreDefinition/Structural/FindRecArg.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.TerminationMeasure -import Lean.Elab.PreDefinition.FixedParams -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Elab.PreDefinition.Structural.RecArgInfo +public import Lean.Elab.PreDefinition.TerminationMeasure +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Elab.PreDefinition.Structural.RecArgInfo + +public section namespace Lean.Elab.Structural open Meta diff --git a/src/Lean/Elab/PreDefinition/Structural/IndGroupInfo.lean b/src/Lean/Elab/PreDefinition/Structural/IndGroupInfo.lean index 620dd17edf..dbbdaf85ec 100644 --- a/src/Lean/Elab/PreDefinition/Structural/IndGroupInfo.lean +++ b/src/Lean/Elab/PreDefinition/Structural/IndGroupInfo.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.InferType +public import Lean.Meta.InferType + +public section /-! This module contains the types diff --git a/src/Lean/Elab/PreDefinition/Structural/IndPred.lean b/src/Lean/Elab/PreDefinition/Structural/IndPred.lean index 13a22a270e..4a4851cf2a 100644 --- a/src/Lean/Elab/PreDefinition/Structural/IndPred.lean +++ b/src/Lean/Elab/PreDefinition/Structural/IndPred.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Lean.Meta.IndPredBelow -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Elab.PreDefinition.Structural.RecArgInfo +public import Lean.Meta.IndPredBelow +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Elab.PreDefinition.Structural.RecArgInfo + +public section namespace Lean.Elab.Structural open Meta diff --git a/src/Lean/Elab/PreDefinition/Structural/Main.lean b/src/Lean/Elab/PreDefinition/Structural/Main.lean index f1d7c774f8..f0246bd3e5 100644 --- a/src/Lean/Elab/PreDefinition/Structural/Main.lean +++ b/src/Lean/Elab/PreDefinition/Structural/Main.lean @@ -3,17 +3,21 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Elab.PreDefinition.TerminationMeasure -import Lean.Elab.PreDefinition.Mutual -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Elab.PreDefinition.Structural.FindRecArg -import Lean.Elab.PreDefinition.Structural.Preprocess -import Lean.Elab.PreDefinition.Structural.BRecOn -import Lean.Elab.PreDefinition.Structural.IndPred -import Lean.Elab.PreDefinition.Structural.Eqns -import Lean.Elab.PreDefinition.Structural.SmartUnfolding -import Lean.Meta.Tactic.TryThis +public import Lean.Elab.PreDefinition.TerminationMeasure +public import Lean.Elab.PreDefinition.Mutual +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Elab.PreDefinition.Structural.FindRecArg +public import Lean.Elab.PreDefinition.Structural.Preprocess +public import Lean.Elab.PreDefinition.Structural.BRecOn +public import Lean.Elab.PreDefinition.Structural.IndPred +public import Lean.Elab.PreDefinition.Structural.Eqns +public import Lean.Elab.PreDefinition.Structural.SmartUnfolding +public import Lean.Meta.Tactic.TryThis + +public section namespace Lean.Elab namespace Structural diff --git a/src/Lean/Elab/PreDefinition/Structural/Preprocess.lean b/src/Lean/Elab/PreDefinition/Structural/Preprocess.lean index 6ed5a9666e..6ee9f964a7 100644 --- a/src/Lean/Elab/PreDefinition/Structural/Preprocess.lean +++ b/src/Lean/Elab/PreDefinition/Structural/Preprocess.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.RecAppSyntax -import Lean.Meta.WHNF +public import Lean.Meta.Transform +public import Lean.Elab.RecAppSyntax +public import Lean.Meta.WHNF + +public section namespace Lean.Elab.Structural open Meta diff --git a/src/Lean/Elab/PreDefinition/Structural/RecArgInfo.lean b/src/Lean/Elab/PreDefinition/Structural/RecArgInfo.lean index 10225d0b78..9e7160de70 100644 --- a/src/Lean/Elab/PreDefinition/Structural/RecArgInfo.lean +++ b/src/Lean/Elab/PreDefinition/Structural/RecArgInfo.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.ForEachExpr -import Lean.Elab.PreDefinition.FixedParams -import Lean.Elab.PreDefinition.Structural.IndGroupInfo +public import Lean.Meta.Basic +public import Lean.Meta.ForEachExpr +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Elab.PreDefinition.Structural.IndGroupInfo + +public section namespace Lean.Elab.Structural diff --git a/src/Lean/Elab/PreDefinition/Structural/SmartUnfolding.lean b/src/Lean/Elab/PreDefinition/Structural/SmartUnfolding.lean index 62a5f277ad..cd524175c9 100644 --- a/src/Lean/Elab/PreDefinition/Structural/SmartUnfolding.lean +++ b/src/Lean/Elab/PreDefinition/Structural/SmartUnfolding.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Meta.Match.MatcherApp.Basic +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Meta.Match.MatcherApp.Basic + +public section namespace Lean.Elab.Structural open Meta diff --git a/src/Lean/Elab/PreDefinition/TerminationHint.lean b/src/Lean/Elab/PreDefinition/TerminationHint.lean index f756ead5b2..509731b1c0 100644 --- a/src/Lean/Elab/PreDefinition/TerminationHint.lean +++ b/src/Lean/Elab/PreDefinition/TerminationHint.lean @@ -3,8 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Parser.Term +public import Lean.Parser.Term +meta import Lean.Parser.Term + +public section set_option autoImplicit false diff --git a/src/Lean/Elab/PreDefinition/TerminationMeasure.lean b/src/Lean/Elab/PreDefinition/TerminationMeasure.lean index 5ea783ca6d..67ba038eb7 100644 --- a/src/Lean/Elab/PreDefinition/TerminationMeasure.lean +++ b/src/Lean/Elab/PreDefinition/TerminationMeasure.lean @@ -3,14 +3,18 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Parser.Term -import Lean.Elab.Term -import Lean.Elab.Binders -import Lean.Elab.SyntheticMVars -import Lean.Elab.PreDefinition.TerminationHint -import Lean.PrettyPrinter.Delaborator.Basic +public import Lean.Parser.Term +public import Lean.Elab.Term +public import Lean.Elab.Binders +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.PreDefinition.TerminationHint +public import Lean.PrettyPrinter.Delaborator.Basic + +public section /-! This module contains diff --git a/src/Lean/Elab/PreDefinition/WF.lean b/src/Lean/Elab/PreDefinition/WF.lean index 35803852fc..14bed9e3cc 100644 --- a/src/Lean/Elab/PreDefinition/WF.lean +++ b/src/Lean/Elab/PreDefinition/WF.lean @@ -3,6 +3,10 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.WF.Main -import Lean.Elab.PreDefinition.WF.Eqns +public import Lean.Elab.PreDefinition.WF.Main +public import Lean.Elab.PreDefinition.WF.Eqns + +public section diff --git a/src/Lean/Elab/PreDefinition/WF/Basic.lean b/src/Lean/Elab/PreDefinition/WF/Basic.lean index 78159bf024..235884c4c5 100644 --- a/src/Lean/Elab/PreDefinition/WF/Basic.lean +++ b/src/Lean/Elab/PreDefinition/WF/Basic.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab.WF diff --git a/src/Lean/Elab/PreDefinition/WF/Eqns.lean b/src/Lean/Elab/PreDefinition/WF/Eqns.lean index 35c56b7600..3fedf735cb 100644 --- a/src/Lean/Elab/PreDefinition/WF/Eqns.lean +++ b/src/Lean/Elab/PreDefinition/WF/Eqns.lean @@ -3,15 +3,19 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Split -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Eqns -import Lean.Meta.ArgsPacker.Basic -import Lean.Elab.PreDefinition.WF.Unfold -import Lean.Elab.PreDefinition.FixedParams -import Init.Data.Array.Basic +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Split +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Meta.ArgsPacker.Basic +public import Lean.Elab.PreDefinition.WF.Unfold +public import Lean.Elab.PreDefinition.FixedParams +public import Init.Data.Array.Basic + +public section namespace Lean.Elab.WF open Meta diff --git a/src/Lean/Elab/PreDefinition/WF/Fix.lean b/src/Lean/Elab/PreDefinition/WF/Fix.lean index d7ad8d3a21..ec7c8ca6f6 100644 --- a/src/Lean/Elab/PreDefinition/WF/Fix.lean +++ b/src/Lean/Elab/PreDefinition/WF/Fix.lean @@ -3,16 +3,20 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Array -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.WF.Basic -import Lean.Elab.Tactic.Basic -import Lean.Meta.ArgsPacker -import Lean.Meta.ForEachExpr -import Lean.Meta.Match.MatcherApp.Transform -import Lean.Meta.Tactic.Cleanup -import Lean.Util.HasConstCache +public import Lean.Data.Array +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.WF.Basic +public import Lean.Elab.Tactic.Basic +public import Lean.Meta.ArgsPacker +public import Lean.Meta.ForEachExpr +public import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Meta.Tactic.Cleanup +public import Lean.Util.HasConstCache + +public section namespace Lean.Elab.WF open Meta diff --git a/src/Lean/Elab/PreDefinition/WF/FloatRecApp.lean b/src/Lean/Elab/PreDefinition/WF/FloatRecApp.lean index afa9919bf8..22b4b8b62b 100644 --- a/src/Lean/Elab/PreDefinition/WF/FloatRecApp.lean +++ b/src/Lean/Elab/PreDefinition/WF/FloatRecApp.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Elab.RecAppSyntax +public import Lean.Meta.Transform +public import Lean.Elab.RecAppSyntax + +public section namespace Lean.Elab.WF open Meta diff --git a/src/Lean/Elab/PreDefinition/WF/GuessLex.lean b/src/Lean/Elab/PreDefinition/WF/GuessLex.lean index 82c4a13b63..0e61f820a5 100644 --- a/src/Lean/Elab/PreDefinition/WF/GuessLex.lean +++ b/src/Lean/Elab/PreDefinition/WF/GuessLex.lean @@ -3,22 +3,26 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Util.HasConstCache -import Lean.Meta.Match.MatcherApp.Transform -import Lean.Meta.Tactic.Cleanup -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.TryThis -import Lean.Meta.ArgsPacker -import Lean.Elab.Quotation -import Lean.Elab.RecAppSyntax -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Mutual -import Lean.Elab.PreDefinition.Structural.Basic -import Lean.Elab.PreDefinition.TerminationMeasure -import Lean.Elab.PreDefinition.FixedParams -import Lean.Elab.PreDefinition.WF.Basic -import Lean.Data.Array +public import Lean.Util.HasConstCache +public import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Meta.Tactic.Cleanup +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.TryThis +public import Lean.Meta.ArgsPacker +public import Lean.Elab.Quotation +public import Lean.Elab.RecAppSyntax +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Mutual +public import Lean.Elab.PreDefinition.Structural.Basic +public import Lean.Elab.PreDefinition.TerminationMeasure +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Elab.PreDefinition.WF.Basic +public import Lean.Data.Array + +public section /-! diff --git a/src/Lean/Elab/PreDefinition/WF/Main.lean b/src/Lean/Elab/PreDefinition/WF/Main.lean index b86405ea24..9d32804372 100644 --- a/src/Lean/Elab/PreDefinition/WF/Main.lean +++ b/src/Lean/Elab/PreDefinition/WF/Main.lean @@ -3,17 +3,21 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.TerminationMeasure -import Lean.Elab.PreDefinition.Mutual -import Lean.Elab.PreDefinition.WF.PackMutual -import Lean.Elab.PreDefinition.WF.FloatRecApp -import Lean.Elab.PreDefinition.WF.Rel -import Lean.Elab.PreDefinition.WF.Fix -import Lean.Elab.PreDefinition.WF.Unfold -import Lean.Elab.PreDefinition.WF.Preprocess -import Lean.Elab.PreDefinition.WF.GuessLex +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.TerminationMeasure +public import Lean.Elab.PreDefinition.Mutual +public import Lean.Elab.PreDefinition.WF.PackMutual +public import Lean.Elab.PreDefinition.WF.FloatRecApp +public import Lean.Elab.PreDefinition.WF.Rel +public import Lean.Elab.PreDefinition.WF.Fix +public import Lean.Elab.PreDefinition.WF.Unfold +public import Lean.Elab.PreDefinition.WF.Preprocess +public import Lean.Elab.PreDefinition.WF.GuessLex + +public section namespace Lean.Elab open WF diff --git a/src/Lean/Elab/PreDefinition/WF/PackMutual.lean b/src/Lean/Elab/PreDefinition/WF/PackMutual.lean index af465a6e2c..8bf8aaee4b 100644 --- a/src/Lean/Elab/PreDefinition/WF/PackMutual.lean +++ b/src/Lean/Elab/PreDefinition/WF/PackMutual.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.ArgsPacker -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.FixedParams -import Lean.Elab.PreDefinition.WF.Eqns +public import Lean.Meta.ArgsPacker +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Elab.PreDefinition.WF.Eqns + +public section /-! This module contains roughly everything needed to turn mutual n-ary functions into a single unary diff --git a/src/Lean/Elab/PreDefinition/WF/Preprocess.lean b/src/Lean/Elab/PreDefinition/WF/Preprocess.lean index 2e15c1e83f..239b87b7d5 100644 --- a/src/Lean/Elab/PreDefinition/WF/Preprocess.lean +++ b/src/Lean/Elab/PreDefinition/WF/Preprocess.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Match.MatcherApp.Basic -import Lean.Elab.Tactic.Simp +public import Lean.Meta.Transform +public import Lean.Meta.Match.MatcherApp.Basic +public import Lean.Elab.Tactic.Simp + +public section /-! This module implements the preprocessing of function definitions involved in well-founded recursion. diff --git a/src/Lean/Elab/PreDefinition/WF/Rel.lean b/src/Lean/Elab/PreDefinition/WF/Rel.lean index aca5a9faeb..95a960aa94 100644 --- a/src/Lean/Elab/PreDefinition/WF/Rel.lean +++ b/src/Lean/Elab/PreDefinition/WF/Rel.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Rename -import Lean.Elab.SyntheticMVars -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.TerminationMeasure -import Lean.Elab.PreDefinition.FixedParams -import Lean.Meta.ArgsPacker +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Rename +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.TerminationMeasure +public import Lean.Elab.PreDefinition.FixedParams +public import Lean.Meta.ArgsPacker + +public section namespace Lean.Elab.WF open Meta diff --git a/src/Lean/Elab/PreDefinition/WF/Unfold.lean b/src/Lean/Elab/PreDefinition/WF/Unfold.lean index e951237572..d64873b106 100644 --- a/src/Lean/Elab/PreDefinition/WF/Unfold.lean +++ b/src/Lean/Elab/PreDefinition/WF/Unfold.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.PreDefinition.Basic -import Lean.Elab.PreDefinition.Eqns -import Lean.Meta.Tactic.Apply +public import Lean.Elab.PreDefinition.Basic +public import Lean.Elab.PreDefinition.Eqns +public import Lean.Meta.Tactic.Apply + +public section namespace Lean.Elab.WF open Meta diff --git a/src/Lean/Elab/Print.lean b/src/Lean/Elab/Print.lean index 07b5dd9b81..a9e8972c13 100644 --- a/src/Lean/Elab/Print.lean +++ b/src/Lean/Elab/Print.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Eqns -import Lean.Util.CollectAxioms -import Lean.Elab.Command +public import Lean.Meta.Eqns +public import Lean.Util.CollectAxioms +public import Lean.Elab.Command + +public section namespace Lean.Elab.Command diff --git a/src/Lean/Elab/Quotation.lean b/src/Lean/Elab/Quotation.lean index 9e1cbf1a75..b13fe1db06 100644 --- a/src/Lean/Elab/Quotation.lean +++ b/src/Lean/Elab/Quotation.lean @@ -5,14 +5,18 @@ Authors: Sebastian Ullrich Elaboration of syntax quotations as terms and patterns (in `match_syntax`). See also `./Hygiene.lean` for the basic hygiene workings and data types. -/ +module + prelude -import Lean.Syntax -import Lean.ResolveName -import Lean.Elab.Term -import Lean.Elab.Quotation.Util -import Lean.Elab.Quotation.Precheck -import Lean.Elab.Syntax -import Lean.Parser.Syntax +public import Lean.Syntax +public import Lean.ResolveName +public import Lean.Elab.Term +public import Lean.Elab.Quotation.Util +public import Lean.Elab.Quotation.Precheck +public import Lean.Elab.Syntax +public import Lean.Parser.Syntax + +public section namespace Lean.Elab.Term.Quotation open Lean.Parser.Term @@ -75,7 +79,7 @@ def resolveSectionVariable (sectionVars : NameMap Name) (id : Name) : List (Name loop extractionResult.name [] /-- Transform sequence of pushes and appends into acceptable code -/ -def ArrayStxBuilder := Sum (Array Term) Term +@[expose] def ArrayStxBuilder := Sum (Array Term) Term namespace ArrayStxBuilder @@ -274,7 +278,7 @@ elab_stx_quot Parser.Command.quot /-! # match -/ /-- an "alternative" of patterns plus right-hand side -/ -private abbrev Alt := List Term × Term +abbrev Alt := List Term × Term /-- In a single match step, we match the first discriminant against the "head" of the first pattern of the first diff --git a/src/Lean/Elab/Quotation/Precheck.lean b/src/Lean/Elab/Quotation/Precheck.lean index 2d1a6ad109..161cfde962 100644 --- a/src/Lean/Elab/Quotation/Precheck.lean +++ b/src/Lean/Elab/Quotation/Precheck.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.KeyedDeclsAttribute -import Lean.Parser.Command -- for `precheckedQuot` -import Lean.Elab.Term -import Lean.Elab.Quotation.Util +public import Lean.KeyedDeclsAttribute +public import Lean.Parser.Command -- for `precheckedQuot` +public import Lean.Elab.Term +public import Lean.Elab.Quotation.Util + +public section namespace Lean.Elab.Term.Quotation open Lean.Elab.Term diff --git a/src/Lean/Elab/Quotation/Util.lean b/src/Lean/Elab/Quotation/Util.lean index e8cf275f3d..379e6e6a2d 100644 --- a/src/Lean/Elab/Quotation/Util.lean +++ b/src/Lean/Elab/Quotation/Util.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Term +public import Lean.Elab.Term + +public section namespace Lean.Elab.Term.Quotation open Lean.Syntax diff --git a/src/Lean/Elab/RecAppSyntax.lean b/src/Lean/Elab/RecAppSyntax.lean index 8a638f02b7..01fb9dfa14 100644 --- a/src/Lean/Elab/RecAppSyntax.lean +++ b/src/Lean/Elab/RecAppSyntax.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Elab/RecommendedSpelling.lean b/src/Lean/Elab/RecommendedSpelling.lean index 185a4b56a8..8dbab1243e 100644 --- a/src/Lean/Elab/RecommendedSpelling.lean +++ b/src/Lean/Elab/RecommendedSpelling.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Markus Himmel -/ +module + prelude -import Lean.Parser.Term.Doc -import Lean.Parser.Command -import Lean.Elab.Command +public import Lean.Parser.Term.Doc +public import Lean.Parser.Command +public import Lean.Elab.Command + +public section namespace Lean.Elab.Term.Doc open Lean.Parser.Term.Doc diff --git a/src/Lean/Elab/SetOption.lean b/src/Lean/Elab/SetOption.lean index 54701e9a71..41cd199d94 100644 --- a/src/Lean/Elab/SetOption.lean +++ b/src/Lean/Elab/SetOption.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Log -import Lean.Elab.InfoTree +public import Lean.Log +public import Lean.Elab.InfoTree + +public section namespace Lean.Elab variable [Monad m] [MonadOptions m] [MonadError m] [MonadLiftT (EIO Exception) m] [MonadInfoTree m] diff --git a/src/Lean/Elab/StructInst.lean b/src/Lean/Elab/StructInst.lean index 6a894cae37..b6b3a1de95 100644 --- a/src/Lean/Elab/StructInst.lean +++ b/src/Lean/Elab/StructInst.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller -/ +module + prelude -import Lean.Util.FindExpr -import Lean.Parser.Term -import Lean.Meta.Structure -import Lean.Elab.App -import Lean.Elab.Binders -import Lean.Elab.StructInstHint -import Lean.PrettyPrinter +public import Lean.Util.FindExpr +public import Lean.Parser.Term +public import Lean.Meta.Structure +public import Lean.Elab.App +public import Lean.Elab.Binders +public import Lean.Elab.StructInstHint +public import Lean.PrettyPrinter + +public section /-! # Structure instance elaborator @@ -314,8 +318,8 @@ private def formatStruct : StructInstView → Format else "{" ++ format (source.explicit.map (·.stx)) ++ " with " ++ fieldsFmt ++ implicitFmt ++ "}" -instance : ToFormat FieldView := ⟨formatField⟩ -instance : ToFormat StructInstView := ⟨formatStruct⟩ +instance : ToFormat FieldView := ⟨private_decl% formatField⟩ +instance : ToFormat StructInstView := ⟨private_decl% formatStruct⟩ /-- Converts a `FieldLHS` back into syntax. This assumes the `ref` fields have the correct structure. @@ -488,14 +492,14 @@ private structure ExpandedField where private def ExpandedField.isNested (f : ExpandedField) : Bool := f.val matches .nested .. -instance : ToMessageData ExpandedFieldVal where +private instance : ToMessageData ExpandedFieldVal where toMessageData | .term stx => m!"term {stx}" | .proj fvarId stx parentStructName _ => m!"proj {Expr.fvar fvarId} {.ofConstName parentStructName}{indentD stx}" | .source fvar => m!"source {fvar}" | .nested fieldViews sources => m!"nested {MessageData.joinSep (sources.map (·.stx)).toList ", "} {MessageData.joinSep (fieldViews.map (indentD <| toMessageData ·)).toList "\n"}" -instance : ToMessageData ExpandedField where +private instance : ToMessageData ExpandedField where toMessageData field := m!"field '{field.name}' is {field.val}" abbrev ExpandedFields := NameMap ExpandedField diff --git a/src/Lean/Elab/StructInstHint.lean b/src/Lean/Elab/StructInstHint.lean index a2d100ab64..c144b7ac3c 100644 --- a/src/Lean/Elab/StructInstHint.lean +++ b/src/Lean/Elab/StructInstHint.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.Parser.Term -import Lean.Meta.Hint -import Lean.PrettyPrinter +public import Lean.Parser.Term +public import Lean.Meta.Hint +public import Lean.PrettyPrinter + +public section /-! # Missing-field hints for structure instance elaborator diff --git a/src/Lean/Elab/Structure.lean b/src/Lean/Elab/Structure.lean index 869f7667b8..6470fbf944 100644 --- a/src/Lean/Elab/Structure.lean +++ b/src/Lean/Elab/Structure.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Structure -import Lean.Elab.MutualInductive +public import Lean.Meta.Structure +public import Lean.Elab.MutualInductive + +public section namespace Lean.Elab.Command @@ -437,10 +441,10 @@ Monad for elaborating parents and fields of a `structure`. -/ private abbrev StructElabM := StateT State TermElabM -instance : Inhabited (StructElabM α) where +private instance : Inhabited (StructElabM α) where default := throw default -def runStructElabM (k : StructElabM α) (init : State := {}) : TermElabM α := k.run' init +private def runStructElabM (k : StructElabM α) (init : State := {}) : TermElabM α := k.run' init private def addParentInfo (parent : StructParentInfo) : StructElabM Unit := do modify fun s => { s with parents := s.parents.push parent } diff --git a/src/Lean/Elab/Syntax.lean b/src/Lean/Elab/Syntax.lean index bc4483bf46..a8e0d03db9 100644 --- a/src/Lean/Elab/Syntax.lean +++ b/src/Lean/Elab/Syntax.lean @@ -3,10 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Command -import Lean.Parser.Syntax -import Lean.Elab.Util +public import Lean.Elab.Command +public import Lean.Parser.Syntax +public import Lean.Elab.Util +public meta import Lean.Parser.Syntax + +public section namespace Lean.Elab.Term /-- diff --git a/src/Lean/Elab/SyntheticMVars.lean b/src/Lean/Elab/SyntheticMVars.lean index ba531160a5..872fb8ada9 100644 --- a/src/Lean/Elab/SyntheticMVars.lean +++ b/src/Lean/Elab/SyntheticMVars.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Tactic.Util -import Lean.Util.NumObjs -import Lean.Util.ForEachExpr -import Lean.Util.OccursCheck -import Lean.Elab.Tactic.Basic -import Lean.Meta.AbstractNestedProofs +public import Lean.Meta.Tactic.Util +public import Lean.Util.NumObjs +public import Lean.Util.ForEachExpr +public import Lean.Util.OccursCheck +public import Lean.Elab.Tactic.Basic +public import Lean.Meta.AbstractNestedProofs + +public section namespace Lean.Elab.Term open Tactic (TacticM evalTactic getUnsolvedGoals withTacticInfoContext) diff --git a/src/Lean/Elab/Tactic.lean b/src/Lean/Elab/Tactic.lean index e5ed953ecb..7da838c684 100644 --- a/src/Lean/Elab/Tactic.lean +++ b/src/Lean/Elab/Tactic.lean @@ -3,53 +3,57 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Term -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Tactic.Induction -import Lean.Elab.Tactic.Generalize -import Lean.Elab.Tactic.Injection -import Lean.Elab.Tactic.Match -import Lean.Elab.Tactic.Rewrite -import Lean.Elab.Tactic.Location -import Lean.Elab.Tactic.SimpTrace -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.Simproc -import Lean.Elab.Tactic.BuiltinTactic -import Lean.Elab.Tactic.Split -import Lean.Elab.Tactic.Conv -import Lean.Elab.Tactic.Delta -import Lean.Elab.Tactic.Meta -import Lean.Elab.Tactic.Unfold -import Lean.Elab.Tactic.Calc -import Lean.Elab.Tactic.Congr -import Lean.Elab.Tactic.Guard -import Lean.Elab.Tactic.RCases -import Lean.Elab.Tactic.Repeat -import Lean.Elab.Tactic.Ext -import Lean.Elab.Tactic.Change -import Lean.Elab.Tactic.FalseOrByContra -import Lean.Elab.Tactic.Omega -import Lean.Elab.Tactic.Simpa -import Lean.Elab.Tactic.NormCast -import Lean.Elab.Tactic.Symm -import Lean.Elab.Tactic.SolveByElim -import Lean.Elab.Tactic.LibrarySearch -import Lean.Elab.Tactic.ShowTerm -import Lean.Elab.Tactic.Rfl -import Lean.Elab.Tactic.Rewrites -import Lean.Elab.Tactic.DiscrTreeKey -import Lean.Elab.Tactic.BVDecide -import Lean.Elab.Tactic.BoolToPropSimps -import Lean.Elab.Tactic.Classical -import Lean.Elab.Tactic.Grind -import Lean.Elab.Tactic.Monotonicity -import Lean.Elab.Tactic.Try -import Lean.Elab.Tactic.AsAuxLemma -import Lean.Elab.Tactic.TreeTacAttr -import Lean.Elab.Tactic.ExposeNames -import Lean.Elab.Tactic.SimpArith -import Lean.Elab.Tactic.Show -import Lean.Elab.Tactic.Lets -import Lean.Elab.Tactic.Do +public import Lean.Elab.Term +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Induction +public import Lean.Elab.Tactic.Generalize +public import Lean.Elab.Tactic.Injection +public import Lean.Elab.Tactic.Match +public import Lean.Elab.Tactic.Rewrite +public import Lean.Elab.Tactic.Location +public import Lean.Elab.Tactic.SimpTrace +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.Simproc +public import Lean.Elab.Tactic.BuiltinTactic +public import Lean.Elab.Tactic.Split +public import Lean.Elab.Tactic.Conv +public import Lean.Elab.Tactic.Delta +public import Lean.Elab.Tactic.Meta +public import Lean.Elab.Tactic.Unfold +public import Lean.Elab.Tactic.Calc +public import Lean.Elab.Tactic.Congr +public import Lean.Elab.Tactic.Guard +public import Lean.Elab.Tactic.RCases +public import Lean.Elab.Tactic.Repeat +public import Lean.Elab.Tactic.Ext +public import Lean.Elab.Tactic.Change +public import Lean.Elab.Tactic.FalseOrByContra +public import Lean.Elab.Tactic.Omega +public import Lean.Elab.Tactic.Simpa +public import Lean.Elab.Tactic.NormCast +public import Lean.Elab.Tactic.Symm +public import Lean.Elab.Tactic.SolveByElim +public import Lean.Elab.Tactic.LibrarySearch +public import Lean.Elab.Tactic.ShowTerm +public import Lean.Elab.Tactic.Rfl +public import Lean.Elab.Tactic.Rewrites +public import Lean.Elab.Tactic.DiscrTreeKey +public import Lean.Elab.Tactic.BVDecide +public import Lean.Elab.Tactic.BoolToPropSimps +public import Lean.Elab.Tactic.Classical +public import Lean.Elab.Tactic.Grind +public import Lean.Elab.Tactic.Monotonicity +public import Lean.Elab.Tactic.Try +public import Lean.Elab.Tactic.AsAuxLemma +public import Lean.Elab.Tactic.TreeTacAttr +public import Lean.Elab.Tactic.ExposeNames +public import Lean.Elab.Tactic.SimpArith +public import Lean.Elab.Tactic.Show +public import Lean.Elab.Tactic.Lets +public import Lean.Elab.Tactic.Do + +public section diff --git a/src/Lean/Elab/Tactic/AsAuxLemma.lean b/src/Lean/Elab/Tactic/AsAuxLemma.lean index d02ba2b461..72498a678b 100644 --- a/src/Lean/Elab/Tactic/AsAuxLemma.lean +++ b/src/Lean/Elab/Tactic/AsAuxLemma.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Init.Tactics -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Meta -import Lean.MetavarContext -import Lean.Meta.Closure +public import Init.Tactics +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Meta +public import Lean.MetavarContext +public import Lean.Meta.Closure + +public section open Lean Meta Elab Tactic Parser.Tactic diff --git a/src/Lean/Elab/Tactic/BVDecide.lean b/src/Lean/Elab/Tactic/BVDecide.lean index 60082cbffa..58a6ced640 100644 --- a/src/Lean/Elab/Tactic/BVDecide.lean +++ b/src/Lean/Elab/Tactic/BVDecide.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.LRAT -import Lean.Elab.Tactic.BVDecide.External -import Lean.Elab.Tactic.BVDecide.Frontend +public import Lean.Elab.Tactic.BVDecide.LRAT +public import Lean.Elab.Tactic.BVDecide.External +public import Lean.Elab.Tactic.BVDecide.Frontend + +public section /-! This directory offers three different SAT tactics for proving goals involving `BitVec` and `Bool`: diff --git a/src/Lean/Elab/Tactic/BVDecide/External.lean b/src/Lean/Elab/Tactic/BVDecide/External.lean index 39563fae1c..98d70dc0c4 100644 --- a/src/Lean/Elab/Tactic/BVDecide/External.lean +++ b/src/Lean/Elab/Tactic/BVDecide/External.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Tactic.BVDecide.LRAT.Parser -import Lean.CoreM -import Std.Internal.Parsec +public import Std.Tactic.BVDecide.LRAT.Parser +public import Lean.CoreM +public import Std.Internal.Parsec + +public section /-! This module implements the logic to call CaDiCal (or CLI interface compatible SAT solvers) and diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend.lean index afb354cf2d..a70ca90881 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.Attr -import Lean.Elab.Tactic.BVDecide.Frontend.BVCheck -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide -import Lean.Elab.Tactic.BVDecide.Frontend.BVTrace -import Lean.Elab.Tactic.BVDecide.Frontend.LRAT -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Lean.Elab.Tactic.BVDecide.Frontend.BVCheck +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide +public import Lean.Elab.Tactic.BVDecide.Frontend.BVTrace +public import Lean.Elab.Tactic.BVDecide.Frontend.LRAT +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize + +public section /-! This module provides the tactic frontends, consisting of: diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Attr.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Attr.lean index dd88e69d97..0bfb7d3d43 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Attr.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Attr.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison, Henrik Böving -/ +module + prelude -import Lean.Util.Trace -import Lean.Elab.Tactic.Simp -import Std.Tactic.BVDecide.Syntax +public import Lean.Util.Trace +public import Lean.Elab.Tactic.Simp +public import Std.Tactic.BVDecide.Syntax + +public section /-! Provides environment extensions around the `bv_decide` tactic frontends. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVCheck.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVCheck.lean index 9841e17d05..c26c6323d1 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVCheck.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVCheck.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide -import Lean.Meta.Tactic.TryThis -import Std.Tactic.BVDecide.Syntax +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide +public import Lean.Meta.Tactic.TryThis +public import Std.Tactic.BVDecide.Syntax + +public section /-! This modules provides the implementation of `bv_check`. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide.lean index 97ad83686a..7e658d7454 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide.lean @@ -3,14 +3,18 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Sat.AIG.CNF -import Std.Sat.AIG.RelabelNat -import Std.Tactic.BVDecide.Bitblast -import Std.Tactic.BVDecide.Syntax -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.SatAtBVLogical -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize -import Lean.Elab.Tactic.BVDecide.Frontend.LRAT +public import Std.Sat.AIG.CNF +public import Std.Sat.AIG.RelabelNat +public import Std.Tactic.BVDecide.Bitblast +public import Std.Tactic.BVDecide.Syntax +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.SatAtBVLogical +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize +public import Lean.Elab.Tactic.BVDecide.Frontend.LRAT + +public section /-! This module provides the implementation of the `bv_decide` frontend itself. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reflect.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reflect.lean index be7bda66b7..8bcf720ede 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reflect.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reflect.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Data.HashMap -import Std.Tactic.BVDecide.Bitblast.BVExpr.Basic -import Lean.Meta.AppBuilder -import Lean.ToExpr -import Lean.Data.RArray +public import Std.Data.HashMap +public import Std.Tactic.BVDecide.Bitblast.BVExpr.Basic +public import Lean.Meta.AppBuilder +public import Lean.ToExpr +public import Lean.Data.RArray + +public section /-! This module contains the implementation of the reflection monad, used by all other components of this diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVExpr.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVExpr.lean index 68adfc54f6..f06d2895c7 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVExpr.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVExpr.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.Reflect -import Std.Tactic.BVDecide.Reflect +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.Reflect +public import Std.Tactic.BVDecide.Reflect + +public section /-! Provides the logic for reifying `BitVec` expressions. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVLogical.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVLogical.lean index b40b58e9e0..72cacced47 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVLogical.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVLogical.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVPred +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVPred + +public section /-! Provides the logic for reifying `BitVec` problems with boolean substructure. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVPred.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVPred.lean index 6bacccba84..9764744277 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVPred.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedBVPred.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVExpr +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVExpr + +public section /-! Provides the logic for reifying predicates on `BitVec`. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedLemmas.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedLemmas.lean index 9739acae73..1a2cbe20b0 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedLemmas.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/ReifiedLemmas.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVLogical +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVLogical + +public section /-! Provides the logic for generating auxiliary lemmas during reification. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reify.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reify.lean index ce60b7560e..db189675e4 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reify.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/Reify.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVLogical -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedLemmas +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedBVLogical +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.ReifiedLemmas + +public section /-! Reifies `BitVec` problems with boolean substructure. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/SatAtBVLogical.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/SatAtBVLogical.lean index bceb1a0580..950ff9c15b 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/SatAtBVLogical.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVDecide/SatAtBVLogical.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.Reify +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide.Reify + +public section /-! This module is the main entry point for reifying `BitVec` problems with boolean substructure. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVTrace.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVTrace.lean index 2d4aa1fac4..479dfbbfe6 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/BVTrace.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/BVTrace.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide -import Lean.Elab.Tactic.BVDecide.Frontend.BVCheck -import Lean.Elab.Tactic.BVDecide.LRAT.Trim -import Lean.Meta.Tactic.TryThis -import Std.Tactic.BVDecide.Syntax +public import Lean.Elab.Tactic.BVDecide.Frontend.BVDecide +public import Lean.Elab.Tactic.BVDecide.Frontend.BVCheck +public import Lean.Elab.Tactic.BVDecide.LRAT.Trim +public import Lean.Meta.Tactic.TryThis +public import Std.Tactic.BVDecide.Syntax + +public section /-! This module contains the implementation of `bv_decide?`. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/LRAT.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/LRAT.lean index 2b7267a577..cd311c87d9 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/LRAT.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/LRAT.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.Attr -import Lean.Elab.Tactic.BVDecide.LRAT.Trim -import Lean.Elab.Tactic.BVDecide.External -import Std.Tactic.BVDecide.LRAT.Checker -import Std.Sat.CNF.Dimacs +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Lean.Elab.Tactic.BVDecide.LRAT.Trim +public import Lean.Elab.Tactic.BVDecide.External +public import Std.Tactic.BVDecide.LRAT.Checker +public import Std.Sat.CNF.Dimacs + +public section /-! This module contains the logic around writing proofs of UNSAT, using LRAT proofs, as meta code. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize.lean index 5da9195f61..c47c5ce9ea 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize.lean @@ -3,20 +3,24 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.FalseOrByContra -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Simproc -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Rewrite -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.AndFlatten -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.EmbeddedConstraint -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.AC -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Structures -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.IntToBitVec -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Enums -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ShortCircuit +public import Lean.Elab.Tactic.FalseOrByContra +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Simproc +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Rewrite +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.AndFlatten +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.EmbeddedConstraint +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.AC +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Structures +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.IntToBitVec +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Enums +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ShortCircuit + +public section /-! This module contains the implementation of `bv_normalize`, the preprocessing tactic for `bv_decide`. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean index 77cd6c81fa..3c0af50599 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AC.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving, Alex Keizer, Siddharth Bhat -/ +module + prelude -import Lean.Meta.Tactic.AC.Main -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Meta.Tactic.AC.Main +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic + +public section namespace Lean.Elab.Tactic.BVDecide namespace Frontend.Normalize diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AndFlatten.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AndFlatten.lean index e369d21099..ffc02db72b 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AndFlatten.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/AndFlatten.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Tactic.BVDecide.Normalize.Bool -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Meta.Tactic.Assert +public import Std.Tactic.BVDecide.Normalize.Bool +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Meta.Tactic.Assert + +public section /-! This module contains the implementation of the and flattening pass in the fixpoint pipeline, taking diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ApplyControlFlow.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ApplyControlFlow.lean index c3f35adb5b..2c705b7926 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ApplyControlFlow.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ApplyControlFlow.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Meta.Tactic.Simp +public import Lean.Meta.Tactic.Simp + +public section /-! This modules contains simprocs and functions to compute discrimination tree keys in order to diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Basic.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Basic.lean index 97ccfe7294..c7422fda8d 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Basic.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Basic.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Meta.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Lean.Meta.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr + +public section /-! This module contains the basic preprocessing pipeline framework for `bv_normalize`. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/EmbeddedConstraint.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/EmbeddedConstraint.lean index f014c50ece..5a3bdf4b50 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/EmbeddedConstraint.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/EmbeddedConstraint.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Tactic.BVDecide.Normalize.Bool -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Meta.Tactic.Simp +public import Std.Tactic.BVDecide.Normalize.Bool +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Meta.Tactic.Simp + +public section /-! This module contains the implementation of the embedded constraint substitution pass in the fixpoint diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Enums.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Enums.lean index da4448a3b3..86895de02d 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Enums.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Enums.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Structures -import Lean.Meta.Tactic.Simp +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Structures +public import Lean.Meta.Tactic.Simp + +public section /-! This module contains the implementation of the pre processing pass for handling enum inductive diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/IntToBitVec.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/IntToBitVec.lean index daef572851..d24d5a5ffd 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/IntToBitVec.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/IntToBitVec.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Init.Data.SInt.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Attr -import Lean.Elab.Tactic.Simp +public import Init.Data.SInt.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Lean.Elab.Tactic.Simp + +public section /-! This module contains the implementation of the pre processing pass for reducing `UIntX`/`IntX` to @@ -44,11 +48,11 @@ private abbrev M := StateRefT SizeState MetaM namespace M @[inline] -def addSizeTerm (e : Expr) : M Unit := do +private def addSizeTerm (e : Expr) : M Unit := do modify fun s => { s with relevantTerms := s.relevantTerms.insert e } @[inline] -def addSizeHyp (f : FVarId) : M Unit := do +private def addSizeHyp (f : FVarId) : M Unit := do modify fun s => { s with relevantHyps := s.relevantHyps.insert f } end M diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Rewrite.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Rewrite.lean index b108e0a3cd..13a7084715 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Rewrite.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Rewrite.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr + +public section /-! This module contains the implementation of the rewriting pass in the fixpoint pipeline, applying diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ShortCircuit.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ShortCircuit.lean index d240337820..86e63cbfff 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ShortCircuit.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/ShortCircuit.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Tobias Grosser. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tobias Grosser -/ +module + prelude -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Attr -import Std.Tactic.BVDecide.Normalize.BitVec +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Std.Tactic.BVDecide.Normalize.BitVec + +public section /-! This module contains the implementation of the short-circuiting pass, which is responsible for diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Simproc.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Simproc.lean index 7e9befd989..5e398968d5 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Simproc.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Simproc.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Std.Tactic.BVDecide.Normalize -import Std.Tactic.BVDecide.Syntax -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.BVDecide.Frontend.Attr +public import Std.Tactic.BVDecide.Normalize +public import Std.Tactic.BVDecide.Syntax +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.BVDecide.Frontend.Attr + +public section /-! This module contains implementations of simprocs used in the `bv_normalize` simp set. diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Structures.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Structures.lean index 03a169ca1f..454c3ea86f 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Structures.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/Structures.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Simp -import Lean.Meta.Injective +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.ApplyControlFlow +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.TypeAnalysis +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Simp +public import Lean.Meta.Injective + +public section /-! This module contains the implementation of the pre processing pass for automatically splitting up diff --git a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/TypeAnalysis.lean b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/TypeAnalysis.lean index a24d9cacfa..62c80bcf85 100644 --- a/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/TypeAnalysis.lean +++ b/src/Lean/Elab/Tactic/BVDecide/Frontend/Normalize/TypeAnalysis.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Init.Data.SInt.Basic -import Std.Tactic.BVDecide.Normalize.BitVec -import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic +public import Init.Data.SInt.Basic +public import Std.Tactic.BVDecide.Normalize.BitVec +public import Lean.Elab.Tactic.BVDecide.Frontend.Normalize.Basic + +public section /-! This file implements the type analysis pass for the structures and enum inductives pass. It figures diff --git a/src/Lean/Elab/Tactic/BVDecide/LRAT.lean b/src/Lean/Elab/Tactic/BVDecide/LRAT.lean index 51f928472d..180686a96a 100644 --- a/src/Lean/Elab/Tactic/BVDecide/LRAT.lean +++ b/src/Lean/Elab/Tactic/BVDecide/LRAT.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Lean.Elab.Tactic.BVDecide.LRAT.Trim +public import Lean.Elab.Tactic.BVDecide.LRAT.Trim + +public section /-! This directory contains the implementation of the LRAT trimming algorithms. diff --git a/src/Lean/Elab/Tactic/BVDecide/LRAT/Trim.lean b/src/Lean/Elab/Tactic/BVDecide/LRAT/Trim.lean index cd7f3f0ba0..da12598ec6 100644 --- a/src/Lean/Elab/Tactic/BVDecide/LRAT/Trim.lean +++ b/src/Lean/Elab/Tactic/BVDecide/LRAT/Trim.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ +module + prelude -import Init.Data.Nat.Fold -import Std.Tactic.BVDecide.LRAT.Actions -import Std.Data.HashMap +public import Init.Data.Nat.Fold +public import Std.Tactic.BVDecide.LRAT.Actions +public import Std.Data.HashMap + +public section /-! This module implements the LRAT trimming algorithm described in section 4 of diff --git a/src/Lean/Elab/Tactic/Basic.lean b/src/Lean/Elab/Tactic/Basic.lean index d8a95e55e3..acb56f59f7 100644 --- a/src/Lean/Elab/Tactic/Basic.lean +++ b/src/Lean/Elab/Tactic/Basic.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Tactic.Util -import Lean.Elab.Term +public import Lean.Meta.Tactic.Util +public import Lean.Elab.Term + +public section namespace Lean.Elab open Meta diff --git a/src/Lean/Elab/Tactic/BoolToPropSimps.lean b/src/Lean/Elab/Tactic/BoolToPropSimps.lean index e14ce2fc3d..4304ee5f6f 100644 --- a/src/Lean/Elab/Tactic/BoolToPropSimps.lean +++ b/src/Lean/Elab/Tactic/BoolToPropSimps.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Tobias Grosser -/ +module + prelude -import Lean.Meta.Tactic.Simp.Attr +public import Lean.Meta.Tactic.Simp.Attr + +public section builtin_initialize bool_to_prop : Lean.Meta.SimpExtension ← Lean.Meta.registerSimpAttr `bool_to_prop diff --git a/src/Lean/Elab/Tactic/BuiltinTactic.lean b/src/Lean/Elab/Tactic/BuiltinTactic.lean index d76c6dd21f..efd5fba12b 100644 --- a/src/Lean/Elab/Tactic/BuiltinTactic.lean +++ b/src/Lean/Elab/Tactic/BuiltinTactic.lean @@ -3,20 +3,24 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Diagnostics -import Lean.Meta.Hint -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Assumption -import Lean.Meta.Tactic.Contradiction -import Lean.Meta.Tactic.Refl -import Lean.Elab.Binders -import Lean.Elab.Open -import Lean.Elab.Eval -import Lean.Elab.SetOption -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Do +public import Lean.Meta.Diagnostics +public import Lean.Meta.Hint +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Tactic.Contradiction +public import Lean.Meta.Tactic.Refl +public import Lean.Elab.Binders +public import Lean.Elab.Open +public import Lean.Elab.Eval +public import Lean.Elab.SetOption +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Do + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Calc.lean b/src/Lean/Elab/Tactic/Calc.lean index a548ae45ec..aa7aeb1601 100644 --- a/src/Lean/Elab/Tactic/Calc.lean +++ b/src/Lean/Elab/Tactic/Calc.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Calc -import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Calc +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Change.lean b/src/Lean/Elab/Tactic/Change.lean index 79c4eacd3a..07722437f8 100644 --- a/src/Lean/Elab/Tactic/Change.lean +++ b/src/Lean/Elab/Tactic/Change.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Kyle Miller. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.Tactic.Replace -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Replace +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic open Meta @@ -13,7 +17,7 @@ open Meta # Implementation of the `change` tactic -/ -private def elabChangeDefaultError (p tgt : Expr) : MetaM MessageData := do +def elabChangeDefaultError (p tgt : Expr) : MetaM MessageData := do return m!"\ 'change' tactic failed, pattern{indentExpr p}\n\ is not definitionally equal to target{indentExpr tgt}" @@ -64,7 +68,7 @@ but using named placeholders or `?_` results in `change` to creating new goals. The tactic `show e` is interchangeable with `change e`, where the pattern `e` is applied to the main goal. -/ -@[builtin_tactic change] elab_rules : tactic +@[builtin_tactic change] def evalChange : Tactic | `(tactic| change $newType:term $[$loc:location]?) => do withLocation (expandOptLocation (Lean.mkOptionalNode loc)) (atLocal := fun h => do @@ -76,5 +80,6 @@ the main goal. -/ liftMetaTactic fun mvarId => do return (← mvarId.replaceTargetDefEq tgt') :: mvars) (failed := fun _ => throwError "'change' tactic failed") + | _ => throwUnsupportedSyntax end Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/Classical.lean b/src/Lean/Elab/Tactic/Classical.lean index 1a1aeacf6c..2d3e54126f 100644 --- a/src/Lean/Elab/Tactic/Classical.lean +++ b/src/Lean/Elab/Tactic/Classical.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Kim Morrison -/ +module + prelude -import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Basic + +public section /-! # `classical` tactic -/ diff --git a/src/Lean/Elab/Tactic/Config.lean b/src/Lean/Elab/Tactic/Config.lean index 9961bf24b2..9dfabe2fbc 100644 --- a/src/Lean/Elab/Tactic/Config.lean +++ b/src/Lean/Elab/Tactic/Config.lean @@ -3,11 +3,16 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller -/ +module + prelude -import Lean.Meta.Eval -import Lean.Elab.Tactic.Basic -import Lean.Elab.SyntheticMVars -import Lean.Linter.MissingDocs +public import Lean.Meta.Eval +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.SyntheticMVars +public import Lean.Linter.MissingDocs +meta import Lean.Parser.Tactic + +public section namespace Lean.Elab.Tactic open Meta Parser.Tactic Command @@ -20,7 +25,7 @@ private structure ConfigItemView where (bool : Bool := false) /-- Interprets the `config` as an array of option/value pairs. -/ -private def mkConfigItemViews (c : TSyntaxArray ``configItem) : Array ConfigItemView := +def mkConfigItemViews (c : TSyntaxArray ``configItem) : Array ConfigItemView := c.map fun item => match item with | `(configItem| ($option:ident := $value)) => { ref := item, option, value } @@ -61,7 +66,7 @@ private partial def expandField (structName : Name) (field : Name) : MetaM (Name return (field' ++ field'', projFn) /-- Elaborates a tactic configuration. -/ -private def elabConfig (recover : Bool) (structName : Name) (items : Array ConfigItemView) : TermElabM Expr := +def elabConfig (recover : Bool) (structName : Name) (items : Array ConfigItemView) : TermElabM Expr := withoutModifyingStateWithInfoAndMessages <| withLCtx {} {} <| withSaveInfoContext do let mkStructInst (source? : Option Term) (fields : TSyntaxArray ``Parser.Term.structInstField) : TermElabM Term := match source? with diff --git a/src/Lean/Elab/Tactic/Congr.lean b/src/Lean/Elab/Tactic/Congr.lean index bbfab37d53..59e6e0fbc8 100644 --- a/src/Lean/Elab/Tactic/Congr.lean +++ b/src/Lean/Elab/Tactic/Congr.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Congr -import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.Congr +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/Conv.lean b/src/Lean/Elab/Tactic/Conv.lean index f4ba8c0e21..fdf96e4de9 100644 --- a/src/Lean/Elab/Tactic/Conv.lean +++ b/src/Lean/Elab/Tactic/Conv.lean @@ -3,13 +3,17 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Conv.Basic -import Lean.Elab.Tactic.Conv.Congr -import Lean.Elab.Tactic.Conv.Rewrite -import Lean.Elab.Tactic.Conv.Change -import Lean.Elab.Tactic.Conv.Lets -import Lean.Elab.Tactic.Conv.Simp -import Lean.Elab.Tactic.Conv.Pattern -import Lean.Elab.Tactic.Conv.Delta -import Lean.Elab.Tactic.Conv.Unfold +public import Lean.Elab.Tactic.Conv.Basic +public import Lean.Elab.Tactic.Conv.Congr +public import Lean.Elab.Tactic.Conv.Rewrite +public import Lean.Elab.Tactic.Conv.Change +public import Lean.Elab.Tactic.Conv.Lets +public import Lean.Elab.Tactic.Conv.Simp +public import Lean.Elab.Tactic.Conv.Pattern +public import Lean.Elab.Tactic.Conv.Delta +public import Lean.Elab.Tactic.Conv.Unfold + +public section diff --git a/src/Lean/Elab/Tactic/Conv/Basic.lean b/src/Lean/Elab/Tactic/Conv/Basic.lean index 409a70d2a0..7ed0247f61 100644 --- a/src/Lean/Elab/Tactic/Conv/Basic.lean +++ b/src/Lean/Elab/Tactic/Conv/Basic.lean @@ -3,12 +3,16 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Reduce -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Replace -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.BuiltinTactic +public import Lean.Meta.Reduce +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Replace +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.BuiltinTactic + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Change.lean b/src/Lean/Elab/Tactic/Conv/Change.lean index 2daa813e92..681ed4f373 100644 --- a/src/Lean/Elab/Tactic/Conv/Change.lean +++ b/src/Lean/Elab/Tactic/Conv/Change.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Tactic.Change -import Lean.Elab.Tactic.Conv.Basic +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Change +public import Lean.Elab.Tactic.Conv.Basic + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Congr.lean b/src/Lean/Elab/Tactic/Conv/Congr.lean index d2fe022a58..a0ed034f2c 100644 --- a/src/Lean/Elab/Tactic/Conv/Congr.lean +++ b/src/Lean/Elab/Tactic/Conv/Congr.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Main -import Lean.Meta.Tactic.Congr -import Lean.Elab.Tactic.Conv.Basic +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Congr +public import Lean.Elab.Tactic.Conv.Basic + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Delta.lean b/src/Lean/Elab/Tactic/Conv/Delta.lean index c26b461868..ea278f1396 100644 --- a/src/Lean/Elab/Tactic/Conv/Delta.lean +++ b/src/Lean/Elab/Tactic/Conv/Delta.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Delta -import Lean.Elab.Tactic.Conv.Basic +public import Lean.Elab.Tactic.Delta +public import Lean.Elab.Tactic.Conv.Basic + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Lets.lean b/src/Lean/Elab/Tactic/Conv/Lets.lean index dfec982662..1955e3fe7e 100644 --- a/src/Lean/Elab/Tactic/Conv/Lets.lean +++ b/src/Lean/Elab/Tactic/Conv/Lets.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Elab.Tactic.Lets -import Lean.Elab.Tactic.Conv.Basic +public import Lean.Elab.Tactic.Lets +public import Lean.Elab.Tactic.Conv.Basic + +public section /-! # Conv tactics to manipulate `let` expressions @@ -19,7 +23,7 @@ namespace Lean.Elab.Tactic.Conv ### `extract_lets` -/ -@[builtin_tactic Lean.Parser.Tactic.Conv.extractLets] elab_rules : tactic +@[builtin_tactic Lean.Parser.Tactic.Conv.extractLets] def evalExtractLets : Tactic | `(conv| extract_lets $cfg:optConfig $ids*) => do let mut config ← elabExtractLetsConfig cfg let givenNames := (ids.map getNameOfIdent').toList @@ -42,12 +46,13 @@ namespace Lean.Elab.Tactic.Conv assign mvarId g return (fvarIds, [g.mvarId!]) extractLetsAddVarInfo ids fvars + | _ => throwUnsupportedSyntax /-! ### `lift_lets` -/ -@[builtin_tactic Lean.Parser.Tactic.Conv.liftLets] elab_rules : tactic +@[builtin_tactic Lean.Parser.Tactic.Conv.liftLets] def evalLiftLets : Tactic | `(conv| lift_lets $cfg:optConfig) => do let mut config ← elabLiftLetsConfig cfg withMainContext do @@ -56,12 +61,13 @@ namespace Lean.Elab.Tactic.Conv if lhs == lhs' then throwTacticEx `lift_lets (← getMainGoal) m!"made no progress" changeLhs lhs' + | _ => throwUnsupportedSyntax /-! ### `let_to_have` -/ -@[builtin_tactic Lean.Parser.Tactic.Conv.letToHave] elab_rules : tactic +@[builtin_tactic Lean.Parser.Tactic.Conv.letToHave] def evalLetToHave : Tactic | `(conv| let_to_have) => do withMainContext do let lhs ← getLhs @@ -69,5 +75,6 @@ namespace Lean.Elab.Tactic.Conv if lhs == lhs' then throwTacticEx `let_to_have (← getMainGoal) m!"made no progress" changeLhs lhs' + | _ => throwUnsupportedSyntax end Lean.Elab.Tactic.Conv diff --git a/src/Lean/Elab/Tactic/Conv/Pattern.lean b/src/Lean/Elab/Tactic/Conv/Pattern.lean index 7faba51f1e..022f4e27dd 100644 --- a/src/Lean/Elab/Tactic/Conv/Pattern.lean +++ b/src/Lean/Elab/Tactic/Conv/Pattern.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.Conv.Basic -import Lean.HeadIndex +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.Conv.Basic +public import Lean.HeadIndex + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Rewrite.lean b/src/Lean/Elab/Tactic/Conv/Rewrite.lean index 0223a28992..fa535095d1 100644 --- a/src/Lean/Elab/Tactic/Conv/Rewrite.lean +++ b/src/Lean/Elab/Tactic/Conv/Rewrite.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Rewrite -import Lean.Elab.Tactic.Rewrite -import Lean.Elab.Tactic.Conv.Basic +public import Lean.Meta.Tactic.Rewrite +public import Lean.Elab.Tactic.Rewrite +public import Lean.Elab.Tactic.Conv.Basic + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Conv/Simp.lean b/src/Lean/Elab/Tactic/Conv/Simp.lean index b764034d32..8dcdbce5c0 100644 --- a/src/Lean/Elab/Tactic/Conv/Simp.lean +++ b/src/Lean/Elab/Tactic/Conv/Simp.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Moritz Doll -/ +module + prelude -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.Split -import Lean.Elab.Tactic.Conv.Basic -import Lean.Elab.Tactic.SimpTrace +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.Split +public import Lean.Elab.Tactic.Conv.Basic +public import Lean.Elab.Tactic.SimpTrace + +public section namespace Lean.Elab.Tactic.Conv open Meta Tactic TryThis diff --git a/src/Lean/Elab/Tactic/Conv/Unfold.lean b/src/Lean/Elab/Tactic/Conv/Unfold.lean index f867928676..c2bfe54731 100644 --- a/src/Lean/Elab/Tactic/Conv/Unfold.lean +++ b/src/Lean/Elab/Tactic/Conv/Unfold.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Unfold -import Lean.Elab.Tactic.Conv.Simp +public import Lean.Elab.Tactic.Unfold +public import Lean.Elab.Tactic.Conv.Simp + +public section namespace Lean.Elab.Tactic.Conv open Meta diff --git a/src/Lean/Elab/Tactic/Delta.lean b/src/Lean/Elab/Tactic/Delta.lean index a185725df1..292e6c5ae1 100644 --- a/src/Lean/Elab/Tactic/Delta.lean +++ b/src/Lean/Elab/Tactic/Delta.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Delta -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Delta +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/DiscrTreeKey.lean b/src/Lean/Elab/Tactic/DiscrTreeKey.lean index f7cbb02838..a69f459b72 100644 --- a/src/Lean/Elab/Tactic/DiscrTreeKey.lean +++ b/src/Lean/Elab/Tactic/DiscrTreeKey.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Matthew Robert Ballard. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tomas Skrivan, Matthew Robert Ballard -/ +module + prelude -import Init.Tactics -import Lean.Elab.Command -import Lean.Meta.Tactic.Simp.SimpTheorems +public import Init.Tactics +public import Lean.Elab.Command +public import Lean.Meta.Tactic.Simp.SimpTheorems + +public section namespace Lean.Elab.Tactic.DiscrTreeKey diff --git a/src/Lean/Elab/Tactic/Do.lean b/src/Lean/Elab/Tactic/Do.lean index 277e516a93..d3d595402d 100644 --- a/src/Lean/Elab/Tactic/Do.lean +++ b/src/Lean/Elab/Tactic/Do.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Lean.Elab.Tactic.Do.ProofMode -import Lean.Elab.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.Attr -import Lean.Elab.Tactic.Do.LetElim -import Lean.Elab.Tactic.Do.Spec -import Lean.Elab.Tactic.Do.VCGen +public import Lean.Elab.Tactic.Do.ProofMode +public import Lean.Elab.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.Attr +public import Lean.Elab.Tactic.Do.LetElim +public import Lean.Elab.Tactic.Do.Spec +public import Lean.Elab.Tactic.Do.VCGen + +public section diff --git a/src/Lean/Elab/Tactic/Do/Attr.lean b/src/Lean/Elab/Tactic/Do/Attr.lean index f1dc83c119..10f5976ba7 100644 --- a/src/Lean/Elab/Tactic/Do/Attr.lean +++ b/src/Lean/Elab/Tactic/Do/Attr.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Lean.Meta.Tactic.Simp -import Std.Do.Triple.Basic -import Std.Tactic.Do.Syntax +public import Lean.Meta.Tactic.Simp +public import Std.Do.Triple.Basic +public import Std.Tactic.Do.Syntax + +public section namespace Lean.Elab.Tactic.Do.SpecAttr diff --git a/src/Lean/Elab/Tactic/Do/LetElim.lean b/src/Lean/Elab/Tactic/Do/LetElim.lean index 05c25e8c61..dd41a52eff 100644 --- a/src/Lean/Elab/Tactic/Do/LetElim.lean +++ b/src/Lean/Elab/Tactic/Do/LetElim.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Lean.Meta.Tactic.Simp +public import Lean.Meta.Tactic.Simp + +public section namespace Lean.Elab.Tactic.Do diff --git a/src/Lean/Elab/Tactic/Do/ProofMode.lean b/src/Lean/Elab/Tactic/Do/ProofMode.lean index 0a3de714de..7ce5f4a05f 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode.lean @@ -3,22 +3,26 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Delab -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Clear -import Lean.Elab.Tactic.Do.ProofMode.Intro -import Lean.Elab.Tactic.Do.ProofMode.Revert -import Lean.Elab.Tactic.Do.ProofMode.Exact -import Lean.Elab.Tactic.Do.ProofMode.Assumption -import Lean.Elab.Tactic.Do.ProofMode.Pure -import Lean.Elab.Tactic.Do.ProofMode.Frame -import Lean.Elab.Tactic.Do.ProofMode.LeftRight -import Lean.Elab.Tactic.Do.ProofMode.Constructor -import Lean.Elab.Tactic.Do.ProofMode.RenameI -import Lean.Elab.Tactic.Do.ProofMode.Specialize -import Lean.Elab.Tactic.Do.ProofMode.Cases -import Lean.Elab.Tactic.Do.ProofMode.Exfalso -import Lean.Elab.Tactic.Do.ProofMode.Have -import Lean.Elab.Tactic.Do.ProofMode.Refine +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Delab +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Clear +public import Lean.Elab.Tactic.Do.ProofMode.Intro +public import Lean.Elab.Tactic.Do.ProofMode.Revert +public import Lean.Elab.Tactic.Do.ProofMode.Exact +public import Lean.Elab.Tactic.Do.ProofMode.Assumption +public import Lean.Elab.Tactic.Do.ProofMode.Pure +public import Lean.Elab.Tactic.Do.ProofMode.Frame +public import Lean.Elab.Tactic.Do.ProofMode.LeftRight +public import Lean.Elab.Tactic.Do.ProofMode.Constructor +public import Lean.Elab.Tactic.Do.ProofMode.RenameI +public import Lean.Elab.Tactic.Do.ProofMode.Specialize +public import Lean.Elab.Tactic.Do.ProofMode.Cases +public import Lean.Elab.Tactic.Do.ProofMode.Exfalso +public import Lean.Elab.Tactic.Do.ProofMode.Have +public import Lean.Elab.Tactic.Do.ProofMode.Refine + +public section diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Assumption.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Assumption.lean index 56c2ca202f..d77972f878 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Assumption.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Assumption.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Exact -import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Exact +public import Lean.Elab.Tactic.Do.ProofMode.Focus + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Basic.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Basic.lean index 13e7ec420f..e86cab2338 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Basic.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Basic.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Meta.Basic -import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Std.Tactic.Do.Syntax +public import Lean.Meta.Basic +public import Lean.Elab.Tactic.Do.ProofMode.MGoal + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Cases.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Cases.lean index e18af97b1a..145439d17f 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Cases.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Cases.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Focus -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Pure -import Lean.Elab.Tactic.Do.ProofMode.Intro +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Pure +public import Lean.Elab.Tactic.Do.ProofMode.Intro + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic Lean.Parser.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Clear.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Clear.lean index 31dea56e16..ca37546f81 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Clear.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Clear.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Focus + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Constructor.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Constructor.lean index d7fe93618e..821ce783e3 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Constructor.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Constructor.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Delab.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Delab.lean index b0f8665466..6d60985a5a 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Delab.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Delab.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.PrettyPrinter.Delaborator.Basic +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.PrettyPrinter.Delaborator.Basic + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Exact.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Exact.lean index 1ef51b4d85..983e2fe534 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Exact.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Exact.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Focus -import Lean.Elab.Tactic.ElabTerm +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Exfalso.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Exfalso.lean index 9e83844f4e..85126ed5bf 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Exfalso.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Exfalso.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Basic + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Focus.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Focus.lean index 72685812b3..3c4c23faba 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Focus.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Focus.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.MGoal + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic ProofMode diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Frame.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Frame.lean index 1f1a2253a9..7f25a23153 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Frame.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Frame.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Focus + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Have.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Have.lean index 0f4fe4bd5f..9b9a171d5b 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Have.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Have.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Cases -import Lean.Elab.Tactic.Do.ProofMode.Specialize +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Cases +public import Lean.Elab.Tactic.Do.ProofMode.Specialize + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Intro.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Intro.lean index 1ace356a05..33a261f244 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Intro.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Intro.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Basic + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/LeftRight.lean b/src/Lean/Elab/Tactic/Do/ProofMode/LeftRight.lean index f4c2978588..398711c8c1 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/LeftRight.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/LeftRight.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/MGoal.lean b/src/Lean/Elab/Tactic/Do/ProofMode/MGoal.lean index 501a4fb1b8..3b5d4ac1f0 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/MGoal.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/MGoal.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Do.SPred.DerivedLaws -import Std.Tactic.Do.ProofMode -import Lean.SubExpr -import Lean.Meta.Basic -import Lean.Elab.Tactic.Basic +public import Std.Do.SPred.DerivedLaws +public import Std.Tactic.Do.ProofMode +public import Lean.SubExpr +public import Lean.Meta.Basic +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab.Tactic.Do.ProofMode diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Pure.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Pure.lean index 081857410b..db9524e717 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Pure.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Pure.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Focus + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Refine.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Refine.lean index c64fdaae9e..b8c6f29ff7 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Refine.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Refine.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Focus -import Lean.Elab.Tactic.Do.ProofMode.Assumption -import Lean.Elab.Tactic.Do.ProofMode.Exact +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Lean.Elab.Tactic.Do.ProofMode.Assumption +public import Lean.Elab.Tactic.Do.ProofMode.Exact + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic Lean.Parser.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/RenameI.lean b/src/Lean/Elab/Tactic/Do/ProofMode/RenameI.lean index eaf95224e4..27ee13f237 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/RenameI.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/RenameI.lean @@ -3,9 +3,11 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Basic namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Revert.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Revert.lean index 9e73298af8..987bc7af90 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Revert.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Revert.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.Focus -import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Lean.Elab.Tactic.Do.ProofMode.Basic + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/ProofMode/Specialize.lean b/src/Lean/Elab/Tactic/Do/ProofMode/Specialize.lean index 253cc1b39e..ca77fd6b42 100644 --- a/src/Lean/Elab/Tactic/Do/ProofMode/Specialize.lean +++ b/src/Lean/Elab/Tactic/Do/ProofMode/Specialize.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Std.Tactic.Do.Syntax -import Lean.Elab.Tactic.Do.ProofMode.MGoal -import Lean.Elab.Tactic.Do.ProofMode.Focus -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Pure -import Lean.Elab.Tactic.ElabTerm +public import Std.Tactic.Do.Syntax +public import Lean.Elab.Tactic.Do.ProofMode.MGoal +public import Lean.Elab.Tactic.Do.ProofMode.Focus +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Pure +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.Tactic.Do.ProofMode open Std.Do SPred.Tactic diff --git a/src/Lean/Elab/Tactic/Do/Spec.lean b/src/Lean/Elab/Tactic/Do/Spec.lean index 0af5e0933f..6d779dea8c 100644 --- a/src/Lean/Elab/Tactic/Do/Spec.lean +++ b/src/Lean/Elab/Tactic/Do/Spec.lean @@ -3,14 +3,18 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Intro -import Lean.Elab.Tactic.Do.ProofMode.Pure -import Lean.Elab.Tactic.Do.ProofMode.Frame -import Lean.Elab.Tactic.Do.ProofMode.Assumption -import Lean.Elab.Tactic.Do.Attr -import Std.Do.Triple +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Intro +public import Lean.Elab.Tactic.Do.ProofMode.Pure +public import Lean.Elab.Tactic.Do.ProofMode.Frame +public import Lean.Elab.Tactic.Do.ProofMode.Assumption +public import Lean.Elab.Tactic.Do.Attr +public import Std.Do.Triple + +public section namespace Lean.Elab.Tactic.Do open Lean Elab Tactic Meta diff --git a/src/Lean/Elab/Tactic/Do/Syntax.lean b/src/Lean/Elab/Tactic/Do/Syntax.lean index 0c234300c6..4db477cda5 100644 --- a/src/Lean/Elab/Tactic/Do/Syntax.lean +++ b/src/Lean/Elab/Tactic/Do/Syntax.lean @@ -3,11 +3,15 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König, Mario Carneiro, Sebastian Graf -/ +module + prelude -import Init.NotationExtra -import Lean.Elab.BuiltinNotation -import Std.Do.PostCond -import Std.Do.Triple.Basic +public import Init.NotationExtra +public import Lean.Elab.BuiltinNotation +public import Std.Do.PostCond +public import Std.Do.Triple.Basic + +public section namespace Std.Do @@ -15,7 +19,7 @@ open Lean Parser Meta Elab Term PrettyPrinter Delaborator open Std.Do in @[builtin_delab app.Std.Do.PostCond.total] -private meta def unexpandPostCondTotal : Delab := do +private def unexpandPostCondTotal : Delab := do match ← SubExpr.withAppArg <| delab with | `(fun $xs:term* => $e) => let t ← `(⇓ $xs* => $(← SPred.Notation.unpack e)) @@ -23,7 +27,7 @@ private meta def unexpandPostCondTotal : Delab := do | t => `($(mkIdent ``PostCond.total):term $t) @[inherit_doc Triple, builtin_doc, builtin_term_elab triple] -private meta def elabTriple : TermElab +private def elabTriple : TermElab | `(⦃$P⦄ $x ⦃$Q⦄), _ => do -- In a simple world, this would just be a macro expanding to -- `Triple $x spred($P) spred($Q)`. diff --git a/src/Lean/Elab/Tactic/Do/VCGen.lean b/src/Lean/Elab/Tactic/Do/VCGen.lean index 0898fc8fcb..d7eb76204d 100644 --- a/src/Lean/Elab/Tactic/Do/VCGen.lean +++ b/src/Lean/Elab/Tactic/Do/VCGen.lean @@ -3,22 +3,26 @@ Copyright (c) 2025 Lean FRO LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Init.Guard -import Std.Do.WP -import Std.Do.Triple -import Lean.Meta.Tactic.Split -import Lean.Elab.Tactic.Simp -import Lean.Elab.Tactic.Meta -import Lean.Elab.Tactic.Do.ProofMode.Basic -import Lean.Elab.Tactic.Do.ProofMode.Intro -import Lean.Elab.Tactic.Do.ProofMode.Cases -import Lean.Elab.Tactic.Do.ProofMode.Specialize -import Lean.Elab.Tactic.Do.ProofMode.Pure -import Lean.Elab.Tactic.Do.LetElim -import Lean.Elab.Tactic.Do.Spec -import Lean.Elab.Tactic.Do.Attr -import Lean.Elab.Tactic.Do.Syntax +public import Init.Guard +public import Std.Do.WP +public import Std.Do.Triple +public import Lean.Meta.Tactic.Split +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.Tactic.Meta +public import Lean.Elab.Tactic.Do.ProofMode.Basic +public import Lean.Elab.Tactic.Do.ProofMode.Intro +public import Lean.Elab.Tactic.Do.ProofMode.Cases +public import Lean.Elab.Tactic.Do.ProofMode.Specialize +public import Lean.Elab.Tactic.Do.ProofMode.Pure +public import Lean.Elab.Tactic.Do.LetElim +public import Lean.Elab.Tactic.Do.Spec +public import Lean.Elab.Tactic.Do.Attr +public import Lean.Elab.Tactic.Do.Syntax + +public section namespace Lean.Elab.Tactic.Do diff --git a/src/Lean/Elab/Tactic/Doc.lean b/src/Lean/Elab/Tactic/Doc.lean index 2584af415b..9ecf3a40ed 100644 --- a/src/Lean/Elab/Tactic/Doc.lean +++ b/src/Lean/Elab/Tactic/Doc.lean @@ -3,11 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.DocString -import Lean.Elab.Command -import Lean.Parser.Tactic.Doc -import Lean.Parser.Command +public import Lean.DocString +public import Lean.Elab.Command + +public section namespace Lean.Elab.Tactic.Doc open Lean.Parser.Tactic.Doc diff --git a/src/Lean/Elab/Tactic/ElabTerm.lean b/src/Lean/Elab/Tactic/ElabTerm.lean index ca38935ca7..44c16be5b7 100644 --- a/src/Lean/Elab/Tactic/ElabTerm.lean +++ b/src/Lean/Elab/Tactic/ElabTerm.lean @@ -3,16 +3,20 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Constructor -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.AuxLemma -import Lean.Meta.Tactic.Cleanup -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Rename -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Config -import Lean.Elab.SyntheticMVars +public import Lean.Meta.Tactic.Constructor +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.AuxLemma +public import Lean.Meta.Tactic.Cleanup +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Rename +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Config +public import Lean.Elab.SyntheticMVars + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/ExposeNames.lean b/src/Lean/Elab/Tactic/ExposeNames.lean index 3ef68f5e3a..010181d66b 100644 --- a/src/Lean/Elab/Tactic/ExposeNames.lean +++ b/src/Lean/Elab/Tactic/ExposeNames.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.ExposeNames -import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.ExposeNames +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/Ext.lean b/src/Lean/Elab/Tactic/Ext.lean index b79f921857..2f4c1e9a40 100644 --- a/src/Lean/Elab/Tactic/Ext.lean +++ b/src/Lean/Elab/Tactic/Ext.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Mario Carneiro -/ +module + prelude -import Init.Ext -import Lean.Meta.Tactic.Ext -import Lean.Elab.DeclarationRange -import Lean.Elab.Tactic.RCases -import Lean.Elab.Tactic.Repeat -import Lean.Elab.Tactic.BuiltinTactic -import Lean.Elab.Command -import Lean.Linter.Basic +public import Init.Ext +public import Lean.Meta.Tactic.Ext +public import Lean.Elab.DeclarationRange +public import Lean.Elab.Tactic.RCases +public import Lean.Elab.Tactic.Repeat +public import Lean.Elab.Tactic.BuiltinTactic +public import Lean.Elab.Command +public import Lean.Linter.Basic + +public section /-! # Implementation of the `@[ext]` attribute diff --git a/src/Lean/Elab/Tactic/FalseOrByContra.lean b/src/Lean/Elab/Tactic/FalseOrByContra.lean index 825d259d4a..50cbaa0c48 100644 --- a/src/Lean/Elab/Tactic/FalseOrByContra.lean +++ b/src/Lean/Elab/Tactic/FalseOrByContra.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Tactic.Basic -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Intro +public import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Intro + +public section /-! # `false_or_by_contra` tactic diff --git a/src/Lean/Elab/Tactic/Generalize.lean b/src/Lean/Elab/Tactic/Generalize.lean index c76a4a048e..3475e158fc 100644 --- a/src/Lean/Elab/Tactic/Generalize.lean +++ b/src/Lean/Elab/Tactic/Generalize.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Tactic.Generalize -import Lean.Meta.Check -import Lean.Meta.Tactic.Intro -import Lean.Elab.Binders -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Generalize +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Intro +public import Lean.Elab.Binders +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Grind.lean b/src/Lean/Elab/Tactic/Grind.lean index a6e058fee3..3a1ffe2483 100644 --- a/src/Lean/Elab/Tactic/Grind.lean +++ b/src/Lean/Elab/Tactic/Grind.lean @@ -3,14 +3,19 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Tactics -import Lean.Meta.Tactic.Grind -import Lean.Meta.Tactic.TryThis -import Lean.Elab.Command -import Lean.Elab.MutualDef -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Config +public import Init.Grind.Tactics +public import Lean.Meta.Tactic.Grind +public import Lean.Meta.Tactic.TryThis +public import Lean.Elab.Command +public import Lean.Elab.MutualDef +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Config +meta import Lean.Meta.Tactic.Grind.Parser + +public section namespace Lean.Elab.Tactic open Meta @@ -138,8 +143,8 @@ where def mkGrindParams (config : Grind.Config) (only : Bool) (ps : TSyntaxArray ``Parser.Tactic.grindParam) : MetaM Grind.Params := do let params ← Grind.mkParams config - let ematch ← if only then pure {} else Grind.getEMatchTheorems - let casesTypes ← if only then pure {} else Grind.getCasesTypes + let ematch ← if only then pure default else Grind.getEMatchTheorems + let casesTypes ← if only then pure default else Grind.getCasesTypes let params := { params with ematch, casesTypes } elabGrindParams params ps only diff --git a/src/Lean/Elab/Tactic/Guard.lean b/src/Lean/Elab/Tactic/Guard.lean index 53443b3402..c1f02e5d93 100644 --- a/src/Lean/Elab/Tactic/Guard.lean +++ b/src/Lean/Elab/Tactic/Guard.lean @@ -3,12 +3,16 @@ Copyright (c) 2021 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Leonardo de Moura -/ +module + prelude -import Init.Guard -import Lean.Elab.Command -import Lean.Elab.Tactic.Conv.Basic -import Lean.Meta.Basic -import Lean.Meta.Eval +public import Init.Guard +public import Lean.Elab.Command +public import Lean.Elab.Tactic.Conv.Basic +public import Lean.Meta.Basic +public import Lean.Meta.Eval + +public section namespace Lean.Elab.Tactic.GuardExpr open Meta diff --git a/src/Lean/Elab/Tactic/Induction.lean b/src/Lean/Elab/Tactic/Induction.lean index 2b19bb1735..a96e1079a8 100644 --- a/src/Lean/Elab/Tactic/Induction.lean +++ b/src/Lean/Elab/Tactic/Induction.lean @@ -3,22 +3,26 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Util.CollectFVars -import Lean.AuxRecursor -import Lean.Parser.Term -import Lean.Meta.RecursorInfo -import Lean.Meta.CollectMVars -import Lean.Meta.Tactic.ElimInfo -import Lean.Meta.Tactic.FunIndInfo -import Lean.Meta.Tactic.Induction -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.FunIndCollect -import Lean.Meta.GeneralizeVars -import Lean.Elab.App -import Lean.Elab.Match -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Tactic.Generalize +public import Lean.Util.CollectFVars +public import Lean.AuxRecursor +public import Lean.Parser.Term +public import Lean.Meta.RecursorInfo +public import Lean.Meta.CollectMVars +public import Lean.Meta.Tactic.ElimInfo +public import Lean.Meta.Tactic.FunIndInfo +public import Lean.Meta.Tactic.Induction +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.FunIndCollect +public import Lean.Meta.GeneralizeVars +public import Lean.Elab.App +public import Lean.Elab.Match +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Generalize + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Injection.lean b/src/Lean/Elab/Tactic/Injection.lean index aef74f79fd..ec0edbdd17 100644 --- a/src/Lean/Elab/Tactic/Injection.lean +++ b/src/Lean/Elab/Tactic/Injection.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Injection -import Lean.Meta.Tactic.Assumption -import Lean.Elab.Tactic.ElabTerm +public import Lean.Meta.Tactic.Injection +public import Lean.Meta.Tactic.Assumption +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.Tactic -- optional (" with " >> many1 ident') diff --git a/src/Lean/Elab/Tactic/Lets.lean b/src/Lean/Elab/Tactic/Lets.lean index f72be9c011..02f7ad4144 100644 --- a/src/Lean/Elab/Tactic/Lets.lean +++ b/src/Lean/Elab/Tactic/Lets.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.Tactic.Lets -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Lets +public import Lean.Elab.Tactic.Location + +public section /-! # Tactics to manipulate `let` expressions @@ -34,7 +38,7 @@ def extractLetsAddVarInfo (ids : Array Syntax) (fvars : Array FVarId) : TacticM declare_config_elab elabExtractLetsConfig ExtractLetsConfig -@[builtin_tactic extractLets] elab_rules : tactic +@[builtin_tactic extractLets] def evalExtractLets : Tactic | `(tactic| extract_lets $cfg:optConfig $ids* $[$loc?:location]?) => do let mut config ← elabExtractLetsConfig cfg let givenNames := (ids.map getNameOfIdent').toList @@ -50,6 +54,7 @@ declare_config_elab elabExtractLetsConfig ExtractLetsConfig return (fvars, [mvarId]) extractLetsAddVarInfo ids fvars) (failed := fun _ => throwError "'extract_lets' tactic failed") + | _ => throwUnsupportedSyntax /-! ### `lift_lets` @@ -57,23 +62,25 @@ declare_config_elab elabExtractLetsConfig ExtractLetsConfig declare_config_elab elabLiftLetsConfig LiftLetsConfig -@[builtin_tactic liftLets] elab_rules : tactic +@[builtin_tactic liftLets] def evalLiftLets : Tactic | `(tactic| lift_lets $cfg:optConfig $[$loc?:location]?) => do let mut config ← elabLiftLetsConfig cfg withLocation (expandOptLocation (Lean.mkOptionalNode loc?)) (atLocal := fun h => liftMetaTactic1 fun mvarId => mvarId.liftLetsLocalDecl h config) (atTarget := liftMetaTactic1 fun mvarId => mvarId.liftLets config) (failed := fun _ => throwError "'lift_lets' tactic failed") + | _ => throwUnsupportedSyntax /-! ### `let_to_have` -/ -@[builtin_tactic letToHave] elab_rules : tactic +@[builtin_tactic letToHave] def evalLetToHave : Tactic | `(tactic| let_to_have $[$loc?:location]?) => do withLocation (expandOptLocation (Lean.mkOptionalNode loc?)) (atLocal := fun h => liftMetaTactic1 fun mvarId => mvarId.letToHaveLocalDecl h) (atTarget := liftMetaTactic1 fun mvarId => mvarId.letToHave) (failed := fun _ => throwError "'let_to_have' tactic failed") + | _ => throwUnsupportedSyntax end Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/LibrarySearch.lean b/src/Lean/Elab/Tactic/LibrarySearch.lean index b1d51c06a8..1de4869301 100644 --- a/src/Lean/Elab/Tactic/LibrarySearch.lean +++ b/src/Lean/Elab/Tactic/LibrarySearch.lean @@ -3,10 +3,14 @@ Copyright (c) 2021-2024 Gabriel Ebner and Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Joe Hendrix, Kim Morrison -/ +module + prelude -import Lean.Meta.Tactic.LibrarySearch -import Lean.Meta.Tactic.TryThis -import Lean.Elab.Tactic.ElabTerm +public import Lean.Meta.Tactic.LibrarySearch +public import Lean.Meta.Tactic.TryThis +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.LibrarySearch diff --git a/src/Lean/Elab/Tactic/Location.lean b/src/Lean/Elab/Tactic/Location.lean index 03a9fa8578..dade42253b 100644 --- a/src/Lean/Elab/Tactic/Location.lean +++ b/src/Lean/Elab/Tactic/Location.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.ElabTerm + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/Match.lean b/src/Lean/Elab/Tactic/Match.lean index f95a6fe467..980e87a637 100644 --- a/src/Lean/Elab/Tactic/Match.lean +++ b/src/Lean/Elab/Tactic/Match.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Term -import Lean.Elab.Match -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Induction +public import Lean.Parser.Term +public import Lean.Elab.Match +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Induction + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Meta.lean b/src/Lean/Elab/Tactic/Meta.lean index c6be92112e..de870d3eb8 100644 --- a/src/Lean/Elab/Tactic/Meta.lean +++ b/src/Lean/Elab/Tactic/Meta.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.SyntheticMVars -import Lean.Elab.Tactic.Basic +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab open Term diff --git a/src/Lean/Elab/Tactic/Monotonicity.lean b/src/Lean/Elab/Tactic/Monotonicity.lean index 2111d00aef..725b2f41c6 100644 --- a/src/Lean/Elab/Tactic/Monotonicity.lean +++ b/src/Lean/Elab/Tactic/Monotonicity.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Tactic.Split -import Lean.Elab.RecAppSyntax -import Lean.Elab.Tactic.Basic -import Init.Internal.Order +public import Lean.Meta.Tactic.Split +public import Lean.Elab.RecAppSyntax +public import Lean.Elab.Tactic.Basic +public import Init.Internal.Order + +public section namespace Lean.Meta.Monotonicity @@ -59,7 +63,7 @@ Finds tagged monotonicity theorems of the form `monotone (fun x => e)`. def findMonoThms (e : Expr) : MetaM (Array Name) := do (monotoneExt.getState (← getEnv)).getMatch e -private def defaultFailK (f : Expr) (monoThms : Array Name) : MetaM α := +def defaultFailK (f : Expr) (monoThms : Array Name) : MetaM α := let extraMsg := if monoThms.isEmpty then m!"" else m!"Tried to apply {.andList (monoThms.toList.map (m!"'{·}'"))}, but failed." throwError "Failed to prove monotonicity of:{indentExpr f}\n{extraMsg}" diff --git a/src/Lean/Elab/Tactic/NormCast.lean b/src/Lean/Elab/Tactic/NormCast.lean index 952e6eafe6..813977f432 100644 --- a/src/Lean/Elab/Tactic/NormCast.lean +++ b/src/Lean/Elab/Tactic/NormCast.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Paul-Nicolas Madelaine. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Paul-Nicolas Madelaine, Robert Y. Lewis, Mario Carneiro, Gabriel Ebner -/ +module + prelude -import Lean.Meta.Tactic.NormCast -import Lean.Elab.Tactic.Conv.Simp -import Lean.Elab.ElabRules +public import Lean.Meta.Tactic.NormCast +public import Lean.Elab.Tactic.Conv.Simp +public import Lean.Elab.ElabRules + +public section /-! # The `norm_cast` family of tactics. diff --git a/src/Lean/Elab/Tactic/Omega.lean b/src/Lean/Elab/Tactic/Omega.lean index 481c640bb6..708d3657f2 100644 --- a/src/Lean/Elab/Tactic/Omega.lean +++ b/src/Lean/Elab/Tactic/Omega.lean @@ -3,8 +3,12 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Tactic.Omega.Frontend +public import Lean.Elab.Tactic.Omega.Frontend + +public section /-! # `omega` diff --git a/src/Lean/Elab/Tactic/Omega/Core.lean b/src/Lean/Elab/Tactic/Omega/Core.lean index 5b37c1a251..d33470349a 100644 --- a/src/Lean/Elab/Tactic/Omega/Core.lean +++ b/src/Lean/Elab/Tactic/Omega/Core.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Init.Omega.Constraint -import Lean.Elab.Tactic.Omega.OmegaM -import Lean.Elab.Tactic.Omega.MinNatAbs +public import Init.Omega.Constraint +public import Lean.Elab.Tactic.Omega.OmegaM +public import Lean.Elab.Tactic.Omega.MinNatAbs + +public section namespace Lean.Elab.Tactic.Omega diff --git a/src/Lean/Elab/Tactic/Omega/Frontend.lean b/src/Lean/Elab/Tactic/Omega/Frontend.lean index fb130aa31a..1abc0e886c 100644 --- a/src/Lean/Elab/Tactic/Omega/Frontend.lean +++ b/src/Lean/Elab/Tactic/Omega/Frontend.lean @@ -3,12 +3,16 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Tactic.Omega.Core -import Lean.Elab.Tactic.FalseOrByContra -import Lean.Elab.Tactic.Config -import Lean.Elab.MutualDef -import Lean.Meta.Closure +public import Lean.Elab.Tactic.Omega.Core +public import Lean.Elab.Tactic.FalseOrByContra +public import Lean.Elab.Tactic.Config +public import Lean.Elab.MutualDef +public import Lean.Meta.Closure + +public section /-! # Frontend to the `omega` tactic. diff --git a/src/Lean/Elab/Tactic/Omega/MinNatAbs.lean b/src/Lean/Elab/Tactic/Omega/MinNatAbs.lean index 141c3a06a4..60dd5826f5 100644 --- a/src/Lean/Elab/Tactic/Omega/MinNatAbs.lean +++ b/src/Lean/Elab/Tactic/Omega/MinNatAbs.lean @@ -3,12 +3,16 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Init.BinderPredicates -import Init.Data.Int.Order -import Init.Data.List.MinMax -import Init.Data.Nat.MinMax -import Init.Data.Option.Lemmas +public import Init.BinderPredicates +public import Init.Data.Int.Order +public import Init.Data.List.MinMax +public import Init.Data.Nat.MinMax +public import Init.Data.Option.Lemmas + +public section /-! # `List.nonzeroMinimum`, `List.minNatAbs`, `List.maxNatAbs` @@ -141,7 +145,7 @@ theorem minNatAbs_eq_nonzero_iff (xs : List Int) (w : z ≠ 0) : xs.minNatAbs = z ↔ (∃ y ∈ xs, y.natAbs = z) ∧ (∀ y ∈ xs, z ≤ y.natAbs ∨ y = 0) := by simp [minNatAbs, nonzeroMinimum_eq_nonzero_iff w] -@[simp] theorem minNatAbs_nil : ([] : List Int).minNatAbs = 0 := rfl +@[simp] theorem minNatAbs_nil : ([] : List Int).minNatAbs = 0 := (rfl) /-- The maximum absolute value in a list of integers. -/ def maxNatAbs (xs : List Int) : Nat := xs.map Int.natAbs |>.max? |>.getD 0 diff --git a/src/Lean/Elab/Tactic/Omega/OmegaM.lean b/src/Lean/Elab/Tactic/Omega/OmegaM.lean index 18b3fa8829..457b7c0355 100644 --- a/src/Lean/Elab/Tactic/Omega/OmegaM.lean +++ b/src/Lean/Elab/Tactic/Omega/OmegaM.lean @@ -3,15 +3,19 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Init.Omega.LinearCombo -import Init.Omega.Int -import Init.Omega.Logic -import Init.Data.BitVec.Basic -import Lean.Meta.AppBuilder -import Lean.Meta.Canonicalizer -import Std.Data.HashMap.Basic -import Std.Data.HashSet.Basic +public import Init.Omega.LinearCombo +public import Init.Omega.Int +public import Init.Omega.Logic +public import Init.Data.BitVec.Basic +public import Lean.Meta.AppBuilder +public import Lean.Meta.Canonicalizer +public import Std.Data.HashMap.Basic +public import Std.Data.HashSet.Basic + +public section /-! # The `OmegaM` state monad. @@ -62,7 +66,7 @@ abbrev OmegaM' := StateRefT State (ReaderT Context CanonM) /-- Cache of expressions that have been visited, and their reflection as a linear combination. -/ -def Cache : Type := Std.HashMap Expr (LinearCombo × OmegaM' Expr) +@[expose] def Cache : Type := Std.HashMap Expr (LinearCombo × OmegaM' Expr) /-- The `OmegaM` monad maintains two pieces of state: diff --git a/src/Lean/Elab/Tactic/RCases.lean b/src/Lean/Elab/Tactic/RCases.lean index b367dd78dd..90b6b2724a 100644 --- a/src/Lean/Elab/Tactic/RCases.lean +++ b/src/Lean/Elab/Tactic/RCases.lean @@ -3,8 +3,12 @@ Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Jacob von Raumer -/ +module + prelude -import Lean.Elab.Tactic.Induction +public import Lean.Elab.Tactic.Induction + +public section namespace Lean.Elab.Tactic.RCases open Meta Parser Tactic diff --git a/src/Lean/Elab/Tactic/Repeat.lean b/src/Lean/Elab/Tactic/Repeat.lean index b9757e07ac..8622cf8979 100644 --- a/src/Lean/Elab/Tactic/Repeat.lean +++ b/src/Lean/Elab/Tactic/Repeat.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Kim Morrison -/ +module + prelude -import Lean.Meta.Tactic.Repeat -import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.Repeat +public import Lean.Elab.Tactic.Basic + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/Rewrite.lean b/src/Lean/Elab/Tactic/Rewrite.lean index a77ef9b38e..ec2ceb423e 100644 --- a/src/Lean/Elab/Tactic/Rewrite.lean +++ b/src/Lean/Elab/Tactic/Rewrite.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Replace -import Lean.Elab.Tactic.Location -import Lean.Elab.Tactic.Config +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Replace +public import Lean.Elab.Tactic.Location +public import Lean.Elab.Tactic.Config + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Rewrites.lean b/src/Lean/Elab/Tactic/Rewrites.lean index d7d580214e..c7efb1821f 100644 --- a/src/Lean/Elab/Tactic/Rewrites.lean +++ b/src/Lean/Elab/Tactic/Rewrites.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Tactic.Location -import Lean.Meta.Tactic.Replace -import Lean.Meta.Tactic.Rewrites +public import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.Tactic.Rewrites + +public section /-! # The `rewrites` tactic. diff --git a/src/Lean/Elab/Tactic/Rfl.lean b/src/Lean/Elab/Tactic/Rfl.lean index ce35132f12..72885dcff7 100644 --- a/src/Lean/Elab/Tactic/Rfl.lean +++ b/src/Lean/Elab/Tactic/Rfl.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Newell Jensen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Newell Jensen, Thomas Murrills -/ +module + prelude -import Lean.Meta.Tactic.Rfl -import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.Rfl +public import Lean.Elab.Tactic.Basic + +public section /-! # `rfl` tactic extension for reflexive relations diff --git a/src/Lean/Elab/Tactic/Show.lean b/src/Lean/Elab/Tactic/Show.lean index ff8c3f0089..14ee4b24b8 100644 --- a/src/Lean/Elab/Tactic/Show.lean +++ b/src/Lean/Elab/Tactic/Show.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Robin Arnez. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Robin Arnez -/ +module + prelude -import Lean.Elab.Tactic.Change +public import Lean.Elab.Tactic.Change + +public section namespace Lean.Elab.Tactic open Meta @@ -61,7 +65,8 @@ where is not definitionally equal to the target{indentExpr tgt}\n\ (Errors for other goals omitted)" -@[builtin_tactic «show»] elab_rules : tactic +@[builtin_tactic «show»] def evalShow : Tactic | `(tactic| show $newType:term) => elabShow newType + | _ => throwUnsupportedSyntax end Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/ShowTerm.lean b/src/Lean/Elab/Tactic/ShowTerm.lean index 720f4dd0a9..f66d9937f7 100644 --- a/src/Lean/Elab/Tactic/ShowTerm.lean +++ b/src/Lean/Elab/Tactic/ShowTerm.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison, Mario Carneiro -/ +module + prelude -import Lean.Elab.ElabRules -import Lean.Meta.Tactic.TryThis +public import Lean.Elab.ElabRules +public import Lean.Meta.Tactic.TryThis + +public section namespace Lean.Elab.Tactic.ShowTerm open Lean Elab Term Tactic Meta.Tactic.TryThis Parser.Tactic diff --git a/src/Lean/Elab/Tactic/Simp.lean b/src/Lean/Elab/Tactic/Simp.lean index 8189d6d6db..2f79cc2237 100644 --- a/src/Lean/Elab/Tactic/Simp.lean +++ b/src/Lean/Elab/Tactic/Simp.lean @@ -3,16 +3,20 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp -import Lean.Meta.Tactic.Simp.LoopProtection -import Lean.Meta.Tactic.Replace -import Lean.Meta.Hint -import Lean.Elab.BuiltinNotation -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.ElabTerm -import Lean.Elab.Tactic.Location -import Lean.Elab.Tactic.Config +public import Lean.Meta.Tactic.Simp +public import Lean.Meta.Tactic.Simp.LoopProtection +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.Hint +public import Lean.Elab.BuiltinNotation +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.ElabTerm +public import Lean.Elab.Tactic.Location +public import Lean.Elab.Tactic.Config + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/SimpArith.lean b/src/Lean/Elab/Tactic/SimpArith.lean index 393d68968e..444f66dd32 100644 --- a/src/Lean/Elab/Tactic/SimpArith.lean +++ b/src/Lean/Elab/Tactic/SimpArith.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Elab.Tactic.Simp -import Lean.Meta.Tactic.TryThis +public import Lean.Elab.Tactic.Simp +public import Lean.Meta.Tactic.TryThis + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/SimpTrace.lean b/src/Lean/Elab/Tactic/SimpTrace.lean index 28913ea31e..3921d1a234 100644 --- a/src/Lean/Elab/Tactic/SimpTrace.lean +++ b/src/Lean/Elab/Tactic/SimpTrace.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Elab.ElabRules -import Lean.Elab.Tactic.Simp -import Lean.Meta.Tactic.TryThis +public import Lean.Elab.ElabRules +public import Lean.Elab.Tactic.Simp +public import Lean.Meta.Tactic.TryThis + +public section /-! # `simp?` tactic diff --git a/src/Lean/Elab/Tactic/Simpa.lean b/src/Lean/Elab/Tactic/Simpa.lean index f54d8215a9..5575d49f99 100644 --- a/src/Lean/Elab/Tactic/Simpa.lean +++ b/src/Lean/Elab/Tactic/Simpa.lean @@ -3,12 +3,16 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Arthur Paulino, Gabriel Ebner, Mario Carneiro -/ +module + prelude -import Lean.Meta.Tactic.Assumption -import Lean.Meta.Tactic.TryThis -import Lean.Elab.Tactic.Simp -import Lean.Elab.App -import Lean.Linter.Basic +public import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Tactic.TryThis +public import Lean.Elab.Tactic.Simp +public import Lean.Elab.App +public import Lean.Linter.Basic + +public section /-- Enables the 'unnecessary `simpa`' linter. This will report if a use of diff --git a/src/Lean/Elab/Tactic/Simproc.lean b/src/Lean/Elab/Tactic/Simproc.lean index 1412e50701..99b3f803c6 100644 --- a/src/Lean/Elab/Tactic/Simproc.lean +++ b/src/Lean/Elab/Tactic/Simproc.lean @@ -3,14 +3,18 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Simproc -import Lean.ReservedNameAction -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Elab.Binders -import Lean.Elab.SyntheticMVars -import Lean.Elab.Term -import Lean.Elab.Command +public import Init.Simproc +public import Lean.ReservedNameAction +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Elab.Binders +public import Lean.Elab.SyntheticMVars +public import Lean.Elab.Term +public import Lean.Elab.Command + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/Tactic/SolveByElim.lean b/src/Lean/Elab/Tactic/SolveByElim.lean index 6c8e88c4fc..aab7d4f7c4 100644 --- a/src/Lean/Elab/Tactic/SolveByElim.lean +++ b/src/Lean/Elab/Tactic/SolveByElim.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison, David Renshaw -/ +module + prelude -import Lean.Meta.Tactic.SolveByElim -import Lean.Elab.Tactic.Config +public import Lean.Meta.Tactic.SolveByElim +public import Lean.Elab.Tactic.Config + +public section namespace Lean.Elab.Tactic.SolveByElim open Meta diff --git a/src/Lean/Elab/Tactic/Split.lean b/src/Lean/Elab/Tactic/Split.lean index ff5357c2e8..be2380c12a 100644 --- a/src/Lean/Elab/Tactic/Split.lean +++ b/src/Lean/Elab/Tactic/Split.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Hint -import Lean.Meta.Tactic.Split -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Location +public import Lean.Meta.Hint +public import Lean.Meta.Tactic.Split +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Symm.lean b/src/Lean/Elab/Tactic/Symm.lean index 42a344b16f..9d81db1ef8 100644 --- a/src/Lean/Elab/Tactic/Symm.lean +++ b/src/Lean/Elab/Tactic/Symm.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Siddhartha Gadgil. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Siddhartha Gadgil, Mario Carneiro, Kim Morrison -/ +module + prelude -import Lean.Meta.Tactic.Symm -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Symm +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic diff --git a/src/Lean/Elab/Tactic/TreeTacAttr.lean b/src/Lean/Elab/Tactic/TreeTacAttr.lean index 2a31c9d3d2..ab24333865 100644 --- a/src/Lean/Elab/Tactic/TreeTacAttr.lean +++ b/src/Lean/Elab/Tactic/TreeTacAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Paul Reichert -/ +module + prelude -import Lean.Meta.Tactic.Simp +public import Lean.Meta.Tactic.Simp + +public section open Lean.Meta diff --git a/src/Lean/Elab/Tactic/Try.lean b/src/Lean/Elab/Tactic/Try.lean index acb1b61b7e..7fe0230904 100644 --- a/src/Lean/Elab/Tactic/Try.lean +++ b/src/Lean/Elab/Tactic/Try.lean @@ -3,16 +3,20 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Try -import Init.Grind.Tactics -import Lean.Meta.Tactic.ExposeNames -import Lean.Meta.Tactic.Try -import Lean.Meta.Tactic.TryThis -import Lean.Elab.Tactic.Config -import Lean.Elab.Tactic.SimpTrace -import Lean.Elab.Tactic.LibrarySearch -import Lean.Elab.Tactic.Grind +public import Init.Try +public import Init.Grind.Tactics +public import Lean.Meta.Tactic.ExposeNames +public import Lean.Meta.Tactic.Try +public import Lean.Meta.Tactic.TryThis +public import Lean.Elab.Tactic.Config +public import Lean.Elab.Tactic.SimpTrace +public import Lean.Elab.Tactic.LibrarySearch +public import Lean.Elab.Tactic.Grind + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Tactic/Unfold.lean b/src/Lean/Elab/Tactic/Unfold.lean index d62c6e8b21..3da7816846 100644 --- a/src/Lean/Elab/Tactic/Unfold.lean +++ b/src/Lean/Elab/Tactic/Unfold.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Unfold -import Lean.Elab.Tactic.Basic -import Lean.Elab.Tactic.Location +public import Lean.Meta.Tactic.Unfold +public import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Location + +public section namespace Lean.Elab.Tactic open Meta diff --git a/src/Lean/Elab/Term.lean b/src/Lean/Elab/Term.lean index d2d7253c00..13b393a014 100644 --- a/src/Lean/Elab/Term.lean +++ b/src/Lean/Elab/Term.lean @@ -3,21 +3,26 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.ReservedNameAction -import Lean.Meta.AppBuilder -import Lean.Meta.CollectMVars -import Lean.Meta.Coe -import Lean.Util.CollectLevelMVars -import Lean.Linter.Deprecated -import Lean.Elab.Config -import Lean.Elab.Level -import Lean.Elab.DeclModifiers -import Lean.Elab.PreDefinition.TerminationHint -import Lean.Elab.DeclarationRange -import Lean.Elab.WhereFinally -import Lean.Language.Basic -import Lean.Elab.InfoTree.InlayHints +public import Lean.ReservedNameAction +public import Lean.Meta.AppBuilder +public import Lean.Meta.CollectMVars +public import Lean.Meta.Coe +public import Lean.Util.CollectLevelMVars +public import Lean.Linter.Deprecated +public import Lean.Elab.Config +public import Lean.Elab.Level +public import Lean.Elab.DeclModifiers +public import Lean.Elab.PreDefinition.TerminationHint +public import Lean.Elab.DeclarationRange +public import Lean.Elab.WhereFinally +public import Lean.Language.Basic +public import Lean.Elab.InfoTree.InlayHints +public meta import Lean.Parser.Term + +public section namespace Lean.Elab diff --git a/src/Lean/Elab/Time.lean b/src/Lean/Elab/Time.lean index 3d8604725b..ca353988a9 100644 --- a/src/Lean/Elab/Time.lean +++ b/src/Lean/Elab/Time.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Elab.Command +public import Lean.Elab.Command + +public section /-! # Defines `#time` command. diff --git a/src/Lean/Elab/Util.lean b/src/Lean/Elab/Util.lean index 41b42365fc..08b96554e2 100644 --- a/src/Lean/Elab/Util.lean +++ b/src/Lean/Elab/Util.lean @@ -3,10 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Command -import Lean.KeyedDeclsAttribute -import Lean.Elab.Exception +import Lean.Parser.Extension +meta import Lean.Parser.Command +public import Lean.KeyedDeclsAttribute +public import Lean.Elab.Exception + +public section namespace Lean diff --git a/src/Lean/Elab/WhereFinally.lean b/src/Lean/Elab/WhereFinally.lean index 4a18f151be..fd54d7f029 100644 --- a/src/Lean/Elab/WhereFinally.lean +++ b/src/Lean/Elab/WhereFinally.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Graf -/ +module + prelude -import Lean.Parser.Term +public import Lean.Parser.Term + +public section namespace Lean.Elab diff --git a/src/Lean/EnvExtension.lean b/src/Lean/EnvExtension.lean index 7d13d60a30..2837d96016 100644 --- a/src/Lean/EnvExtension.lean +++ b/src/Lean/EnvExtension.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Environment +public import Lean.Environment + +public section /-! Further environment extension API; the primitives live in `Lean.Environment`. -/ namespace Lean /-- Simple `PersistentEnvExtension` that implements `exportEntriesFn` using a list of entries. -/ -def SimplePersistentEnvExtension (α σ : Type) := PersistentEnvExtension α α (List α × σ) +@[expose] def SimplePersistentEnvExtension (α σ : Type) := PersistentEnvExtension α α (List α × σ) @[specialize] def mkStateFromImportedEntries {α σ : Type} (addEntryFn : σ → α → σ) (initState : σ) (as : Array (Array α)) : σ := as.foldl (fun r es => es.foldl (fun r e => addEntryFn r e) r) initState @@ -87,7 +91,7 @@ end SimplePersistentEnvExtension /-- Environment extension for tagging declarations. Declarations must only be tagged in the module where they were declared. -/ -def TagDeclarationExtension := SimplePersistentEnvExtension Name NameSet +@[expose] def TagDeclarationExtension := SimplePersistentEnvExtension Name NameSet def mkTagDeclarationExtension (name : Name := by exact decl_name%) (asyncMode : EnvExtension.AsyncMode := .mainOnly) : IO TagDeclarationExtension := diff --git a/src/Lean/Environment.lean b/src/Lean/Environment.lean index eb87c5886f..4976ac783f 100644 --- a/src/Lean/Environment.lean +++ b/src/Lean/Environment.lean @@ -3,25 +3,30 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Control.StateRef -import Init.Data.Array.BinSearch -import Init.Data.Stream -import Init.System.Promise -import Lean.ImportingFlag -import Lean.Data.NameTrie -import Lean.Data.SMap -import Lean.Setup -import Lean.Declaration -import Lean.LocalContext -import Lean.Util.Path -import Lean.Util.FindExpr -import Lean.Util.Profile -import Lean.Util.InstantiateLevelParams -import Lean.Util.FoldConsts -import Lean.PrivateName -import Lean.LoadDynlib -import Init.Dynamic +public import Init.Control.StateRef +public import Init.Data.Array.BinSearch +public import Init.Data.Stream +public import Init.System.Promise +public import Lean.ImportingFlag +public import Lean.Data.NameTrie +public import Lean.Data.SMap +public import Lean.Setup +public import Lean.Declaration +public import Lean.LocalContext +public import Lean.Util.Path +public import Lean.Util.FindExpr +public import Lean.Util.Profile +public import Lean.Util.InstantiateLevelParams +public import Lean.Util.FoldConsts +public import Lean.PrivateName +public import Lean.LoadDynlib +public import Init.Dynamic +import Init.Data.Slice + +public section /-! # Note [Environment Branches] @@ -75,10 +80,10 @@ register_builtin_option debug.skipKernelTC : Bool := { /-- Opaque environment extension state. -/ opaque EnvExtensionStateSpec : (α : Type) × Inhabited α := ⟨Unit, ⟨()⟩⟩ -def EnvExtensionState : Type := EnvExtensionStateSpec.fst +@[expose] def EnvExtensionState : Type := EnvExtensionStateSpec.fst instance : Inhabited EnvExtensionState := EnvExtensionStateSpec.snd -def ModuleIdx := Nat +@[expose] def ModuleIdx := Nat deriving BEq, ToString abbrev ModuleIdx.toNat (midx : ModuleIdx) : Nat := midx @@ -98,7 +103,7 @@ abbrev ConstMap := SMap Name ConstantInfo A compacted region holds multiple Lean objects in a contiguous memory region, which can be read/written to/from disk. Objects inside the region do not have reference counters and cannot be freed individually. The contents of .olean files are compacted regions. -/ -def CompactedRegion := USize +@[expose] def CompactedRegion := USize @[extern "lean_compacted_region_is_memory_mapped"] opaque CompactedRegion.isMemoryMapped : CompactedRegion → Bool @@ -113,7 +118,7 @@ unsafe opaque CompactedRegion.free : CompactedRegion → IO Unit /-- Opaque persistent environment extension entry. -/ opaque EnvExtensionEntrySpec : NonemptyType.{0} -def EnvExtensionEntry : Type := EnvExtensionEntrySpec.type +@[expose] def EnvExtensionEntry : Type := EnvExtensionEntrySpec.type instance : Nonempty EnvExtensionEntry := EnvExtensionEntrySpec.property /-- Content of a .olean file. @@ -556,13 +561,13 @@ structure Environment where identical to `base.extensions` in other contexts. Access via `getModuleEntries (level := .server)`. -/ - private serverBaseExts : Array EnvExtensionState := base.private.extensions + private serverBaseExts : Array EnvExtensionState := private_decl% base.private.extensions /-- Kernel environment task that is fulfilled when all asynchronously elaborated declarations are finished, containing the resulting environment. Also collects the environment extension state of all environment branches that contributed contained declarations. -/ - checked : Task Kernel.Environment := .pure base.private + checked : Task Kernel.Environment := private_decl% (.pure base.private) /-- Container of asynchronously elaborated declarations. For consistency, `Lean.addDecl` makes sure this contains constants added even synchronously, i.e. `base ⨃ asyncConsts` is the set of @@ -1903,6 +1908,7 @@ private def ImportedModule.loadIRData? (self : ImportedModule) (arts : NameMap I structure ImportState where private moduleNameMap : Std.HashMap Name ImportedModule := {} private moduleNames : Array Name := #[] +deriving Inhabited def throwAlreadyImported (s : ImportState) (const2ModIdx : Std.HashMap Name ModuleIdx) (modIdx : Nat) (cname : Name) : IO α := do let modName := s.moduleNames[modIdx]! @@ -1911,7 +1917,7 @@ def throwAlreadyImported (s : ImportState) (const2ModIdx : Std.HashMap Name Modu abbrev ImportStateM := StateRefT ImportState IO -@[inline] nonrec def ImportStateM.run (x : ImportStateM α) (s : ImportState := {}) : IO (α × ImportState) := +@[inline] nonrec def ImportStateM.run (x : ImportStateM α) (s : ImportState := default) : IO (α × ImportState) := x.run s private def findOLeanParts (mod : Name) : IO (Array System.FilePath) := do diff --git a/src/Lean/ErrorExplanation.lean b/src/Lean/ErrorExplanation.lean index 3a1e7130c0..8756c95479 100644 --- a/src/Lean/ErrorExplanation.lean +++ b/src/Lean/ErrorExplanation.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.Message -import Lean.EnvExtension -import Lean.DocString.Links +public import Lean.Message +public import Lean.EnvExtension +public import Lean.DocString.Links + +public section namespace Lean diff --git a/src/Lean/ErrorExplanations.lean b/src/Lean/ErrorExplanations.lean index dd4dd62d6e..04701e73e1 100644 --- a/src/Lean/ErrorExplanations.lean +++ b/src/Lean/ErrorExplanations.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanations.CtorResultingTypeMismatch -import Lean.ErrorExplanations.DependsOnNoncomputable -import Lean.ErrorExplanations.InductiveParamMismatch -import Lean.ErrorExplanations.InductiveParamMissing -import Lean.ErrorExplanations.InferBinderTypeFailed -import Lean.ErrorExplanations.InferDefTypeFailed -import Lean.ErrorExplanations.InvalidDottedIdent -import Lean.ErrorExplanations.RedundantMatchAlt -import Lean.ErrorExplanations.UnknownIdentifier +public import Lean.ErrorExplanations.CtorResultingTypeMismatch +public import Lean.ErrorExplanations.DependsOnNoncomputable +public import Lean.ErrorExplanations.InductiveParamMismatch +public import Lean.ErrorExplanations.InductiveParamMissing +public import Lean.ErrorExplanations.InferBinderTypeFailed +public import Lean.ErrorExplanations.InferDefTypeFailed +public import Lean.ErrorExplanations.InvalidDottedIdent +public import Lean.ErrorExplanations.RedundantMatchAlt +public import Lean.ErrorExplanations.UnknownIdentifier + +public section diff --git a/src/Lean/ErrorExplanations/CtorResultingTypeMismatch.lean b/src/Lean/ErrorExplanations/CtorResultingTypeMismatch.lean index 4899960e05..8c91df8314 100644 --- a/src/Lean/ErrorExplanations/CtorResultingTypeMismatch.lean +++ b/src/Lean/ErrorExplanations/CtorResultingTypeMismatch.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- In an inductive declaration, the resulting type of each constructor must match the type being diff --git a/src/Lean/ErrorExplanations/DependsOnNoncomputable.lean b/src/Lean/ErrorExplanations/DependsOnNoncomputable.lean index cc4e995020..d73882de3f 100644 --- a/src/Lean/ErrorExplanations/DependsOnNoncomputable.lean +++ b/src/Lean/ErrorExplanations/DependsOnNoncomputable.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error indicates that the specified definition depends on one or more definitions that do not diff --git a/src/Lean/ErrorExplanations/InductiveParamMismatch.lean b/src/Lean/ErrorExplanations/InductiveParamMismatch.lean index 4f45267d00..e528ac3885 100644 --- a/src/Lean/ErrorExplanations/InductiveParamMismatch.lean +++ b/src/Lean/ErrorExplanations/InductiveParamMismatch.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error occurs when a parameter of an inductive type is not uniform in an inductive diff --git a/src/Lean/ErrorExplanations/InductiveParamMissing.lean b/src/Lean/ErrorExplanations/InductiveParamMissing.lean index a9d01c95f3..b1fb7a06d6 100644 --- a/src/Lean/ErrorExplanations/InductiveParamMissing.lean +++ b/src/Lean/ErrorExplanations/InductiveParamMissing.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error occurs when an inductive type constructor is partially applied in the type of one of its diff --git a/src/Lean/ErrorExplanations/InferBinderTypeFailed.lean b/src/Lean/ErrorExplanations/InferBinderTypeFailed.lean index 24f0ab71f3..328d41080e 100644 --- a/src/Lean/ErrorExplanations/InferBinderTypeFailed.lean +++ b/src/Lean/ErrorExplanations/InferBinderTypeFailed.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error occurs when the type of a binder in a declaration header or local binding is not fully diff --git a/src/Lean/ErrorExplanations/InferDefTypeFailed.lean b/src/Lean/ErrorExplanations/InferDefTypeFailed.lean index 2f0c4f033b..0147e9da6d 100644 --- a/src/Lean/ErrorExplanations/InferDefTypeFailed.lean +++ b/src/Lean/ErrorExplanations/InferDefTypeFailed.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error occurs when the type of a definition is not fully specified and Lean is unable to infer diff --git a/src/Lean/ErrorExplanations/InvalidDottedIdent.lean b/src/Lean/ErrorExplanations/InvalidDottedIdent.lean index 6eaa6f0001..27247a4bba 100644 --- a/src/Lean/ErrorExplanations/InvalidDottedIdent.lean +++ b/src/Lean/ErrorExplanations/InvalidDottedIdent.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error indicates that dotted identifier notation was used in an invalid or unsupported context. diff --git a/src/Lean/ErrorExplanations/RedundantMatchAlt.lean b/src/Lean/ErrorExplanations/RedundantMatchAlt.lean index 4af781a4ce..dd5db1ee52 100644 --- a/src/Lean/ErrorExplanations/RedundantMatchAlt.lean +++ b/src/Lean/ErrorExplanations/RedundantMatchAlt.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation + +public section /-- This error occurs when an alternative in a pattern match can never be reached: any values that would diff --git a/src/Lean/ErrorExplanations/UnknownIdentifier.lean b/src/Lean/ErrorExplanations/UnknownIdentifier.lean index 86461cf3c4..5f22133670 100644 --- a/src/Lean/ErrorExplanations/UnknownIdentifier.lean +++ b/src/Lean/ErrorExplanations/UnknownIdentifier.lean @@ -3,8 +3,10 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.ErrorExplanation +public import Lean.ErrorExplanation /-- This error means that Lean was unable to find a variable or constant matching the given name. More @@ -42,7 +44,9 @@ def inventory := Unknown constant `Std.HashSet.ofList` ``` ```lean fixed -import Std.Data.HashSet.Basic +public import Std.Data.HashSet.Basic + +public section def inventory := Std.HashSet.ofList [("apples", 3), ("bananas", 4)] diff --git a/src/Lean/Exception.lean b/src/Lean/Exception.lean index ce3ba0e350..c25c56d50f 100644 --- a/src/Lean/Exception.lean +++ b/src/Lean/Exception.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Message -import Lean.InternalExceptionId -import Lean.Data.Options -import Lean.Util.MonadCache +public import Lean.Message +public import Lean.InternalExceptionId +public import Lean.Data.Options +public import Lean.Util.MonadCache -- This import is necessary to ensure that any users of the `throwNamedError` macros have access to -- all declared explanations: -import Lean.ErrorExplanations +public import Lean.ErrorExplanations + +public section namespace Lean diff --git a/src/Lean/Expr.lean b/src/Lean/Expr.lean index 188a620263..ebbefc32a3 100644 --- a/src/Lean/Expr.lean +++ b/src/Lean/Expr.lean @@ -3,14 +3,18 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Hashable -import Init.Data.Int -import Lean.Data.KVMap -import Lean.Data.SMap -import Lean.Level -import Std.Data.HashSet.Basic -import Std.Data.TreeSet.Basic +public import Init.Data.Hashable +public import Init.Data.Int +public import Lean.Data.KVMap +public import Lean.Data.SMap +public import Lean.Level +public import Std.Data.HashSet.Basic +public import Std.Data.TreeSet.Basic + +public section namespace Lean @@ -129,7 +133,7 @@ Cached hash code, cached results, and other data for `Expr`. Remark: this is mostly an internal datastructure used to implement `Expr`, most will never have to use it. -/ -def Expr.Data := UInt64 +@[expose] def Expr.Data := UInt64 instance: Inhabited Expr.Data := inferInstanceAs (Inhabited UInt64) @@ -216,7 +220,7 @@ instance : Repr FVarId where /-- A set of unique free variable identifiers. This is a persistent data structure implemented using `Std.TreeSet`. -/ -def FVarIdSet := Std.TreeSet FVarId (Name.quickCmp ·.name ·.name) +@[expose] def FVarIdSet := Std.TreeSet FVarId (Name.quickCmp ·.name ·.name) deriving Inhabited, EmptyCollection instance : ForIn m FVarIdSet FVarId := inferInstanceAs (ForIn _ (Std.TreeSet _ _) ..) @@ -237,13 +241,13 @@ def FVarIdSet.ofArray (l : Array FVarId) : FVarIdSet := A set of unique free variable identifiers implemented using hashtables. Hashtables are faster than red-black trees if they are used linearly. They are not persistent data-structures. -/ -def FVarIdHashSet := Std.HashSet FVarId +@[expose] def FVarIdHashSet := Std.HashSet FVarId deriving Inhabited, EmptyCollection /-- A mapping from free variable identifiers to values of type `α`. This is a persistent data structure implemented using `Std.TreeMap`. -/ -def FVarIdMap (α : Type) := Std.TreeMap FVarId α (Name.quickCmp ·.name ·.name) +@[expose] def FVarIdMap (α : Type) := Std.TreeMap FVarId α (Name.quickCmp ·.name ·.name) def FVarIdMap.insert (s : FVarIdMap α) (fvarId : FVarId) (a : α) : FVarIdMap α := Std.TreeMap.insert s fvarId a @@ -261,7 +265,7 @@ structure MVarId where instance : Repr MVarId where reprPrec n p := reprPrec n.name p -def MVarIdSet := Std.TreeSet MVarId (Name.quickCmp ·.name ·.name) +@[expose] def MVarIdSet := Std.TreeSet MVarId (Name.quickCmp ·.name ·.name) deriving Inhabited, EmptyCollection def MVarIdSet.insert (s : MVarIdSet) (mvarId : MVarId) : MVarIdSet := @@ -275,7 +279,7 @@ def MVarIdSet.ofArray (l : Array MVarId) : MVarIdSet := instance : ForIn m MVarIdSet MVarId := inferInstanceAs (ForIn _ (Std.TreeSet _ _) ..) -def MVarIdMap (α : Type) := Std.TreeMap MVarId α (Name.quickCmp ·.name ·.name) +@[expose] def MVarIdMap (α : Type) := Std.TreeMap MVarId α (Name.quickCmp ·.name ·.name) def MVarIdMap.insert (s : MVarIdMap α) (mvarId : MVarId) (a : α) : MVarIdMap α := Std.TreeMap.insert s mvarId a @@ -660,7 +664,7 @@ def mkProj (structName : Name) (idx : Nat) (struct : Expr) : Expr := /-- `.app f a` is now the preferred form. -/ -@[match_pattern] def mkApp (f a : Expr) : Expr := +@[match_pattern, expose] def mkApp (f a : Expr) : Expr := .app f a /-- @@ -691,16 +695,16 @@ def mkSimpleThunk (type : Expr) : Expr := @[inline] def mkHave (x : Name) (t : Expr) (v : Expr) (b : Expr) : Expr := .letE x t v b true -@[match_pattern] def mkAppB (f a b : Expr) := mkApp (mkApp f a) b -@[match_pattern] def mkApp2 (f a b : Expr) := mkAppB f a b -@[match_pattern] def mkApp3 (f a b c : Expr) := mkApp (mkAppB f a b) c -@[match_pattern] def mkApp4 (f a b c d : Expr) := mkAppB (mkAppB f a b) c d -@[match_pattern] def mkApp5 (f a b c d e : Expr) := mkApp (mkApp4 f a b c d) e -@[match_pattern] def mkApp6 (f a b c d e₁ e₂ : Expr) := mkAppB (mkApp4 f a b c d) e₁ e₂ -@[match_pattern] def mkApp7 (f a b c d e₁ e₂ e₃ : Expr) := mkApp3 (mkApp4 f a b c d) e₁ e₂ e₃ -@[match_pattern] def mkApp8 (f a b c d e₁ e₂ e₃ e₄ : Expr) := mkApp4 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ -@[match_pattern] def mkApp9 (f a b c d e₁ e₂ e₃ e₄ e₅ : Expr) := mkApp5 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ e₅ -@[match_pattern] def mkApp10 (f a b c d e₁ e₂ e₃ e₄ e₅ e₆ : Expr) := mkApp6 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ e₅ e₆ +@[match_pattern, expose] def mkAppB (f a b : Expr) := mkApp (mkApp f a) b +@[match_pattern, expose] def mkApp2 (f a b : Expr) := mkAppB f a b +@[match_pattern, expose] def mkApp3 (f a b c : Expr) := mkApp (mkAppB f a b) c +@[match_pattern, expose] def mkApp4 (f a b c d : Expr) := mkAppB (mkAppB f a b) c d +@[match_pattern, expose] def mkApp5 (f a b c d e : Expr) := mkApp (mkApp4 f a b c d) e +@[match_pattern, expose] def mkApp6 (f a b c d e₁ e₂ : Expr) := mkAppB (mkApp4 f a b c d) e₁ e₂ +@[match_pattern, expose] def mkApp7 (f a b c d e₁ e₂ e₃ : Expr) := mkApp3 (mkApp4 f a b c d) e₁ e₂ e₃ +@[match_pattern, expose] def mkApp8 (f a b c d e₁ e₂ e₃ e₄ : Expr) := mkApp4 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ +@[match_pattern, expose] def mkApp9 (f a b c d e₁ e₂ e₃ e₄ e₅ : Expr) := mkApp5 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ e₅ +@[match_pattern, expose] def mkApp10 (f a b c d e₁ e₂ e₃ e₄ e₅ e₆ : Expr) := mkApp6 (mkApp4 f a b c d) e₁ e₂ e₃ e₄ e₅ e₆ /-- `.lit l` is now the preferred form. @@ -866,7 +870,7 @@ def isFVarOf : Expr → FVarId → Bool | _, _ => false /-- Return `true` if the given expression is a forall-expression aka (dependent) arrow. -/ -def isForall : Expr → Bool +@[expose] def isForall : Expr → Bool | forallE .. => true | _ => false diff --git a/src/Lean/HeadIndex.lean b/src/Lean/HeadIndex.lean index dee9c91f50..54ffe7f780 100644 --- a/src/Lean/HeadIndex.lean +++ b/src/Lean/HeadIndex.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Hygiene.lean b/src/Lean/Hygiene.lean index d0ce1bc118..3d5d614d15 100644 --- a/src/Lean/Hygiene.lean +++ b/src/Lean/Hygiene.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Data.Name -import Lean.Data.Options -import Lean.Data.Format +public import Lean.Data.Name +public import Lean.Data.Options +public import Lean.Data.Format + +public section namespace Lean /-! Remark: `MonadQuotation` class is part of the `Init` package and loaded by default since it is used in the builtin command `macro`. -/ diff --git a/src/Lean/ImportingFlag.lean b/src/Lean/ImportingFlag.lean index b8a685fa81..df9b380487 100644 --- a/src/Lean/ImportingFlag.lean +++ b/src/Lean/ImportingFlag.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section namespace Lean private builtin_initialize importingRef : IO.Ref Bool ← IO.mkRef false diff --git a/src/Lean/InternalExceptionId.lean b/src/Lean/InternalExceptionId.lean index 7e67b62969..c498628f79 100644 --- a/src/Lean/InternalExceptionId.lean +++ b/src/Lean/InternalExceptionId.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section namespace Lean /-- Internal exception identifier -/ diff --git a/src/Lean/KeyedDeclsAttribute.lean b/src/Lean/KeyedDeclsAttribute.lean index bcc608cd31..cfd981892e 100644 --- a/src/Lean/KeyedDeclsAttribute.lean +++ b/src/Lean/KeyedDeclsAttribute.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Compiler.InitAttr -import Lean.ScopedEnvExtension -import Lean.Compiler.IR.CompilerM +public import Lean.Compiler.InitAttr +public import Lean.ScopedEnvExtension +public import Lean.Compiler.IR.CompilerM + +public section /-! A builder for attributes that are applied to declarations of a common type and diff --git a/src/Lean/LabelAttribute.lean b/src/Lean/LabelAttribute.lean index 43d79e31b8..83904c1bb3 100644 --- a/src/Lean/LabelAttribute.lean +++ b/src/Lean/LabelAttribute.lean @@ -3,9 +3,14 @@ Copyright (c) 2023 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.DocString +public import Lean.ScopedEnvExtension +public import Lean.DocString +public meta import Init.Data.String.Extra + +public section /-! # "Label" attributes diff --git a/src/Lean/Language/Basic.lean b/src/Lean/Language/Basic.lean index 76e88c5e8a..023a40376c 100644 --- a/src/Lean/Language/Basic.lean +++ b/src/Lean/Language/Basic.lean @@ -8,10 +8,14 @@ driver. See the [server readme](../Server/README.md#worker-architecture) for an Authors: Sebastian Ullrich -/ +module + prelude -import Init.System.Promise -import Lean.Parser.Types -import Lean.Util.Trace +public import Init.System.Promise +public import Lean.Parser.Types +public import Lean.Util.Trace + +public section set_option linter.missingDocs true diff --git a/src/Lean/Language/Lean.lean b/src/Lean/Language/Lean.lean index 24250fdd95..e7f919dd1f 100644 --- a/src/Lean/Language/Lean.lean +++ b/src/Lean/Language/Lean.lean @@ -8,12 +8,16 @@ recompilation Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Language.Basic -import Lean.Language.Util -import Lean.Language.Lean.Types -import Lean.Parser.Module -import Lean.Elab.Import +public import Lean.Language.Basic +public import Lean.Language.Util +public import Lean.Language.Lean.Types +public import Lean.Parser.Module +public import Lean.Elab.Import + +public section /-! # Note [Incremental Parsing] diff --git a/src/Lean/Language/Lean/Types.lean b/src/Lean/Language/Lean/Types.lean index 316ad4f7b9..344263098b 100644 --- a/src/Lean/Language/Lean/Types.lean +++ b/src/Lean/Language/Lean/Types.lean @@ -8,9 +8,13 @@ recompilation Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Language.Basic -import Lean.Elab.Command +public import Lean.Language.Basic +public import Lean.Elab.Command + +public section set_option linter.missingDocs true @@ -18,7 +22,8 @@ namespace Lean.Language.Lean open Lean.Elab Command open Lean.Parser -private def pushOpt (a? : Option α) (as : Array α) : Array α := +/-- Pushes `a?` into the array if it is `some`. -/ +def pushOpt (a? : Option α) (as : Array α) : Array α := match a? with | some a => as.push a | none => as diff --git a/src/Lean/Language/Util.lean b/src/Lean/Language/Util.lean index e9a1875758..daeb7939a7 100644 --- a/src/Lean/Language/Util.lean +++ b/src/Lean/Language/Util.lean @@ -7,10 +7,14 @@ Additional snapshot functionality that needs further imports. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Language.Basic -import Lean.CoreM -import Lean.Elab.InfoTree +public import Lean.Language.Basic +public import Lean.CoreM +public import Lean.Elab.InfoTree + +public section namespace Lean.Language diff --git a/src/Lean/Level.lean b/src/Lean/Level.lean index 158559db64..a9d5fe5e22 100644 --- a/src/Lean/Level.lean +++ b/src/Lean/Level.lean @@ -3,15 +3,19 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Array.QSort -import Lean.Data.PersistentHashMap -import Lean.Data.PersistentHashSet -import Lean.Hygiene -import Lean.Data.Name -import Lean.Data.Format -import Init.Data.Option.Coe -import Std.Data.TreeSet.Basic +public import Init.Data.Array.QSort +public import Lean.Data.PersistentHashMap +public import Lean.Data.PersistentHashSet +public import Lean.Hygiene +public import Lean.Data.Name +public import Lean.Data.Format +public import Init.Data.Option.Coe +public import Std.Data.TreeSet.Basic + +public section def Nat.imax (n m : Nat) : Nat := if m = 0 then 0 else Nat.max n m @@ -24,7 +28,7 @@ namespace Lean hasMVar : 1-bit hasParam : 1-bit depth : 24-bits -/ -def Level.Data := UInt64 +@[expose] def Level.Data := UInt64 instance : Inhabited Level.Data := inferInstanceAs (Inhabited UInt64) @@ -71,12 +75,12 @@ abbrev LMVarId := LevelMVarId instance : Repr LMVarId where reprPrec n p := reprPrec n.name p -def LMVarIdSet := Std.TreeSet LMVarId (Name.quickCmp ·.name ·.name) +@[expose] def LMVarIdSet := Std.TreeSet LMVarId (Name.quickCmp ·.name ·.name) deriving Inhabited, EmptyCollection instance : ForIn m LMVarIdSet LMVarId := inferInstanceAs (ForIn _ (Std.TreeSet _ _) ..) -def LMVarIdMap (α : Type) := Std.TreeMap LMVarId α (Name.quickCmp ·.name ·.name) +@[expose] def LMVarIdMap (α : Type) := Std.TreeMap LMVarId α (Name.quickCmp ·.name ·.name) instance : EmptyCollection (LMVarIdMap α) := inferInstanceAs (EmptyCollection (Std.TreeMap _ _ _)) @@ -128,7 +132,7 @@ def hasParam (u : Level) : Bool := end Level -def levelZero := +@[expose] def levelZero := Level.zero def mkLevelMVar (mvarId : LMVarId) := @@ -137,7 +141,7 @@ def mkLevelMVar (mvarId : LMVarId) := def mkLevelParam (name : Name) := Level.param name -def mkLevelSucc (u : Level) := +@[expose] def mkLevelSucc (u : Level) := Level.succ u def mkLevelMax (u v : Level) := @@ -200,7 +204,7 @@ def isNeverZero : Level → Bool | max l₁ l₂ => isNeverZero l₁ || isNeverZero l₂ | imax _ l₂ => isNeverZero l₂ -def ofNat : Nat → Level +@[expose] def ofNat : Nat → Level | 0 => levelZero | n+1 => mkLevelSucc (ofNat n) diff --git a/src/Lean/Linter.lean b/src/Lean/Linter.lean index 30b21aef92..450c90a55e 100644 --- a/src/Lean/Linter.lean +++ b/src/Lean/Linter.lean @@ -3,14 +3,18 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König -/ +module + prelude -import Lean.Linter.Util -import Lean.Linter.Builtin -import Lean.Linter.ConstructorAsVariable -import Lean.Linter.Deprecated -import Lean.Linter.UnusedVariables -import Lean.Linter.MissingDocs -import Lean.Linter.Omit -import Lean.Linter.List -import Lean.Linter.Sets -import Lean.Linter.UnusedSimpArgs +public import Lean.Linter.Util +public import Lean.Linter.Builtin +public import Lean.Linter.ConstructorAsVariable +public import Lean.Linter.Deprecated +public import Lean.Linter.UnusedVariables +public import Lean.Linter.MissingDocs +public import Lean.Linter.Omit +public import Lean.Linter.List +public import Lean.Linter.Sets +public import Lean.Linter.UnusedSimpArgs + +public section diff --git a/src/Lean/Linter/Basic.lean b/src/Lean/Linter/Basic.lean index 041a21d90e..3f42b33994 100644 --- a/src/Lean/Linter/Basic.lean +++ b/src/Lean/Linter/Basic.lean @@ -3,17 +3,21 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König -/ +module + prelude -import Lean.Data.Options -import Lean.MonadEnv -import Lean.Log +public import Lean.Data.Options +public import Lean.MonadEnv +public import Lean.Log + +public section namespace Lean.Linter /-- Linter sets are represented as a map from linter name to set name, to make it easy to look up which sets to check for enabling a linter. -/ -def LinterSets := NameMap (Array Name) +@[expose] def LinterSets := NameMap (Array Name) deriving EmptyCollection, Inhabited /-- Insert a set into a `LinterSets` map. diff --git a/src/Lean/Linter/Builtin.lean b/src/Lean/Linter/Builtin.lean index 91e18e279e..683bd0f933 100644 --- a/src/Lean/Linter/Builtin.lean +++ b/src/Lean/Linter/Builtin.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König -/ +module + prelude -import Lean.Linter.Util -import Lean.Elab.Command +public import Lean.Linter.Util +public import Lean.Elab.Command + +public section namespace Lean.Linter diff --git a/src/Lean/Linter/ConstructorAsVariable.lean b/src/Lean/Linter/ConstructorAsVariable.lean index 3a063b36c7..bfd6da0fb9 100644 --- a/src/Lean/Linter/ConstructorAsVariable.lean +++ b/src/Lean/Linter/ConstructorAsVariable.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.Elab.Command -import Lean.Linter.Util +public import Lean.Elab.Command +public import Lean.Linter.Util + +public section set_option linter.missingDocs true diff --git a/src/Lean/Linter/Deprecated.lean b/src/Lean/Linter/Deprecated.lean index 2afa536fc6..8644f7e294 100644 --- a/src/Lean/Linter/Deprecated.lean +++ b/src/Lean/Linter/Deprecated.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Linter.Basic -import Lean.Attributes -import Lean.Elab.InfoTree.Main +public import Lean.Linter.Basic +public import Lean.Attributes +public import Lean.Elab.InfoTree.Main + +public section namespace Lean.Linter diff --git a/src/Lean/Linter/List.lean b/src/Lean/Linter/List.lean index 49e6ff07bc..7edaa72d54 100644 --- a/src/Lean/Linter/List.lean +++ b/src/Lean/Linter/List.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Command -import Lean.Server.InfoUtils +public import Lean.Elab.Command +public import Lean.Server.InfoUtils + +public section set_option linter.missingDocs true -- keep it documented /-! diff --git a/src/Lean/Linter/MissingDocs.lean b/src/Lean/Linter/MissingDocs.lean index ff0c813be4..299197f2d0 100644 --- a/src/Lean/Linter/MissingDocs.lean +++ b/src/Lean/Linter/MissingDocs.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Parser.Syntax -import Lean.Meta.Tactic.Simp.RegisterCommand -import Lean.Elab.Command -import Lean.Elab.SetOption -import Lean.Linter.Util +public import Lean.Parser.Syntax +public import Lean.Meta.Tactic.Simp.RegisterCommand +public import Lean.Elab.Command +public import Lean.Elab.SetOption +public import Lean.Linter.Util + +public section namespace Lean.Linter open Elab.Command Parser Command diff --git a/src/Lean/Linter/Omit.lean b/src/Lean/Linter/Omit.lean index 7887dd7960..089bfc4891 100644 --- a/src/Lean/Linter/Omit.lean +++ b/src/Lean/Linter/Omit.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Command -import Lean.Linter.Util +public import Lean.Elab.Command +public import Lean.Linter.Util + +public section namespace Lean.Linter open Elab.Command diff --git a/src/Lean/Linter/Sets.lean b/src/Lean/Linter/Sets.lean index 8bc3d84c6c..30d4eebbce 100644 --- a/src/Lean/Linter/Sets.lean +++ b/src/Lean/Linter/Sets.lean @@ -3,9 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Anne Baanen -/ +module + prelude -import Lean.Elab.Command -import Lean.Linter.Basic +public import Lean.Elab.Command +public import Lean.Linter.Basic +meta import Lean.Elab.Command + +public section namespace Lean.Linter diff --git a/src/Lean/Linter/UnusedSimpArgs.lean b/src/Lean/Linter/UnusedSimpArgs.lean index 9e585b9c3e..720a52d8c7 100644 --- a/src/Lean/Linter/UnusedSimpArgs.lean +++ b/src/Lean/Linter/UnusedSimpArgs.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Elab.Command -import Lean.Elab.Tactic.Simp -import Lean.Linter.Util +public import Lean.Elab.Command +public import Lean.Elab.Tactic.Simp +public import Lean.Linter.Util + +public section namespace Lean.Linter diff --git a/src/Lean/Linter/UnusedVariables.lean b/src/Lean/Linter/UnusedVariables.lean index 9307929566..a17fcd788c 100644 --- a/src/Lean/Linter/UnusedVariables.lean +++ b/src/Lean/Linter/UnusedVariables.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Mario Carneiro -/ +module + prelude -import Lean.Elab.Command -import Lean.Linter.Util +public import Lean.Elab.Command +public import Lean.Linter.Util + +public section set_option linter.missingDocs true -- keep it documented /-! # Unused variable Linter diff --git a/src/Lean/Linter/Util.lean b/src/Lean/Linter/Util.lean index c4f952027d..50a8ff0777 100644 --- a/src/Lean/Linter/Util.lean +++ b/src/Lean/Linter/Util.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Lars König. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Lars König -/ +module + prelude -import Lean.Data.Options -import Lean.Server.InfoUtils -import Lean.Linter.Basic +public import Lean.Data.Options +public import Lean.Server.InfoUtils +public import Lean.Linter.Basic + +public section namespace Lean.Linter diff --git a/src/Lean/LoadDynlib.lean b/src/Lean/LoadDynlib.lean index b6589eafce..66f88b447f 100644 --- a/src/Lean/LoadDynlib.lean +++ b/src/Lean/LoadDynlib.lean @@ -3,20 +3,24 @@ Copyright (c) 2021 Mac Malone. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mac Malone -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section namespace Lean private opaque DynlibImpl : NonemptyType.{0} /-- A dynamic library handle. -/ -def Dynlib := DynlibImpl.type +@[expose] def Dynlib := DynlibImpl.type instance : Nonempty Dynlib := DynlibImpl.property private opaque Dynlib.SymbolImpl (dynlib : Dynlib) : NonemptyType.{0} /-- A reference to a symbol within a dynamic library. -/ def Dynlib.Symbol (dynlib : Dynlib) := SymbolImpl dynlib |>.type -instance : Nonempty (Dynlib.Symbol dynlib) := Dynlib.SymbolImpl dynlib |>.property +instance : Nonempty (Dynlib.Symbol dynlib) := by exact Dynlib.SymbolImpl dynlib |>.property /-- Dynamically loads a shared library. diff --git a/src/Lean/LocalContext.lean b/src/Lean/LocalContext.lean index 4e568176b3..425e28b6fe 100644 --- a/src/Lean/LocalContext.lean +++ b/src/Lean/LocalContext.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Nat.Control -import Lean.Data.PersistentArray -import Lean.Expr -import Lean.Hygiene +public import Init.Data.Nat.Control +public import Lean.Data.PersistentArray +public import Lean.Expr +public import Lean.Hygiene + +public section namespace Lean diff --git a/src/Lean/Log.lean b/src/Lean/Log.lean index a8083c6536..d6a7d8a718 100644 --- a/src/Lean/Log.lean +++ b/src/Lean/Log.lean @@ -3,15 +3,19 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.Sorry -import Lean.Widget.Types -import Lean.Message -import Lean.DocString.Links +public import Lean.Util.Sorry +public import Lean.Widget.Types +public import Lean.Message +public import Lean.DocString.Links -- This import is necessary to ensure that any users of the `logNamedError` macros have access to -- all declared explanations: -import Lean.ErrorExplanations -import Lean.Data.Json.Basic +public import Lean.ErrorExplanations +public import Lean.Data.Json.Basic + +public section namespace Lean @@ -66,7 +70,9 @@ A widget for displaying error names and explanation links. -- create circular imports. Instead, we add this attribute post-hoc in `Lean.ErrorExplanation`. def errorDescriptionWidget : Widget.Module where javascript := " -import { createElement } from 'react'; +public import { createElement } from 'react'; + +public section export default function ({ code, explanationUrl }) { const sansText = { fontFamily: 'var(--vscode-font-family)' } diff --git a/src/Lean/Message.lean b/src/Lean/Message.lean index 3ea3a8120b..64403f59f5 100644 --- a/src/Lean/Message.lean +++ b/src/Lean/Message.lean @@ -5,14 +5,18 @@ Author: Sebastian Ullrich, Leonardo de Moura Message type used by the Lean frontend -/ +module + prelude -import Init.Data.Slice.Array -import Lean.Data.Position -import Lean.Data.OpenDecl -import Lean.MetavarContext -import Lean.Environment -import Lean.Util.PPExt -import Lean.Util.Sorry +public import Init.Data.Slice.Array +public import Lean.Data.Position +public import Lean.Data.OpenDecl +public import Lean.MetavarContext +public import Lean.Environment +public import Lean.Util.PPExt +public import Lean.Util.Sorry + +public section namespace Lean diff --git a/src/Lean/Meta.lean b/src/Lean/Meta.lean index f53aec60eb..bd9f7bf4eb 100644 --- a/src/Lean/Meta.lean +++ b/src/Lean/Meta.lean @@ -3,55 +3,59 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.LevelDefEq -import Lean.Meta.WHNF -import Lean.Meta.InferType -import Lean.Meta.FunInfo -import Lean.Meta.ExprDefEq -import Lean.Meta.DecLevel -import Lean.Meta.DiscrTree -import Lean.Meta.Reduce -import Lean.Meta.Instances -import Lean.Meta.AbstractMVars -import Lean.Meta.SynthInstance -import Lean.Meta.AppBuilder -import Lean.Meta.Sorry -import Lean.Meta.Tactic -import Lean.Meta.KAbstract -import Lean.Meta.RecursorInfo -import Lean.Meta.GeneralizeTelescope -import Lean.Meta.Match -import Lean.Meta.ReduceEval -import Lean.Meta.Closure -import Lean.Meta.AbstractNestedProofs -import Lean.Meta.LetToHave -import Lean.Meta.ForEachExpr -import Lean.Meta.Transform -import Lean.Meta.PPGoal -import Lean.Meta.UnificationHint -import Lean.Meta.Inductive -import Lean.Meta.SizeOf -import Lean.Meta.IndPredBelow -import Lean.Meta.Coe -import Lean.Meta.CollectFVars -import Lean.Meta.GeneralizeVars -import Lean.Meta.Injective -import Lean.Meta.Structure -import Lean.Meta.Constructions -import Lean.Meta.CongrTheorems -import Lean.Meta.Eqns -import Lean.Meta.ExprLens -import Lean.Meta.ExprTraverse -import Lean.Meta.Eval -import Lean.Meta.CoeAttr -import Lean.Meta.Iterator -import Lean.Meta.LazyDiscrTree -import Lean.Meta.LitValues -import Lean.Meta.CheckTactic -import Lean.Meta.Canonicalizer -import Lean.Meta.Diagnostics -import Lean.Meta.BinderNameHint -import Lean.Meta.TryThis -import Lean.Meta.Hint +public import Lean.Meta.Basic +public import Lean.Meta.LevelDefEq +public import Lean.Meta.WHNF +public import Lean.Meta.InferType +public import Lean.Meta.FunInfo +public import Lean.Meta.ExprDefEq +public import Lean.Meta.DecLevel +public import Lean.Meta.DiscrTree +public import Lean.Meta.Reduce +public import Lean.Meta.Instances +public import Lean.Meta.AbstractMVars +public import Lean.Meta.SynthInstance +public import Lean.Meta.AppBuilder +public import Lean.Meta.Sorry +public import Lean.Meta.Tactic +public import Lean.Meta.KAbstract +public import Lean.Meta.RecursorInfo +public import Lean.Meta.GeneralizeTelescope +public import Lean.Meta.Match +public import Lean.Meta.ReduceEval +public import Lean.Meta.Closure +public import Lean.Meta.AbstractNestedProofs +public import Lean.Meta.LetToHave +public import Lean.Meta.ForEachExpr +public import Lean.Meta.Transform +public import Lean.Meta.PPGoal +public import Lean.Meta.UnificationHint +public import Lean.Meta.Inductive +public import Lean.Meta.SizeOf +public import Lean.Meta.IndPredBelow +public import Lean.Meta.Coe +public import Lean.Meta.CollectFVars +public import Lean.Meta.GeneralizeVars +public import Lean.Meta.Injective +public import Lean.Meta.Structure +public import Lean.Meta.Constructions +public import Lean.Meta.CongrTheorems +public import Lean.Meta.Eqns +public import Lean.Meta.ExprLens +public import Lean.Meta.ExprTraverse +public import Lean.Meta.Eval +public import Lean.Meta.CoeAttr +public import Lean.Meta.Iterator +public import Lean.Meta.LazyDiscrTree +public import Lean.Meta.LitValues +public import Lean.Meta.CheckTactic +public import Lean.Meta.Canonicalizer +public import Lean.Meta.Diagnostics +public import Lean.Meta.BinderNameHint +public import Lean.Meta.TryThis +public import Lean.Meta.Hint + +public section diff --git a/src/Lean/Meta/ACLt.lean b/src/Lean/Meta/ACLt.lean index 7496d54b40..38d9cf2ec1 100644 --- a/src/Lean/Meta/ACLt.lean +++ b/src/Lean/Meta/ACLt.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.FunInfo -import Lean.Meta.DiscrTree +public import Lean.Meta.Basic +public import Lean.Meta.FunInfo +public import Lean.Meta.DiscrTree + +public section namespace Lean diff --git a/src/Lean/Meta/AbstractMVars.lean b/src/Lean/Meta/AbstractMVars.lean index c7af090915..f4b63f138d 100644 --- a/src/Lean/Meta/AbstractMVars.lean +++ b/src/Lean/Meta/AbstractMVars.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta namespace AbstractMVars diff --git a/src/Lean/Meta/AbstractNestedProofs.lean b/src/Lean/Meta/AbstractNestedProofs.lean index ea0d756ac2..62badbe685 100644 --- a/src/Lean/Meta/AbstractNestedProofs.lean +++ b/src/Lean/Meta/AbstractNestedProofs.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Lean.Meta.Closure -import Lean.Meta.Transform +public import Init.Grind.Util +public import Lean.Meta.Closure +public import Lean.Meta.Transform + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/AppBuilder.lean b/src/Lean/Meta/AppBuilder.lean index da7f1ef2f6..09b1116b9c 100644 --- a/src/Lean/Meta/AppBuilder.lean +++ b/src/Lean/Meta/AppBuilder.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Structure -import Lean.Meta.SynthInstance -import Lean.Meta.Check -import Lean.Meta.DecLevel +public import Lean.Structure +public import Lean.Meta.SynthInstance +public import Lean.Meta.Check +public import Lean.Meta.DecLevel + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/ArgsPacker.lean b/src/Lean/Meta/ArgsPacker.lean index 185f0dea52..34a84cae05 100644 --- a/src/Lean/Meta/ArgsPacker.lean +++ b/src/Lean/Meta/ArgsPacker.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.PProdN -import Lean.Meta.ArgsPacker.Basic +public import Lean.Meta.AppBuilder +public import Lean.Meta.PProdN +public import Lean.Meta.ArgsPacker.Basic + +public section /-! This module implements the equivalence between the types diff --git a/src/Lean/Meta/ArgsPacker/Basic.lean b/src/Lean/Meta/ArgsPacker/Basic.lean index 07394f1908..88089ceb52 100644 --- a/src/Lean/Meta/ArgsPacker/Basic.lean +++ b/src/Lean/Meta/ArgsPacker/Basic.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Init.Data.Array.Basic +public import Init.Data.Array.Basic + +public section /-! The basic data type and namespace for the `Lean.Meta.ArgsPacker` modules. diff --git a/src/Lean/Meta/Basic.lean b/src/Lean/Meta/Basic.lean index ea2498d933..ecf81e8267 100644 --- a/src/Lean/Meta/Basic.lean +++ b/src/Lean/Meta/Basic.lean @@ -3,15 +3,19 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.LOption -import Lean.Environment -import Lean.Class -import Lean.ReducibilityAttrs -import Lean.Util.ReplaceExpr -import Lean.Util.MonadBacktrack -import Lean.Compiler.InlineAttrs -import Lean.Meta.TransparencyMode +public import Lean.Data.LOption +public import Lean.Environment +public import Lean.Class +public import Lean.ReducibilityAttrs +public import Lean.Util.ReplaceExpr +public import Lean.Util.MonadBacktrack +public import Lean.Compiler.InlineAttrs +public import Lean.Meta.TransparencyMode + +public section /-! This module provides four (mutually dependent) goodies that are needed for building the elaborator and tactic frameworks. @@ -213,7 +217,7 @@ private def Config.toKey (c : Config) : UInt64 := structure ConfigWithKey where private mk :: config : Config := {} - key : UInt64 := config.toKey + key : UInt64 := private_decl% config.toKey instance : Inhabited ConfigWithKey where -- #9463 default := private {} @@ -310,7 +314,7 @@ structure InfoCacheKey where deriving Inhabited, BEq instance : Hashable InfoCacheKey where - hash := fun { configKey, expr, nargs? } => mixHash (hash configKey) <| mixHash (hash expr) (hash nargs?) + hash := private fun { configKey, expr, nargs? } => mixHash (hash configKey) <| mixHash (hash expr) (hash nargs?) -- Remark: we don't need to store `Config.toKey` because typeclass resolution uses a fixed configuration. structure SynthInstanceCacheKey where @@ -348,7 +352,7 @@ instance : BEq ExprConfigCacheKey where a.configKey == b.configKey instance : Hashable ExprConfigCacheKey where - hash := fun { expr, configKey } => mixHash (hash expr) (hash configKey) + hash := private fun { expr, configKey } => mixHash (hash expr) (hash configKey) abbrev InferTypeCache := PersistentHashMap ExprConfigCacheKey Expr abbrev FunInfoCache := PersistentHashMap InfoCacheKey FunInfo @@ -362,7 +366,7 @@ structure DefEqCacheKey where deriving Inhabited, BEq instance : Hashable DefEqCacheKey where - hash := fun { lhs, rhs, configKey } => mixHash (hash lhs) <| mixHash (hash rhs) (hash configKey) + hash := private fun { lhs, rhs, configKey } => mixHash (hash lhs) <| mixHash (hash rhs) (hash configKey) /-- A mapping `(s, t) ↦ isDefEq s t`. @@ -525,7 +529,7 @@ The key operations provided by `MetaM` are: The following is a small example that demonstrates how to obtain and manipulate the type of a `Fin` expression: ``` -import Lean +public import Lean open Lean Meta @@ -756,7 +760,9 @@ the kernel typechecker. The kernel typechecker is invoked when a definition is a Here are examples of type-incorrect terms for which `inferType` succeeds: ```lean -import Lean +public import Lean + +public section open Lean Meta diff --git a/src/Lean/Meta/BinderNameHint.lean b/src/Lean/Meta/BinderNameHint.lean index 51e043299e..ddc13f930f 100644 --- a/src/Lean/Meta/BinderNameHint.lean +++ b/src/Lean/Meta/BinderNameHint.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Util.FindExpr -import Lean.Meta.Basic -import Init.BinderNameHint +public import Lean.Util.FindExpr +public import Lean.Meta.Basic +public import Init.BinderNameHint + +public section namespace Lean diff --git a/src/Lean/Meta/Canonicalizer.lean b/src/Lean/Meta/Canonicalizer.lean index f4b46e1409..fa76277650 100644 --- a/src/Lean/Meta/Canonicalizer.lean +++ b/src/Lean/Meta/Canonicalizer.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ShareCommon -import Lean.Meta.Basic -import Lean.Meta.FunInfo -import Std.Data.HashMap.Raw +public import Lean.Util.ShareCommon +public import Lean.Meta.Basic +public import Lean.Meta.FunInfo +public import Std.Data.HashMap.Raw + +public section namespace Lean.Meta namespace Canonicalizer diff --git a/src/Lean/Meta/Check.lean b/src/Lean/Meta/Check.lean index 1f868ea2e9..2e5b1c41b9 100644 --- a/src/Lean/Meta/Check.lean +++ b/src/Lean/Meta/Check.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.InferType -import Lean.Meta.Sorry +public import Lean.Meta.InferType +public import Lean.Meta.Sorry + +public section /-! This is not the Kernel type checker, but an auxiliary method for checking diff --git a/src/Lean/Meta/CheckTactic.lean b/src/Lean/Meta/CheckTactic.lean index d346ec3508..fbda16ade0 100644 --- a/src/Lean/Meta/CheckTactic.lean +++ b/src/Lean/Meta/CheckTactic.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joe Hendrix -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta.CheckTactic diff --git a/src/Lean/Meta/Closure.lean b/src/Lean/Meta/Closure.lean index dc02c4f3a3..54de415937 100644 --- a/src/Lean/Meta/Closure.lean +++ b/src/Lean/Meta/Closure.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.MetavarContext -import Lean.Environment -import Lean.AddDecl -import Lean.Util.FoldConsts -import Lean.Meta.Basic -import Lean.Meta.Check -import Lean.Meta.Tactic.AuxLemma +public import Lean.MetavarContext +public import Lean.Environment +public import Lean.AddDecl +public import Lean.Util.FoldConsts +public import Lean.Meta.Basic +public import Lean.Meta.Check +public import Lean.Meta.Tactic.AuxLemma + +public section /-! diff --git a/src/Lean/Meta/Coe.lean b/src/Lean/Meta/Coe.lean index 485b4bcbc7..b83775760c 100644 --- a/src/Lean/Meta/Coe.lean +++ b/src/Lean/Meta/Coe.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.SynthInstance -import Lean.Meta.AppBuilder +public import Lean.Meta.Transform +public import Lean.Meta.SynthInstance +public import Lean.Meta.AppBuilder + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/CoeAttr.lean b/src/Lean/Meta/CoeAttr.lean index 0509cd2b22..d4ef276884 100644 --- a/src/Lean/Meta/CoeAttr.lean +++ b/src/Lean/Meta/CoeAttr.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Mario Carneiro, Leonardo de Moura -/ +module + prelude -import Lean.Attributes -import Lean.ScopedEnvExtension -import Lean.Meta.FunInfo +public import Lean.Attributes +public import Lean.ScopedEnvExtension +public import Lean.Meta.FunInfo + +public section /-! # The `@[coe]` attribute, used to delaborate coercion functions as `↑` diff --git a/src/Lean/Meta/CollectFVars.lean b/src/Lean/Meta/CollectFVars.lean index f8b57b069d..36312ac925 100644 --- a/src/Lean/Meta/CollectFVars.lean +++ b/src/Lean/Meta/CollectFVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Util.CollectFVars -import Lean.Meta.Basic +public import Lean.Util.CollectFVars +public import Lean.Meta.Basic + +public section namespace Lean diff --git a/src/Lean/Meta/CollectMVars.lean b/src/Lean/Meta/CollectMVars.lean index d5d98e073c..bece593c0e 100644 --- a/src/Lean/Meta/CollectMVars.lean +++ b/src/Lean/Meta/CollectMVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectMVars -import Lean.Meta.Basic +public import Lean.Util.CollectMVars +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/CompletionName.lean b/src/Lean/Meta/CompletionName.lean index 920ce118e9..73614583bb 100644 --- a/src/Lean/Meta/CompletionName.lean +++ b/src/Lean/Meta/CompletionName.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Match.MatcherInfo +public import Lean.Meta.Basic +public import Lean.Meta.Match.MatcherInfo + +public section /-! This exports a predicate for checking whether a name should be made diff --git a/src/Lean/Meta/CongrTheorems.lean b/src/Lean/Meta/CongrTheorems.lean index 406507b074..650706b60e 100644 --- a/src/Lean/Meta/CongrTheorems.lean +++ b/src/Lean/Meta/CongrTheorems.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.Class -import Lean.ReservedNameAction -import Lean.ResolveName -import Lean.Meta.AppBuilder -import Lean.Meta.Tactic.Subst -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Assert +public import Lean.AddDecl +public import Lean.Class +public import Lean.ReservedNameAction +public import Lean.ResolveName +public import Lean.Meta.AppBuilder +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Assert + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Constructions.lean b/src/Lean/Meta/Constructions.lean index 469d6a3af5..4c14babc63 100644 --- a/src/Lean/Meta/Constructions.lean +++ b/src/Lean/Meta/Constructions.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Constructions.CasesOn -import Lean.Meta.Constructions.NoConfusion -import Lean.Meta.Constructions.RecOn -import Lean.Meta.Constructions.BRecOn +public import Lean.Meta.Constructions.CasesOn +public import Lean.Meta.Constructions.NoConfusion +public import Lean.Meta.Constructions.RecOn +public import Lean.Meta.Constructions.BRecOn + +public section diff --git a/src/Lean/Meta/Constructions/BRecOn.lean b/src/Lean/Meta/Constructions/BRecOn.lean index 49f79cc956..812a74a9d9 100644 --- a/src/Lean/Meta/Constructions/BRecOn.lean +++ b/src/Lean/Meta/Constructions/BRecOn.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Init.Data.Range.Polymorphic.Stream -import Lean.Meta.InferType -import Lean.AuxRecursor -import Lean.AddDecl -import Lean.Meta.CompletionName -import Lean.Meta.PProdN +public import Init.Data.Range.Polymorphic.Stream +public import Lean.Meta.InferType +public import Lean.AuxRecursor +public import Lean.AddDecl +public import Lean.Meta.CompletionName +public import Lean.Meta.PProdN + +public section namespace Lean open Meta diff --git a/src/Lean/Meta/Constructions/CasesOn.lean b/src/Lean/Meta/Constructions/CasesOn.lean index e4ab37384d..e05a0f6c16 100644 --- a/src/Lean/Meta/Constructions/CasesOn.lean +++ b/src/Lean/Meta/Constructions/CasesOn.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.Meta.Basic +public import Lean.AddDecl +public import Lean.Meta.Basic + +public section namespace Lean diff --git a/src/Lean/Meta/Constructions/NoConfusion.lean b/src/Lean/Meta/Constructions/NoConfusion.lean index de28bb2bff..7cf96e504a 100644 --- a/src/Lean/Meta/Constructions/NoConfusion.lean +++ b/src/Lean/Meta/Constructions/NoConfusion.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.Meta.AppBuilder -import Lean.Meta.CompletionName -import Lean.Meta.Constructions.NoConfusionLinear +public import Lean.AddDecl +public import Lean.Meta.AppBuilder +public import Lean.Meta.CompletionName +public import Lean.Meta.Constructions.NoConfusionLinear + +public section register_builtin_option backwards.linearNoConfusionType : Bool := { diff --git a/src/Lean/Meta/Constructions/NoConfusionLinear.lean b/src/Lean/Meta/Constructions/NoConfusionLinear.lean index dc74484d4a..239c550fc9 100644 --- a/src/Lean/Meta/Constructions/NoConfusionLinear.lean +++ b/src/Lean/Meta/Constructions/NoConfusionLinear.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.AddDecl -import Lean.Meta.AppBuilder -import Lean.Meta.CompletionName +public import Lean.AddDecl +public import Lean.Meta.AppBuilder +public import Lean.Meta.CompletionName + +public section /-! This module produces a construction for the `noConfusionType` that is linear in size in the number of diff --git a/src/Lean/Meta/Constructions/RecOn.lean b/src/Lean/Meta/Constructions/RecOn.lean index be156575a2..0877c8043e 100644 --- a/src/Lean/Meta/Constructions/RecOn.lean +++ b/src/Lean/Meta/Constructions/RecOn.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.InferType -import Lean.AuxRecursor -import Lean.AddDecl -import Lean.Meta.CompletionName +public import Lean.Meta.InferType +public import Lean.AuxRecursor +public import Lean.AddDecl +public import Lean.Meta.CompletionName + +public section open Lean Meta diff --git a/src/Lean/Meta/CtorRecognizer.lean b/src/Lean/Meta/CtorRecognizer.lean index c7d251037b..289824870d 100644 --- a/src/Lean/Meta/CtorRecognizer.lean +++ b/src/Lean/Meta/CtorRecognizer.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Offset +public import Lean.Meta.LitValues +public import Lean.Meta.Offset + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/DecLevel.lean b/src/Lean/Meta/DecLevel.lean index c6b360c19a..7a08e584b9 100644 --- a/src/Lean/Meta/DecLevel.lean +++ b/src/Lean/Meta/DecLevel.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.InferType +public import Lean.Meta.Basic +public import Lean.Meta.InferType + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Diagnostics.lean b/src/Lean/Meta/Diagnostics.lean index 464b9ab28d..fb8caf7276 100644 --- a/src/Lean/Meta/Diagnostics.lean +++ b/src/Lean/Meta/Diagnostics.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.PrettyPrinter -import Lean.Meta.Basic -import Lean.Meta.Instances +public import Lean.PrettyPrinter +public import Lean.Meta.Basic +public import Lean.Meta.Instances + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/DiscrTree.lean b/src/Lean/Meta/DiscrTree.lean index 225bc65111..e662c7ae23 100644 --- a/src/Lean/Meta/DiscrTree.lean +++ b/src/Lean/Meta/DiscrTree.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Jannis Limperg, Kim Morrison -/ +module + prelude -import Lean.Meta.WHNF -import Lean.Meta.Transform -import Lean.Meta.DiscrTreeTypes +public import Lean.Meta.WHNF +public import Lean.Meta.Transform +public import Lean.Meta.DiscrTreeTypes + +public section namespace Lean.Meta.DiscrTree /-! diff --git a/src/Lean/Meta/DiscrTreeTypes.lean b/src/Lean/Meta/DiscrTreeTypes.lean index d0e96aa625..d50d70971d 100644 --- a/src/Lean/Meta/DiscrTreeTypes.lean +++ b/src/Lean/Meta/DiscrTreeTypes.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.ToExpr +public import Lean.Expr +public import Lean.ToExpr + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Eqns.lean b/src/Lean/Meta/Eqns.lean index 1d296a8813..010888e4d3 100644 --- a/src/Lean/Meta/Eqns.lean +++ b/src/Lean/Meta/Eqns.lean @@ -3,14 +3,18 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ReservedNameAction -import Lean.AddDecl -import Lean.Meta.Basic -import Lean.Meta.AppBuilder -import Lean.Meta.Match.MatcherInfo -import Lean.DefEqAttrib -import Lean.Meta.LetToHave +public import Lean.ReservedNameAction +public import Lean.AddDecl +public import Lean.Meta.Basic +public import Lean.Meta.AppBuilder +public import Lean.Meta.Match.MatcherInfo +public import Lean.DefEqAttrib +public import Lean.Meta.LetToHave + +public section namespace Lean.Meta @@ -115,7 +119,7 @@ builtin_initialize registerReservedNamePredicate fun env n => Id.run do else false -def GetEqnsFn := Name → MetaM (Option (Array Name)) +@[expose] def GetEqnsFn := Name → MetaM (Option (Array Name)) private builtin_initialize getEqnsFnsRef : IO.Ref (List GetEqnsFn) ← IO.mkRef [] @@ -256,7 +260,7 @@ def generateEagerEqns (declName : Name) : MetaM Unit := do trace[Elab.definition.eqns] "generating eager equations for {declName}" let _ ← getEqnsFor?Core declName -def GetUnfoldEqnFn := Name → MetaM (Option Name) +@[expose] def GetUnfoldEqnFn := Name → MetaM (Option Name) private builtin_initialize getUnfoldEqnFnsRef : IO.Ref (List GetUnfoldEqnFn) ← IO.mkRef [] diff --git a/src/Lean/Meta/Eval.lean b/src/Lean/Meta/Eval.lean index 6c09eba737..b49612c728 100644 --- a/src/Lean/Meta/Eval.lean +++ b/src/Lean/Meta/Eval.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.Meta.Check -import Lean.Util.CollectLevelParams +public import Lean.AddDecl +public import Lean.Meta.Check +public import Lean.Util.CollectLevelParams + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/ExprDefEq.lean b/src/Lean/Meta/ExprDefEq.lean index 0f83511f16..1c3975c894 100644 --- a/src/Lean/Meta/ExprDefEq.lean +++ b/src/Lean/Meta/ExprDefEq.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Offset -import Lean.Meta.UnificationHint -import Lean.Util.OccursCheck +public import Lean.Meta.Offset +public import Lean.Meta.UnificationHint +public import Lean.Util.OccursCheck + +public section namespace Lean.Meta @@ -702,8 +706,8 @@ private def cache (e r : Expr) : CheckAssignmentM Unit := do modify fun s => { s with cache := s.cache.insert e r } instance : MonadCache Expr Expr CheckAssignmentM where - findCached? := findCached? - cache := cache + findCached? := private findCached? + cache := private cache private def addAssignmentInfo (msg : MessageData) : CheckAssignmentM MessageData := do let ctx ← read diff --git a/src/Lean/Meta/ExprLens.lean b/src/Lean/Meta/ExprLens.lean index 1a47f09962..bc5f6f4ac5 100644 --- a/src/Lean/Meta/ExprLens.lean +++ b/src/Lean/Meta/ExprLens.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 E.W.Ayers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Meta.Basic -import Lean.SubExpr +public import Lean.Meta.Basic +public import Lean.SubExpr + +public section /-! diff --git a/src/Lean/Meta/ExprTraverse.lean b/src/Lean/Meta/ExprTraverse.lean index 5ee365fc3c..924852e2ec 100644 --- a/src/Lean/Meta/ExprTraverse.lean +++ b/src/Lean/Meta/ExprTraverse.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 E.W.Ayers. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Meta.Basic -import Lean.SubExpr +public import Lean.Meta.Basic +public import Lean.SubExpr + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/ForEachExpr.lean b/src/Lean/Meta/ForEachExpr.lean index 2bab4bd953..0a0df19424 100644 --- a/src/Lean/Meta/ForEachExpr.lean +++ b/src/Lean/Meta/ForEachExpr.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.MonadCache -import Lean.Meta.Basic +public import Lean.Expr +public import Lean.Util.MonadCache +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/FunInfo.lean b/src/Lean/Meta/FunInfo.lean index e9823160d4..acd68b3cf8 100644 --- a/src/Lean/Meta/FunInfo.lean +++ b/src/Lean/Meta/FunInfo.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.InferType +public import Lean.Meta.Basic +public import Lean.Meta.InferType + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/GeneralizeTelescope.lean b/src/Lean/Meta/GeneralizeTelescope.lean index 6454879ee1..ca90554e4f 100644 --- a/src/Lean/Meta/GeneralizeTelescope.lean +++ b/src/Lean/Meta/GeneralizeTelescope.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.KAbstract -import Lean.Meta.Check +public import Lean.Meta.KAbstract +public import Lean.Meta.Check + +public section namespace Lean.Meta namespace GeneralizeTelescope diff --git a/src/Lean/Meta/GeneralizeVars.lean b/src/Lean/Meta/GeneralizeVars.lean index ff8701251c..4e9c9d176f 100644 --- a/src/Lean/Meta/GeneralizeVars.lean +++ b/src/Lean/Meta/GeneralizeVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Util.CollectFVars +public import Lean.Meta.Basic +public import Lean.Util.CollectFVars + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/GetUnfoldableConst.lean b/src/Lean/Meta/GetUnfoldableConst.lean index fa79dac14c..7d5b1a1a33 100644 --- a/src/Lean/Meta/GetUnfoldableConst.lean +++ b/src/Lean/Meta/GetUnfoldableConst.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.GlobalInstances +public import Lean.Meta.GlobalInstances + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/GlobalInstances.lean b/src/Lean/Meta/GlobalInstances.lean index 1cb5401f00..32ce3a0dc7 100644 --- a/src/Lean/Meta/GlobalInstances.lean +++ b/src/Lean/Meta/GlobalInstances.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.ScopedEnvExtension +public import Lean.Meta.Basic +public import Lean.ScopedEnvExtension + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Hint.lean b/src/Lean/Meta/Hint.lean index d52d6907dd..310eeb9d7b 100644 --- a/src/Lean/Meta/Hint.lean +++ b/src/Lean/Meta/Hint.lean @@ -4,15 +4,19 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joseph Rotella -/ +module + prelude -import Lean.CoreM -import Lean.Data.Lsp.Utf16 -import Lean.Message -import Lean.Meta.TryThis -import Lean.Util.Diff -import Lean.Widget.Types -import Lean.PrettyPrinter +public import Lean.CoreM +public import Lean.Data.Lsp.Utf16 +public import Lean.Message +public import Lean.Meta.TryThis +public import Lean.Util.Diff +public import Lean.Widget.Types +public import Lean.PrettyPrinter + +public section namespace Lean.Meta.Hint @@ -46,8 +50,10 @@ be able to use this widget. Instead, we register the attribute post-hoc when we -/ def tryThisDiffWidget : Widget.Module where javascript := " -import * as React from 'react'; -import { EditorContext, EnvPosContext } from '@leanprover/infoview'; +public import * as React from 'react'; +public import { EditorContext, EnvPosContext } from '@leanprover/infoview'; + +public section const e = React.createElement; export default function ({ diff, range, suggestion }) { const pos = React.useContext(EnvPosContext) diff --git a/src/Lean/Meta/IndPredBelow.lean b/src/Lean/Meta/IndPredBelow.lean index c2939b309b..e5d49b743a 100644 --- a/src/Lean/Meta/IndPredBelow.lean +++ b/src/Lean/Meta/IndPredBelow.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Lean.Meta.Constructions.CasesOn -import Lean.Meta.Match.Match -import Lean.Meta.Tactic.SolveByElim +public import Lean.Meta.Constructions.CasesOn +public import Lean.Meta.Match.Match +public import Lean.Meta.Tactic.SolveByElim + +public section namespace Lean.Meta.IndPredBelow open Match diff --git a/src/Lean/Meta/Inductive.lean b/src/Lean/Meta/Inductive.lean index 98f06a779e..034d501995 100644 --- a/src/Lean/Meta/Inductive.lean +++ b/src/Lean/Meta/Inductive.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section /-! # Helper methods for inductive datatypes -/ diff --git a/src/Lean/Meta/InferType.lean b/src/Lean/Meta/InferType.lean index 7943bd81ff..9fd4b96d0a 100644 --- a/src/Lean/Meta/InferType.lean +++ b/src/Lean/Meta/InferType.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.LBool -import Lean.Meta.Basic +public import Lean.Data.LBool +public import Lean.Meta.Basic + +public section namespace Lean diff --git a/src/Lean/Meta/Injective.lean b/src/Lean/Meta/Injective.lean index 49a4e8326b..79db5e751c 100644 --- a/src/Lean/Meta/Injective.lean +++ b/src/Lean/Meta/Injective.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Tactic.Injection -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Subst -import Lean.Meta.Tactic.Simp.Types -import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Transform +public import Lean.Meta.Tactic.Injection +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Tactic.Assumption + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Instances.lean b/src/Lean/Meta/Instances.lean index 23c8d17472..a2043087e3 100644 --- a/src/Lean/Meta/Instances.lean +++ b/src/Lean/Meta/Instances.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Range.Polymorphic.Stream -import Lean.ScopedEnvExtension -import Lean.Meta.GlobalInstances -import Lean.Meta.DiscrTree -import Lean.Meta.CollectMVars +public import Init.Data.Range.Polymorphic.Stream +public import Lean.ScopedEnvExtension +public import Lean.Meta.GlobalInstances +public import Lean.Meta.DiscrTree +public import Lean.Meta.CollectMVars + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/IntInstTesters.lean b/src/Lean/Meta/IntInstTesters.lean index bcc43c0048..7ce225934f 100644 --- a/src/Lean/Meta/IntInstTesters.lean +++ b/src/Lean/Meta/IntInstTesters.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta /-! diff --git a/src/Lean/Meta/Iterator.lean b/src/Lean/Meta/Iterator.lean index a7ff17279b..d7ab6194c3 100644 --- a/src/Lean/Meta/Iterator.lean +++ b/src/Lean/Meta/Iterator.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joe Hendrix -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/KAbstract.lean b/src/Lean/Meta/KAbstract.lean index 34381ce3fb..2b6141d34e 100644 --- a/src/Lean/Meta/KAbstract.lean +++ b/src/Lean/Meta/KAbstract.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.HeadIndex -import Lean.Meta.Basic +public import Lean.HeadIndex +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/KExprMap.lean b/src/Lean/Meta/KExprMap.lean index 336322cc6d..36d3ed7392 100644 --- a/src/Lean/Meta/KExprMap.lean +++ b/src/Lean/Meta/KExprMap.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Data.AssocList -import Lean.HeadIndex -import Lean.Meta.Basic +public import Lean.Data.AssocList +public import Lean.HeadIndex +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/LazyDiscrTree.lean b/src/Lean/Meta/LazyDiscrTree.lean index dbfe7ba4f1..88a49c6c29 100644 --- a/src/Lean/Meta/LazyDiscrTree.lean +++ b/src/Lean/Meta/LazyDiscrTree.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Joe Hendrix, Kim Morrison -/ +module + prelude -import Lean.Meta.CompletionName -import Lean.Meta.DiscrTree +public import Lean.Meta.CompletionName +public import Lean.Meta.DiscrTree + +public section /-! # Lazy Discrimination Tree @@ -16,7 +20,7 @@ initialization strategy. The discrimination tree can be created through `createImportedDiscrTree`. This creates a discrimination tree from all -imported modules in an environment using a callback that provides the +public imported modules in an environment using a callback that provides the entries as `InitEntry` values. The function `getMatch` can be used to get the values that match the @@ -57,8 +61,8 @@ end Key -- This namespace contains definitions copied from Lean.Meta.DiscrTree. namespace MatchClone -private def tmpMVarId : MVarId := { name := `_discr_tree_tmp } -private def tmpStar := mkMVar tmpMVarId +def tmpMVarId : MVarId := { name := `_discr_tree_tmp } +def tmpStar := mkMVar tmpMVarId /-- Returns true iff the argument should be treated as a "wildcard" by the @@ -71,7 +75,7 @@ private def tmpStar := mkMVar tmpMVarId avoid coupling between `DiscrTree` and `LazyDiscrTree` while both are potentially subject to independent changes. -/ -private def ignoreArg (a : Expr) (i : Nat) (infos : Array ParamInfo) : MetaM Bool := do +def ignoreArg (a : Expr) (i : Nat) (infos : Array ParamInfo) : MetaM Bool := do if h : i < infos.size then let info := infos[i] if info.isInstImplicit then @@ -83,7 +87,7 @@ private def ignoreArg (a : Expr) (i : Nat) (infos : Array ParamInfo) : MetaM Boo else isProof a -private partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Array Expr → MetaM (Array Expr) +partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Array Expr → MetaM (Array Expr) | i, .app f a, todo => do if (← ignoreArg a i infos) then pushArgsAux infos (i-1) f (todo.push tmpStar) @@ -97,7 +101,7 @@ private partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Arr - `Nat.zero` - `Nat.succ x` where `isNumeral x` - `OfNat.ofNat _ x _` where `isNumeral x` -/ -private partial def isNumeral (e : Expr) : Bool := +partial def isNumeral (e : Expr) : Bool := if e.isRawNatLit then true else let f := e.getAppFn @@ -109,7 +113,7 @@ private partial def isNumeral (e : Expr) : Bool := else if fName == ``Nat.zero && e.getAppNumArgs == 0 then true else false -private partial def toNatLit? (e : Expr) : Option Literal := +partial def toNatLit? (e : Expr) : Option Literal := if isNumeral e then if let some n := loop e then some (.natVal n) @@ -134,7 +138,7 @@ where failure | _ => failure -private def isNatType (e : Expr) : MetaM Bool := +def isNatType (e : Expr) : MetaM Bool := return (← whnf e).isConstOf ``Nat /-- @@ -145,7 +149,7 @@ private def isNatType (e : Expr) : MetaM Bool := - `Nat.succ _` This function assumes `e.isAppOf fName` -/ -private def isNatOffset (fName : Name) (e : Expr) : MetaM Bool := do +def isNatOffset (fName : Name) (e : Expr) : MetaM Bool := do if fName == ``Nat.add && e.getAppNumArgs == 2 then return isNumeral e.appArg! else if fName == ``Add.add && e.getAppNumArgs == 4 then @@ -160,7 +164,7 @@ This is a hook to determine if we should add an expression as a wildcard pattern Clone of `Lean.Meta.DiscrTree.shouldAddAsStar`. See it for more discussion. -/ -private def shouldAddAsStar (fName : Name) (e : Expr) : MetaM Bool := do +def shouldAddAsStar (fName : Name) (e : Expr) : MetaM Bool := do isNatOffset fName e /-- @@ -174,7 +178,7 @@ discrimination tree. Clone of `Lean.Meta.DiscrTree.elimLooseBVarsByBeta`. See it for more discussion. -/ -private def elimLooseBVarsByBeta (e : Expr) : CoreM Expr := +def elimLooseBVarsByBeta (e : Expr) : CoreM Expr := Core.transform e (pre := fun e => do if !e.hasLooseBVars then @@ -184,7 +188,7 @@ private def elimLooseBVarsByBeta (e : Expr) : CoreM Expr := else return .continue) -private def getKeyArgs (e : Expr) (isMatch root : Bool) : +def getKeyArgs (e : Expr) (isMatch root : Bool) : MetaM (Key × Array Expr) := do let e ← DiscrTree.reduceDT e root unless root do @@ -259,7 +263,7 @@ private def getKeyArgs (e : Expr) (isMatch root : Bool) : /- Given an expression we are looking for patterns that match, return the key and sub-expressions. -/ -private abbrev getMatchKeyArgs (e : Expr) (root : Bool) : +abbrev getMatchKeyArgs (e : Expr) (root : Bool) : MetaM (Key × Array Expr) := getKeyArgs e (isMatch := true) (root := root) @@ -268,18 +272,18 @@ end MatchClone /-- An unprocessed entry in the lazy discrimination tree. -/ -private abbrev LazyEntry α := Array Expr × ((LocalContext × LocalInstances) × α) +abbrev LazyEntry α := Array Expr × ((LocalContext × LocalInstances) × α) /-- Index identifying trie in a discrimination tree. -/ -@[reducible] -private def TrieIndex := Nat +@[reducible, expose] +def TrieIndex := Nat /-- Discrimination tree trie. See `LazyDiscrTree`. -/ -private structure Trie (α : Type) where +structure Trie (α : Type) where node :: /-- Values for matches ending at this trie. -/ values : Array α @@ -294,7 +298,7 @@ private structure Trie (α : Type) where instance : EmptyCollection (Trie α) := ⟨.node #[] 0 {} #[]⟩ /-- Push lazy entry to trie. -/ -private def Trie.pushPending : Trie α → LazyEntry α → Trie α +def Trie.pushPending : Trie α → LazyEntry α → Trie α | .node vs star cs p, e => .node vs star cs (p.push e) end LazyDiscrTree @@ -330,7 +334,7 @@ open Lean.Meta.DiscrTree (mkNoindexAnnotation hasNoindexAnnotation reduceDT) /-- Specialization of Lean.Meta.DiscrTree.pushArgs -/ -private def pushArgs (root : Bool) (todo : Array Expr) (e : Expr) : +def pushArgs (root : Bool) (todo : Array Expr) (e : Expr) : MetaM (Key × Array Expr) := do if hasNoindexAnnotation e then return (.star, todo) @@ -382,15 +386,15 @@ private def pushArgs (root : Bool) (todo : Array Expr) (e : Expr) : return (.other, todo) /-- Initial capacity for key and todo vector. -/ -private def initCapacity := 8 +def initCapacity := 8 /-- Get the root key and rest of terms of an expression using the specified config. -/ -private def rootKey (e : Expr) : MetaM (Key × Array Expr) := +def rootKey (e : Expr) : MetaM (Key × Array Expr) := pushArgs true (Array.mkEmpty initCapacity) e -private partial def buildPath (op : Bool → Array Expr → Expr → MetaM (Key × Array Expr)) (root : Bool) (todo : Array Expr) (keys : Array Key) : MetaM (Array Key) := do +partial def buildPath (op : Bool → Array Expr → Expr → MetaM (Key × Array Expr)) (root : Bool) (todo : Array Expr) (keys : Array Key) : MetaM (Array Key) := do if todo.isEmpty then return keys else @@ -424,25 +428,25 @@ def targetPath (e : Expr) : MetaM (Array Key) := do /- Monad for finding matches while resolving deferred patterns. -/ @[reducible] -private def MatchM α := StateRefT (Array (Trie α)) MetaM +def MatchM α := StateRefT (Array (Trie α)) MetaM -private def runMatch (d : LazyDiscrTree α) (m : MatchM α β) : MetaM (β × LazyDiscrTree α) := do +def runMatch (d : LazyDiscrTree α) (m : MatchM α β) : MetaM (β × LazyDiscrTree α) := do let { tries := a, roots := r } := d let (result, a) ← withReducible <| m.run a return (result, { tries := a, roots := r}) -private def setTrie (i : TrieIndex) (v : Trie α) : MatchM α Unit := +def setTrie (i : TrieIndex) (v : Trie α) : MatchM α Unit := modify (·.set! i v) /-- Create a new trie with the given lazy entry. -/ -private def newTrie [Monad m] [MonadState (Array (Trie α)) m] (e : LazyEntry α) : m TrieIndex := do +def newTrie [Monad m] [MonadState (Array (Trie α)) m] (e : LazyEntry α) : m TrieIndex := do modifyGet fun a => let sz := a.size; (sz, a.push (.node #[] 0 {} #[e])) /-- Add a lazy entry to an existing trie. -/ -private def addLazyEntryToTrie (i:TrieIndex) (e : LazyEntry α) : MatchM α Unit := +def addLazyEntryToTrie (i:TrieIndex) (e : LazyEntry α) : MatchM α Unit := modify (·.modify i (·.pushPending e)) -private def evalLazyEntry +def evalLazyEntry (p : Array α × TrieIndex × Std.HashMap Key TrieIndex) (entry : LazyEntry α) : MatchM α (Array α × TrieIndex × Std.HashMap Key TrieIndex) := do @@ -475,7 +479,7 @@ private def evalLazyEntry This evaluates all lazy entries in a trie and updates `values`, `starIdx`, and `children` accordingly. -/ -private partial def evalLazyEntries +partial def evalLazyEntries (values : Array α) (starIdx : TrieIndex) (children : Std.HashMap Key TrieIndex) (entries : Array (LazyEntry α)) : MatchM α (Array α × TrieIndex × Std.HashMap Key TrieIndex) := do @@ -484,7 +488,7 @@ private partial def evalLazyEntries let mut children := children entries.foldlM (init := (values, starIdx, children)) evalLazyEntry -private def evalNode (c : TrieIndex) : +def evalNode (c : TrieIndex) : MatchM α (Array α × TrieIndex × Std.HashMap Key TrieIndex) := do let .node vs star cs pending := (←get)[c]! if pending.size = 0 then @@ -539,7 +543,7 @@ structure MatchResult (α : Type) where namespace MatchResult -private def push (r : MatchResult α) (score : Nat) (e : Array α) : MatchResult α := +def push (r : MatchResult α) (score : Nat) (e : Array α) : MatchResult α := if e.isEmpty then r else if score < r.elts.size then @@ -601,7 +605,7 @@ multiple partial matches to explore next, to ensure the order of results matches user expectations, this code must add paths we want to prioritize and return results earlier are added last. -/ -private partial def getMatchLoop (cases : Array PartialMatch) (result : MatchResult α) : MatchM α (MatchResult α) := do +partial def getMatchLoop (cases : Array PartialMatch) (result : MatchResult α) : MatchM α (MatchResult α) := do if cases.isEmpty then pure result else do @@ -647,7 +651,7 @@ private partial def getMatchLoop (cases : Array PartialMatch) (result : MatchRes cases |> pushNonStar k args getMatchLoop cases result -private def getStarResult (root : Std.HashMap Key TrieIndex) : MatchM α (MatchResult α) := +def getStarResult (root : Std.HashMap Key TrieIndex) : MatchM α (MatchResult α) := match root[Key.star]? with | none => pure <| {} @@ -658,7 +662,7 @@ private def getStarResult (root : Std.HashMap Key TrieIndex) : MatchM α (MatchR /- Add partial match to cases if discriminator tree root map has potential matches. -/ -private def pushRootCase (r : Std.HashMap Key TrieIndex) (k : Key) (args : Array Expr) +def pushRootCase (r : Std.HashMap Key TrieIndex) (k : Key) (args : Array Expr) (cases : Array PartialMatch) : Array PartialMatch := match r[k]? with | none => cases @@ -667,7 +671,7 @@ private def pushRootCase (r : Std.HashMap Key TrieIndex) (k : Key) (args : Array /-- Find values that match `e` in `root`. -/ -private def getMatchCore (root : Std.HashMap Key TrieIndex) (e : Expr) : +def getMatchCore (root : Std.HashMap Key TrieIndex) (e : Expr) : MatchM α (MatchResult α) := do let result ← getStarResult root let (k, args) ← MatchClone.getMatchKeyArgs e (root := true) (← read) @@ -696,7 +700,7 @@ def getMatch (d : LazyDiscrTree α) (e : Expr) : MetaM (MatchResult α × LazyDi Structure for quickly initializing a lazy discrimination tree with a large number of elements using concurrent functions for generating entries. -/ -private structure PreDiscrTree (α : Type) where +structure PreDiscrTree (α : Type) where /-- Maps keys to index in tries array. -/ roots : Std.HashMap Key Nat := {} /-- Lazy entries for root of trie. -/ @@ -705,7 +709,7 @@ private structure PreDiscrTree (α : Type) where namespace PreDiscrTree -private def modifyAt (d : PreDiscrTree α) (k : Key) +def modifyAt (d : PreDiscrTree α) (k : Key) (f : Array (LazyEntry α) → Array (LazyEntry α)) : PreDiscrTree α := let { roots, tries } := d match roots[k]? with @@ -716,11 +720,11 @@ private def modifyAt (d : PreDiscrTree α) (k : Key) { roots, tries := tries.modify i f } /-- Add an entry to the pre-discrimination tree.-/ -private def push (d : PreDiscrTree α) (k : Key) (e : LazyEntry α) : PreDiscrTree α := +def push (d : PreDiscrTree α) (k : Key) (e : LazyEntry α) : PreDiscrTree α := d.modifyAt k (·.push e) /-- Convert a pre-discrimination tree to a lazy discrimination tree. -/ -private def toLazy (d : PreDiscrTree α) : LazyDiscrTree α := +def toLazy (d : PreDiscrTree α) : LazyDiscrTree α := let { roots, tries } := d -- Adjust trie indices so the first value is reserved (so 0 is never a valid trie index) let roots := roots.fold (init := roots) (fun m k n => m.insert k (n+1)) @@ -775,7 +779,7 @@ def mkSubEntry (e : InitEntry α) (idx : Nat) (value : α) : end InitEntry /-- Information about a failed import. -/ -private structure ImportFailure where +structure ImportFailure where /-- Module with constant that import failed on. -/ module : Name /-- Constant that import failed on. -/ @@ -784,10 +788,10 @@ private structure ImportFailure where exception : Exception /-- Information generation from imported modules. -/ -private structure ImportData where +structure ImportData where errors : IO.Ref (Array ImportFailure) -private def ImportData.new : BaseIO ImportData := do +def ImportData.new : BaseIO ImportData := do let errors ← IO.mkRef #[] pure { errors } @@ -805,7 +809,7 @@ def blacklistInsertion (env : Environment) (declName : Name) : Bool := || (declName matches .str _ "inj") || (declName matches .str _ "noConfusionType") -private def addConstImportData +def addConstImportData (cctx : Core.Context) (env : Environment) (modName : Name) @@ -839,7 +843,7 @@ private def addConstImportData Contains the pre discrimination tree and any errors occurring during initialization of the library search tree. -/ -private structure InitResults (α : Type) where +structure InitResults (α : Type) where tree : PreDiscrTree α := {} errors : Array ImportFailure := #[] @@ -859,12 +863,12 @@ instance : Append (InitResults α) where end InitResults -private def toFlat (d : ImportData) (tree : PreDiscrTree α) : +def toFlat (d : ImportData) (tree : PreDiscrTree α) : BaseIO (InitResults α) := do let de ← d.errors.swap #[] pure ⟨tree, de⟩ -private partial def loadImportedModule +partial def loadImportedModule (cctx : Core.Context) (env : Environment) (act : Name → ConstantInfo → MetaM (Array (InitEntry α))) @@ -882,7 +886,7 @@ private partial def loadImportedModule else pure tree -private def createImportedEnvironmentSeq (cctx : Core.Context) (ngen : NameGenerator) (env : Environment) +def createImportedEnvironmentSeq (cctx : Core.Context) (ngen : NameGenerator) (env : Environment) (act : Name → ConstantInfo → MetaM (Array (InitEntry α))) (start stop : Nat) : BaseIO (InitResults α) := do let cacheRef ← IO.mkRef (Cache.empty ngen) @@ -898,7 +902,7 @@ private def createImportedEnvironmentSeq (cctx : Core.Context) (ngen : NameGener termination_by stop - start /-- Get the results of each task and merge using combining function -/ -private def combineGet [Append α] (z : α) (tasks : Array (Task α)) : α := +def combineGet [Append α] (z : α) (tasks : Array (Task α)) : α := tasks.foldl (fun x t => x ++ t.get) (init := z) def getChildNgen [Monad M] [MonadNameGenerator M] : M NameGenerator := do @@ -960,7 +964,7 @@ def createImportedDiscrTree [Monad m] [MonadLog m] [AddMessageContext m] [MonadO pure <| r.tree.toLazy /-- Creates the core context used for initializing a tree using the current context. -/ -private def createTreeCtx (ctx : Core.Context) : Core.Context := { +def createTreeCtx (ctx : Core.Context) : Core.Context := { fileName := ctx.fileName fileMap := ctx.fileMap options := ctx.options diff --git a/src/Lean/Meta/LetToHave.lean b/src/Lean/Meta/LetToHave.lean index 3a9f5d8f7d..259307a4fe 100644 --- a/src/Lean/Meta/LetToHave.lean +++ b/src/Lean/Meta/LetToHave.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.Check -import Lean.ReservedNameAction -import Lean.AddDecl -import Lean.Meta.Transform -import Lean.Util.CollectFVars -import Lean.Util.CollectMVars +public import Lean.Meta.Check +public import Lean.ReservedNameAction +public import Lean.AddDecl +public import Lean.Meta.Transform +public import Lean.Util.CollectFVars +public import Lean.Util.CollectMVars + +public section /-! # Transforming nondependent `let`s into `have`s diff --git a/src/Lean/Meta/LevelDefEq.lean b/src/Lean/Meta/LevelDefEq.lean index 120b02ca88..faaee901dc 100644 --- a/src/Lean/Meta/LevelDefEq.lean +++ b/src/Lean/Meta/LevelDefEq.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectMVars -import Lean.Meta.Basic -import Lean.Meta.InferType -import Lean.Meta.DecLevel +public import Lean.Util.CollectMVars +public import Lean.Meta.Basic +public import Lean.Meta.InferType +public import Lean.Meta.DecLevel + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/LitValues.lean b/src/Lean/Meta/LitValues.lean index 36234ab5af..df92df2010 100644 --- a/src/Lean/Meta/LitValues.lean +++ b/src/Lean/Meta/LitValues.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Init.Control.Option +public import Lean.Meta.Basic +public import Init.Control.Option + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match.lean b/src/Lean/Meta/Match.lean index 15514eb876..d88392acd0 100644 --- a/src/Lean/Meta/Match.lean +++ b/src/Lean/Meta/Match.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Match.MatchPatternAttr -import Lean.Meta.Match.Match -import Lean.Meta.Match.CaseValues -import Lean.Meta.Match.CaseArraySizes -import Lean.Meta.Match.MatchEqs +public import Lean.Meta.Match.MatchPatternAttr +public import Lean.Meta.Match.Match +public import Lean.Meta.Match.CaseValues +public import Lean.Meta.Match.CaseArraySizes +public import Lean.Meta.Match.MatchEqs + +public section namespace Lean diff --git a/src/Lean/Meta/Match/Basic.lean b/src/Lean/Meta/Match/Basic.lean index 40cbfe8160..f821c56908 100644 --- a/src/Lean/Meta/Match/Basic.lean +++ b/src/Lean/Meta/Match/Basic.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Check -import Lean.Meta.CollectFVars -import Lean.Meta.Match.MatcherInfo -import Lean.Meta.Match.CaseArraySizes +public import Lean.Meta.Check +public import Lean.Meta.CollectFVars +public import Lean.Meta.Match.MatcherInfo +public import Lean.Meta.Match.CaseArraySizes + +public section namespace Lean.Meta.Match diff --git a/src/Lean/Meta/Match/CaseArraySizes.lean b/src/Lean/Meta/Match/CaseArraySizes.lean index 69f37eb18d..a1e0c17f93 100644 --- a/src/Lean/Meta/Match/CaseArraySizes.lean +++ b/src/Lean/Meta/Match/CaseArraySizes.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Assert -import Lean.Meta.Match.CaseValues +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Match.CaseValues + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match/CaseValues.lean b/src/Lean/Meta/Match/CaseValues.lean index 39aa755c24..a20bf8f895 100644 --- a/src/Lean/Meta/Match/CaseValues.lean +++ b/src/Lean/Meta/Match/CaseValues.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Subst -import Lean.Meta.Tactic.Clear -import Lean.Meta.Match.Value +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Match.Value + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match/MVarRenaming.lean b/src/Lean/Meta/Match/MVarRenaming.lean index 9b64027329..43af7d5bf0 100644 --- a/src/Lean/Meta/Match/MVarRenaming.lean +++ b/src/Lean/Meta/Match/MVarRenaming.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ReplaceExpr +public import Lean.Util.ReplaceExpr + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match/Match.lean b/src/Lean/Meta/Match/Match.lean index 117e9bef25..ae4c62d94d 100644 --- a/src/Lean/Meta/Match/Match.lean +++ b/src/Lean/Meta/Match/Match.lean @@ -3,17 +3,21 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Check -import Lean.Meta.Closure -import Lean.Meta.CtorRecognizer -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Contradiction -import Lean.Meta.GeneralizeTelescope -import Lean.Meta.Match.Basic -import Lean.Meta.Match.MatcherApp.Basic -import Lean.Meta.Match.MVarRenaming +public import Lean.Meta.LitValues +public import Lean.Meta.Check +public import Lean.Meta.Closure +public import Lean.Meta.CtorRecognizer +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Contradiction +public import Lean.Meta.GeneralizeTelescope +public import Lean.Meta.Match.Basic +public import Lean.Meta.Match.MatcherApp.Basic +public import Lean.Meta.Match.MVarRenaming + +public section namespace Lean.Meta.Match diff --git a/src/Lean/Meta/Match/MatchEqs.lean b/src/Lean/Meta/Match/MatchEqs.lean index 602b06ddf6..54812136ed 100644 --- a/src/Lean/Meta/Match/MatchEqs.lean +++ b/src/Lean/Meta/Match/MatchEqs.lean @@ -3,16 +3,20 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.CtorRecognizer -import Lean.Meta.Match.Match -import Lean.Meta.Match.MatchEqsExt -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.Delta -import Lean.Meta.Tactic.SplitIf -import Lean.Meta.Tactic.Injection -import Lean.Meta.Tactic.Contradiction +public import Lean.Meta.CtorRecognizer +public import Lean.Meta.Match.Match +public import Lean.Meta.Match.MatchEqsExt +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Delta +public import Lean.Meta.Tactic.SplitIf +public import Lean.Meta.Tactic.Injection +public import Lean.Meta.Tactic.Contradiction + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match/MatchEqsExt.lean b/src/Lean/Meta/Match/MatchEqsExt.lean index 0cdac1fd9c..3ca147ab15 100644 --- a/src/Lean/Meta/Match/MatchEqsExt.lean +++ b/src/Lean/Meta/Match/MatchEqsExt.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta.Match diff --git a/src/Lean/Meta/Match/MatchPatternAttr.lean b/src/Lean/Meta/Match/MatchPatternAttr.lean index d374dab221..e46e41c8bd 100644 --- a/src/Lean/Meta/Match/MatchPatternAttr.lean +++ b/src/Lean/Meta/Match/MatchPatternAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes +public import Lean.Attributes + +public section namespace Lean diff --git a/src/Lean/Meta/Match/MatcherApp.lean b/src/Lean/Meta/Match/MatcherApp.lean index 035c2ec292..bf87b88537 100644 --- a/src/Lean/Meta/Match/MatcherApp.lean +++ b/src/Lean/Meta/Match/MatcherApp.lean @@ -3,6 +3,10 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.Match.MatcherApp.Basic -import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Meta.Match.MatcherApp.Basic +public import Lean.Meta.Match.MatcherApp.Transform + +public section diff --git a/src/Lean/Meta/Match/MatcherApp/Basic.lean b/src/Lean/Meta/Match/MatcherApp/Basic.lean index 762ec475be..c995eddf55 100644 --- a/src/Lean/Meta/Match/MatcherApp/Basic.lean +++ b/src/Lean/Meta/Match/MatcherApp/Basic.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Match.MatcherInfo +public import Lean.Meta.Match.MatcherInfo + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Match/MatcherApp/Transform.lean b/src/Lean/Meta/Match/MatcherApp/Transform.lean index 70545a720d..f7dee3416d 100644 --- a/src/Lean/Meta/Match/MatcherApp/Transform.lean +++ b/src/Lean/Meta/Match/MatcherApp/Transform.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Joachim Breitner -/ +module + prelude -import Lean.Meta.Match -import Lean.Meta.InferType -import Lean.Meta.Check -import Lean.Meta.Tactic.Split +public import Lean.Meta.Match +public import Lean.Meta.InferType +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Split + +public section namespace Lean.Meta.MatcherApp diff --git a/src/Lean/Meta/Match/MatcherInfo.lean b/src/Lean/Meta/Match/MatcherInfo.lean index adf041105f..e6ca44fe83 100644 --- a/src/Lean/Meta/Match/MatcherInfo.lean +++ b/src/Lean/Meta/Match/MatcherInfo.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta namespace Match @@ -33,7 +37,7 @@ structure MatcherInfo where -/ discrInfos : Array DiscrInfo -def MatcherInfo.numAlts (info : MatcherInfo) : Nat := +@[expose] def MatcherInfo.numAlts (info : MatcherInfo) : Nat := info.altNumParams.size def MatcherInfo.arity (info : MatcherInfo) : Nat := diff --git a/src/Lean/Meta/Match/Value.lean b/src/Lean/Meta/Match/Value.lean index 9ccd0a390a..0c28df84b4 100644 --- a/src/Lean/Meta/Match/Value.lean +++ b/src/Lean/Meta/Match/Value.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Expr +public import Lean.Meta.LitValues +public import Lean.Expr + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/MatchUtil.lean b/src/Lean/Meta/MatchUtil.lean index 2c0a70858d..ed256486a2 100644 --- a/src/Lean/Meta/MatchUtil.lean +++ b/src/Lean/Meta/MatchUtil.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.Recognizers -import Lean.Meta.Basic -import Lean.Meta.CtorRecognizer +public import Lean.Util.Recognizers +public import Lean.Meta.Basic +public import Lean.Meta.CtorRecognizer + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/NatInstTesters.lean b/src/Lean/Meta/NatInstTesters.lean index d64b52f1f7..7740208ad8 100644 --- a/src/Lean/Meta/NatInstTesters.lean +++ b/src/Lean/Meta/NatInstTesters.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta /-! diff --git a/src/Lean/Meta/Offset.lean b/src/Lean/Meta/Offset.lean index 01216f4542..dadaa4f37a 100644 --- a/src/Lean/Meta/Offset.lean +++ b/src/Lean/Meta/Offset.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Control.Option -import Lean.Data.LBool -import Lean.Meta.InferType -import Lean.Meta.NatInstTesters -import Lean.Util.SafeExponentiation +public import Init.Control.Option +public import Lean.Data.LBool +public import Lean.Meta.InferType +public import Lean.Meta.NatInstTesters +public import Lean.Util.SafeExponentiation + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Order.lean b/src/Lean/Meta/Order.lean index 0fea809fe6..2c08d88527 100644 --- a/src/Lean/Meta/Order.lean +++ b/src/Lean/Meta/Order.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Różowski, Joachim Breitner -/ +module + prelude -import Lean.Meta.InferType -import Lean.Meta.PProdN -import Lean.Meta.AppBuilder -import Init.Internal.Order.Basic +public import Lean.Meta.InferType +public import Lean.Meta.PProdN +public import Lean.Meta.AppBuilder +public import Init.Internal.Order.Basic + +public section /-! This module has meta-functions for constructions expressions related to `Lean.Order`. diff --git a/src/Lean/Meta/PPGoal.lean b/src/Lean/Meta/PPGoal.lean index c90ca3c881..5d45a9a710 100644 --- a/src/Lean/Meta/PPGoal.lean +++ b/src/Lean/Meta/PPGoal.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Meta.InferType +public import Lean.Meta.InferType + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/PProdN.lean b/src/Lean/Meta/PProdN.lean index 09c27694e9..dc5e0549a1 100644 --- a/src/Lean/Meta/PProdN.lean +++ b/src/Lean/Meta/PProdN.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.InferType -import Lean.Meta.Transform +public import Lean.Meta.InferType +public import Lean.Meta.Transform + +public section /-! This module provides functions to pack and unpack values using nested `PProd` or `And`, diff --git a/src/Lean/Meta/RecursorInfo.lean b/src/Lean/Meta/RecursorInfo.lean index eb1ecf14ea..06a5f2648e 100644 --- a/src/Lean/Meta/RecursorInfo.lean +++ b/src/Lean/Meta/RecursorInfo.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AuxRecursor -import Lean.Util.FindExpr -import Lean.Meta.Basic +public import Lean.AuxRecursor +public import Lean.Util.FindExpr +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Reduce.lean b/src/Lean/Meta/Reduce.lean index fac88d7188..f4574de136 100644 --- a/src/Lean/Meta/Reduce.lean +++ b/src/Lean/Meta/Reduce.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.FunInfo -import Lean.Util.MonadCache +public import Lean.Meta.Basic +public import Lean.Meta.FunInfo +public import Lean.Util.MonadCache + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/ReduceEval.lean b/src/Lean/Meta/ReduceEval.lean index e25069ca81..a52d3bda02 100644 --- a/src/Lean/Meta/ReduceEval.lean +++ b/src/Lean/Meta/ReduceEval.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Offset +public import Lean.Meta.Offset + +public section /-! Evaluation by reduction -/ @@ -21,13 +25,13 @@ private def throwFailedToEval (e : Expr) : MetaM α := throwError "reduceEval: failed to evaluate argument{indentExpr e}" instance : ReduceEval Nat where - reduceEval e := do + reduceEval e := private do let e ← whnf e let some n ← evalNat e | throwFailedToEval e pure n instance [ReduceEval α] : ReduceEval (Option α) where - reduceEval e := do + reduceEval e := private do let e ← whnf e let Expr.const c .. ← pure e.getAppFn | throwFailedToEval e let nargs := e.getAppNumArgs @@ -36,7 +40,7 @@ instance [ReduceEval α] : ReduceEval (Option α) where else throwFailedToEval e instance : ReduceEval String where - reduceEval e := do + reduceEval e := private do let Expr.lit (Literal.strVal s) ← whnf e | throwFailedToEval e pure s diff --git a/src/Lean/Meta/SizeOf.lean b/src/Lean/Meta/SizeOf.lean index d61729e0f7..f0ca05ebdd 100644 --- a/src/Lean/Meta/SizeOf.lean +++ b/src/Lean/Meta/SizeOf.lean @@ -3,12 +3,16 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.List.BasicAux -import Lean.AddDecl -import Lean.Meta.AppBuilder -import Lean.Meta.Instances -import Lean.DefEqAttrib +public import Init.Data.List.BasicAux +public import Lean.AddDecl +public import Lean.Meta.AppBuilder +public import Lean.Meta.Instances +public import Lean.DefEqAttrib + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Sorry.lean b/src/Lean/Meta/Sorry.lean index e5f600063b..e219600e08 100644 --- a/src/Lean/Meta/Sorry.lean +++ b/src/Lean/Meta/Sorry.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Data.Lsp.Utf16 -import Lean.Meta.InferType -import Lean.Util.Recognizers +public import Lean.Data.Lsp.Utf16 +public import Lean.Meta.InferType +public import Lean.Util.Recognizers + +public section /-! # Utilities for creating and recognizing `sorry` diff --git a/src/Lean/Meta/Structure.lean b/src/Lean/Meta/Structure.lean index 7e14dcaf54..a3a0ae1107 100644 --- a/src/Lean/Meta/Structure.lean +++ b/src/Lean/Meta/Structure.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Kyle Miller -/ +module + prelude -import Lean.AddDecl -import Lean.Structure -import Lean.Meta.AppBuilder +public import Lean.AddDecl +public import Lean.Structure +public import Lean.Meta.AppBuilder + +public section /-! # Structure methods that require `MetaM` infrastructure diff --git a/src/Lean/Meta/SynthInstance.lean b/src/Lean/Meta/SynthInstance.lean index 2f9da13d11..3794b7892a 100644 --- a/src/Lean/Meta/SynthInstance.lean +++ b/src/Lean/Meta/SynthInstance.lean @@ -5,13 +5,17 @@ Authors: Daniel Selsam, Leonardo de Moura Type class instance synthesizer using tabled resolution. -/ +module + prelude -import Init.Data.Array.InsertionSort -import Lean.Meta.Basic -import Lean.Meta.Instances -import Lean.Meta.AbstractMVars -import Lean.Meta.Check -import Lean.Util.Profile +public import Init.Data.Array.InsertionSort +public import Lean.Meta.Basic +public import Lean.Meta.Instances +public import Lean.Meta.AbstractMVars +public import Lean.Meta.Check +public import Lean.Util.Profile + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic.lean b/src/Lean/Meta/Tactic.lean index e6f6a588c1..99b6d289f6 100644 --- a/src/Lean/Meta/Tactic.lean +++ b/src/Lean/Meta/Tactic.lean @@ -3,43 +3,47 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Assumption -import Lean.Meta.Tactic.Contradiction -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Revert -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Generalize -import Lean.Meta.Tactic.Replace -import Lean.Meta.Tactic.Lets -import Lean.Meta.Tactic.Induction -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.ElimInfo -import Lean.Meta.Tactic.Delta -import Lean.Meta.Tactic.Constructor -import Lean.Meta.Tactic.Simp -import Lean.Meta.Tactic.AuxLemma -import Lean.Meta.Tactic.SplitIf -import Lean.Meta.Tactic.Split -import Lean.Meta.Tactic.TryThis -import Lean.Meta.Tactic.Cleanup -import Lean.Meta.Tactic.Unfold -import Lean.Meta.Tactic.Rename -import Lean.Meta.Tactic.AC -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.Congr -import Lean.Meta.Tactic.Repeat -import Lean.Meta.Tactic.NormCast -import Lean.Meta.Tactic.IndependentOf -import Lean.Meta.Tactic.Symm -import Lean.Meta.Tactic.Backtrack -import Lean.Meta.Tactic.SolveByElim -import Lean.Meta.Tactic.FunInd -import Lean.Meta.Tactic.Rfl -import Lean.Meta.Tactic.Rewrites -import Lean.Meta.Tactic.Grind -import Lean.Meta.Tactic.Ext -import Lean.Meta.Tactic.Try +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Tactic.Contradiction +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Revert +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Generalize +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.Tactic.Lets +public import Lean.Meta.Tactic.Induction +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.ElimInfo +public import Lean.Meta.Tactic.Delta +public import Lean.Meta.Tactic.Constructor +public import Lean.Meta.Tactic.Simp +public import Lean.Meta.Tactic.AuxLemma +public import Lean.Meta.Tactic.SplitIf +public import Lean.Meta.Tactic.Split +public import Lean.Meta.Tactic.TryThis +public import Lean.Meta.Tactic.Cleanup +public import Lean.Meta.Tactic.Unfold +public import Lean.Meta.Tactic.Rename +public import Lean.Meta.Tactic.AC +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Congr +public import Lean.Meta.Tactic.Repeat +public import Lean.Meta.Tactic.NormCast +public import Lean.Meta.Tactic.IndependentOf +public import Lean.Meta.Tactic.Symm +public import Lean.Meta.Tactic.Backtrack +public import Lean.Meta.Tactic.SolveByElim +public import Lean.Meta.Tactic.FunInd +public import Lean.Meta.Tactic.Rfl +public import Lean.Meta.Tactic.Rewrites +public import Lean.Meta.Tactic.Grind +public import Lean.Meta.Tactic.Ext +public import Lean.Meta.Tactic.Try + +public section diff --git a/src/Lean/Meta/Tactic/AC.lean b/src/Lean/Meta/Tactic/AC.lean index 15469048c2..73bd1eb66d 100644 --- a/src/Lean/Meta/Tactic/AC.lean +++ b/src/Lean/Meta/Tactic/AC.lean @@ -3,5 +3,9 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Lean.Meta.Tactic.AC.Main +public import Lean.Meta.Tactic.AC.Main + +public section diff --git a/src/Lean/Meta/Tactic/AC/Main.lean b/src/Lean/Meta/Tactic/AC/Main.lean index d496b3f928..ce50771847 100644 --- a/src/Lean/Meta/Tactic/AC/Main.lean +++ b/src/Lean/Meta/Tactic/AC/Main.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Dany Fabian -/ +module + prelude -import Init.Data.AC -import Lean.Meta.AppBuilder -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.Simp.Main -import Lean.Elab.Tactic.Rewrite +public import Init.Data.AC +public import Lean.Meta.AppBuilder +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Elab.Tactic.Rewrite + +public section namespace Lean.Meta.AC open Lean.Data.AC @@ -60,7 +64,7 @@ inductive PreExpr | op (lhs rhs : PreExpr) | var (e : Expr) -@[match_pattern] def bin (op l r : Expr) := +@[match_pattern, expose] def bin (op l r : Expr) := Expr.app (Expr.app op l) r def toACExpr (op l r : Expr) : MetaM (Array Expr × ACExpr) := do diff --git a/src/Lean/Meta/Tactic/Acyclic.lean b/src/Lean/Meta/Tactic/Acyclic.lean index 2770acec5f..e4fdc7f18f 100644 --- a/src/Lean/Meta/Tactic/Acyclic.lean +++ b/src/Lean/Meta/Tactic/Acyclic.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.MatchUtil -import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.MatchUtil +public import Lean.Meta.Tactic.Simp.Main + +public section namespace Lean.MVarId open Meta diff --git a/src/Lean/Meta/Tactic/Apply.lean b/src/Lean/Meta/Tactic/Apply.lean index 7c6790eb27..f9551df9be 100644 --- a/src/Lean/Meta/Tactic/Apply.lean +++ b/src/Lean/Meta/Tactic/Apply.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Siddhartha Gadgil -/ +module + prelude -import Lean.Util.FindMVar -import Lean.Meta.SynthInstance -import Lean.Meta.CollectMVars -import Lean.Meta.Tactic.Util -import Lean.PrettyPrinter +public import Lean.Util.FindMVar +public import Lean.Meta.SynthInstance +public import Lean.Meta.CollectMVars +public import Lean.Meta.Tactic.Util +public import Lean.PrettyPrinter + +public section namespace Lean.Meta /-- diff --git a/src/Lean/Meta/Tactic/Assert.lean b/src/Lean/Meta/Tactic/Assert.lean index 5d0d0a00bc..31c40b16db 100644 --- a/src/Lean/Meta/Tactic/Assert.lean +++ b/src/Lean/Meta/Tactic/Assert.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.FVarSubst -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Revert -import Lean.Util.ForEachExpr +public import Lean.Meta.Tactic.FVarSubst +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Revert +public import Lean.Util.ForEachExpr + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Assumption.lean b/src/Lean/Meta/Tactic/Assumption.lean index b7aa848720..5d4d8f5ca0 100644 --- a/src/Lean/Meta/Tactic/Assumption.lean +++ b/src/Lean/Meta/Tactic/Assumption.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Util + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/AuxLemma.lean b/src/Lean/Meta/Tactic/AuxLemma.lean index 8a991fc970..a72cbd018b 100644 --- a/src/Lean/Meta/Tactic/AuxLemma.lean +++ b/src/Lean/Meta/Tactic/AuxLemma.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.AddDecl -import Lean.Meta.Basic -import Lean.DefEqAttrib +public import Lean.AddDecl +public import Lean.Meta.Basic +public import Lean.DefEqAttrib + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Backtrack.lean b/src/Lean/Meta/Tactic/Backtrack.lean index 5e811d4fd9..d473a2c8f0 100644 --- a/src/Lean/Meta/Tactic/Backtrack.lean +++ b/src/Lean/Meta/Tactic/Backtrack.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Init.Data.List.BasicAux -import Lean.Meta.Iterator -import Lean.Meta.Tactic.IndependentOf +public import Init.Data.List.BasicAux +public import Lean.Meta.Iterator +public import Lean.Meta.Tactic.IndependentOf + +public section /-! # `backtrack` diff --git a/src/Lean/Meta/Tactic/Cases.lean b/src/Lean/Meta/Tactic/Cases.lean index b9b616151c..8f1ef0d06a 100644 --- a/src/Lean/Meta/Tactic/Cases.lean +++ b/src/Lean/Meta/Tactic/Cases.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.Tactic.Induction -import Lean.Meta.Tactic.Injection -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Subst -import Lean.Meta.Tactic.Acyclic -import Lean.Meta.Tactic.UnifyEq +public import Lean.Meta.AppBuilder +public import Lean.Meta.Tactic.Induction +public import Lean.Meta.Tactic.Injection +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Tactic.Acyclic +public import Lean.Meta.Tactic.UnifyEq + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Cleanup.lean b/src/Lean/Meta/Tactic/Cleanup.lean index 49d5d71eb9..cda1f020ae 100644 --- a/src/Lean/Meta/Tactic/Cleanup.lean +++ b/src/Lean/Meta/Tactic/Cleanup.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.CollectFVars -import Lean.Meta.Tactic.Clear +public import Lean.Meta.CollectFVars +public import Lean.Meta.Tactic.Clear + +public section namespace Lean.Meta @@ -69,7 +73,7 @@ where By default, `toPreserve := #[]` and `indirectProps := true`. These settings are used in the mathlib tactic `extract_goal` to give the user more control over which variables to include. -/ -abbrev _root_.Lean.MVarId.cleanup (mvarId : MVarId) (toPreserve : Array FVarId := #[]) (indirectProps : Bool := true) : MetaM MVarId := do +@[inline] def _root_.Lean.MVarId.cleanup (mvarId : MVarId) (toPreserve : Array FVarId := #[]) (indirectProps : Bool := true) : MetaM MVarId := do cleanupCore mvarId toPreserve indirectProps end Lean.Meta diff --git a/src/Lean/Meta/Tactic/Clear.lean b/src/Lean/Meta/Tactic/Clear.lean index 59c1429acc..5ef1ceaa79 100644 --- a/src/Lean/Meta/Tactic/Clear.lean +++ b/src/Lean/Meta/Tactic/Clear.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Util + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Congr.lean b/src/Lean/Meta/Tactic/Congr.lean index b9b6f475fa..252a3cc80f 100644 --- a/src/Lean/Meta/Tactic/Congr.lean +++ b/src/Lean/Meta/Tactic/Congr.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.CongrTheorems -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.Assumption +public import Lean.Meta.CongrTheorems +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Assumption + +public section namespace Lean open Meta diff --git a/src/Lean/Meta/Tactic/Constructor.lean b/src/Lean/Meta/Tactic/Constructor.lean index ac8fb3ae96..7529ae13a0 100644 --- a/src/Lean/Meta/Tactic/Constructor.lean +++ b/src/Lean/Meta/Tactic/Constructor.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Check -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Apply +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Apply + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Contradiction.lean b/src/Lean/Meta/Tactic/Contradiction.lean index 4bc2cff31b..1386516d4d 100644 --- a/src/Lean/Meta/Tactic/Contradiction.lean +++ b/src/Lean/Meta/Tactic/Contradiction.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.MatchUtil -import Lean.Meta.Tactic.Assumption -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Apply +public import Lean.Meta.MatchUtil +public import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Apply + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Delta.lean b/src/Lean/Meta/Tactic/Delta.lean index e27a280eb6..1a27ef759f 100644 --- a/src/Lean/Meta/Tactic/Delta.lean +++ b/src/Lean/Meta/Tactic/Delta.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Tactic.Replace +public import Lean.Meta.Transform +public import Lean.Meta.Tactic.Replace + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/ElimInfo.lean b/src/Lean/Meta/Tactic/ElimInfo.lean index cb0631dbfd..d381fd8528 100644 --- a/src/Lean/Meta/Tactic/ElimInfo.lean +++ b/src/Lean/Meta/Tactic/ElimInfo.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Check -import Lean.ScopedEnvExtension +public import Lean.Meta.Basic +public import Lean.Meta.Check +public import Lean.ScopedEnvExtension + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/ExposeNames.lean b/src/Lean/Meta/Tactic/ExposeNames.lean index c565d7d292..ec89891670 100644 --- a/src/Lean/Meta/Tactic/ExposeNames.lean +++ b/src/Lean/Meta/Tactic/ExposeNames.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Util + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Ext.lean b/src/Lean/Meta/Tactic/Ext.lean index 050b8d68e4..b14ed3af5a 100644 --- a/src/Lean/Meta/Tactic/Ext.lean +++ b/src/Lean/Meta/Tactic/Ext.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Mario Carneiro -/ +module + prelude -import Init.Data.Array.InsertionSort -import Lean.Meta.DiscrTree +public import Init.Data.Array.InsertionSort +public import Lean.Meta.DiscrTree + +public section namespace Lean.Meta.Ext diff --git a/src/Lean/Meta/Tactic/FVarSubst.lean b/src/Lean/Meta/Tactic/FVarSubst.lean index 5c72a63de2..54708e2767 100644 --- a/src/Lean/Meta/Tactic/FVarSubst.lean +++ b/src/Lean/Meta/Tactic/FVarSubst.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Mario Carneiro -/ +module + prelude -import Lean.Data.AssocList -import Lean.Expr -import Lean.LocalContext -import Lean.Util.ReplaceExpr +public import Lean.Data.AssocList +public import Lean.Expr +public import Lean.LocalContext +public import Lean.Util.ReplaceExpr + +public section namespace Lean.Meta /-- diff --git a/src/Lean/Meta/Tactic/FunInd.lean b/src/Lean/Meta/Tactic/FunInd.lean index 62cbb540b1..e1fb1c0185 100644 --- a/src/Lean/Meta/Tactic/FunInd.lean +++ b/src/Lean/Meta/Tactic/FunInd.lean @@ -4,21 +4,25 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Match.MatcherApp.Transform -import Lean.Meta.Check -import Lean.Meta.Tactic.Subst -import Lean.Meta.Injective -- for elimOptParam -import Lean.Meta.ArgsPacker -import Lean.Meta.PProdN -import Lean.Elab.PreDefinition.WF.Eqns -import Lean.Elab.PreDefinition.Structural.Eqns -import Lean.Elab.PreDefinition.Structural.IndGroupInfo -import Lean.Elab.PreDefinition.Structural.FindRecArg -import Lean.Elab.Command -import Lean.Meta.Tactic.ElimInfo -import Lean.Meta.Tactic.FunIndInfo +public import Lean.Meta.Basic +public import Lean.Meta.Match.MatcherApp.Transform +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Injective -- for elimOptParam +public import Lean.Meta.ArgsPacker +public import Lean.Meta.PProdN +public import Lean.Elab.PreDefinition.WF.Eqns +public import Lean.Elab.PreDefinition.Structural.Eqns +public import Lean.Elab.PreDefinition.Structural.IndGroupInfo +public import Lean.Elab.PreDefinition.Structural.FindRecArg +public import Lean.Elab.Command +public import Lean.Meta.Tactic.ElimInfo +public import Lean.Meta.Tactic.FunIndInfo + +public section /-! This module contains code to derive, from the definition of a recursive function (structural or diff --git a/src/Lean/Meta/Tactic/FunIndCollect.lean b/src/Lean/Meta/Tactic/FunIndCollect.lean index f9d4685d2a..65f3345aa6 100644 --- a/src/Lean/Meta/Tactic/FunIndCollect.lean +++ b/src/Lean/Meta/Tactic/FunIndCollect.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.FunIndInfo +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.FunIndInfo + +public section /-! Support for collecting function calls that could be used for `fun_induction` or `fun_cases`. diff --git a/src/Lean/Meta/Tactic/FunIndInfo.lean b/src/Lean/Meta/Tactic/FunIndInfo.lean index a0e450016f..45f9aeff65 100644 --- a/src/Lean/Meta/Tactic/FunIndInfo.lean +++ b/src/Lean/Meta/Tactic/FunIndInfo.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Basic -import Lean.ScopedEnvExtension -import Lean.ReservedNameAction +public import Lean.Meta.Basic +public import Lean.ScopedEnvExtension +public import Lean.ReservedNameAction + +public section /-! This module defines the data structure and environment extension to remember how to map the diff --git a/src/Lean/Meta/Tactic/Generalize.lean b/src/Lean/Meta/Tactic/Generalize.lean index 50ae3a10c4..e8e1b05990 100644 --- a/src/Lean/Meta/Tactic/Generalize.lean +++ b/src/Lean/Meta/Tactic/Generalize.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.KAbstract -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.FVarSubst -import Lean.Meta.Tactic.Revert +public import Lean.Meta.KAbstract +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.FVarSubst +public import Lean.Meta.Tactic.Revert + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Grind.lean b/src/Lean/Meta/Tactic/Grind.lean index e2e8b90e4e..ec8a736216 100644 --- a/src/Lean/Meta/Tactic/Grind.lean +++ b/src/Lean/Meta/Tactic/Grind.lean @@ -3,37 +3,41 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Attr -import Lean.Meta.Tactic.Grind.RevertAll -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.Injection -import Lean.Meta.Tactic.Grind.Core -import Lean.Meta.Tactic.Grind.Canon -import Lean.Meta.Tactic.Grind.MarkNestedSubsingletons -import Lean.Meta.Tactic.Grind.Inv -import Lean.Meta.Tactic.Grind.Proof -import Lean.Meta.Tactic.Grind.Propagate -import Lean.Meta.Tactic.Grind.PP -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Ctor -import Lean.Meta.Tactic.Grind.Parser -import Lean.Meta.Tactic.Grind.EMatchTheorem -import Lean.Meta.Tactic.Grind.EMatch -import Lean.Meta.Tactic.Grind.Main -import Lean.Meta.Tactic.Grind.CasesMatch -import Lean.Meta.Tactic.Grind.Arith -import Lean.Meta.Tactic.Grind.Ext -import Lean.Meta.Tactic.Grind.MatchCond -import Lean.Meta.Tactic.Grind.MatchDiscrOnly -import Lean.Meta.Tactic.Grind.Diseq -import Lean.Meta.Tactic.Grind.MBTC -import Lean.Meta.Tactic.Grind.Lookahead -import Lean.Meta.Tactic.Grind.LawfulEqCmp -import Lean.Meta.Tactic.Grind.ReflCmp -import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Attr +public import Lean.Meta.Tactic.Grind.RevertAll +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.Injection +public import Lean.Meta.Tactic.Grind.Core +public import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.MarkNestedSubsingletons +public import Lean.Meta.Tactic.Grind.Inv +public import Lean.Meta.Tactic.Grind.Proof +public import Lean.Meta.Tactic.Grind.Propagate +public import Lean.Meta.Tactic.Grind.PP +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Ctor +public import Lean.Meta.Tactic.Grind.Parser +public import Lean.Meta.Tactic.Grind.EMatchTheorem +public import Lean.Meta.Tactic.Grind.EMatch +public import Lean.Meta.Tactic.Grind.Main +public import Lean.Meta.Tactic.Grind.CasesMatch +public import Lean.Meta.Tactic.Grind.Arith +public import Lean.Meta.Tactic.Grind.Ext +public import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Grind.MatchDiscrOnly +public import Lean.Meta.Tactic.Grind.Diseq +public import Lean.Meta.Tactic.Grind.MBTC +public import Lean.Meta.Tactic.Grind.Lookahead +public import Lean.Meta.Tactic.Grind.LawfulEqCmp +public import Lean.Meta.Tactic.Grind.ReflCmp +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Grind/AlphaShareCommon.lean b/src/Lean/Meta/Tactic/Grind/AlphaShareCommon.lean index e6ec133e5f..686d40fb54 100644 --- a/src/Lean/Meta/Tactic/Grind/AlphaShareCommon.lean +++ b/src/Lean/Meta/Tactic/Grind/AlphaShareCommon.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.ExprPtr + +public section namespace Lean.Meta.Grind @@ -52,10 +56,10 @@ structure AlphaKey where expr : Expr instance : Hashable AlphaKey where - hash k := alphaHash k.expr + hash k := private alphaHash k.expr instance : BEq AlphaKey where - beq k₁ k₂ := alphaEq k₁.expr k₂.expr + beq k₁ k₂ := private alphaEq k₁.expr k₂.expr structure AlphaShareCommon.State where map : PHashMap ExprPtr Expr := {} diff --git a/src/Lean/Meta/Tactic/Grind/Arith.lean b/src/Lean/Meta/Tactic/Grind/Arith.lean index 53ddb17309..fa577c1ef7 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.ProofUtil -import Lean.Meta.Tactic.Grind.Arith.Types -import Lean.Meta.Tactic.Grind.Arith.Main -import Lean.Meta.Tactic.Grind.Arith.Offset -import Lean.Meta.Tactic.Grind.Arith.Cutsat -import Lean.Meta.Tactic.Grind.Arith.CommRing -import Lean.Meta.Tactic.Grind.Arith.Linear -import Lean.Meta.Tactic.Grind.Arith.Simproc +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.ProofUtil +public import Lean.Meta.Tactic.Grind.Arith.Types +public import Lean.Meta.Tactic.Grind.Arith.Main +public import Lean.Meta.Tactic.Grind.Arith.Offset +public import Lean.Meta.Tactic.Grind.Arith.Cutsat +public import Lean.Meta.Tactic.Grind.Arith.CommRing +public import Lean.Meta.Tactic.Grind.Arith.Linear +public import Lean.Meta.Tactic.Grind.Arith.Simproc + +public section diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing.lean index 360aed8293..6c9af67fe9 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing.lean @@ -3,20 +3,24 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.Trace -import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly -import Lean.Meta.Tactic.Grind.Arith.CommRing.Types -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.Internalize -import Lean.Meta.Tactic.Grind.Arith.CommRing.ToExpr -import Lean.Meta.Tactic.Grind.Arith.CommRing.Var -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.CommRing.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.CommRing.Inv -import Lean.Meta.Tactic.Grind.Arith.CommRing.PP +public import Lean.Util.Trace +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Types +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Internalize +public import Lean.Meta.Tactic.Grind.Arith.CommRing.ToExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Var +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.CommRing.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Inv +public import Lean.Meta.Tactic.Grind.Arith.CommRing.PP + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/DenoteExpr.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/DenoteExpr.lean index 9de8e30658..312aab9141 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/DenoteExpr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/DenoteExpr.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.OfSemiring -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Var -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Init.Grind.Ring.OfSemiring +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Var +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId + +public section namespace Lean.Meta.Grind.Arith.CommRing /-! diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/EqCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/EqCnstr.lean index 0fd1e185a3..395366bc25 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/EqCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/EqCnstr.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.ProveEq -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.CommRing.Inv -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.ProveEq +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Inv +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify + +public section namespace Lean.Meta.Grind.Arith.CommRing /-- Returns `some ringId` if `a` and `b` are elements of the same ring. -/ @@ -283,7 +287,7 @@ private def checkNumEq0Updated : RingM Unit := do for c in basis do c.addToQueue -abbrev withCheckingNumEq0 (k : RingM Unit) : RingM Unit := do +@[inline] def withCheckingNumEq0 (k : RingM Unit) : RingM Unit := do try k finally diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Internalize.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Internalize.lean index 7e3bd099ff..f848f559f9 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Internalize.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Internalize.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Inv.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Inv.lean index 960b8ae3b2..8473d58d7d 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Inv.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Inv.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/PP.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/PP.lean index 48731a1f6c..347a2e7b16 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/PP.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/PP.lean @@ -3,14 +3,18 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr + +public section namespace Lean.Meta.Grind.Arith.CommRing private abbrev M := StateT Ring MetaM -instance : MonadRing M where +private instance : MonadRing M where getRing := get modifyRing := modify canonExpr e := return e @@ -25,19 +29,19 @@ private def toOption (cls : Name) (header : Thunk MessageData) (msgs : Array Mes private def push (msgs : Array MessageData) (msg? : Option MessageData) : Array MessageData := if let some msg := msg? then msgs.push msg else msgs -def ppBasis? : M (Option MessageData) := do +private def ppBasis? : M (Option MessageData) := do let mut basis := #[] for c in (← getRing).basis do basis := basis.push (toTraceElem (← c.denoteExpr)) return toOption `basis "Basis" basis -def ppDiseqs? : M (Option MessageData) := do +private def ppDiseqs? : M (Option MessageData) := do let mut diseqs := #[] for d in (← getRing).diseqs do diseqs := diseqs.push (toTraceElem (← d.denoteExpr)) return toOption `diseqs "Disequalities" diseqs -def ppRing? : M (Option MessageData) := do +private def ppRing? : M (Option MessageData) := do let msgs := #[] let msgs := push msgs (← ppBasis?) let msgs := push msgs (← ppDiseqs?) diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Poly.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Poly.lean index 5c520cb69f..9a9f501712 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Poly.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Poly.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Poly +public import Init.Grind.Ring.Poly + +public section namespace Lean.Grind.CommRing /-- `sharesVar m₁ m₂` returns `true` if `m₁` and `m₂` shares at least one variable. -/ diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Proof.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Proof.lean index 9d0cbe48e3..ba56fa64c3 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Proof.lean @@ -3,14 +3,18 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.OfSemiring -import Lean.Meta.Tactic.Grind.Diseq -import Lean.Meta.Tactic.Grind.Arith.ProofUtil -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.CommRing.SafePoly -import Lean.Meta.Tactic.Grind.Arith.CommRing.ToExpr +public import Init.Grind.Ring.OfSemiring +public import Lean.Meta.Tactic.Grind.Diseq +public import Lean.Meta.Tactic.Grind.Arith.ProofUtil +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.SafePoly +public import Lean.Meta.Tactic.Grind.Arith.CommRing.ToExpr + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Reify.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Reify.lean index 1b9fb8439a..fefbc1ccab 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Reify.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Reify.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Var +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Var + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/RingId.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/RingId.lean index 92f588d4be..c8cd420747 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/RingId.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/RingId.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Field -import Init.Grind.Ring.Envelope -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.SynthInstance -import Lean.Meta.Tactic.Grind.Arith.Insts -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Init.Grind.Ring.Field +public import Init.Grind.Ring.Envelope +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Arith.Insts +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/SafePoly.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/SafePoly.lean index 48b510f884..ce56063c47 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/SafePoly.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/SafePoly.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr + +public section namespace Lean.Meta.Grind.Arith.CommRing @@ -81,19 +85,19 @@ private def toPoly (e : RingExpr) : RingM Poly := do Converts the given ring expression into a multivariate polynomial. If the ring has a nonzero characteristic, it is used during normalization. -/ -abbrev _root_.Lean.Grind.CommRing.Expr.toPolyM (e : RingExpr) : RingM Poly := do +@[inline] def _root_.Lean.Grind.CommRing.Expr.toPolyM (e : RingExpr) : RingM Poly := do toPoly e -abbrev _root_.Lean.Grind.CommRing.Poly.mulConstM (p : Poly) (k : Int) : RingM Poly := +@[inline] def _root_.Lean.Grind.CommRing.Poly.mulConstM (p : Poly) (k : Int) : RingM Poly := mulConst k p -abbrev _root_.Lean.Grind.CommRing.Poly.mulMonM (p : Poly) (k : Int) (m : Mon) : RingM Poly := +@[inline] def _root_.Lean.Grind.CommRing.Poly.mulMonM (p : Poly) (k : Int) (m : Mon) : RingM Poly := mulMon k m p -abbrev _root_.Lean.Grind.CommRing.Poly.mulM (p₁ p₂ : Poly) : RingM Poly := do +@[inline] def _root_.Lean.Grind.CommRing.Poly.mulM (p₁ p₂ : Poly) : RingM Poly := do mul p₁ p₂ -abbrev _root_.Lean.Grind.CommRing.Poly.combineM (p₁ p₂ : Poly) : RingM Poly := +@[inline] def _root_.Lean.Grind.CommRing.Poly.combineM (p₁ p₂ : Poly) : RingM Poly := combine p₁ p₂ def _root_.Lean.Grind.CommRing.Poly.spolM (p₁ p₂ : Poly) : RingM Grind.CommRing.SPolResult := do diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/ToExpr.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/ToExpr.lean index b402551863..522b334914 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/ToExpr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/ToExpr.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Poly -import Init.Grind.Ring.OfSemiring -import Lean.ToExpr +public import Init.Grind.Ring.Poly +public import Init.Grind.Ring.OfSemiring +public import Lean.ToExpr + +public section namespace Lean.Meta.Grind.Arith.CommRing open Grind.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Types.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Types.lean index ab7902cc12..038499f46b 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Types.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.OfSemiring -import Lean.Data.PersistentArray -import Lean.Meta.Tactic.Grind.ExprPtr -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly +public import Init.Grind.Ring.OfSemiring +public import Lean.Data.PersistentArray +public import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly + +public section namespace Lean.Meta.Grind.Arith.CommRing export Lean.Grind.CommRing (Var Power Mon Poly) diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Util.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Util.lean index 3e7dd5740e..68e793dd99 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Util.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Canon -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.SynthInstance -import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly +public import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Poly + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Var.lean b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Var.lean index b5d1573698..7be0feb816 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Var.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/CommRing/Var.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util + +public section namespace Lean.Meta.Grind.Arith.CommRing diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat.lean index 88cd5f1b0e..79870cc216 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat.lean @@ -3,22 +3,26 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.Trace -import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Search -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Types -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var -import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.SearchM -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model -import Lean.Meta.Tactic.Grind.Arith.Cutsat.MBTC -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat -import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing +public import Lean.Util.Trace +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Search +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Types +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.SearchM +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.MBTC +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/CommRing.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/CommRing.lean index f2ecc8b8c5..e3fa3cdc93 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/CommRing.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/CommRing.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.ProveEq -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.ProveEq +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var + +public section /-! CommRing interface for cutsat. We use it to normalize nonlinear polynomials. diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/DvdCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/DvdCnstr.lean index 1a418fb573..0f546a3f2b 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/DvdCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/DvdCnstr.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Int -import Lean.Meta.Tactic.Grind.PropagatorAttr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm +public import Lean.Meta.Tactic.Simp.Arith.Int +public import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean index 5de3811241..9481101b72 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/EqCnstr.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var -import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt -import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Inv.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Inv.lean index 7810e127ba..408309d84c 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Inv.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Inv.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var + +public section namespace Int.Linear /-- Returns `true` if all coefficients are not `0`. -/ diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean index a154088c92..069e6f39d7 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/LeCnstr.lean @@ -3,16 +3,20 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Int -import Lean.Meta.Tactic.Grind.PropagatorAttr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt -import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing +public import Lean.Meta.Tactic.Simp.Arith.Int +public import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Proof +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/MBTC.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/MBTC.lean index 6d78757643..2f088f05bd 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/MBTC.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/MBTC.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Canon -import Lean.Meta.Tactic.Grind.MBTC -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model +public import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.MBTC +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Model.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Model.lean index 23d1248f9b..6ba2c96e9b 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Model.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Model.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.ToInt -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.ModelUtil +public import Init.Grind.ToInt +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.ModelUtil + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Nat.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Nat.lean index 829ccbd451..da588dfac7 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Nat.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Nat.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Int.OfNat -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Simp.Arith.Nat.Basic -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm +public import Init.Data.Int.OfNat +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Simp.Arith.Nat.Basic +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Norm + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Norm.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Norm.lean index 2a6e5ca614..734648d729 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Norm.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Norm.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util + +public section namespace Lean.Meta.Grind.Arith.Cutsat /-! diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean index 1814a3337b..fb105eb4b5 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Proof.lean @@ -3,16 +3,20 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Poly -import Lean.Meta.Tactic.Grind.Diseq -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.ProofUtil -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat -import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof +public import Init.Grind.Ring.Poly +public import Lean.Meta.Tactic.Grind.Diseq +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.ProofUtil +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.CommRing +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ReorderVars.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ReorderVars.lean index c402fbe4b0..ccf741dc9c 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ReorderVars.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ReorderVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Search.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Search.lean index efe4b59c60..1da2e5660a 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Search.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Search.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.SearchM -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ReorderVars +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Var +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.DvdCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.SearchM +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ReorderVars + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/SearchM.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/SearchM.lean index 19e46462e4..543c824a3a 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/SearchM.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/SearchM.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util + +public section namespace Lean.Meta.Grind.Arith.Cutsat /-- diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToInt.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToInt.lean index 57bbcca9ce..37910db08a 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToInt.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToInt.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.ToIntLemmas -import Lean.Meta.Tactic.Grind.SynthInstance -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.EvalNum +public import Init.Grind.ToIntLemmas +public import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.EvalNum + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToIntInfo.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToIntInfo.lean index e1cc32312a..c5b722aedb 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToIntInfo.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/ToIntInfo.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.ToInt -import Lean.Meta.Tactic.Grind.Arith.Util +public import Init.Grind.ToInt +public import Lean.Meta.Tactic.Grind.Arith.Util + +public section namespace Lean.Meta.Grind.Arith.Cutsat open Lean Grind diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Types.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Types.lean index ccd88b0d5b..e5ec9910b4 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Types.lean @@ -3,14 +3,18 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Int.Linear -import Std.Internal.Rat -import Lean.Data.PersistentArray -import Lean.Meta.Tactic.Grind.ExprPtr -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToIntInfo -import Lean.Meta.Tactic.Grind.Arith.CommRing.Types +public import Init.Data.Int.Linear +public import Std.Internal.Rat +public import Lean.Data.PersistentArray +public import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToIntInfo +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Types + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Util.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Util.lean index 593e9cbe32..1c969c6e67 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Util.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.Util + +public section namespace Int.Linear def Poly.isZero : Poly → Bool diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean index 4305ca6c72..10d5188363 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Cutsat/Var.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.IntInstTesters -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt +public import Lean.Meta.IntInstTesters +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Util +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Nat +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt + +public section namespace Lean.Meta.Grind.Arith.Cutsat diff --git a/src/Lean/Meta/Tactic/Grind/Arith/EvalNum.lean b/src/Lean/Meta/Tactic/Grind/Arith/EvalNum.lean index d1f01f3f53..06ec3f5754 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/EvalNum.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/EvalNum.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Insts.lean b/src/Lean/Meta/Tactic/Grind/Arith/Insts.lean index 08ec0ee2c2..a69a4d7247 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Insts.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Insts.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.EvalNum -import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Arith.EvalNum +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Internalize.lean b/src/Lean/Meta/Tactic/Grind/Arith/Internalize.lean index 69128009d4..416dceb51d 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Internalize.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Internalize.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Offset -import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.CommRing.Internalize -import Lean.Meta.Tactic.Grind.Arith.Linear.Internalize +public import Lean.Meta.Tactic.Grind.Arith.Offset +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Internalize +public import Lean.Meta.Tactic.Grind.Arith.Linear.Internalize + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Inv.lean b/src/Lean/Meta/Tactic/Grind/Arith/Inv.lean index de7a1f4a9e..eb9e952eaf 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Inv.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Inv.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Offset -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv -import Lean.Meta.Tactic.Grind.Arith.Linear.Inv +public import Lean.Meta.Tactic.Grind.Arith.Offset +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Inv +public import Lean.Meta.Tactic.Grind.Arith.Linear.Inv + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear.lean index d777e1a878..74e2f45ce6 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear.lean @@ -3,23 +3,27 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.Types -import Lean.Meta.Tactic.Grind.Arith.Linear.Util -import Lean.Meta.Tactic.Grind.Arith.Linear.Var -import Lean.Meta.Tactic.Grind.Arith.Linear.StructId -import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr -import Lean.Meta.Tactic.Grind.Arith.Linear.Reify -import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.ToExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Proof -import Lean.Meta.Tactic.Grind.Arith.Linear.SearchM -import Lean.Meta.Tactic.Grind.Arith.Linear.Search -import Lean.Meta.Tactic.Grind.Arith.Linear.PropagateEq -import Lean.Meta.Tactic.Grind.Arith.Linear.Internalize -import Lean.Meta.Tactic.Grind.Arith.Linear.Model -import Lean.Meta.Tactic.Grind.Arith.Linear.PP -import Lean.Meta.Tactic.Grind.Arith.Linear.MBTC +public import Lean.Meta.Tactic.Grind.Arith.Linear.Types +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Lean.Meta.Tactic.Grind.Arith.Linear.StructId +public import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Reify +public import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.ToExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Proof +public import Lean.Meta.Tactic.Grind.Arith.Linear.SearchM +public import Lean.Meta.Tactic.Grind.Arith.Linear.Search +public import Lean.Meta.Tactic.Grind.Arith.Linear.PropagateEq +public import Lean.Meta.Tactic.Grind.Arith.Linear.Internalize +public import Lean.Meta.Tactic.Grind.Arith.Linear.Model +public import Lean.Meta.Tactic.Grind.Arith.Linear.PP +public import Lean.Meta.Tactic.Grind.Arith.Linear.MBTC + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/DenoteExpr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/DenoteExpr.lean index 0edf495cb0..3563c44436 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/DenoteExpr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/DenoteExpr.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.ProveEq -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Util -import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Lean.Meta.Tactic.Grind.ProveEq +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var + +public section namespace Lean.Meta.Grind.Arith.Linear /-! diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/IneqCnstr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/IneqCnstr.lean index e5f2ce5d61..14befee819 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/IneqCnstr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/IneqCnstr.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Poly -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Var -import Lean.Meta.Tactic.Grind.Arith.Linear.StructId -import Lean.Meta.Tactic.Grind.Arith.Linear.Reify -import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Proof +public import Init.Grind.Ring.Poly +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Lean.Meta.Tactic.Grind.Arith.Linear.StructId +public import Lean.Meta.Tactic.Grind.Arith.Linear.Reify +public import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Proof + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Internalize.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Internalize.lean index 93833be822..2f89c011b2 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Internalize.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Internalize.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.Linear.StructId -import Lean.Meta.Tactic.Grind.Arith.Linear.Reify +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.Linear.StructId +public import Lean.Meta.Tactic.Grind.Arith.Linear.Reify + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Inv.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Inv.lean index 909a640e05..aba91ec08c 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Inv.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Inv.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/MBTC.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/MBTC.lean index c773890ffd..28a7e30b15 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/MBTC.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/MBTC.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Canon -import Lean.Meta.Tactic.Grind.MBTC -import Lean.Meta.Tactic.Grind.Arith.Linear.Model -import Lean.Meta.Tactic.Grind.Arith.Linear.PropagateEq +public import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.MBTC +public import Lean.Meta.Tactic.Grind.Arith.Linear.Model +public import Lean.Meta.Tactic.Grind.Arith.Linear.PropagateEq + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Model.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Model.lean index cea3935708..3cff588572 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Model.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Model.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.ModelUtil +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.ModelUtil + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/PP.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/PP.lean index 80579d3383..a1bc2d1532 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/PP.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/PP.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.Model +public import Lean.Meta.Tactic.Grind.Arith.Linear.Model + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Proof.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Proof.lean index f6a29b50cb..895e959244 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Proof.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof -import Lean.Meta.Tactic.Grind.Arith.Linear.Util -import Lean.Meta.Tactic.Grind.Arith.Linear.ToExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Proof +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.ToExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/PropagateEq.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/PropagateEq.lean index 6a8c7ea553..5d12e033cd 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/PropagateEq.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/PropagateEq.lean @@ -3,16 +3,20 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Poly -import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify -import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Var -import Lean.Meta.Tactic.Grind.Arith.Linear.StructId -import Lean.Meta.Tactic.Grind.Arith.Linear.Reify -import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr -import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.Proof +public import Init.Grind.Ring.Poly +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Reify +public import Lean.Meta.Tactic.Grind.Arith.CommRing.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Lean.Meta.Tactic.Grind.Arith.Linear.StructId +public import Lean.Meta.Tactic.Grind.Arith.Linear.Reify +public import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Proof + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Reify.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Reify.lean index 6415300c7c..e3de73ba29 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Reify.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Reify.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Search.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Search.lean index f0f0373528..5100d15a32 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Search.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Search.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr -import Lean.Meta.Tactic.Grind.Arith.Linear.SearchM -import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Linear.DenoteExpr +public import Lean.Meta.Tactic.Grind.Arith.Linear.SearchM +public import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/SearchM.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/SearchM.lean index 1d57859eed..9ac26cc5f8 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/SearchM.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/SearchM.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/StructId.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/StructId.lean index 7013bcf63e..affe56b835 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/StructId.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/StructId.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ordered.Module -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.SynthInstance -import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt -import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util -import Lean.Meta.Tactic.Grind.Arith.Linear.Util -import Lean.Meta.Tactic.Grind.Arith.Linear.Var +public import Init.Grind.Ordered.Module +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.ToInt +public import Lean.Meta.Tactic.Grind.Arith.CommRing.RingId +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Var + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/ToExpr.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/ToExpr.lean index bae39d9c1f..b1d30231d5 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/ToExpr.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/ToExpr.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ordered.Linarith -import Lean.ToExpr +public import Init.Grind.Ordered.Linarith +public import Lean.ToExpr + +public section namespace Lean.Meta.Grind.Arith.Linear open Grind.Linarith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Types.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Types.lean index 5786efb2a2..be0538f469 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Types.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Std.Internal.Rat -import Init.Grind.Ring.Poly -import Init.Grind.Ordered.Linarith -import Lean.Data.PersistentArray -import Lean.Meta.Tactic.Grind.ExprPtr +public import Std.Internal.Rat +public import Init.Grind.Ring.Poly +public import Init.Grind.Ordered.Linarith +public import Lean.Data.PersistentArray +public import Lean.Meta.Tactic.Grind.ExprPtr + +public section namespace Lean.Meta.Grind.Arith.Linear export Lean.Grind.Linarith (Var Poly) diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Util.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Util.lean index 65725ef92a..ee445de677 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Util.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.CommRing.Util +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Util + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Var.lean b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Var.lean index da5f953c67..c542066ce2 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Linear/Var.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Linear/Var.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Linear.Util +public import Lean.Meta.Tactic.Grind.Arith.Linear.Util + +public section namespace Lean.Meta.Grind.Arith.Linear diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Main.lean b/src/Lean/Meta/Tactic/Grind/Arith/Main.lean index 2e089086dd..b06c9aa4ef 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Main.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Main.lean @@ -3,14 +3,18 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.PropagatorAttr -import Lean.Meta.Tactic.Grind.Arith.Offset -import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Search -import Lean.Meta.Tactic.Grind.Arith.CommRing.EqCnstr -import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr -import Lean.Meta.Tactic.Grind.Arith.Linear.Search +public import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Lean.Meta.Tactic.Grind.Arith.Offset +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.LeCnstr +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Search +public import Lean.Meta.Tactic.Grind.Arith.CommRing.EqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Linear.IneqCnstr +public import Lean.Meta.Tactic.Grind.Arith.Linear.Search + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Model.lean b/src/Lean/Meta/Tactic/Grind/Arith/Model.lean index 8349c8a076..f223938b57 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Model.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Model.lean @@ -3,6 +3,10 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Offset.Model -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model +public import Lean.Meta.Tactic.Grind.Arith.Offset.Model +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Model + +public section diff --git a/src/Lean/Meta/Tactic/Grind/Arith/ModelUtil.lean b/src/Lean/Meta/Tactic/Grind/Arith/ModelUtil.lean index 529cd1a528..89b521c2af 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/ModelUtil.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/ModelUtil.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Std.Internal.Rat -import Lean.Meta.Tactic.Grind.Types +public import Std.Internal.Rat +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind.Arith open Std.Internal diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset.lean index f4a1bb0041..0cec0f7ff1 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Offset.Main -import Lean.Meta.Tactic.Grind.Arith.Offset.Proof -import Lean.Meta.Tactic.Grind.Arith.Offset.Util -import Lean.Meta.Tactic.Grind.Arith.Offset.Types +public import Lean.Meta.Tactic.Grind.Arith.Offset.Main +public import Lean.Meta.Tactic.Grind.Arith.Offset.Proof +public import Lean.Meta.Tactic.Grind.Arith.Offset.Util +public import Lean.Meta.Tactic.Grind.Arith.Offset.Types + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Main.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Main.lean index 958a1e01e6..de7136ac0a 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Main.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Main.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Offset -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.Offset.Proof -import Lean.Meta.Tactic.Grind.Arith.Offset.Util +public import Init.Grind.Offset +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.Offset.Proof +public import Lean.Meta.Tactic.Grind.Arith.Offset.Util + +public section namespace Lean.Meta.Grind.Arith.Offset /-! diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Model.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Model.lean index 82ed1846cc..7da8ed7909 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Model.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Model.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Basic +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Util + +public section namespace Lean.Meta.Grind.Arith.Offset diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Proof.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Proof.lean index f0b1a171a8..2fe421ce60 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Proof.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Offset -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Grind.Types +public import Init.Grind.Offset +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind.Arith.Offset /-! diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Types.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Types.lean index 79f0022047..5a5900a489 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Types.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.AssocList -import Lean.Data.PersistentArray -import Lean.Meta.Tactic.Grind.ExprPtr -import Lean.Meta.Tactic.Grind.Arith.Util -import Lean.Meta.Tactic.Grind.Arith.Offset.Util +public import Lean.Data.AssocList +public import Lean.Data.PersistentArray +public import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Meta.Tactic.Grind.Arith.Offset.Util + +public section namespace Lean.Meta.Grind.Arith.Offset diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Util.lean b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Util.lean index d4a636ea3b..86e4a882a1 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Offset/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Offset/Util.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Message -import Lean.Meta.Tactic.Grind.Arith.Util +public import Lean.Expr +public import Lean.Message +public import Lean.Meta.Tactic.Grind.Arith.Util + +public section namespace Lean.Meta.Grind.Arith.Offset diff --git a/src/Lean/Meta/Tactic/Grind/Arith/ProofUtil.lean b/src/Lean/Meta/Tactic/Grind/Arith/ProofUtil.lean index 1bf6ba7890..1a15f88a19 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/ProofUtil.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/ProofUtil.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Simproc.lean b/src/Lean/Meta/Tactic/Grind/Arith/Simproc.lean index 699dbee6f5..c1ebb6232e 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Simproc.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Simproc.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Basic -import Init.Simproc -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Grind.SynthInstance +public import Init.Grind.Ring.Basic +public import Init.Simproc +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Types.lean b/src/Lean/Meta/Tactic/Grind/Arith/Types.lean index 02aca3b55a..ee3b1063e7 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Types.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Arith.Offset.Types -import Lean.Meta.Tactic.Grind.Arith.Cutsat.Types -import Lean.Meta.Tactic.Grind.Arith.CommRing.Types -import Lean.Meta.Tactic.Grind.Arith.Linear.Types +public import Lean.Meta.Tactic.Grind.Arith.Offset.Types +public import Lean.Meta.Tactic.Grind.Arith.Cutsat.Types +public import Lean.Meta.Tactic.Grind.Arith.CommRing.Types +public import Lean.Meta.Tactic.Grind.Arith.Linear.Types + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Arith/Util.lean b/src/Lean/Meta/Tactic/Grind/Arith/Util.lean index 1b0e8afd0d..50592e305f 100644 --- a/src/Lean/Meta/Tactic/Grind/Arith/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Arith/Util.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Ring.Basic -import Lean.Meta.SynthInstance -import Lean.Meta.Basic -import Std.Internal.Rat +public import Init.Grind.Ring.Basic +public import Lean.Meta.SynthInstance +public import Lean.Meta.Basic +public import Std.Internal.Rat + +public section namespace Lean.Meta.Grind.Arith diff --git a/src/Lean/Meta/Tactic/Grind/Attr.lean b/src/Lean/Meta/Tactic/Grind/Attr.lean index 7a2a71ed3e..48598c3cbf 100644 --- a/src/Lean/Meta/Tactic/Grind/Attr.lean +++ b/src/Lean/Meta/Tactic/Grind/Attr.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.EMatchTheorem -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.ExtAttr +public import Lean.Meta.Tactic.Grind.EMatchTheorem +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.ExtAttr + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Beta.lean b/src/Lean/Meta/Tactic/Grind/Beta.lean index 3dfad9d1c3..905a7e55ae 100644 --- a/src/Lean/Meta/Tactic/Grind/Beta.lean +++ b/src/Lean/Meta/Tactic/Grind/Beta.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Canon.lean b/src/Lean/Meta/Tactic/Grind/Canon.lean index c213b76c45..e496f2370e 100644 --- a/src/Lean/Meta/Tactic/Grind/Canon.lean +++ b/src/Lean/Meta/Tactic/Grind/Canon.lean @@ -3,14 +3,18 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Lean.Meta.Basic -import Lean.Meta.FunInfo -import Lean.Util.FVarSubset -import Lean.Util.PtrSet -import Lean.Util.FVarSubset -import Lean.Meta.Tactic.Grind.Types +public import Init.Grind.Util +public import Lean.Meta.Basic +public import Lean.Meta.FunInfo +public import Lean.Util.FVarSubset +public import Lean.Util.PtrSet +public import Lean.Util.FVarSubset +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind namespace Canon @@ -128,7 +132,7 @@ private inductive ShouldCanonResult where deriving Inhabited instance : Repr ShouldCanonResult where - reprPrec r _ := match r with + reprPrec r _ := private match r with | .canonType => "canonType" | .canonInst => "canonInst" | .canonImplicit => "canonImplicit" diff --git a/src/Lean/Meta/Tactic/Grind/Cases.lean b/src/Lean/Meta/Tactic/Grind/Cases.lean index 25fe92ef50..664b498c3e 100644 --- a/src/Lean/Meta/Tactic/Grind/Cases.lean +++ b/src/Lean/Meta/Tactic/Grind/Cases.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Cases + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/CasesMatch.lean b/src/Lean/Meta/Tactic/Grind/CasesMatch.lean index 45c9644af2..4539b1746b 100644 --- a/src/Lean/Meta/Tactic/Grind/CasesMatch.lean +++ b/src/Lean/Meta/Tactic/Grind/CasesMatch.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Cases -import Lean.Meta.Match.MatcherApp -import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Match.MatcherApp +public import Lean.Meta.Tactic.Grind.MatchCond + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Core.lean b/src/Lean/Meta/Tactic/Grind/Core.lean index 02bc6e25b8..f27814adf4 100644 --- a/src/Lean/Meta/Tactic/Grind/Core.lean +++ b/src/Lean/Meta/Tactic/Grind/Core.lean @@ -3,17 +3,21 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Inv -import Lean.Meta.Tactic.Grind.PP -import Lean.Meta.Tactic.Grind.Ctor -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Beta -import Lean.Meta.Tactic.Grind.Internalize -import Lean.Meta.Tactic.Grind.Simp +public import Init.Grind.Util +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Inv +public import Lean.Meta.Tactic.Grind.PP +public import Lean.Meta.Tactic.Grind.Ctor +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Beta +public import Lean.Meta.Tactic.Grind.Internalize +public import Lean.Meta.Tactic.Grind.Simp + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Ctor.lean b/src/Lean/Meta/Tactic/Grind/Ctor.lean index 1d20f9ad54..03d28164c7 100644 --- a/src/Lean/Meta/Tactic/Grind/Ctor.lean +++ b/src/Lean/Meta/Tactic/Grind/Ctor.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.ProveEq +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.ProveEq + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Diseq.lean b/src/Lean/Meta/Tactic/Grind/Diseq.lean index 081e47df96..3955b937da 100644 --- a/src/Lean/Meta/Tactic/Grind/Diseq.lean +++ b/src/Lean/Meta/Tactic/Grind/Diseq.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Grind.Types +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/EMatch.lean b/src/Lean/Meta/Tactic/Grind/EMatch.lean index 80f3721a1a..696c07cb3e 100644 --- a/src/Lean/Meta/Tactic/Grind/EMatch.lean +++ b/src/Lean/Meta/Tactic/Grind/EMatch.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Intro -import Lean.Meta.Tactic.Grind.MatchDiscrOnly -import Lean.Meta.Tactic.Grind.MatchCond -import Lean.Meta.Tactic.Grind.Core +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Intro +public import Lean.Meta.Tactic.Grind.MatchDiscrOnly +public import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Grind.Core + +public section namespace Lean.Meta.Grind namespace EMatch diff --git a/src/Lean/Meta/Tactic/Grind/EMatchTheorem.lean b/src/Lean/Meta/Tactic/Grind/EMatchTheorem.lean index 21c9dda3c3..98809a036b 100644 --- a/src/Lean/Meta/Tactic/Grind/EMatchTheorem.lean +++ b/src/Lean/Meta/Tactic/Grind/EMatchTheorem.lean @@ -3,18 +3,22 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Init.Grind.Tactics -import Lean.HeadIndex -import Lean.PrettyPrinter -import Lean.Util.FoldConsts -import Lean.Util.CollectFVars -import Lean.Meta.Basic -import Lean.Meta.InferType -import Lean.Meta.Eqns -import Lean.Meta.Match.MatchEqs -import Lean.Meta.Tactic.Grind.Util +public import Init.Grind.Util +public import Init.Grind.Tactics +public import Lean.HeadIndex +public import Lean.PrettyPrinter +public import Lean.Util.FoldConsts +public import Lean.Util.CollectFVars +public import Lean.Meta.Basic +public import Lean.Meta.InferType +public import Lean.Meta.Eqns +public import Lean.Meta.Match.MatchEqs +public import Lean.Meta.Tactic.Grind.Util + +public section namespace Lean.Meta.Grind @@ -273,8 +277,8 @@ private def inferEMatchProofType (proof : Expr) (gen : Bool) : MetaM Expr := do -- Configuration for the `grind` normalizer. We want both `zetaDelta` and `zeta` private def normConfig : Grind.Config := {} -theorem normConfig_zeta : normConfig.zeta = true := rfl -theorem normConfig_zetaDelta : normConfig.zetaDelta = true := rfl +private theorem normConfig_zeta : normConfig.zeta = true := rfl +private theorem normConfig_zetaDelta : normConfig.zetaDelta = true := rfl def preprocessPattern (pat : Expr) (normalizePattern := true) : MetaM Expr := do let pat ← instantiateMVars pat diff --git a/src/Lean/Meta/Tactic/Grind/EqResolution.lean b/src/Lean/Meta/Tactic/Grind/EqResolution.lean index fe954f3025..4967e46a68 100644 --- a/src/Lean/Meta/Tactic/Grind/EqResolution.lean +++ b/src/Lean/Meta/Tactic/Grind/EqResolution.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.MatchUtil -import Lean.Util.ForEachExpr +public import Lean.Meta.AppBuilder +public import Lean.Meta.MatchUtil +public import Lean.Util.ForEachExpr + +public section namespace Lean.Meta.Grind /-! A basic "equality resolution" procedure. -/ diff --git a/src/Lean/Meta/Tactic/Grind/ExprPtr.lean b/src/Lean/Meta/Tactic/Grind/ExprPtr.lean index 5d40276b90..98839a673c 100644 --- a/src/Lean/Meta/Tactic/Grind/ExprPtr.lean +++ b/src/Lean/Meta/Tactic/Grind/ExprPtr.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Ext.lean b/src/Lean/Meta/Tactic/Grind/Ext.lean index 6abd7c192e..452bfa6ebb 100644 --- a/src/Lean/Meta/Tactic/Grind/Ext.lean +++ b/src/Lean/Meta/Tactic/Grind/Ext.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section namespace Lean.Meta.Grind /-! Extensionality theorems support. -/ diff --git a/src/Lean/Meta/Tactic/Grind/ExtAttr.lean b/src/Lean/Meta/Tactic/Grind/ExtAttr.lean index 46512f9582..83aa88c78d 100644 --- a/src/Lean/Meta/Tactic/Grind/ExtAttr.lean +++ b/src/Lean/Meta/Tactic/Grind/ExtAttr.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Ext +public import Lean.Meta.Tactic.Ext + +public section namespace Lean.Meta.Grind /-! Grind extensionality attribute to mark which `[ext]` theorems should be used. -/ diff --git a/src/Lean/Meta/Tactic/Grind/ForallProp.lean b/src/Lean/Meta/Tactic/Grind/ForallProp.lean index 9bae65c439..63b7d884e1 100644 --- a/src/Lean/Meta/Tactic/Grind/ForallProp.lean +++ b/src/Lean/Meta/Tactic/Grind/ForallProp.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Internalize -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.EqResolution +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Internalize +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.EqResolution + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/Injection.lean b/src/Lean/Meta/Tactic/Grind/Injection.lean index 65c9778621..9715d71503 100644 --- a/src/Lean/Meta/Tactic/Grind/Injection.lean +++ b/src/Lean/Meta/Tactic/Grind/Injection.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.CtorRecognizer -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Clear +public import Lean.Meta.CtorRecognizer +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Clear + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/Internalize.lean b/src/Lean/Meta/Tactic/Grind/Internalize.lean index 73375d6795..09277f4772 100644 --- a/src/Lean/Meta/Tactic/Grind/Internalize.lean +++ b/src/Lean/Meta/Tactic/Grind/Internalize.lean @@ -3,19 +3,23 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Init.Grind.Lemmas -import Lean.Meta.LitValues -import Lean.Meta.Match.MatcherInfo -import Lean.Meta.Match.MatchEqsExt -import Lean.Meta.Match.MatchEqs -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Canon -import Lean.Meta.Tactic.Grind.Beta -import Lean.Meta.Tactic.Grind.MatchCond -import Lean.Meta.Tactic.Grind.Arith.Internalize +public import Init.Grind.Util +public import Init.Grind.Lemmas +public import Lean.Meta.LitValues +public import Lean.Meta.Match.MatcherInfo +public import Lean.Meta.Match.MatchEqsExt +public import Lean.Meta.Match.MatchEqs +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.Beta +public import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Grind.Arith.Internalize + +public section namespace Lean.Meta.Grind /-- Adds `e` to congruence table. -/ diff --git a/src/Lean/Meta/Tactic/Grind/Intro.lean b/src/Lean/Meta/Tactic/Grind/Intro.lean index 6427ffa042..44746b33ca 100644 --- a/src/Lean/Meta/Tactic/Grind/Intro.lean +++ b/src/Lean/Meta/Tactic/Grind/Intro.lean @@ -3,16 +3,20 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.CasesMatch -import Lean.Meta.Tactic.Grind.Injection -import Lean.Meta.Tactic.Grind.Core -import Lean.Meta.Tactic.Grind.SearchM +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.CasesMatch +public import Lean.Meta.Tactic.Grind.Injection +public import Lean.Meta.Tactic.Grind.Core +public import Lean.Meta.Tactic.Grind.SearchM + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Inv.lean b/src/Lean/Meta/Tactic/Grind/Inv.lean index d4683ce33e..30f9e5777d 100644 --- a/src/Lean/Meta/Tactic/Grind/Inv.lean +++ b/src/Lean/Meta/Tactic/Grind/Inv.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Proof -import Lean.Meta.Tactic.Grind.MatchCond -import Lean.Meta.Tactic.Grind.Arith.Inv +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Proof +public import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Grind.Arith.Inv + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/LawfulEqCmp.lean b/src/Lean/Meta/Tactic/Grind/LawfulEqCmp.lean index 106511db58..2f771ff167 100644 --- a/src/Lean/Meta/Tactic/Grind/LawfulEqCmp.lean +++ b/src/Lean/Meta/Tactic/Grind/LawfulEqCmp.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section /-! Support for type class `LawfulEqCmp`. diff --git a/src/Lean/Meta/Tactic/Grind/Lookahead.lean b/src/Lean/Meta/Tactic/Grind/Lookahead.lean index 9c3399a6c5..8a53923f2d 100644 --- a/src/Lean/Meta/Tactic/Grind/Lookahead.lean +++ b/src/Lean/Meta/Tactic/Grind/Lookahead.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Intro -import Lean.Meta.Tactic.Grind.Arith -import Lean.Meta.Tactic.Grind.Split -import Lean.Meta.Tactic.Grind.EMatch -import Lean.Meta.Tactic.Grind.SearchM +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Intro +public import Lean.Meta.Tactic.Grind.Arith +public import Lean.Meta.Tactic.Grind.Split +public import Lean.Meta.Tactic.Grind.EMatch +public import Lean.Meta.Tactic.Grind.SearchM + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/MBTC.lean b/src/Lean/Meta/Tactic/Grind/MBTC.lean index 07f59e94ab..c2657f7759 100644 --- a/src/Lean/Meta/Tactic/Grind/MBTC.lean +++ b/src/Lean/Meta/Tactic/Grind/MBTC.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Canon +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Canon + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Main.lean b/src/Lean/Meta/Tactic/Grind/Main.lean index 868c56acbf..7e2b579230 100644 --- a/src/Lean/Meta/Tactic/Grind/Main.lean +++ b/src/Lean/Meta/Tactic/Grind/Main.lean @@ -3,31 +3,35 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.ExposeNames -import Lean.Meta.Tactic.Simp.Diagnostics -import Lean.Meta.Tactic.Grind.RevertAll -import Lean.Meta.Tactic.Grind.PropagatorAttr -import Lean.Meta.Tactic.Grind.Proj -import Lean.Meta.Tactic.Grind.ForallProp -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Inv -import Lean.Meta.Tactic.Grind.Intro -import Lean.Meta.Tactic.Grind.EMatch -import Lean.Meta.Tactic.Grind.Split -import Lean.Meta.Tactic.Grind.Solve -import Lean.Meta.Tactic.Grind.SimpUtil -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.LawfulEqCmp -import Lean.Meta.Tactic.Grind.ReflCmp +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.ExposeNames +public import Lean.Meta.Tactic.Simp.Diagnostics +public import Lean.Meta.Tactic.Grind.RevertAll +public import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Lean.Meta.Tactic.Grind.Proj +public import Lean.Meta.Tactic.Grind.ForallProp +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Inv +public import Lean.Meta.Tactic.Grind.Intro +public import Lean.Meta.Tactic.Grind.EMatch +public import Lean.Meta.Tactic.Grind.Split +public import Lean.Meta.Tactic.Grind.Solve +public import Lean.Meta.Tactic.Grind.SimpUtil +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.LawfulEqCmp +public import Lean.Meta.Tactic.Grind.ReflCmp + +public section namespace Lean.Meta.Grind structure Params where config : Grind.Config - ematch : EMatchTheorems := {} + ematch : EMatchTheorems := default symPrios : SymbolPriorities := {} casesTypes : CasesTypes := {} extra : PArray EMatchTheorem := {} diff --git a/src/Lean/Meta/Tactic/Grind/MarkNestedSubsingletons.lean b/src/Lean/Meta/Tactic/Grind/MarkNestedSubsingletons.lean index 3c9844bf44..77644d6908 100644 --- a/src/Lean/Meta/Tactic/Grind/MarkNestedSubsingletons.lean +++ b/src/Lean/Meta/Tactic/Grind/MarkNestedSubsingletons.lean @@ -3,15 +3,19 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Lean.Util.PtrSet -import Lean.Meta.Transform -import Lean.Meta.Basic -import Lean.Meta.InferType -import Lean.Meta.Tactic.Grind.ExprPtr -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Types +public import Init.Grind.Util +public import Lean.Util.PtrSet +public import Lean.Meta.Transform +public import Lean.Meta.Basic +public import Lean.Meta.InferType +public import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind @@ -104,7 +108,7 @@ where let e ← foldProjs e normalizeLevels e -def markNestedProof (e : Expr) : M Expr := do +private def markNestedProof (e : Expr) : M Expr := do let prop ← inferType e let prop ← markNestedSubsingletons.preprocess prop return mkApp2 (mkConst ``Grind.nestedProof) prop e diff --git a/src/Lean/Meta/Tactic/Grind/MatchCond.lean b/src/Lean/Meta/Tactic/Grind/MatchCond.lean index 35f8ba5fb7..eefcab9ab1 100644 --- a/src/Lean/Meta/Tactic/Grind/MatchCond.lean +++ b/src/Lean/Meta/Tactic/Grind/MatchCond.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind -import Init.Simproc -import Lean.Meta.Tactic.Contradiction -import Lean.Meta.Tactic.Grind.ProveEq -import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Init.Grind +public import Init.Simproc +public import Lean.Meta.Tactic.Contradiction +public import Lean.Meta.Tactic.Grind.ProveEq +public import Lean.Meta.Tactic.Grind.PropagatorAttr + +public section namespace Lean.Meta.Grind /- diff --git a/src/Lean/Meta/Tactic/Grind/MatchDiscrOnly.lean b/src/Lean/Meta/Tactic/Grind/MatchDiscrOnly.lean index 4641b328e7..d575f3f0ca 100644 --- a/src/Lean/Meta/Tactic/Grind/MatchDiscrOnly.lean +++ b/src/Lean/Meta/Tactic/Grind/MatchDiscrOnly.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Init.Simproc -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Simp.Rewrite +public import Init.Grind.Util +public import Init.Simproc +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.Rewrite + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/PP.lean b/src/Lean/Meta/Tactic/Grind/PP.lean index 084b65bb7f..5a1d5a0d0d 100644 --- a/src/Lean/Meta/Tactic/Grind/PP.lean +++ b/src/Lean/Meta/Tactic/Grind/PP.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Util -import Init.Grind.PP -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Arith.Model -import Lean.Meta.Tactic.Grind.Arith.CommRing.PP -import Lean.Meta.Tactic.Grind.Arith.Linear.PP +public import Init.Grind.Util +public import Init.Grind.PP +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Arith.Model +public import Lean.Meta.Tactic.Grind.Arith.CommRing.PP +public import Lean.Meta.Tactic.Grind.Arith.Linear.PP + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Parser.lean b/src/Lean/Meta/Tactic/Grind/Parser.lean index 21d798f0f4..bc7b65f0e9 100644 --- a/src/Lean/Meta/Tactic/Grind/Parser.lean +++ b/src/Lean/Meta/Tactic/Grind/Parser.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Command +public import Lean.Parser.Command + +public section namespace Lean.Parser.Command /-! diff --git a/src/Lean/Meta/Tactic/Grind/Proj.lean b/src/Lean/Meta/Tactic/Grind/Proj.lean index f587b78eac..42d17425d3 100644 --- a/src/Lean/Meta/Tactic/Grind/Proj.lean +++ b/src/Lean/Meta/Tactic/Grind/Proj.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ProjFns -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Internalize +public import Lean.ProjFns +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Internalize + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Proof.lean b/src/Lean/Meta/Tactic/Grind/Proof.lean index 4953e02a95..6096a4f01b 100644 --- a/src/Lean/Meta/Tactic/Grind/Proof.lean +++ b/src/Lean/Meta/Tactic/Grind/Proof.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Grind.Types +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Propagate.lean b/src/Lean/Meta/Tactic/Grind/Propagate.lean index fbb71c765e..626a0dcee5 100644 --- a/src/Lean/Meta/Tactic/Grind/Propagate.lean +++ b/src/Lean/Meta/Tactic/Grind/Propagate.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind -import Lean.Meta.Tactic.Grind.Proof -import Lean.Meta.Tactic.Grind.PropagatorAttr -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.Ext -import Lean.Meta.Tactic.Grind.Internalize +public import Init.Grind +public import Lean.Meta.Tactic.Grind.Proof +public import Lean.Meta.Tactic.Grind.PropagatorAttr +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Ext +public import Lean.Meta.Tactic.Grind.Internalize + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/PropagatorAttr.lean b/src/Lean/Meta/Tactic/Grind/PropagatorAttr.lean index 6cd98068bf..a10e2d1c6b 100644 --- a/src/Lean/Meta/Tactic/Grind/PropagatorAttr.lean +++ b/src/Lean/Meta/Tactic/Grind/PropagatorAttr.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind -import Lean.Meta.Tactic.Grind.Proof +public import Init.Grind +public import Lean.Meta.Tactic.Grind.Proof + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/ProveEq.lean b/src/Lean/Meta/Tactic/Grind/ProveEq.lean index 1daf49d7c2..2513321981 100644 --- a/src/Lean/Meta/Tactic/Grind/ProveEq.lean +++ b/src/Lean/Meta/Tactic/Grind/ProveEq.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Simp + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/ReflCmp.lean b/src/Lean/Meta/Tactic/Grind/ReflCmp.lean index 7a94d70657..dc71ca117b 100644 --- a/src/Lean/Meta/Tactic/Grind/ReflCmp.lean +++ b/src/Lean/Meta/Tactic/Grind/ReflCmp.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.SynthInstance +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.SynthInstance + +public section /-! Support for type class `ReflCmp`. diff --git a/src/Lean/Meta/Tactic/Grind/RevertAll.lean b/src/Lean/Meta/Tactic/Grind/RevertAll.lean index ef2fe7bde8..6fb820a466 100644 --- a/src/Lean/Meta/Tactic/Grind/RevertAll.lean +++ b/src/Lean/Meta/Tactic/Grind/RevertAll.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Revert +public import Lean.Meta.Tactic.Revert + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/SearchM.lean b/src/Lean/Meta/Tactic/Grind/SearchM.lean index 95848b52e6..816e6b40e6 100644 --- a/src/Lean/Meta/Tactic/Grind/SearchM.lean +++ b/src/Lean/Meta/Tactic/Grind/SearchM.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ForEachExpr -import Lean.Meta.Tactic.Grind.Types +public import Lean.Util.ForEachExpr +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/Grind/Simp.lean b/src/Lean/Meta/Tactic/Grind/Simp.lean index 08fdd2a093..f02ca4119a 100644 --- a/src/Lean/Meta/Tactic/Grind/Simp.lean +++ b/src/Lean/Meta/Tactic/Grind/Simp.lean @@ -3,15 +3,19 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Lemmas -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Simp.Main -import Lean.Meta.Tactic.Grind.Util -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.MatchDiscrOnly -import Lean.Meta.Tactic.Grind.MarkNestedSubsingletons -import Lean.Meta.Tactic.Grind.Canon +public import Init.Grind.Lemmas +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Grind.Util +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.MatchDiscrOnly +public import Lean.Meta.Tactic.Grind.MarkNestedSubsingletons +public import Lean.Meta.Tactic.Grind.Canon + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/SimpUtil.lean b/src/Lean/Meta/Tactic/Grind/SimpUtil.lean index a854d6ee5e..757c2b849f 100644 --- a/src/Lean/Meta/Tactic/Grind/SimpUtil.lean +++ b/src/Lean/Meta/Tactic/Grind/SimpUtil.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Grind.Simp -import Lean.Meta.Tactic.Grind.MatchDiscrOnly -import Lean.Meta.Tactic.Grind.MatchCond -import Lean.Meta.Tactic.Grind.ForallProp -import Lean.Meta.Tactic.Grind.Arith.Simproc -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.List -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Grind.Simp +public import Lean.Meta.Tactic.Grind.MatchDiscrOnly +public import Lean.Meta.Tactic.Grind.MatchCond +public import Lean.Meta.Tactic.Grind.ForallProp +public import Lean.Meta.Tactic.Grind.Arith.Simproc +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.List +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Solve.lean b/src/Lean/Meta/Tactic/Grind/Solve.lean index 14c3c4fc56..8696beba2a 100644 --- a/src/Lean/Meta/Tactic/Grind/Solve.lean +++ b/src/Lean/Meta/Tactic/Grind/Solve.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Split -import Lean.Meta.Tactic.Grind.EMatch -import Lean.Meta.Tactic.Grind.Arith -import Lean.Meta.Tactic.Grind.Lookahead -import Lean.Meta.Tactic.Grind.SearchM +public import Lean.Meta.Tactic.Grind.Split +public import Lean.Meta.Tactic.Grind.EMatch +public import Lean.Meta.Tactic.Grind.Arith +public import Lean.Meta.Tactic.Grind.Lookahead +public import Lean.Meta.Tactic.Grind.SearchM + +public section namespace Lean.Meta.Grind def tryFallback : GoalM Bool := do diff --git a/src/Lean/Meta/Tactic/Grind/Split.lean b/src/Lean/Meta/Tactic/Grind/Split.lean index 8e372b3e49..8480eee984 100644 --- a/src/Lean/Meta/Tactic/Grind/Split.lean +++ b/src/Lean/Meta/Tactic/Grind/Split.lean @@ -3,12 +3,16 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Grind.Types -import Lean.Meta.Tactic.Grind.Intro -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.CasesMatch -import Lean.Meta.Tactic.Grind.SearchM +public import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.Tactic.Grind.Intro +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.CasesMatch +public import Lean.Meta.Tactic.Grind.SearchM + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/SynthInstance.lean b/src/Lean/Meta/Tactic/Grind/SynthInstance.lean index b7f18100c4..097a2e7d13 100644 --- a/src/Lean/Meta/Tactic/Grind/SynthInstance.lean +++ b/src/Lean/Meta/Tactic/Grind/SynthInstance.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.SynthInstance -import Lean.Meta.Tactic.Grind.Types +public import Lean.Meta.SynthInstance +public import Lean.Meta.Tactic.Grind.Types + +public section namespace Lean.Meta.Grind diff --git a/src/Lean/Meta/Tactic/Grind/Types.lean b/src/Lean/Meta/Tactic/Grind/Types.lean index e3208560f9..f721503f6a 100644 --- a/src/Lean/Meta/Tactic/Grind/Types.lean +++ b/src/Lean/Meta/Tactic/Grind/Types.lean @@ -3,24 +3,29 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Grind.Tactics -import Init.Data.Queue -import Std.Data.TreeSet.Basic -import Lean.HeadIndex -import Lean.Meta.Basic -import Lean.Meta.CongrTheorems -import Lean.Meta.AbstractNestedProofs -import Lean.Meta.Tactic.Simp.Types -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Ext -import Lean.Meta.Tactic.Grind.ExprPtr -import Lean.Meta.Tactic.Grind.AlphaShareCommon -import Lean.Meta.Tactic.Grind.Attr -import Lean.Meta.Tactic.Grind.ExtAttr -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.Arith.Types -import Lean.Meta.Tactic.Grind.EMatchTheorem +public import Init.Grind.Tactics +public import Init.Data.Queue +public import Std.Data.TreeSet.Basic +public import Lean.HeadIndex +public import Lean.Meta.Basic +public import Lean.Meta.CongrTheorems +public import Lean.Meta.AbstractNestedProofs +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Ext +public import Lean.Meta.Tactic.Grind.ExprPtr +public import Lean.Meta.Tactic.Grind.AlphaShareCommon +public import Lean.Meta.Tactic.Grind.Attr +public import Lean.Meta.Tactic.Grind.ExtAttr +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.Arith.Types +public import Lean.Meta.Tactic.Grind.EMatchTheorem +meta import Lean.Parser.Do + +public section namespace Lean.Meta.Grind @@ -204,8 +209,8 @@ structure State where reflCmpMap : PHashMap ExprPtr (Option Expr) := {} private opaque MethodsRefPointed : NonemptyType.{0} -private def MethodsRef : Type := MethodsRefPointed.type -instance : Nonempty MethodsRef := MethodsRefPointed.property +def MethodsRef : Type := MethodsRefPointed.type +instance : Nonempty MethodsRef := by exact MethodsRefPointed.property abbrev GrindM := ReaderT MethodsRef $ ReaderT Context $ StateRefT State MetaM @@ -459,7 +464,10 @@ inductive NewFact where | eq (lhs rhs proof : Expr) (isHEq : Bool) | fact (prop proof : Expr) (generation : Nat) -abbrev ENodeMap := PHashMap ExprPtr ENode +-- This type should be considered opaque outside this module. +def ENodeMap := PHashMap ExprPtr ENode +instance : Inhabited ENodeMap where + default := private (id {}) -- TODO(sullrich): `id` works around `private` not respecting the expected type /-- Key for the congruence table. @@ -536,10 +544,10 @@ where hasSameRoot enodes a b instance : Hashable (CongrKey enodeMap) where - hash k := congrHash enodeMap k.e + hash k := private congrHash enodeMap k.e instance : BEq (CongrKey enodeMap) where - beq k1 k2 := isCongruent enodeMap k1.e k2.e + beq k1 k2 := private isCongruent enodeMap k1.e k2.e abbrev CongrTable (enodeMap : ENodeMap) := PHashSet (CongrKey enodeMap) @@ -728,7 +736,7 @@ structure Clean.State where structure Goal where mvarId : MVarId canon : Canon.State := {} - private enodeMap : ENodeMap := {} + enodeMap : ENodeMap := default exprs : PArray Expr := {} parents : ParentMap := {} congrTable : CongrTable enodeMap := {} diff --git a/src/Lean/Meta/Tactic/Grind/Util.lean b/src/Lean/Meta/Tactic/Grind/Util.lean index debc2d87b9..2c6f22b425 100644 --- a/src/Lean/Meta/Tactic/Grind/Util.lean +++ b/src/Lean/Meta/Tactic/Grind/Util.lean @@ -3,14 +3,18 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Simproc -import Init.Grind.Tactics -import Lean.Meta.AbstractNestedProofs -import Lean.Meta.Transform -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Simp.Simproc +public import Init.Simproc +public import Init.Grind.Tactics +public import Lean.Meta.AbstractNestedProofs +public import Lean.Meta.Transform +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Simp.Simproc + +public section namespace Lean.Meta.Grind /-- diff --git a/src/Lean/Meta/Tactic/IndependentOf.lean b/src/Lean/Meta/Tactic/IndependentOf.lean index c18bb81f49..460b578412 100644 --- a/src/Lean/Meta/Tactic/IndependentOf.lean +++ b/src/Lean/Meta/Tactic/IndependentOf.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Jannis Limperg -/ +module + prelude -import Lean.Meta.CollectMVars -import Lean.Meta.Tactic.Util +public import Lean.Meta.CollectMVars +public import Lean.Meta.Tactic.Util + +public section namespace Lean.MVarId diff --git a/src/Lean/Meta/Tactic/Induction.lean b/src/Lean/Meta/Tactic/Induction.lean index 13631015b3..5fe97867da 100644 --- a/src/Lean/Meta/Tactic/Induction.lean +++ b/src/Lean/Meta/Tactic/Induction.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.RecursorInfo -import Lean.Meta.SynthInstance -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Revert -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.FVarSubst +public import Lean.Meta.RecursorInfo +public import Lean.Meta.SynthInstance +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Revert +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.FVarSubst + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Injection.lean b/src/Lean/Meta/Tactic/Injection.lean index 35a1a757e1..e615e284d5 100644 --- a/src/Lean/Meta/Tactic/Injection.lean +++ b/src/Lean/Meta/Tactic/Injection.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.MatchUtil -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Subst -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Intro +public import Lean.Meta.AppBuilder +public import Lean.Meta.MatchUtil +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Subst +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Intro + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Intro.lean b/src/Lean/Meta/Tactic/Intro.lean index 0b4002b05f..0f0f4cf152 100644 --- a/src/Lean/Meta/Tactic/Intro.lean +++ b/src/Lean/Meta/Tactic/Intro.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Util + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Lets.lean b/src/Lean/Meta/Tactic/Lets.lean index e52d12398e..429bd0a453 100644 --- a/src/Lean/Meta/Tactic/Lets.lean +++ b/src/Lean/Meta/Tactic/Lets.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.Tactic.Replace -import Lean.Meta.LetToHave +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.LetToHave + +public section /-! # Tactics to manipulate `let` expressions diff --git a/src/Lean/Meta/Tactic/LibrarySearch.lean b/src/Lean/Meta/Tactic/LibrarySearch.lean index 62636e9dce..0fd0116d69 100644 --- a/src/Lean/Meta/Tactic/LibrarySearch.lean +++ b/src/Lean/Meta/Tactic/LibrarySearch.lean @@ -3,11 +3,15 @@ Copyright (c) 2021-2023 Gabriel Ebner and Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Joe Hendrix, Kim Morrison -/ +module + prelude -import Init.Data.Nat.MinMax -import Lean.Meta.LazyDiscrTree -import Lean.Meta.Tactic.SolveByElim -import Lean.Util.Heartbeats +public import Init.Data.Nat.MinMax +public import Lean.Meta.LazyDiscrTree +public import Lean.Meta.Tactic.SolveByElim +public import Lean.Util.Heartbeats + +public section /-! # Library search @@ -64,8 +68,7 @@ deriving DecidableEq, Inhabited, Ord, Hashable LibrarySearch has an extension mechanism for replacing the function used to find candidate lemmas. -/ -@[reducible] -def CandidateFinder := Expr → MetaM (Array (Name × DeclMod)) +@[reducible, expose] def CandidateFinder := Expr → MetaM (Array (Name × DeclMod)) open LazyDiscrTree (InitEntry findMatches) @@ -181,8 +184,7 @@ section LibrarySearch A library search candidate using symmetry includes the goal to solve, the metavar context for that goal, and the name and orientation of a rule to try using with goal. -/ -@[reducible] -def Candidate := (MVarId × MetavarContext) × (Name × DeclMod) +@[reducible, expose] def Candidate := (MVarId × MetavarContext) × (Name × DeclMod) /-- Run `searchFn` on both the goal and `symm` applied to the goal. diff --git a/src/Lean/Meta/Tactic/NormCast.lean b/src/Lean/Meta/Tactic/NormCast.lean index 8e3a377045..57f4dd9233 100644 --- a/src/Lean/Meta/Tactic/NormCast.lean +++ b/src/Lean/Meta/Tactic/NormCast.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Paul-Nicolas Madelaine. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Paul-Nicolas Madelaine, Robert Y. Lewis, Mario Carneiro, Gabriel Ebner -/ +module + prelude -import Lean.Meta.CongrTheorems -import Lean.Meta.Tactic.Simp.Attr -import Lean.Meta.CoeAttr +public import Lean.Meta.CongrTheorems +public import Lean.Meta.Tactic.Simp.Attr +public import Lean.Meta.CoeAttr + +public section namespace Lean.Meta.NormCast /-- diff --git a/src/Lean/Meta/Tactic/Refl.lean b/src/Lean/Meta/Tactic/Refl.lean index 597735c782..1932a974b9 100644 --- a/src/Lean/Meta/Tactic/Refl.lean +++ b/src/Lean/Meta/Tactic/Refl.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Reduce -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Apply +public import Lean.Meta.Reduce +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Apply + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Rename.lean b/src/Lean/Meta/Tactic/Rename.lean index 358c198dff..466251a6e9 100644 --- a/src/Lean/Meta/Tactic/Rename.lean +++ b/src/Lean/Meta/Tactic/Rename.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Util + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Repeat.lean b/src/Lean/Meta/Tactic/Repeat.lean index 2082e40ca2..d02760cbba 100644 --- a/src/Lean/Meta/Tactic/Repeat.lean +++ b/src/Lean/Meta/Tactic/Repeat.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Kim Morrison -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean.Meta /-- diff --git a/src/Lean/Meta/Tactic/Replace.lean b/src/Lean/Meta/Tactic/Replace.lean index f3dd25ed3e..0113b19c98 100644 --- a/src/Lean/Meta/Tactic/Replace.lean +++ b/src/Lean/Meta/Tactic/Replace.lean @@ -3,16 +3,20 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ForEachExpr -import Lean.Elab.InfoTree.Main -import Lean.Meta.AppBuilder -import Lean.Meta.MatchUtil -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Revert -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Assert +public import Lean.Util.ForEachExpr +public import Lean.Elab.InfoTree.Main +public import Lean.Meta.AppBuilder +public import Lean.Meta.MatchUtil +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Revert +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Assert + +public section namespace Lean.Meta @@ -95,7 +99,7 @@ where `typeNew`, as these may later be synthesized to fvars which occur after `fvarId` (by e.g. `Term.withSynthesize` or `Term.synthesizeSyntheticMVars`) . -/ -abbrev _root_.Lean.MVarId.replaceLocalDecl (mvarId : MVarId) (fvarId : FVarId) (typeNew : Expr) (eqProof : Expr) : MetaM AssertAfterResult := +@[inline] def _root_.Lean.MVarId.replaceLocalDecl (mvarId : MVarId) (fvarId : FVarId) (typeNew : Expr) (eqProof : Expr) : MetaM AssertAfterResult := replaceLocalDeclCore mvarId fvarId typeNew eqProof /-- diff --git a/src/Lean/Meta/Tactic/Revert.lean b/src/Lean/Meta/Tactic/Revert.lean index 4e1bab54a8..d905b7a62c 100644 --- a/src/Lean/Meta/Tactic/Revert.lean +++ b/src/Lean/Meta/Tactic/Revert.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Clear + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Rewrite.lean b/src/Lean/Meta/Tactic/Rewrite.lean index 18a174cba1..bc420f2a98 100644 --- a/src/Lean/Meta/Tactic/Rewrite.lean +++ b/src/Lean/Meta/Tactic/Rewrite.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.MatchUtil -import Lean.Meta.KAbstract -import Lean.Meta.Check -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Apply -import Lean.Meta.BinderNameHint +public import Lean.Meta.AppBuilder +public import Lean.Meta.MatchUtil +public import Lean.Meta.KAbstract +public import Lean.Meta.Check +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.BinderNameHint + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Rewrites.lean b/src/Lean/Meta/Tactic/Rewrites.lean index 7728b37e37..27f10b38ec 100644 --- a/src/Lean/Meta/Tactic/Rewrites.lean +++ b/src/Lean/Meta/Tactic/Rewrites.lean @@ -3,14 +3,18 @@ Copyright (c) 2023 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Meta.LazyDiscrTree -import Lean.Meta.Tactic.Assumption -import Lean.Meta.Tactic.Rewrite -import Lean.Meta.Tactic.Refl -import Lean.Meta.Tactic.SolveByElim -import Lean.Meta.Tactic.TryThis -import Lean.Util.Heartbeats +public import Lean.Meta.LazyDiscrTree +public import Lean.Meta.Tactic.Assumption +public import Lean.Meta.Tactic.Rewrite +public import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.SolveByElim +public import Lean.Meta.Tactic.TryThis +public import Lean.Util.Heartbeats + +public section namespace Lean.Meta.Rewrites diff --git a/src/Lean/Meta/Tactic/Rfl.lean b/src/Lean/Meta/Tactic/Rfl.lean index 9202eb7e53..87fd726557 100644 --- a/src/Lean/Meta/Tactic/Rfl.lean +++ b/src/Lean/Meta/Tactic/Rfl.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Newell Jensen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Newell Jensen, Thomas Murrills, Joachim Breitner -/ +module + prelude -import Lean.Meta.Tactic.Apply -import Lean.Elab.Tactic.Basic -import Lean.Meta.Tactic.Refl +public import Lean.Meta.Tactic.Apply +public import Lean.Elab.Tactic.Basic +public import Lean.Meta.Tactic.Refl + +public section /-! # `rfl` tactic extension for reflexive relations diff --git a/src/Lean/Meta/Tactic/Simp.lean b/src/Lean/Meta/Tactic/Simp.lean index 6d27c31c2f..7c4e832329 100644 --- a/src/Lean/Meta/Tactic/Simp.lean +++ b/src/Lean/Meta/Tactic/Simp.lean @@ -3,19 +3,23 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.SimpTheorems -import Lean.Meta.Tactic.Simp.SimpCongrTheorems -import Lean.Meta.Tactic.Simp.Types -import Lean.Meta.Tactic.Simp.Main -import Lean.Meta.Tactic.Simp.Rewrite -import Lean.Meta.Tactic.Simp.SimpAll -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Simp.BuiltinSimprocs -import Lean.Meta.Tactic.Simp.RegisterCommand -import Lean.Meta.Tactic.Simp.Attr -import Lean.Meta.Tactic.Simp.Diagnostics -import Lean.Meta.Tactic.Simp.Arith +public import Lean.Meta.Tactic.Simp.SimpTheorems +public import Lean.Meta.Tactic.Simp.SimpCongrTheorems +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Simp.Rewrite +public import Lean.Meta.Tactic.Simp.SimpAll +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs +public import Lean.Meta.Tactic.Simp.RegisterCommand +public import Lean.Meta.Tactic.Simp.Attr +public import Lean.Meta.Tactic.Simp.Diagnostics +public import Lean.Meta.Tactic.Simp.Arith + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Simp/Arith.lean b/src/Lean/Meta/Tactic/Simp/Arith.lean index 70c84f9ad8..e950223c34 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Nat -import Lean.Meta.Tactic.Simp.Arith.Int +public import Lean.Meta.Tactic.Simp.Arith.Nat +public import Lean.Meta.Tactic.Simp.Arith.Int + +public section namespace Lean.Meta.Simp.Arith diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Int.lean b/src/Lean/Meta/Tactic/Simp/Arith/Int.lean index 496fb952cf..32cfa8fabb 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Int.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Int.lean @@ -3,6 +3,10 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Int.Basic -import Lean.Meta.Tactic.Simp.Arith.Int.Simp +public import Lean.Meta.Tactic.Simp.Arith.Int.Basic +public import Lean.Meta.Tactic.Simp.Arith.Int.Simp + +public section diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Int/Basic.lean b/src/Lean/Meta/Tactic/Simp/Arith/Int/Basic.lean index 08757c27a7..6ef7d873cc 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Int/Basic.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Int/Basic.lean @@ -3,15 +3,19 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Int.Linear -import Lean.Util.SortExprs -import Lean.Meta.Check -import Lean.Meta.Offset -import Lean.Meta.IntInstTesters -import Lean.Meta.AppBuilder -import Lean.Meta.KExprMap -import Lean.Data.RArray +public import Init.Data.Int.Linear +public import Lean.Util.SortExprs +public import Lean.Meta.Check +public import Lean.Meta.Offset +public import Lean.Meta.IntInstTesters +public import Lean.Meta.AppBuilder +public import Lean.Meta.KExprMap +public import Lean.Data.RArray + +public section namespace Int.Linear diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Int/Simp.lean b/src/Lean/Meta/Tactic/Simp/Arith/Int/Simp.lean index 155fdd64d8..ee50732d71 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Int/Simp.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Int/Simp.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Util -import Lean.Meta.Tactic.Simp.Arith.Int.Basic +public import Lean.Meta.Tactic.Simp.Arith.Util +public import Lean.Meta.Tactic.Simp.Arith.Int.Basic + +public section def Int.Linear.Poly.gcdAll : Poly → Nat | .num k => k.natAbs diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Nat.lean b/src/Lean/Meta/Tactic/Simp/Arith/Nat.lean index 555deb1e6e..2e4c1e5a02 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Nat.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Nat.lean @@ -3,6 +3,10 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Nat.Basic -import Lean.Meta.Tactic.Simp.Arith.Nat.Simp +public import Lean.Meta.Tactic.Simp.Arith.Nat.Basic +public import Lean.Meta.Tactic.Simp.Arith.Nat.Simp + +public section diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Nat/Basic.lean b/src/Lean/Meta/Tactic/Simp/Arith/Nat/Basic.lean index 7565229c22..2dd6bab6af 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Nat/Basic.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Nat/Basic.lean @@ -3,13 +3,17 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.SortExprs -import Lean.Meta.Check -import Lean.Meta.Offset -import Lean.Meta.AppBuilder -import Lean.Meta.KExprMap -import Lean.Data.RArray +public import Lean.Util.SortExprs +public import Lean.Meta.Check +public import Lean.Meta.Offset +public import Lean.Meta.AppBuilder +public import Lean.Meta.KExprMap +public import Lean.Data.RArray + +public section namespace Nat.Linear diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Nat/Simp.lean b/src/Lean/Meta/Tactic/Simp/Arith/Nat/Simp.lean index 2fd8ef866c..be9a98fc07 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Nat/Simp.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Nat/Simp.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Arith.Util -import Lean.Meta.Tactic.Simp.Arith.Nat.Basic +public import Lean.Meta.Tactic.Simp.Arith.Util +public import Lean.Meta.Tactic.Simp.Arith.Nat.Basic + +public section namespace Lean.Meta.Simp.Arith.Nat diff --git a/src/Lean/Meta/Tactic/Simp/Arith/Util.lean b/src/Lean/Meta/Tactic/Simp/Arith/Util.lean index dbba1ecb0a..4aa17796ad 100644 --- a/src/Lean/Meta/Tactic/Simp/Arith/Util.lean +++ b/src/Lean/Meta/Tactic/Simp/Arith/Util.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic -import Lean.Expr +public import Lean.Meta.Basic +public import Lean.Expr + +public section namespace Lean.Meta.Simp.Arith /- diff --git a/src/Lean/Meta/Tactic/Simp/Attr.lean b/src/Lean/Meta/Tactic/Simp/Attr.lean index c0f1e1419b..9c1e2c03c1 100644 --- a/src/Lean/Meta/Tactic/Simp/Attr.lean +++ b/src/Lean/Meta/Tactic/Simp/Attr.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Types -import Lean.Meta.Tactic.Simp.SimpTheorems -import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Tactic.Simp.SimpTheorems +public import Lean.Meta.Tactic.Simp.Simproc + +public section namespace Lean.Meta open Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs.lean index 4206eaceb9..db2a874f2e 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs.lean @@ -3,15 +3,19 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Fin -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.UInt -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.SInt -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Char -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.String -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.BitVec -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.List -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Array +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Core +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Fin +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.UInt +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.SInt +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Char +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.String +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.BitVec +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.List +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Array + +public section diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Array.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Array.lean index f9050a6fb8..cc82d24cb1 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Array.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Array.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat + +public section namespace Array open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/BitVec.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/BitVec.lean index 112bbd5bf8..7352254190 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/BitVec.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/BitVec.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int -import Init.Data.BitVec.Basic +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int +public import Init.Data.BitVec.Basic + +public section namespace BitVec open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Char.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Char.lean index 6492f41c06..9282bf03fa 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Char.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Char.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ToExpr -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.UInt +public import Lean.ToExpr +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.UInt + +public section namespace Char open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Core.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Core.lean index 38060e97f1..da601c40ae 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Core.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Core.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Simproc -import Lean.Meta.Tactic.Simp.Simproc +public import Init.Simproc +public import Lean.Meta.Tactic.Simp.Simproc + +public section open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Fin.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Fin.lean index 52a62a7534..65232da58b 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Fin.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Fin.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ToExpr -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.ToExpr +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat + +public section namespace Fin open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Int.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Int.lean index 62d5991b24..3753bf9970 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Int.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Int.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ToExpr -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.ToExpr +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat + +public section namespace Int open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/List.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/List.lean index ba0963fef0..1797fba506 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/List.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/List.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat + +public section namespace List open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Nat.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Nat.lean index 0e3ee00756..90527fe471 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Nat.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Nat.lean @@ -3,14 +3,18 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Simproc -import Init.Data.Nat.Simproc -import Lean.Util.SafeExponentiation -import Lean.Meta.LitValues -import Lean.Meta.Offset -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Util +public import Init.Simproc +public import Init.Data.Nat.Simproc +public import Lean.Util.SafeExponentiation +public import Lean.Meta.LitValues +public import Lean.Meta.Offset +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Util + +public section namespace Nat open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/SInt.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/SInt.lean index 211460db9f..608035288b 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/SInt.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/SInt.lean @@ -3,11 +3,15 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Markus Himmel -/ +module + prelude -import Lean.Meta.LitValues -import Init.Data.SInt.Lemmas -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int +public import Lean.Meta.LitValues +public import Init.Data.SInt.Lemmas +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Int + +public section open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/String.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/String.lean index 61c580a534..68596f0ede 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/String.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/String.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ToExpr -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Char +public import Lean.ToExpr +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Char + +public section namespace String open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/UInt.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/UInt.lean index f797cd6f8d..bce037848e 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/UInt.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/UInt.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.LitValues -import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat +public import Lean.Meta.LitValues +public import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat + +public section open Lean Meta Simp diff --git a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Util.lean b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Util.lean index 72d9ade973..6aa44faa21 100644 --- a/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Util.lean +++ b/src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Util.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.Simproc + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/Diagnostics.lean b/src/Lean/Meta/Tactic/Simp/Diagnostics.lean index 804d22cf06..ed0746a281 100644 --- a/src/Lean/Meta/Tactic/Simp/Diagnostics.lean +++ b/src/Lean/Meta/Tactic/Simp/Diagnostics.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Diagnostics -import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Diagnostics +public import Lean.Meta.Tactic.Simp.Types + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/LoopProtection.lean b/src/Lean/Meta/Tactic/Simp/LoopProtection.lean index 241a9f4356..aad1fa503e 100644 --- a/src/Lean/Meta/Tactic/Simp/LoopProtection.lean +++ b/src/Lean/Meta/Tactic/Simp/LoopProtection.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joachim Breitner -/ +module + prelude -import Lean.Meta.Tactic.Simp.Types -import Lean.Linter.Basic +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Linter.Basic + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/Main.lean b/src/Lean/Meta/Tactic/Simp/Main.lean index 97bacf6921..df37056643 100644 --- a/src/Lean/Meta/Tactic/Simp/Main.lean +++ b/src/Lean/Meta/Tactic/Simp/Main.lean @@ -3,15 +3,19 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Transform -import Lean.Meta.Tactic.Replace -import Lean.Meta.Tactic.UnifyEq -import Lean.Meta.Tactic.Simp.Rewrite -import Lean.Meta.Tactic.Simp.Diagnostics -import Lean.Meta.Match.Value -import Lean.Meta.LetToHave -import Lean.Util.CollectLooseBVars +public import Lean.Meta.Transform +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.Tactic.UnifyEq +public import Lean.Meta.Tactic.Simp.Rewrite +public import Lean.Meta.Tactic.Simp.Diagnostics +public import Lean.Meta.Match.Value +public import Lean.Meta.LetToHave +public import Lean.Util.CollectLooseBVars + +public section namespace Lean.Meta namespace Simp diff --git a/src/Lean/Meta/Tactic/Simp/RegisterCommand.lean b/src/Lean/Meta/Tactic/Simp/RegisterCommand.lean index eb26a525c5..4ebfd42fda 100644 --- a/src/Lean/Meta/Tactic/Simp/RegisterCommand.lean +++ b/src/Lean/Meta/Tactic/Simp/RegisterCommand.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Simp.SimpTheorems -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Simp.Attr +public import Lean.Meta.Tactic.Simp.SimpTheorems +public import Lean.Meta.Tactic.Simp.Simproc +meta import Lean.Meta.Tactic.Simp.Attr + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/Rewrite.lean b/src/Lean/Meta/Tactic/Simp/Rewrite.lean index 9deb6031af..7c8ca354b0 100644 --- a/src/Lean/Meta/Tactic/Simp/Rewrite.lean +++ b/src/Lean/Meta/Tactic/Simp/Rewrite.lean @@ -3,18 +3,22 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.ACLt -import Lean.Meta.Match.MatchEqsExt -import Lean.Meta.AppBuilder -import Lean.Meta.SynthInstance -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.UnifyEq -import Lean.Meta.Tactic.Simp.Types -import Lean.Meta.Tactic.Simp.Arith -import Lean.Meta.Tactic.Simp.Simproc -import Lean.Meta.Tactic.Simp.Attr -import Lean.Meta.BinderNameHint +public import Lean.Meta.ACLt +public import Lean.Meta.Match.MatchEqsExt +public import Lean.Meta.AppBuilder +public import Lean.Meta.SynthInstance +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.UnifyEq +public import Lean.Meta.Tactic.Simp.Types +public import Lean.Meta.Tactic.Simp.Arith +public import Lean.Meta.Tactic.Simp.Simproc +public import Lean.Meta.Tactic.Simp.Attr +public import Lean.Meta.BinderNameHint + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/SimpAll.lean b/src/Lean/Meta/Tactic/Simp/SimpAll.lean index 84f00785d5..52a4a24fed 100644 --- a/src/Lean/Meta/Tactic/Simp/SimpAll.lean +++ b/src/Lean/Meta/Tactic/Simp/SimpAll.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Simp.Main + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Simp/SimpCongrTheorems.lean b/src/Lean/Meta/Tactic/Simp/SimpCongrTheorems.lean index a7438b5a8e..fa84bb8ab7 100644 --- a/src/Lean/Meta/Tactic/Simp/SimpCongrTheorems.lean +++ b/src/Lean/Meta/Tactic/Simp/SimpCongrTheorems.lean @@ -3,11 +3,15 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.Util.Recognizers -import Lean.Util.CollectMVars -import Lean.Meta.Basic +public import Lean.ScopedEnvExtension +public import Lean.Util.Recognizers +public import Lean.Util.CollectMVars +public import Lean.Meta.Basic + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean b/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean index 30dea1efd1..dfea32e88f 100644 --- a/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean +++ b/src/Lean/Meta/Tactic/Simp/SimpTheorems.lean @@ -3,15 +3,19 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.Util.Recognizers -import Lean.Meta.DiscrTree -import Lean.Meta.AppBuilder -import Lean.Meta.Eqns -import Lean.Meta.Tactic.AuxLemma -import Lean.DefEqAttrib -import Lean.DocString +public import Lean.ScopedEnvExtension +public import Lean.Util.Recognizers +public import Lean.Meta.DiscrTree +public import Lean.Meta.AppBuilder +public import Lean.Meta.Eqns +public import Lean.Meta.Tactic.AuxLemma +public import Lean.DefEqAttrib +public import Lean.DocString + +public section /-! This module contains types to manages simp theorems and sets theirof. diff --git a/src/Lean/Meta/Tactic/Simp/Simproc.lean b/src/Lean/Meta/Tactic/Simp/Simproc.lean index fc6fac4e71..fb0202cab6 100644 --- a/src/Lean/Meta/Tactic/Simp/Simproc.lean +++ b/src/Lean/Meta/Tactic/Simp/Simproc.lean @@ -3,11 +3,15 @@ Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.Compiler.InitAttr -import Lean.Meta.DiscrTree -import Lean.Meta.Tactic.Simp.Types +public import Lean.ScopedEnvExtension +public import Lean.Compiler.InitAttr +public import Lean.Meta.DiscrTree +public import Lean.Meta.Tactic.Simp.Types + +public section namespace Lean.Meta.Simp diff --git a/src/Lean/Meta/Tactic/Simp/Types.lean b/src/Lean/Meta/Tactic/Simp/Types.lean index 40e92aec11..c9174809bc 100644 --- a/src/Lean/Meta/Tactic/Simp/Types.lean +++ b/src/Lean/Meta/Tactic/Simp/Types.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.CongrTheorems -import Lean.Meta.Eqns -import Lean.Meta.Tactic.Replace -import Lean.Meta.Tactic.Simp.SimpTheorems -import Lean.Meta.Tactic.Simp.SimpCongrTheorems +public import Lean.Meta.AppBuilder +public import Lean.Meta.CongrTheorems +public import Lean.Meta.Eqns +public import Lean.Meta.Tactic.Replace +public import Lean.Meta.Tactic.Simp.SimpTheorems +public import Lean.Meta.Tactic.Simp.SimpCongrTheorems + +public section namespace Lean.Meta namespace Simp @@ -249,9 +253,10 @@ structure Stats where private opaque MethodsRefPointed : NonemptyType.{0} -private def MethodsRef : Type := MethodsRefPointed.type +def MethodsRef : Type := MethodsRefPointed.type -instance : Nonempty MethodsRef := MethodsRefPointed.property +instance : Nonempty MethodsRef := + by exact MethodsRefPointed.property abbrev SimpM := ReaderT MethodsRef $ ReaderT Context $ StateRefT State MetaM diff --git a/src/Lean/Meta/Tactic/SolveByElim.lean b/src/Lean/Meta/Tactic/SolveByElim.lean index f23a4303df..fde9281f0c 100644 --- a/src/Lean/Meta/Tactic/SolveByElim.lean +++ b/src/Lean/Meta/Tactic/SolveByElim.lean @@ -3,15 +3,19 @@ Copyright (c) 2021 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison, David Renshaw -/ +module + prelude -import Init.Data.Sum -import Lean.LabelAttribute -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Backtrack -import Lean.Meta.Tactic.Constructor -import Lean.Meta.Tactic.Repeat -import Lean.Meta.Tactic.Symm -import Lean.Elab.Term +public import Init.Data.Sum +public import Lean.LabelAttribute +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Backtrack +public import Lean.Meta.Tactic.Constructor +public import Lean.Meta.Tactic.Repeat +public import Lean.Meta.Tactic.Symm +public import Lean.Elab.Term + +public section /-! # `solve_by_elim`, `apply_rules`, and `apply_assumption`. diff --git a/src/Lean/Meta/Tactic/Split.lean b/src/Lean/Meta/Tactic/Split.lean index 3d3f57f0cd..508da72b80 100644 --- a/src/Lean/Meta/Tactic/Split.lean +++ b/src/Lean/Meta/Tactic/Split.lean @@ -3,12 +3,16 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Match.MatcherApp.Basic -import Lean.Meta.Tactic.Simp.Main -import Lean.Meta.Tactic.SplitIf -import Lean.Meta.Tactic.Apply -import Lean.Meta.Tactic.Generalize +public import Lean.Meta.Match.MatcherApp.Basic +public import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.SplitIf +public import Lean.Meta.Tactic.Apply +public import Lean.Meta.Tactic.Generalize + +public section namespace Lean.Meta namespace Split diff --git a/src/Lean/Meta/Tactic/SplitIf.lean b/src/Lean/Meta/Tactic/SplitIf.lean index 22e8ff920b..4fedaf1464 100644 --- a/src/Lean/Meta/Tactic/SplitIf.lean +++ b/src/Lean/Meta/Tactic/SplitIf.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Cases -import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Tactic.Cases +public import Lean.Meta.Tactic.Simp.Main + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Subst.lean b/src/Lean/Meta/Tactic/Subst.lean index 7749269dd6..97e9cdd56f 100644 --- a/src/Lean/Meta/Tactic/Subst.lean +++ b/src/Lean/Meta/Tactic/Subst.lean @@ -3,15 +3,19 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.AppBuilder -import Lean.Meta.MatchUtil -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Revert -import Lean.Meta.Tactic.Assert -import Lean.Meta.Tactic.Intro -import Lean.Meta.Tactic.Clear -import Lean.Meta.Tactic.FVarSubst +public import Lean.Meta.AppBuilder +public import Lean.Meta.MatchUtil +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Revert +public import Lean.Meta.Tactic.Assert +public import Lean.Meta.Tactic.Intro +public import Lean.Meta.Tactic.Clear +public import Lean.Meta.Tactic.FVarSubst + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Symm.lean b/src/Lean/Meta/Tactic/Symm.lean index 122a6f63b1..05c4d83fac 100644 --- a/src/Lean/Meta/Tactic/Symm.lean +++ b/src/Lean/Meta/Tactic/Symm.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Siddhartha Gadgil. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Siddhartha Gadgil, Mario Carneiro, Kim Morrison -/ +module + prelude -import Lean.Meta.Reduce -import Lean.Meta.Tactic.Assert +public import Lean.Meta.Reduce +public import Lean.Meta.Tactic.Assert + +public section /-! # `symm` tactic diff --git a/src/Lean/Meta/Tactic/Try.lean b/src/Lean/Meta/Tactic/Try.lean index 46f20874cb..f552f5d507 100644 --- a/src/Lean/Meta/Tactic/Try.lean +++ b/src/Lean/Meta/Tactic/Try.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Try.Collect +public import Lean.Meta.Tactic.Try.Collect + +public section namespace Lean diff --git a/src/Lean/Meta/Tactic/Try/Collect.lean b/src/Lean/Meta/Tactic/Try/Collect.lean index 59d0cf50ff..1e378520d2 100644 --- a/src/Lean/Meta/Tactic/Try/Collect.lean +++ b/src/Lean/Meta/Tactic/Try/Collect.lean @@ -3,14 +3,18 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Try -import Lean.Meta.Tactic.LibrarySearch -import Lean.Meta.Tactic.Util -import Lean.Meta.Tactic.Grind.Cases -import Lean.Meta.Tactic.Grind.EMatchTheorem -import Lean.Meta.Tactic.FunIndInfo -import Lean.Meta.Tactic.FunIndCollect +public import Init.Try +public import Lean.Meta.Tactic.LibrarySearch +public import Lean.Meta.Tactic.Util +public import Lean.Meta.Tactic.Grind.Cases +public import Lean.Meta.Tactic.Grind.EMatchTheorem +public import Lean.Meta.Tactic.FunIndInfo +public import Lean.Meta.Tactic.FunIndCollect + +public section namespace Lean.Meta.Try.Collector diff --git a/src/Lean/Meta/Tactic/TryThis.lean b/src/Lean/Meta/Tactic/TryThis.lean index 4a276aa80f..3d2a5219f0 100644 --- a/src/Lean/Meta/Tactic/TryThis.lean +++ b/src/Lean/Meta/Tactic/TryThis.lean @@ -3,15 +3,20 @@ Copyright (c) 2021 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Mario Carneiro, Thomas Murrills -/ +module + prelude -import Lean.Server.CodeActions -import Lean.Widget.UserWidget -import Lean.Data.Json.Elab -import Lean.Data.Lsp.Utf16 -import Lean.Meta.CollectFVars -import Lean.Meta.Tactic.ExposeNames -import Lean.Meta.TryThis -import Lean.Meta.Hint +public import Lean.Server.CodeActions +public import Lean.Widget.UserWidget +public import Lean.Data.Json.Elab +public import Lean.Data.Lsp.Utf16 +public import Lean.Meta.CollectFVars +public import Lean.Meta.Tactic.ExposeNames +public import Lean.Meta.TryThis +public import Lean.Meta.Hint +meta import Lean.Meta.Hint + +public section /-! # "Try this" code action and tactic suggestions @@ -45,8 +50,10 @@ where `` is a link which will perform the replacement. -/ @[builtin_widget_module] def tryThisWidget : Widget.Module where javascript := " -import * as React from 'react'; -import { EditorContext, EnvPosContext } from '@leanprover/infoview'; +public import * as React from 'react'; +public import { EditorContext, EnvPosContext } from '@leanprover/infoview'; + +public section const e = React.createElement; export default function ({ suggestions, range, header, isInline, style }) { const pos = React.useContext(EnvPosContext) diff --git a/src/Lean/Meta/Tactic/Unfold.lean b/src/Lean/Meta/Tactic/Unfold.lean index c6e63acb6f..cc7885fa4c 100644 --- a/src/Lean/Meta/Tactic/Unfold.lean +++ b/src/Lean/Meta/Tactic/Unfold.lean @@ -3,10 +3,14 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Eqns -import Lean.Meta.Tactic.Delta -import Lean.Meta.Tactic.Simp.Main +public import Lean.Meta.Eqns +public import Lean.Meta.Tactic.Delta +public import Lean.Meta.Tactic.Simp.Main + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/UnifyEq.lean b/src/Lean/Meta/Tactic/UnifyEq.lean index f535956c8f..9bc4292c44 100644 --- a/src/Lean/Meta/Tactic/UnifyEq.lean +++ b/src/Lean/Meta/Tactic/UnifyEq.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Tactic.Injection +public import Lean.Meta.Tactic.Injection + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Tactic/Util.lean b/src/Lean/Meta/Tactic/Util.lean index 5b374fe876..534017192a 100644 --- a/src/Lean/Meta/Tactic/Util.lean +++ b/src/Lean/Meta/Tactic/Util.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ForEachExprWhere -import Lean.Meta.Basic -import Lean.Meta.AppBuilder -import Lean.Meta.PPGoal +public import Lean.Util.ForEachExprWhere +public import Lean.Meta.Basic +public import Lean.Meta.AppBuilder +public import Lean.Meta.PPGoal + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/Transform.lean b/src/Lean/Meta/Transform.lean index 3e1df5b324..26126a5118 100644 --- a/src/Lean/Meta/Transform.lean +++ b/src/Lean/Meta/Transform.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Meta.Basic +public import Lean.Meta.Basic + +public section namespace Lean diff --git a/src/Lean/Meta/TransparencyMode.lean b/src/Lean/Meta/TransparencyMode.lean index cc0c7174ba..3928fd09b0 100644 --- a/src/Lean/Meta/TransparencyMode.lean +++ b/src/Lean/Meta/TransparencyMode.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.UInt.Basic +public import Init.Data.UInt.Basic + +public section namespace Lean.Meta namespace TransparencyMode diff --git a/src/Lean/Meta/TryThis.lean b/src/Lean/Meta/TryThis.lean index cc5939f3d6..dfc5bb9387 100644 --- a/src/Lean/Meta/TryThis.lean +++ b/src/Lean/Meta/TryThis.lean @@ -3,12 +3,16 @@ Copyright (c) 2021 Gabriel Ebner. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Gabriel Ebner, Mario Carneiro, Thomas Murrills -/ +module + prelude -import Lean.CoreM -import Lean.Message -import Lean.Elab.InfoTree.Types -import Lean.Data.Lsp.Basic -import Lean.PrettyPrinter +public import Lean.CoreM +public import Lean.Message +public import Lean.Elab.InfoTree.Types +public import Lean.Data.Lsp.Basic +public import Lean.PrettyPrinter + +public section /-! # "Try this" data types @@ -75,7 +79,7 @@ interesting fields: * `className`: the CSS classes applied to the link * `style`: A `Json` object with additional inline CSS styles such as `color` or `textDecoration`. -/ -def SuggestionStyle := Json deriving Inhabited, ToJson +@[expose] def SuggestionStyle := Json deriving Inhabited, ToJson /-- Style as an error. By default, decorates the text with an undersquiggle; providing the argument `decorated := false` turns this off. -/ diff --git a/src/Lean/Meta/UnificationHint.lean b/src/Lean/Meta/UnificationHint.lean index 6b499228a3..5fe88936ef 100644 --- a/src/Lean/Meta/UnificationHint.lean +++ b/src/Lean/Meta/UnificationHint.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.ScopedEnvExtension -import Lean.Util.Recognizers -import Lean.Meta.Basic -import Lean.Meta.DiscrTree -import Lean.Meta.SynthInstance +public import Lean.ScopedEnvExtension +public import Lean.Util.Recognizers +public import Lean.Meta.Basic +public import Lean.Meta.DiscrTree +public import Lean.Meta.SynthInstance + +public section namespace Lean.Meta diff --git a/src/Lean/Meta/WHNF.lean b/src/Lean/Meta/WHNF.lean index e42ef2a79e..8c30b8089c 100644 --- a/src/Lean/Meta/WHNF.lean +++ b/src/Lean/Meta/WHNF.lean @@ -3,17 +3,21 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Structure -import Lean.Util.Recognizers -import Lean.Util.SafeExponentiation -import Lean.Meta.GetUnfoldableConst -import Lean.Meta.FunInfo -import Lean.Meta.Offset -import Lean.Meta.CtorRecognizer -import Lean.Meta.Match.MatcherInfo -import Lean.Meta.Match.MatchPatternAttr -import Lean.Meta.Transform +public import Lean.Structure +public import Lean.Util.Recognizers +public import Lean.Util.SafeExponentiation +public import Lean.Meta.GetUnfoldableConst +public import Lean.Meta.FunInfo +public import Lean.Meta.Offset +public import Lean.Meta.CtorRecognizer +public import Lean.Meta.Match.MatcherInfo +public import Lean.Meta.Match.MatchPatternAttr +public import Lean.Meta.Transform + +public section namespace Lean.Meta diff --git a/src/Lean/MetavarContext.lean b/src/Lean/MetavarContext.lean index d1c539a5e0..0e8e9058db 100644 --- a/src/Lean/MetavarContext.lean +++ b/src/Lean/MetavarContext.lean @@ -3,10 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.ShareCommon -import Lean.Util.MonadCache -import Lean.LocalContext +public import Init.ShareCommon +public import Lean.Util.MonadCache +public import Lean.LocalContext +import Init.Data.Slice + +public section namespace Lean @@ -640,7 +645,7 @@ structure State where private abbrev M := StateM State -instance : MonadMCtx M where +private instance : MonadMCtx M where getMCtx := return (← get).mctx modifyMCtx f := modify fun s => { s with mctx := f s.mctx } @@ -694,7 +699,7 @@ private def shouldVisit (e : Expr) : M Bool := do | _ => pure false visit e -@[inline] partial def main (pf : FVarId → Bool) (pm : MVarId → Bool) (e : Expr) : M Bool := +@[inline] private partial def main (pf : FVarId → Bool) (pm : MVarId → Bool) (e : Expr) : M Bool := if !e.hasFVar && !e.hasMVar then pure false else dep pf pm e end DependsOn diff --git a/src/Lean/Modifiers.lean b/src/Lean/Modifiers.lean index 99211dfaff..02ec85190b 100644 --- a/src/Lean/Modifiers.lean +++ b/src/Lean/Modifiers.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.EnvExtension -import Lean.PrivateName +public import Lean.EnvExtension +public import Lean.PrivateName + +public section namespace Lean diff --git a/src/Lean/MonadEnv.lean b/src/Lean/MonadEnv.lean index b2154e43b9..91658273f2 100644 --- a/src/Lean/MonadEnv.lean +++ b/src/Lean/MonadEnv.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment -import Lean.Exception -import Lean.Declaration -import Lean.Log -import Lean.AuxRecursor -import Lean.Compiler.Old +public import Lean.Environment +public import Lean.Exception +public import Lean.Declaration +public import Lean.Log +public import Lean.AuxRecursor +public import Lean.Compiler.Old + +public section namespace Lean diff --git a/src/Lean/Namespace.lean b/src/Lean/Namespace.lean index 30d3432027..a4e09cf284 100644 --- a/src/Lean/Namespace.lean +++ b/src/Lean/Namespace.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.EnvExtension +public import Lean.EnvExtension + +public section namespace Lean diff --git a/src/Lean/Parser.lean b/src/Lean/Parser.lean index bd21b4ad10..e4c4127f6c 100644 --- a/src/Lean/Parser.lean +++ b/src/Lean/Parser.lean @@ -3,16 +3,20 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Basic -import Lean.Parser.Level -import Lean.Parser.Term -import Lean.Parser.Tactic -import Lean.Parser.Command -import Lean.Parser.Module -import Lean.Parser.Syntax -import Lean.Parser.Do -import Lean.Parser.Tactic.Doc +public import Lean.Parser.Basic +public import Lean.Parser.Level +public import Lean.Parser.Term +public import Lean.Parser.Tactic +public import Lean.Parser.Command +public import Lean.Parser.Module +public import Lean.Parser.Syntax +public import Lean.Parser.Do +public import Lean.Parser.Tactic.Doc + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/Attr.lean b/src/Lean/Parser/Attr.lean index 27473f7b96..46b95fd54a 100644 --- a/src/Lean/Parser/Attr.lean +++ b/src/Lean/Parser/Attr.lean @@ -3,9 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Basic -import Lean.Parser.Extra +public import Lean.Parser.Basic +public import Lean.Parser.Extra +public meta import Lean.Parser.Extra -- `register_parser_alias` indirect dependency... but do we want that? + +public section namespace Lean.Parser diff --git a/src/Lean/Parser/Basic.lean b/src/Lean/Parser/Basic.lean index d1c13efa80..0833915c49 100644 --- a/src/Lean/Parser/Basic.lean +++ b/src/Lean/Parser/Basic.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Types +public import Lean.Parser.Types + +public section /-! # Basic Lean parser infrastructure @@ -1581,7 +1585,7 @@ def eoi : Parser := { } /-- A multimap indexed by tokens. Used for indexing parsers by their leading token. -/ -def TokenMap (α : Type) := Std.TreeMap Name (List α) Name.quickCmp +@[expose] def TokenMap (α : Type) := Std.TreeMap Name (List α) Name.quickCmp namespace TokenMap diff --git a/src/Lean/Parser/Command.lean b/src/Lean/Parser/Command.lean index 68dc62be0a..36877747aa 100644 --- a/src/Lean/Parser/Command.lean +++ b/src/Lean/Parser/Command.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Term -import Lean.Parser.Do +public import Lean.Parser.Term +public import Lean.Parser.Do + +public section namespace Lean namespace Parser @@ -129,7 +133,7 @@ def declBody : Parser := -- As the pretty printer ignores `lookahead`, we need a custom parenthesizer to choose the correct -- precedence open PrettyPrinter in -@[combinator_parenthesizer declBody] def declBody.parenthesizer : Parenthesizer := +@[combinator_parenthesizer declBody, expose] def declBody.parenthesizer : Parenthesizer := Parenthesizer.categoryParser.parenthesizer `term 0 def declValSimple := leading_parser diff --git a/src/Lean/Parser/Do.lean b/src/Lean/Parser/Do.lean index 47fe3d685f..b8391ce2c2 100644 --- a/src/Lean/Parser/Do.lean +++ b/src/Lean/Parser/Do.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Term +public import Lean.Parser.Term + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/Extension.lean b/src/Lean/Parser/Extension.lean index 2b691d5505..bcd21bd1f3 100644 --- a/src/Lean/Parser/Extension.lean +++ b/src/Lean/Parser/Extension.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Basic -import Lean.ScopedEnvExtension -import Lean.BuiltinDocAttr +public import Lean.Parser.Basic +public import Lean.ScopedEnvExtension +public import Lean.BuiltinDocAttr + +public section /-! Extensible parsing via attributes -/ diff --git a/src/Lean/Parser/Extra.lean b/src/Lean/Parser/Extra.lean index 287e76f57d..1113f4f624 100644 --- a/src/Lean/Parser/Extra.lean +++ b/src/Lean/Parser/Extra.lean @@ -3,11 +3,21 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Extension --- necessary for auto-generation -import Lean.PrettyPrinter.Parenthesizer -import Lean.PrettyPrinter.Formatter +public import Lean.Parser.Extension +public import Lean.PrettyPrinter.Formatter +public import Lean.PrettyPrinter.Parenthesizer +meta import Lean.Hygiene +-- for `run_builtin_parser_attribute_hooks` +import all Lean.Parser.Types +import all Lean.Parser.Basic +import all Lean.Parser.Extension +meta import Lean.Parser.Basic + + +public section namespace Lean namespace Parser @@ -190,7 +200,7 @@ This parser has arity 1, and returns a list of the results from `p`. withPosition $ sepBy1 (checkColGe "irrelevant" >> p) sep (psep <|> checkColEq "irrelevant" >> checkLinebreakBefore >> pushNone) allowTrailingSep open PrettyPrinter Syntax.MonadTraverser Formatter in -@[combinator_formatter sepByIndent] +@[combinator_formatter sepByIndent, expose] def sepByIndent.formatter (p : Formatter) (_sep : String) (pSep : Formatter) : Formatter := do let stx ← getCur let hasNewlineSep := stx.getArgs.mapIdx (fun i n => @@ -205,7 +215,7 @@ def sepByIndent.formatter (p : Formatter) (_sep : String) (pSep : Formatter) : F if hasNewlineSep then pushAlign (force := true) -@[combinator_formatter sepBy1Indent] def sepBy1Indent.formatter := sepByIndent.formatter +@[combinator_formatter sepBy1Indent, expose] def sepBy1Indent.formatter := sepByIndent.formatter attribute [run_builtin_parser_attribute_hooks] sepByIndent sepBy1Indent @@ -266,24 +276,24 @@ end Parser section open PrettyPrinter Parser -@[combinator_formatter ppHardSpace] def ppHardSpace.formatter : Formatter := Formatter.pushWhitespace " " -@[combinator_formatter ppSpace] def ppSpace.formatter : Formatter := Formatter.pushLine -@[combinator_formatter ppLine] def ppLine.formatter : Formatter := Formatter.pushWhitespace "\n" -@[combinator_formatter ppRealFill] def ppRealFill.formatter (p : Formatter) : Formatter := Formatter.fill p -@[combinator_formatter ppRealGroup] def ppRealGroup.formatter (p : Formatter) : Formatter := Formatter.group p -@[combinator_formatter ppIndent] def ppIndent.formatter (p : Formatter) : Formatter := Formatter.indent p -@[combinator_formatter ppDedent] def ppDedent.formatter (p : Formatter) : Formatter := do +@[combinator_formatter ppHardSpace, expose] def ppHardSpace.formatter : Formatter := Formatter.pushWhitespace " " +@[combinator_formatter ppSpace, expose] def ppSpace.formatter : Formatter := Formatter.pushLine +@[combinator_formatter ppLine, expose] def ppLine.formatter : Formatter := Formatter.pushWhitespace "\n" +@[combinator_formatter ppRealFill, expose] def ppRealFill.formatter (p : Formatter) : Formatter := Formatter.fill p +@[combinator_formatter ppRealGroup, expose] def ppRealGroup.formatter (p : Formatter) : Formatter := Formatter.group p +@[combinator_formatter ppIndent, expose] def ppIndent.formatter (p : Formatter) : Formatter := Formatter.indent p +@[combinator_formatter ppDedent, expose] def ppDedent.formatter (p : Formatter) : Formatter := do let opts ← getOptions Formatter.indent p (some ((0:Int) - Std.Format.getIndent opts)) -@[combinator_formatter ppAllowUngrouped] def ppAllowUngrouped.formatter : Formatter := do +@[combinator_formatter ppAllowUngrouped, expose] def ppAllowUngrouped.formatter : Formatter := do modify ({ · with mustBeGrouped := false }) -@[combinator_formatter ppDedentIfGrouped] def ppDedentIfGrouped.formatter (p : Formatter) : Formatter := do +@[combinator_formatter ppDedentIfGrouped, expose] def ppDedentIfGrouped.formatter (p : Formatter) : Formatter := do Formatter.concat p let indent := Std.Format.getIndent (← getOptions) unless (← get).isUngrouped do modify fun st => { st with stack := st.stack.modify (st.stack.size - 1) (·.nest (0 - indent)) } -@[combinator_formatter ppHardLineUnlessUngrouped] def ppHardLineUnlessUngrouped.formatter : Formatter := do +@[combinator_formatter ppHardLineUnlessUngrouped, expose] def ppHardLineUnlessUngrouped.formatter : Formatter := do if (← get).isUngrouped then Formatter.pushLine else diff --git a/src/Lean/Parser/Level.lean b/src/Lean/Parser/Level.lean index a6540a0173..c70eddef48 100644 --- a/src/Lean/Parser/Level.lean +++ b/src/Lean/Parser/Level.lean @@ -3,8 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Extra +public import Lean.Parser.Extra +public meta import Lean.Parser.Extra -- `register_parser_alias` indirect dependency... but do we want that? + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/Module.lean b/src/Lean/Parser/Module.lean index 72dc9c05ed..a419945805 100644 --- a/src/Lean/Parser/Module.lean +++ b/src/Lean/Parser/Module.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Message -import Lean.Parser.Command +public import Lean.Message +public import Lean.Parser.Command + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/StrInterpolation.lean b/src/Lean/Parser/StrInterpolation.lean index 998da4a0d3..41986886d1 100644 --- a/src/Lean/Parser/StrInterpolation.lean +++ b/src/Lean/Parser/StrInterpolation.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Parser.Basic +public import Lean.Parser.Basic + +public section namespace Lean.Parser def isQuotableCharForStrInterpolant (c : Char) : Bool := diff --git a/src/Lean/Parser/Syntax.lean b/src/Lean/Parser/Syntax.lean index 22fa7e4691..a019237788 100644 --- a/src/Lean/Parser/Syntax.lean +++ b/src/Lean/Parser/Syntax.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Command +public import Lean.Parser.Command + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/Tactic.lean b/src/Lean/Parser/Tactic.lean index 6af7909266..0d9bfbd137 100644 --- a/src/Lean/Parser/Tactic.lean +++ b/src/Lean/Parser/Tactic.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Term -import Lean.Parser.Tactic.Doc -import Std.Tactic.Do.Syntax +public import Lean.Parser.Term +public import Lean.Parser.Tactic.Doc +public import Std.Tactic.Do.Syntax + +public section namespace Lean namespace Parser diff --git a/src/Lean/Parser/Tactic/Doc.lean b/src/Lean/Parser/Tactic/Doc.lean index 1f0e8639f3..9b0f451a00 100644 --- a/src/Lean/Parser/Tactic/Doc.lean +++ b/src/Lean/Parser/Tactic/Doc.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.Attributes -import Lean.DocString.Extension -import Lean.Elab.InfoTree.Main -import Lean.Parser.Attr -import Lean.Parser.Extension +public import Lean.Attributes +public import Lean.DocString.Extension +public import Lean.Elab.InfoTree.Main +meta import Lean.Parser.Attr +public import Lean.Parser.Extension + +public section set_option linter.missingDocs true diff --git a/src/Lean/Parser/Term.lean b/src/Lean/Parser/Term.lean index 2dcc6ef0c8..b2b9cdcc7a 100644 --- a/src/Lean/Parser/Term.lean +++ b/src/Lean/Parser/Term.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich, Mario Carneiro -/ +module + prelude -import Lean.Parser.Attr -import Lean.Parser.Level -import Lean.Parser.Term.Doc +public import Lean.Parser.Attr +public import Lean.Parser.Level +public import Lean.Parser.Term.Doc + +public section namespace Lean namespace Parser @@ -15,9 +19,9 @@ namespace Command def commentBody : Parser := { fn := rawFn (finishCommentBlock (pushMissingOnError := true) 1) (trailingWs := true) } -@[combinator_parenthesizer commentBody] +@[combinator_parenthesizer commentBody, expose] def commentBody.parenthesizer := PrettyPrinter.Parenthesizer.visitToken -@[combinator_formatter commentBody] +@[combinator_formatter commentBody, expose] def commentBody.formatter := PrettyPrinter.Formatter.visitAtom Name.anonymous /-- A `docComment` parses a "documentation comment" like `/-- foo -/`. This is not treated like @@ -316,7 +320,7 @@ def binderDefault := leading_parser " := " >> termParser open Lean.PrettyPrinter Parenthesizer Syntax.MonadTraverser in -@[combinator_parenthesizer Lean.Parser.Term.binderDefault] def binderDefault.parenthesizer : Parenthesizer := do +@[combinator_parenthesizer Lean.Parser.Term.binderDefault, expose] def binderDefault.parenthesizer : Parenthesizer := do let prec := match (← getCur) with -- must parenthesize to distinguish from `binderTactic` | `(binderDefault| := by $_) => maxPrec diff --git a/src/Lean/Parser/Term/Doc.lean b/src/Lean/Parser/Term/Doc.lean index 13ceb1cf6f..a7d5be49df 100644 --- a/src/Lean/Parser/Term/Doc.lean +++ b/src/Lean/Parser/Term/Doc.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Markus Himmel -/ +module + prelude -import Lean.Parser.Extension +public import Lean.Parser.Extension + +public section /-! Environment extension to register preferred spellings of notations in identifiers. -/ diff --git a/src/Lean/Parser/Types.lean b/src/Lean/Parser/Types.lean index 2f778c36a5..a5d9714643 100644 --- a/src/Lean/Parser/Types.lean +++ b/src/Lean/Parser/Types.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Data.Trie -import Lean.Syntax -import Lean.Message -import Lean.DocString.Extension +public import Lean.Data.Trie +public import Lean.Syntax +public import Lean.Message +public import Lean.DocString.Extension + +public section namespace Lean.Parser @@ -185,7 +189,7 @@ def extract (stack : SyntaxStack) (start stop : Nat) : Array Syntax := stack.raw.extract (stack.drop + start) (stack.drop + stop) instance : HAppend SyntaxStack (Array Syntax) SyntaxStack where - hAppend stack stxs := { stack with raw := stack.raw ++ stxs } + hAppend stack stxs := private { stack with raw := stack.raw ++ stxs } end SyntaxStack @@ -322,7 +326,7 @@ def toErrorMsg (ctx : InputContext) (s : ParserState) : String := Id.run do end ParserState -def ParserFn := ParserContext → ParserState → ParserState +@[expose] def ParserFn := ParserContext → ParserState → ParserState instance : Inhabited ParserFn where default := fun _ s => s diff --git a/src/Lean/ParserCompiler.lean b/src/Lean/ParserCompiler.lean index 2d26de1c0a..5679b78f4a 100644 --- a/src/Lean/ParserCompiler.lean +++ b/src/Lean/ParserCompiler.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Meta.ReduceEval -import Lean.Meta.WHNF -import Lean.KeyedDeclsAttribute -import Lean.ParserCompiler.Attribute -import Lean.Parser.Extension +public import Lean.Meta.ReduceEval +public import Lean.Meta.WHNF +public import Lean.KeyedDeclsAttribute +public import Lean.ParserCompiler.Attribute +public import Lean.Parser.Extension + +public section /-! Gadgets for compiling parser declarations into other programs, such as pretty printers. diff --git a/src/Lean/ParserCompiler/Attribute.lean b/src/Lean/ParserCompiler/Attribute.lean index a8bc59e060..fcbebdddf3 100644 --- a/src/Lean/ParserCompiler/Attribute.lean +++ b/src/Lean/ParserCompiler/Attribute.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Attributes -import Lean.Compiler.InitAttr -import Lean.ToExpr +public import Lean.Attributes +public import Lean.Compiler.InitAttr +public import Lean.ToExpr + +public section namespace Lean namespace ParserCompiler diff --git a/src/Lean/PremiseSelection.lean b/src/Lean/PremiseSelection.lean index 272cc0f422..47b4ded7e3 100644 --- a/src/Lean/PremiseSelection.lean +++ b/src/Lean/PremiseSelection.lean @@ -3,11 +3,15 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.Command -import Lean.Meta.Eval -import Lean.Meta.CompletionName -import Init.Data.Random +public import Lean.Elab.Command +public import Lean.Meta.Eval +public import Lean.Meta.CompletionName +public import Init.Data.Random + +public section /-! # An API for premise selection algorithms. diff --git a/src/Lean/PrettyPrinter.lean b/src/Lean/PrettyPrinter.lean index b33fc44fe5..c28e23232a 100644 --- a/src/Lean/PrettyPrinter.lean +++ b/src/Lean/PrettyPrinter.lean @@ -3,14 +3,18 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.PrettyPrinter.Delaborator -import Lean.PrettyPrinter.Parenthesizer -import Lean.PrettyPrinter.Formatter -import Lean.Parser.Module -import Lean.ParserCompiler -import Lean.Util.NumObjs -import Lean.Util.ShareCommon +public import Lean.PrettyPrinter.Delaborator +public import Lean.PrettyPrinter.Parenthesizer +public import Lean.PrettyPrinter.Formatter +public import Lean.Parser.Module +public import Lean.ParserCompiler +public import Lean.Util.NumObjs +public import Lean.Util.ShareCommon + +public section namespace Lean.PrettyPrinter diff --git a/src/Lean/PrettyPrinter/Basic.lean b/src/Lean/PrettyPrinter/Basic.lean index c72cc4ee9c..3d9884f25a 100644 --- a/src/Lean/PrettyPrinter/Basic.lean +++ b/src/Lean/PrettyPrinter/Basic.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.KeyedDeclsAttribute +public import Lean.KeyedDeclsAttribute + +public section namespace Lean namespace PrettyPrinter diff --git a/src/Lean/PrettyPrinter/Delaborator.lean b/src/Lean/PrettyPrinter/Delaborator.lean index c0b10de2bb..22c52d89ca 100644 --- a/src/Lean/PrettyPrinter/Delaborator.lean +++ b/src/Lean/PrettyPrinter/Delaborator.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.PrettyPrinter.Delaborator.Options -import Lean.PrettyPrinter.Delaborator.SubExpr -import Lean.PrettyPrinter.Delaborator.TopDownAnalyze -import Lean.PrettyPrinter.Delaborator.Basic -import Lean.PrettyPrinter.Delaborator.Builtins +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.PrettyPrinter.Delaborator.SubExpr +public import Lean.PrettyPrinter.Delaborator.TopDownAnalyze +public import Lean.PrettyPrinter.Delaborator.Basic +public import Lean.PrettyPrinter.Delaborator.Builtins + +public section diff --git a/src/Lean/PrettyPrinter/Delaborator/Attributes.lean b/src/Lean/PrettyPrinter/Delaborator/Attributes.lean index ccbec19ac6..b8fba82d95 100644 --- a/src/Lean/PrettyPrinter/Delaborator/Attributes.lean +++ b/src/Lean/PrettyPrinter/Delaborator/Attributes.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Attributes +public import Lean.Attributes + +public section /-! # Attributes for the pretty printer diff --git a/src/Lean/PrettyPrinter/Delaborator/Basic.lean b/src/Lean/PrettyPrinter/Delaborator/Basic.lean index 33892f6d30..fd6f63455c 100644 --- a/src/Lean/PrettyPrinter/Delaborator/Basic.lean +++ b/src/Lean/PrettyPrinter/Delaborator/Basic.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.KeyedDeclsAttribute -import Lean.PrettyPrinter.Delaborator.Options -import Lean.PrettyPrinter.Delaborator.SubExpr -import Lean.PrettyPrinter.Delaborator.TopDownAnalyze +public import Lean.KeyedDeclsAttribute +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.PrettyPrinter.Delaborator.SubExpr +public import Lean.PrettyPrinter.Delaborator.TopDownAnalyze + +public section /-! The delaborator is the first stage of the pretty printer, and the inverse of the diff --git a/src/Lean/PrettyPrinter/Delaborator/Builtins.lean b/src/Lean/PrettyPrinter/Delaborator/Builtins.lean index ddf03dbd3d..df7c1dc1cf 100644 --- a/src/Lean/PrettyPrinter/Delaborator/Builtins.lean +++ b/src/Lean/PrettyPrinter/Delaborator/Builtins.lean @@ -3,15 +3,19 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Leonardo de Moura, Gabriel Ebner, Mario Carneiro -/ +module + prelude -import Lean.PrettyPrinter.Delaborator.Attributes -import Lean.PrettyPrinter.Delaborator.Basic -import Lean.PrettyPrinter.Delaborator.SubExpr -import Lean.PrettyPrinter.Delaborator.TopDownAnalyze -import Lean.Parser.Do -import Lean.Parser.Command -import Lean.Meta.CoeAttr -import Lean.Meta.Structure +public import Lean.PrettyPrinter.Delaborator.Attributes +public import Lean.PrettyPrinter.Delaborator.Basic +public import Lean.PrettyPrinter.Delaborator.SubExpr +public import Lean.PrettyPrinter.Delaborator.TopDownAnalyze +public import Lean.Parser.Term +meta import Lean.Parser.Command +public import Lean.Meta.CoeAttr +public import Lean.Meta.Structure + +public section namespace Lean.PrettyPrinter.Delaborator open Lean.Meta @@ -1375,7 +1379,7 @@ def delabSorry : Delab := whenPPOption getPPNotation <| whenNotPPOption getPPExp open Parser Command Term in @[run_builtin_parser_attribute_hooks] -- use `termParser` instead of `declId` so we can reuse `delabConst` -def declSigWithId := leading_parser termParser maxPrec >> declSig +meta def declSigWithId := leading_parser termParser maxPrec >> declSig private unsafe def evalSyntaxConstantUnsafe (env : Environment) (opts : Options) (constName : Name) : ExceptT String Id Syntax := env.evalConstCheck Syntax opts ``Syntax constName diff --git a/src/Lean/PrettyPrinter/Delaborator/FieldNotation.lean b/src/Lean/PrettyPrinter/Delaborator/FieldNotation.lean index 1d7e0fa7d9..2affb6634d 100644 --- a/src/Lean/PrettyPrinter/Delaborator/FieldNotation.lean +++ b/src/Lean/PrettyPrinter/Delaborator/FieldNotation.lean @@ -3,12 +3,16 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Meta.InferType -import Lean.Meta.WHNF -import Lean.PrettyPrinter.Delaborator.Attributes -import Lean.PrettyPrinter.Delaborator.Options -import Lean.Structure +public import Lean.Meta.InferType +public import Lean.Meta.WHNF +public import Lean.PrettyPrinter.Delaborator.Attributes +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.Structure + +public section /-! # Functions for analyzing projections for pretty printing diff --git a/src/Lean/PrettyPrinter/Delaborator/Options.lean b/src/Lean/PrettyPrinter/Delaborator/Options.lean index 110c463485..59cec85de6 100644 --- a/src/Lean/PrettyPrinter/Delaborator/Options.lean +++ b/src/Lean/PrettyPrinter/Delaborator/Options.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Data.Options +public import Lean.Data.Options + +public section namespace Lean diff --git a/src/Lean/PrettyPrinter/Delaborator/SubExpr.lean b/src/Lean/PrettyPrinter/Delaborator/SubExpr.lean index 9aedf5c2d2..b9943cd12c 100644 --- a/src/Lean/PrettyPrinter/Delaborator/SubExpr.lean +++ b/src/Lean/PrettyPrinter/Delaborator/SubExpr.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Daniel Selsam, Wojciech Nawrocki -/ +module + prelude -import Lean.Meta.Basic -import Lean.SubExpr +public import Lean.Meta.Basic +public import Lean.SubExpr + +public section /-! # Subexpr utilities for delaborator. diff --git a/src/Lean/PrettyPrinter/Delaborator/TopDownAnalyze.lean b/src/Lean/PrettyPrinter/Delaborator/TopDownAnalyze.lean index c06ab54c89..e78e94aa68 100644 --- a/src/Lean/PrettyPrinter/Delaborator/TopDownAnalyze.lean +++ b/src/Lean/PrettyPrinter/Delaborator/TopDownAnalyze.lean @@ -3,17 +3,21 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Daniel Selsam -/ +module + prelude -import Lean.Meta.SynthInstance -import Lean.Meta.CtorRecognizer -import Lean.Util.FindMVar -import Lean.Util.FindLevelMVar -import Lean.Util.CollectLevelParams -import Lean.Util.ReplaceLevel -import Lean.PrettyPrinter.Delaborator.FieldNotation -import Lean.PrettyPrinter.Delaborator.Options -import Lean.PrettyPrinter.Delaborator.SubExpr -import Lean.Elab.Config +public import Lean.Meta.SynthInstance +public import Lean.Meta.CtorRecognizer +public import Lean.Util.FindMVar +public import Lean.Util.FindLevelMVar +public import Lean.Util.CollectLevelParams +public import Lean.Util.ReplaceLevel +public import Lean.PrettyPrinter.Delaborator.FieldNotation +public import Lean.PrettyPrinter.Delaborator.Options +public import Lean.PrettyPrinter.Delaborator.SubExpr +public import Lean.Elab.Config + +public section /-! The top-down analyzer is an optional preprocessor to the delaborator that aims diff --git a/src/Lean/PrettyPrinter/Formatter.lean b/src/Lean/PrettyPrinter/Formatter.lean index c30a1ed2fb..701d6b8aaf 100644 --- a/src/Lean/PrettyPrinter/Formatter.lean +++ b/src/Lean/PrettyPrinter/Formatter.lean @@ -3,13 +3,17 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.CoreM -import Lean.Parser.Extension -import Lean.Parser.StrInterpolation -import Lean.KeyedDeclsAttribute -import Lean.ParserCompiler.Attribute -import Lean.PrettyPrinter.Basic +public import Lean.CoreM +public import Lean.Parser.Extension +public import Lean.Parser.StrInterpolation +public import Lean.KeyedDeclsAttribute +public import Lean.ParserCompiler.Attribute +public import Lean.PrettyPrinter.Basic + +public section /-! The formatter turns a `Syntax` tree into a `Format` object, inserting both mandatory whitespace (to separate adjacent @@ -131,14 +135,14 @@ def getStackSize : FormatterM Nat := do def setStack (stack : Array Format) : FormatterM Unit := modify fun st => { st with stack := stack } -private def push (f : Format) : FormatterM Unit := +def push (f : Format) : FormatterM Unit := modify fun st => { st with stack := st.stack.push f, isUngrouped := false } /-- Resets the state associated with the lead word, inhibiting any automatic whitespace insertion between tokens. -/ -private def resetLeadWord : FormatterM Unit := do +def resetLeadWord : FormatterM Unit := do modify fun st => { st with leadWord := "", leadWordIdent := false } def pushWhitespace (f : Format) : FormatterM Unit := do @@ -205,7 +209,7 @@ def withMaybeTag (pos? : Option String.Pos) (x : FormatterM Unit) : Formatter := else x -@[combinator_formatter orelse] partial def orelse.formatter (p1 p2 : Formatter) : Formatter := do +@[combinator_formatter orelse, expose] partial def orelse.formatter (p1 p2 : Formatter) : Formatter := do let stx ← getCur -- `orelse` may produce `choice` nodes for antiquotations if stx.getKind == `choice then @@ -218,10 +222,10 @@ def withMaybeTag (pos? : Option String.Pos) (x : FormatterM Unit) : Formatter := -- them in turn. Uses the syntax traverser non-linearly! p1 <|> p2 -@[combinator_formatter recover] +@[combinator_formatter recover, expose] def recover.formatter (fmt : PrettyPrinter.Formatter) := fmt -@[combinator_formatter recover'] +@[combinator_formatter recover', expose] def recover'.formatter (fmt : PrettyPrinter.Formatter) := fmt -- `mkAntiquot` is quite complex, so we'd rather have its formatter synthesized below the actual parser definition. @@ -239,7 +243,7 @@ private def SourceInfo.getExprPos? : SourceInfo → Option String.Pos | SourceInfo.synthetic (pos := pos) .. => pos | _ => none -private def getExprPos? : Syntax → Option String.Pos +def getExprPos? : Syntax → Option String.Pos | Syntax.node info _ _ => SourceInfo.getExprPos? info | Syntax.atom info _ => SourceInfo.getExprPos? info | Syntax.ident info _ _ _ => SourceInfo.getExprPos? info @@ -257,20 +261,20 @@ unsafe def formatterForKindUnsafe (k : SyntaxNodeKind) : Formatter := do @[implemented_by formatterForKindUnsafe] opaque formatterForKind (k : SyntaxNodeKind) : Formatter -@[combinator_formatter withAntiquot] +@[combinator_formatter withAntiquot, expose] def withAntiquot.formatter (antiP p : Formatter) : Formatter := -- TODO: could be optimized using `isAntiquot` (which would have to be moved), but I'd rather -- fix the backtracking hack outright. orelse.formatter antiP p -@[combinator_formatter withAntiquotSuffixSplice] +@[combinator_formatter withAntiquotSuffixSplice, expose] def withAntiquotSuffixSplice.formatter (_ : SyntaxNodeKind) (p suffix : Formatter) : Formatter := do if (← getCur).isAntiquotSuffixSplice then visitArgs <| suffix *> p else p -@[combinator_formatter tokenWithAntiquot] +@[combinator_formatter tokenWithAntiquot, expose] def tokenWithAntiquot.formatter (p : Formatter) : Formatter := do if (← getCur).isTokenAntiquot then visitArgs p @@ -292,7 +296,7 @@ def categoryFormatterCore (cat : Name) : Formatter := do withAntiquot.formatter (mkAntiquot.formatter' cat.toString cat (isPseudoKind := true)) (formatterForKind stx.getKind) modify fun st => { st with mustBeGrouped := true, isUngrouped := !st.mustBeGrouped } -@[combinator_formatter categoryParser] +@[combinator_formatter categoryParser, expose] def categoryParser.formatter (cat : Name) : Formatter := do concat <| categoryFormatterCore cat unless (← get).isUngrouped do @@ -305,23 +309,23 @@ def categoryParser.formatter (cat : Name) : Formatter := do def categoryFormatter (cat : Name) : Formatter := fill <| indent <| categoryFormatterCore cat -@[combinator_formatter parserOfStack] +@[combinator_formatter parserOfStack, expose] def parserOfStack.formatter (offset : Nat) (_prec : Nat := 0) : Formatter := do let st ← get let stx := st.stxTrav.parents.back!.getArg (st.stxTrav.idxs.back! - offset) formatterForKind stx.getKind -@[combinator_formatter error] +@[combinator_formatter error, expose] def error.formatter (_msg : String) : Formatter := pure () -@[combinator_formatter errorAtSavedPos] +@[combinator_formatter errorAtSavedPos, expose] def errorAtSavedPos.formatter (_msg : String) (_delta : Bool) : Formatter := pure () -@[combinator_formatter lookahead] +@[combinator_formatter lookahead, expose] def lookahead.formatter (_ : Formatter) : Formatter := pure () -@[combinator_formatter notFollowedBy] +@[combinator_formatter notFollowedBy, expose] def notFollowedBy.formatter (_ : Formatter) : Formatter := pure () -@[combinator_formatter andthen] +@[combinator_formatter andthen, expose] def andthen.formatter (p1 p2 : Formatter) : Formatter := p2 *> p1 def checkKind (k : SyntaxNodeKind) : FormatterM Unit := do @@ -330,15 +334,15 @@ def checkKind (k : SyntaxNodeKind) : FormatterM Unit := do trace[PrettyPrinter.format.backtrack] "unexpected node kind '{stx.getKind}', expected '{k}'" throwBacktrack -@[combinator_formatter node] +@[combinator_formatter node, expose] def node.formatter (k : SyntaxNodeKind) (p : Formatter) : Formatter := do checkKind k; visitArgs p -@[combinator_formatter withFn] +@[combinator_formatter withFn, expose] def withFn.formatter (_ : ParserFn → ParserFn) (p : Formatter) : Formatter := p -@[combinator_formatter trailingNode] +@[combinator_formatter trailingNode, expose] def trailingNode.formatter (k : SyntaxNodeKind) (_ _ : Nat) (p : Formatter) : Formatter := do checkKind k visitArgs do @@ -432,7 +436,7 @@ def pushToken (info : SourceInfo) (tk : String) (ident : Bool) : FormatterM Unit let ctk := ss' |>.takeWhile (!·.isWhitespace) |>.toString modify fun st => { st with leadWord := ctk } -@[combinator_formatter symbolNoAntiquot] +@[combinator_formatter symbolNoAntiquot, expose] def symbolNoAntiquot.formatter (sym : String) : Formatter := do let stx ← getCur if stx.isToken sym then do @@ -443,14 +447,14 @@ def symbolNoAntiquot.formatter (sym : String) : Formatter := do trace[PrettyPrinter.format.backtrack] "unexpected syntax '{format stx}', expected symbol '{sym}'" throwBacktrack -@[combinator_formatter nonReservedSymbolNoAntiquot] def nonReservedSymbolNoAntiquot.formatter := symbolNoAntiquot.formatter +@[combinator_formatter nonReservedSymbolNoAntiquot, expose] def nonReservedSymbolNoAntiquot.formatter := symbolNoAntiquot.formatter -@[combinator_formatter rawCh] def rawCh.formatter (ch : Char) (trailingWs : Bool := false) := do +@[combinator_formatter rawCh, expose] def rawCh.formatter (ch : Char) (trailingWs : Bool := false) := do unless trailingWs do resetLeadWord symbolNoAntiquot.formatter ch.toString -@[combinator_formatter unicodeSymbolNoAntiquot] +@[combinator_formatter unicodeSymbolNoAntiquot, expose] def unicodeSymbolNoAntiquot.formatter (sym asciiSym : String) : Formatter := do let Syntax.atom info val ← getCur | throwError m!"not an atom: {← getCur}" @@ -460,7 +464,7 @@ def unicodeSymbolNoAntiquot.formatter (sym asciiSym : String) : Formatter := do pushToken info asciiSym false goLeft -@[combinator_formatter identNoAntiquot] +@[combinator_formatter identNoAntiquot, expose] def identNoAntiquot.formatter : Formatter := do checkKind identKind let stx@(Syntax.ident info _ id _) ← getCur @@ -471,14 +475,14 @@ def identNoAntiquot.formatter : Formatter := do withMaybeTag (getExprPos? stx) (pushToken info (id.toString (isToken := isToken)) true) goLeft -@[combinator_formatter rawIdentNoAntiquot] def rawIdentNoAntiquot.formatter : Formatter := do +@[combinator_formatter rawIdentNoAntiquot, expose] def rawIdentNoAntiquot.formatter : Formatter := do checkKind identKind let stx@(Syntax.ident info _ id _) ← getCur | throwError m!"not an ident: {← getCur}" withMaybeTag (getExprPos? stx) (pushToken info id.toString true) goLeft -@[combinator_formatter identEq] def identEq.formatter (_id : Name) := rawIdentNoAntiquot.formatter +@[combinator_formatter identEq, expose] def identEq.formatter (_id : Name) := rawIdentNoAntiquot.formatter def visitAtom (k : SyntaxNodeKind) : Formatter := do let stx ← getCur @@ -489,26 +493,26 @@ def visitAtom (k : SyntaxNodeKind) : Formatter := do pushToken info val false goLeft -@[combinator_formatter charLitNoAntiquot] def charLitNoAntiquot.formatter := visitAtom charLitKind -@[combinator_formatter strLitNoAntiquot] def strLitNoAntiquot.formatter := visitAtom strLitKind -@[combinator_formatter nameLitNoAntiquot] def nameLitNoAntiquot.formatter := visitAtom nameLitKind -@[combinator_formatter numLitNoAntiquot] def numLitNoAntiquot.formatter := visitAtom numLitKind -@[combinator_formatter scientificLitNoAntiquot] def scientificLitNoAntiquot.formatter := visitAtom scientificLitKind -@[combinator_formatter fieldIdx] def fieldIdx.formatter := visitAtom fieldIdxKind +@[combinator_formatter charLitNoAntiquot, expose] def charLitNoAntiquot.formatter := visitAtom charLitKind +@[combinator_formatter strLitNoAntiquot, expose] def strLitNoAntiquot.formatter := visitAtom strLitKind +@[combinator_formatter nameLitNoAntiquot, expose] def nameLitNoAntiquot.formatter := visitAtom nameLitKind +@[combinator_formatter numLitNoAntiquot, expose] def numLitNoAntiquot.formatter := visitAtom numLitKind +@[combinator_formatter scientificLitNoAntiquot, expose] def scientificLitNoAntiquot.formatter := visitAtom scientificLitKind +@[combinator_formatter fieldIdx, expose] def fieldIdx.formatter := visitAtom fieldIdxKind -@[combinator_formatter manyNoAntiquot] +@[combinator_formatter manyNoAntiquot, expose] def manyNoAntiquot.formatter (p : Formatter) : Formatter := do let stx ← getCur visitArgs $ stx.getArgs.size.forM fun _ _ => p -@[combinator_formatter many1NoAntiquot] def many1NoAntiquot.formatter (p : Formatter) : Formatter := manyNoAntiquot.formatter p +@[combinator_formatter many1NoAntiquot, expose] def many1NoAntiquot.formatter (p : Formatter) : Formatter := manyNoAntiquot.formatter p -@[combinator_formatter optionalNoAntiquot] +@[combinator_formatter optionalNoAntiquot, expose] def optionalNoAntiquot.formatter (p : Formatter) : Formatter := do let stx ← getCur visitArgs <| unless stx.getArgs.isEmpty do p -@[combinator_formatter many1Unbox] +@[combinator_formatter many1Unbox, expose] def many1Unbox.formatter (p : Formatter) : Formatter := do let stx ← getCur if stx.getKind == nullKind then do @@ -516,48 +520,48 @@ def many1Unbox.formatter (p : Formatter) : Formatter := do else p -@[combinator_formatter sepByNoAntiquot] +@[combinator_formatter sepByNoAntiquot, expose] def sepByNoAntiquot.formatter (p pSep : Formatter) : Formatter := do let stx ← getCur visitArgs <| stx.getArgs.size.forRevM fun i _ => if i % 2 == 0 then p else pSep -@[combinator_formatter sepBy1NoAntiquot] def sepBy1NoAntiquot.formatter := sepByNoAntiquot.formatter +@[combinator_formatter sepBy1NoAntiquot, expose] def sepBy1NoAntiquot.formatter := sepByNoAntiquot.formatter -@[combinator_formatter withoutInfo] def withoutInfo.formatter (p : Formatter) : Formatter := p -@[combinator_formatter checkWsBefore] def checkWsBefore.formatter : Formatter := do +@[combinator_formatter withoutInfo, expose] def withoutInfo.formatter (p : Formatter) : Formatter := p +@[combinator_formatter checkWsBefore, expose] def checkWsBefore.formatter : Formatter := do let st ← get if st.leadWord != "" then pushLine -@[combinator_formatter checkPrec] def checkPrec.formatter : Formatter := pure () -@[combinator_formatter checkLhsPrec] def checkLhsPrec.formatter : Formatter := pure () -@[combinator_formatter setLhsPrec] def setLhsPrec.formatter : Formatter := pure () -@[combinator_formatter checkStackTop] def checkStackTop.formatter : Formatter := pure () -@[combinator_formatter checkNoWsBefore] def checkNoWsBefore.formatter : Formatter := +@[combinator_formatter checkPrec, expose] def checkPrec.formatter : Formatter := pure () +@[combinator_formatter checkLhsPrec, expose] def checkLhsPrec.formatter : Formatter := pure () +@[combinator_formatter setLhsPrec, expose] def setLhsPrec.formatter : Formatter := pure () +@[combinator_formatter checkStackTop, expose] def checkStackTop.formatter : Formatter := pure () +@[combinator_formatter checkNoWsBefore, expose] def checkNoWsBefore.formatter : Formatter := -- prevent automatic whitespace insertion resetLeadWord -@[combinator_formatter checkLinebreakBefore] def checkLinebreakBefore.formatter : Formatter := pure () -@[combinator_formatter checkTailWs] def checkTailWs.formatter : Formatter := pure () -@[combinator_formatter checkColEq] def checkColEq.formatter : Formatter := pure () -@[combinator_formatter checkColGe] def checkColGe.formatter : Formatter := pure () -@[combinator_formatter checkColGt] def checkColGt.formatter : Formatter := pure () -@[combinator_formatter checkLineEq] def checkLineEq.formatter : Formatter := pure () +@[combinator_formatter checkLinebreakBefore, expose] def checkLinebreakBefore.formatter : Formatter := pure () +@[combinator_formatter checkTailWs, expose] def checkTailWs.formatter : Formatter := pure () +@[combinator_formatter checkColEq, expose] def checkColEq.formatter : Formatter := pure () +@[combinator_formatter checkColGe, expose] def checkColGe.formatter : Formatter := pure () +@[combinator_formatter checkColGt, expose] def checkColGt.formatter : Formatter := pure () +@[combinator_formatter checkLineEq, expose] def checkLineEq.formatter : Formatter := pure () -@[combinator_formatter eoi] def eoi.formatter : Formatter := pure () -@[combinator_formatter checkNoImmediateColon] def checkNoImmediateColon.formatter : Formatter := pure () -@[combinator_formatter skip] def skip.formatter : Formatter := pure () +@[combinator_formatter eoi, expose] def eoi.formatter : Formatter := pure () +@[combinator_formatter checkNoImmediateColon, expose] def checkNoImmediateColon.formatter : Formatter := pure () +@[combinator_formatter skip, expose] def skip.formatter : Formatter := pure () -@[combinator_formatter pushNone] def pushNone.formatter : Formatter := goLeft -@[combinator_formatter hygieneInfoNoAntiquot] def hygieneInfoNoAntiquot.formatter : Formatter := goLeft +@[combinator_formatter pushNone, expose] def pushNone.formatter : Formatter := goLeft +@[combinator_formatter hygieneInfoNoAntiquot, expose] def hygieneInfoNoAntiquot.formatter : Formatter := goLeft -@[combinator_formatter interpolatedStr] +@[combinator_formatter interpolatedStr, expose] def interpolatedStr.formatter (p : Formatter) : Formatter := do visitArgs $ (← getCur).getArgs.reverse.forM fun chunk => match chunk.isLit? interpolatedStrLitKind with | some str => push str *> goLeft | none => p -@[combinator_formatter _root_.ite, macro_inline] def ite {_ : Type} (c : Prop) [Decidable c] (t e : Formatter) : Formatter := +@[combinator_formatter _root_.ite, expose, macro_inline] def ite {_ : Type} (c : Prop) [Decidable c] (t e : Formatter) : Formatter := if c then t else e abbrev FormatterAliasValue := AliasValue Formatter diff --git a/src/Lean/PrettyPrinter/Parenthesizer.lean b/src/Lean/PrettyPrinter/Parenthesizer.lean index e493028ae8..b30af9f708 100644 --- a/src/Lean/PrettyPrinter/Parenthesizer.lean +++ b/src/Lean/PrettyPrinter/Parenthesizer.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Parser.Extension -import Lean.Parser.StrInterpolation -import Lean.ParserCompiler.Attribute -import Lean.PrettyPrinter.Basic -import Lean.PrettyPrinter.Delaborator.Options +public import Lean.Parser.Extension +public import Lean.Parser.StrInterpolation +public import Lean.ParserCompiler.Attribute +public import Lean.PrettyPrinter.Basic +public import Lean.PrettyPrinter.Delaborator.Options + +public section /-! @@ -172,7 +176,7 @@ unsafe builtin_initialize categoryParenthesizerAttribute : KeyedDeclsAttribute C /-- Registers a parenthesizer for a parser combinator. -`@[combinator_parenthesizer c]` registers a declaration of type `Lean.PrettyPrinter.Parenthesizer` +`@[combinator_parenthesizer c, expose]` registers a declaration of type `Lean.PrettyPrinter.Parenthesizer` for the `Parser` declaration `c`. Note that, unlike with `@[parenthesizer]`, this is not a node kind since combinators usually do not introduce their own node kinds. The tagged declaration may optionally accept parameters corresponding to (a prefix of) those of `c`, where `Parser` is @@ -277,7 +281,7 @@ def visitToken : Parenthesizer := do modify fun st => { st with contPrec := none, contCat := Name.anonymous, visitedToken := true } goLeft -@[combinator_parenthesizer orelse] partial def orelse.parenthesizer (p1 p2 : Parenthesizer) : Parenthesizer := do +@[combinator_parenthesizer orelse, expose] partial def orelse.parenthesizer (p1 p2 : Parenthesizer) : Parenthesizer := do let stx ← getCur -- `orelse` may produce `choice` nodes for antiquotations if stx.getKind == `choice then @@ -288,10 +292,10 @@ def visitToken : Parenthesizer := do -- them in turn. Uses the syntax traverser non-linearly! p1 <|> p2 -@[combinator_parenthesizer recover] +@[combinator_parenthesizer recover, expose] def recover.parenthesizer (p : PrettyPrinter.Parenthesizer) : PrettyPrinter.Parenthesizer := p -@[combinator_parenthesizer recover'] +@[combinator_parenthesizer recover', expose] def recover'.parenthesizer (p : PrettyPrinter.Parenthesizer) : PrettyPrinter.Parenthesizer := p -- `mkAntiquot` is quite complex, so we'd rather have its parenthesizer synthesized below the actual parser definition. @@ -318,7 +322,7 @@ unsafe def parenthesizerForKindUnsafe (k : SyntaxNodeKind) : Parenthesizer := do @[implemented_by parenthesizerForKindUnsafe] opaque parenthesizerForKind (k : SyntaxNodeKind) : Parenthesizer -@[combinator_parenthesizer withAntiquot] +@[combinator_parenthesizer withAntiquot, expose] def withAntiquot.parenthesizer (antiP p : Parenthesizer) : Parenthesizer := do let stx ← getCur -- early check as minor optimization that also cleans up the backtrack traces @@ -327,14 +331,14 @@ def withAntiquot.parenthesizer (antiP p : Parenthesizer) : Parenthesizer := do else p -@[combinator_parenthesizer withAntiquotSuffixSplice] +@[combinator_parenthesizer withAntiquotSuffixSplice, expose] def withAntiquotSuffixSplice.parenthesizer (_ : SyntaxNodeKind) (p suffix : Parenthesizer) : Parenthesizer := do if (← getCur).isAntiquotSuffixSplice then visitArgs <| suffix *> p else p -@[combinator_parenthesizer tokenWithAntiquot] +@[combinator_parenthesizer tokenWithAntiquot, expose] def tokenWithAntiquot.parenthesizer (p : Parenthesizer) : Parenthesizer := do if (← getCur).isTokenAntiquot then visitArgs p @@ -351,7 +355,7 @@ partial def parenthesizeCategoryCore (cat : Name) (_prec : Nat) : Parenthesizer withAntiquot.parenthesizer (mkAntiquot.parenthesizer' cat.toString cat (isPseudoKind := true)) (parenthesizerForKind stx.getKind) modify fun st => { st with contCat := cat } -@[combinator_parenthesizer categoryParser] +@[combinator_parenthesizer categoryParser, expose] def categoryParser.parenthesizer (cat : Name) (prec : Nat) : Parenthesizer := do let env ← getEnv match categoryParenthesizerAttribute.getValues env cat with @@ -360,7 +364,7 @@ def categoryParser.parenthesizer (cat : Name) (prec : Nat) : Parenthesizer := do -- In this case this node will never be parenthesized since we don't know which parentheses to use. | _ => parenthesizeCategoryCore cat prec -@[combinator_parenthesizer parserOfStack] +@[combinator_parenthesizer parserOfStack, expose] def parserOfStack.parenthesizer (offset : Nat) (_prec : Nat := 0) : Parenthesizer := do let st ← get let stx := st.stxTrav.parents.back!.getArg (st.stxTrav.idxs.back! - offset) @@ -397,27 +401,27 @@ def level.parenthesizer : CategoryParenthesizer | prec => do def rawStx.parenthesizer : CategoryParenthesizer | _ => do goLeft -@[combinator_parenthesizer error] +@[combinator_parenthesizer error, expose] def error.parenthesizer (_msg : String) : Parenthesizer := pure () -@[combinator_parenthesizer errorAtSavedPos] +@[combinator_parenthesizer errorAtSavedPos, expose] def errorAtSavedPos.parenthesizer (_msg : String) (_delta : Bool) : Parenthesizer := pure () -@[combinator_parenthesizer atomic] +@[combinator_parenthesizer atomic, expose] def atomic.parenthesizer (p : Parenthesizer) : Parenthesizer := p -@[combinator_parenthesizer lookahead] +@[combinator_parenthesizer lookahead, expose] def lookahead.parenthesizer (_ : Parenthesizer) : Parenthesizer := pure () -@[combinator_parenthesizer notFollowedBy] +@[combinator_parenthesizer notFollowedBy, expose] def notFollowedBy.parenthesizer (_ : Parenthesizer) : Parenthesizer := pure () -@[combinator_parenthesizer andthen] +@[combinator_parenthesizer andthen, expose] def andthen.parenthesizer (p1 p2 : Parenthesizer) : Parenthesizer := p2 *> p1 @@ -428,19 +432,19 @@ def checkKind (k : SyntaxNodeKind) : Parenthesizer := do -- HACK; see `orelse.parenthesizer` throwBacktrack -@[combinator_parenthesizer node] +@[combinator_parenthesizer node, expose] def node.parenthesizer (k : SyntaxNodeKind) (p : Parenthesizer) : Parenthesizer := do checkKind k visitArgs p -@[combinator_parenthesizer checkPrec] +@[combinator_parenthesizer checkPrec, expose] def checkPrec.parenthesizer (prec : Nat) : Parenthesizer := addPrecCheck prec -@[combinator_parenthesizer withFn] +@[combinator_parenthesizer withFn, expose] def withFn.parenthesizer (_ : ParserFn → ParserFn) (p : Parenthesizer) : Parenthesizer := p -@[combinator_parenthesizer leadingNode] +@[combinator_parenthesizer leadingNode, expose] def leadingNode.parenthesizer (k : SyntaxNodeKind) (prec : Nat) (p : Parenthesizer) : Parenthesizer := do node.parenthesizer k p addPrecCheck prec @@ -449,7 +453,7 @@ def leadingNode.parenthesizer (k : SyntaxNodeKind) (prec : Nat) (p : Parenthesiz -- into a trailing one. modify fun st => { st with contPrec := Nat.min (Parser.maxPrec-1) prec } -@[combinator_parenthesizer trailingNode] +@[combinator_parenthesizer trailingNode, expose] def trailingNode.parenthesizer (k : SyntaxNodeKind) (prec lhsPrec : Nat) (p : Parenthesizer) : Parenthesizer := do checkKind k visitArgs do @@ -463,33 +467,33 @@ def trailingNode.parenthesizer (k : SyntaxNodeKind) (prec lhsPrec : Nat) (p : Pa -- parser is calling us. categoryParser.parenthesizer ctx.cat lhsPrec -@[combinator_parenthesizer rawCh] def rawCh.parenthesizer (_ch : Char) := visitToken +@[combinator_parenthesizer rawCh, expose] def rawCh.parenthesizer (_ch : Char) := visitToken -@[combinator_parenthesizer symbolNoAntiquot] def symbolNoAntiquot.parenthesizer (_sym : String) := visitToken -@[combinator_parenthesizer unicodeSymbolNoAntiquot] def unicodeSymbolNoAntiquot.parenthesizer (_sym _asciiSym : String) := visitToken +@[combinator_parenthesizer symbolNoAntiquot, expose] def symbolNoAntiquot.parenthesizer (_sym : String) := visitToken +@[combinator_parenthesizer unicodeSymbolNoAntiquot, expose] def unicodeSymbolNoAntiquot.parenthesizer (_sym _asciiSym : String) := visitToken -@[combinator_parenthesizer identNoAntiquot] def identNoAntiquot.parenthesizer := do checkKind identKind; visitToken -@[combinator_parenthesizer rawIdentNoAntiquot] def rawIdentNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer identEq] def identEq.parenthesizer (_id : Name) := visitToken -@[combinator_parenthesizer nonReservedSymbolNoAntiquot] def nonReservedSymbolNoAntiquot.parenthesizer (_sym : String) (_includeIdent : Bool) := visitToken +@[combinator_parenthesizer identNoAntiquot, expose] def identNoAntiquot.parenthesizer := do checkKind identKind; visitToken +@[combinator_parenthesizer rawIdentNoAntiquot, expose] def rawIdentNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer identEq, expose] def identEq.parenthesizer (_id : Name) := visitToken +@[combinator_parenthesizer nonReservedSymbolNoAntiquot, expose] def nonReservedSymbolNoAntiquot.parenthesizer (_sym : String) (_includeIdent : Bool) := visitToken -@[combinator_parenthesizer charLitNoAntiquot] def charLitNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer strLitNoAntiquot] def strLitNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer nameLitNoAntiquot] def nameLitNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer numLitNoAntiquot] def numLitNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer scientificLitNoAntiquot] def scientificLitNoAntiquot.parenthesizer := visitToken -@[combinator_parenthesizer fieldIdx] def fieldIdx.parenthesizer := visitToken +@[combinator_parenthesizer charLitNoAntiquot, expose] def charLitNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer strLitNoAntiquot, expose] def strLitNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer nameLitNoAntiquot, expose] def nameLitNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer numLitNoAntiquot, expose] def numLitNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer scientificLitNoAntiquot, expose] def scientificLitNoAntiquot.parenthesizer := visitToken +@[combinator_parenthesizer fieldIdx, expose] def fieldIdx.parenthesizer := visitToken -@[combinator_parenthesizer manyNoAntiquot] +@[combinator_parenthesizer manyNoAntiquot, expose] def manyNoAntiquot.parenthesizer (p : Parenthesizer) : Parenthesizer := do let stx ← getCur visitArgs $ stx.getArgs.size.forM fun _ _ => p -@[combinator_parenthesizer many1NoAntiquot] +@[combinator_parenthesizer many1NoAntiquot, expose] def many1NoAntiquot.parenthesizer (p : Parenthesizer) : Parenthesizer := do manyNoAntiquot.parenthesizer p -@[combinator_parenthesizer many1Unbox] +@[combinator_parenthesizer many1Unbox, expose] def many1Unbox.parenthesizer (p : Parenthesizer) : Parenthesizer := do let stx ← getCur if stx.getKind == nullKind then @@ -497,44 +501,44 @@ def many1Unbox.parenthesizer (p : Parenthesizer) : Parenthesizer := do else p -@[combinator_parenthesizer optionalNoAntiquot] +@[combinator_parenthesizer optionalNoAntiquot, expose] def optionalNoAntiquot.parenthesizer (p : Parenthesizer) : Parenthesizer := do visitArgs p -@[combinator_parenthesizer sepByNoAntiquot] +@[combinator_parenthesizer sepByNoAntiquot, expose] def sepByNoAntiquot.parenthesizer (p pSep : Parenthesizer) : Parenthesizer := do let stx ← getCur visitArgs <| (List.range stx.getArgs.size).reverse.forM fun i => if i % 2 == 0 then p else pSep -@[combinator_parenthesizer sepBy1NoAntiquot] def sepBy1NoAntiquot.parenthesizer := sepByNoAntiquot.parenthesizer +@[combinator_parenthesizer sepBy1NoAntiquot, expose] def sepBy1NoAntiquot.parenthesizer := sepByNoAntiquot.parenthesizer -@[combinator_parenthesizer withPosition] def withPosition.parenthesizer (p : Parenthesizer) : Parenthesizer := do +@[combinator_parenthesizer withPosition, expose] def withPosition.parenthesizer (p : Parenthesizer) : Parenthesizer := do -- We assume the formatter will indent syntax sufficiently such that parenthesizing a `withPosition` node is never necessary modify fun st => { st with contPrec := none } p -@[combinator_parenthesizer withPositionAfterLinebreak] def withPositionAfterLinebreak.parenthesizer (p : Parenthesizer) : Parenthesizer := +@[combinator_parenthesizer withPositionAfterLinebreak, expose] def withPositionAfterLinebreak.parenthesizer (p : Parenthesizer) : Parenthesizer := -- TODO: improve? withPosition.parenthesizer p -@[combinator_parenthesizer withoutInfo] def withoutInfo.parenthesizer (p : Parenthesizer) : Parenthesizer := p +@[combinator_parenthesizer withoutInfo, expose] def withoutInfo.parenthesizer (p : Parenthesizer) : Parenthesizer := p -@[combinator_parenthesizer checkStackTop] def checkStackTop.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkWsBefore] def checkWsBefore.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkNoWsBefore] def checkNoWsBefore.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkLinebreakBefore] def checkLinebreakBefore.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkTailWs] def checkTailWs.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkColEq] def checkColEq.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkColGe] def checkColGe.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkColGt] def checkColGt.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkLineEq] def checkLineEq.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer eoi] def eoi.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer checkNoImmediateColon] def checkNoImmediateColon.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer skip] def skip.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkStackTop, expose] def checkStackTop.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkWsBefore, expose] def checkWsBefore.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkNoWsBefore, expose] def checkNoWsBefore.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkLinebreakBefore, expose] def checkLinebreakBefore.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkTailWs, expose] def checkTailWs.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkColEq, expose] def checkColEq.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkColGe, expose] def checkColGe.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkColGt, expose] def checkColGt.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkLineEq, expose] def checkLineEq.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer eoi, expose] def eoi.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer checkNoImmediateColon, expose] def checkNoImmediateColon.parenthesizer : Parenthesizer := pure () +@[combinator_parenthesizer skip, expose] def skip.parenthesizer : Parenthesizer := pure () -@[combinator_parenthesizer pushNone] def pushNone.parenthesizer : Parenthesizer := goLeft -@[combinator_parenthesizer hygieneInfoNoAntiquot] def hygieneInfoNoAntiquot.parenthesizer : Parenthesizer := goLeft +@[combinator_parenthesizer pushNone, expose] def pushNone.parenthesizer : Parenthesizer := goLeft +@[combinator_parenthesizer hygieneInfoNoAntiquot, expose] def hygieneInfoNoAntiquot.parenthesizer : Parenthesizer := goLeft -@[combinator_parenthesizer interpolatedStr] +@[combinator_parenthesizer interpolatedStr, expose] def interpolatedStr.parenthesizer (p : Parenthesizer) : Parenthesizer := do visitArgs $ (← getCur).getArgs.reverse.forM fun chunk => if chunk.isOfKind interpolatedStrLitKind then @@ -542,7 +546,7 @@ def interpolatedStr.parenthesizer (p : Parenthesizer) : Parenthesizer := do else p -@[combinator_parenthesizer _root_.ite, macro_inline] def ite {_ : Type} (c : Prop) [Decidable c] (t e : Parenthesizer) : Parenthesizer := +@[combinator_parenthesizer _root_.ite, expose, macro_inline] def ite {_ : Type} (c : Prop) [Decidable c] (t e : Parenthesizer) : Parenthesizer := if c then t else e open Parser diff --git a/src/Lean/PrivateName.lean b/src/Lean/PrivateName.lean index 7ddbada78a..dfbeb80e99 100644 --- a/src/Lean/PrivateName.lean +++ b/src/Lean/PrivateName.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Notation -import Init.Data.Option.Coe +public import Init.Notation +public import Init.Data.Option.Coe + +public section namespace Lean diff --git a/src/Lean/ProjFns.lean b/src/Lean/ProjFns.lean index 2cd82d5a15..af7c70b726 100644 --- a/src/Lean/ProjFns.lean +++ b/src/Lean/ProjFns.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.EnvExtension +public import Lean.EnvExtension + +public section namespace Lean diff --git a/src/Lean/ReducibilityAttrs.lean b/src/Lean/ReducibilityAttrs.lean index 0313bcb1fb..fd8ddca56b 100644 --- a/src/Lean/ReducibilityAttrs.lean +++ b/src/Lean/ReducibilityAttrs.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Attributes -import Lean.ScopedEnvExtension +public import Lean.Attributes +public import Lean.ScopedEnvExtension + +public section namespace Lean diff --git a/src/Lean/Replay.lean b/src/Lean/Replay.lean index 1bdd26868f..49935de126 100644 --- a/src/Lean/Replay.lean +++ b/src/Lean/Replay.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.CoreM -import Lean.AddDecl -import Lean.Util.FoldConsts +public import Lean.CoreM +public import Lean.AddDecl +public import Lean.Util.FoldConsts + +public section /-! # `Lean.Environment.replay` diff --git a/src/Lean/ReservedNameAction.lean b/src/Lean/ReservedNameAction.lean index fe005daed6..1e842935cb 100644 --- a/src/Lean/ReservedNameAction.lean +++ b/src/Lean/ReservedNameAction.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM +public import Lean.CoreM + +public section namespace Lean @@ -14,7 +18,7 @@ The action returns `true` if it "handled" the given name. Remark: usually when one install a reserved name predicate, an associated action is also installed. -/ -def ReservedNameAction := Name → CoreM Bool +@[expose] def ReservedNameAction := Name → CoreM Bool private builtin_initialize reservedNameActionsRef : IO.Ref (Array ReservedNameAction) ← IO.mkRef #[] diff --git a/src/Lean/ResolveName.lean b/src/Lean/ResolveName.lean index 749fb2c365..9951e2cbd6 100644 --- a/src/Lean/ResolveName.lean +++ b/src/Lean/ResolveName.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Sebastian Ullrich -/ +module + prelude -import Lean.Data.OpenDecl -import Lean.Hygiene -import Lean.Modifiers -import Lean.Exception -import Lean.Namespace +public import Lean.Data.OpenDecl +public import Lean.Hygiene +public import Lean.Modifiers +public import Lean.Exception +public import Lean.Namespace + +public section namespace Lean /-! diff --git a/src/Lean/Runtime.lean b/src/Lean/Runtime.lean index f789697858..c99b3dc80f 100644 --- a/src/Lean/Runtime.lean +++ b/src/Lean/Runtime.lean @@ -3,8 +3,12 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Prelude +public import Init.Prelude + +public section namespace Lean diff --git a/src/Lean/ScopedEnvExtension.lean b/src/Lean/ScopedEnvExtension.lean index aaf91a4a4f..33ac254288 100644 --- a/src/Lean/ScopedEnvExtension.lean +++ b/src/Lean/ScopedEnvExtension.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment -import Lean.Data.NameTrie -import Lean.Attributes +public import Lean.Environment +public import Lean.Data.NameTrie +public import Lean.Attributes + +public section namespace Lean diff --git a/src/Lean/Server.lean b/src/Lean/Server.lean index be725439f0..d1a26f90ab 100644 --- a/src/Lean/Server.lean +++ b/src/Lean/Server.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Lean.Server.Watchdog -import Lean.Server.FileWorker -import Lean.Server.Rpc -import Lean.Server.CodeActions -import Lean.Server.Test +public import Lean.Server.Watchdog +public import Lean.Server.FileWorker +public import Lean.Server.Rpc +public import Lean.Server.CodeActions +public import Lean.Server.Test + +public section diff --git a/src/Lean/Server/AsyncList.lean b/src/Lean/Server/AsyncList.lean index 9ba66ef2b5..3fade41b13 100644 --- a/src/Lean/Server/AsyncList.lean +++ b/src/Lean/Server/AsyncList.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Server.ServerTask -import Init.System.Promise +public import Lean.Server.ServerTask +public import Init.System.Promise + +public section namespace IO diff --git a/src/Lean/Server/CodeActions.lean b/src/Lean/Server/CodeActions.lean index 6642fb3372..c68d5753b9 100644 --- a/src/Lean/Server/CodeActions.lean +++ b/src/Lean/Server/CodeActions.lean @@ -4,7 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Server.CodeActions.Attr -import Lean.Server.CodeActions.Basic -import Lean.Server.CodeActions.Provider +public import Lean.Server.CodeActions.Attr +public import Lean.Server.CodeActions.Basic +public import Lean.Server.CodeActions.Provider + +public section diff --git a/src/Lean/Server/CodeActions/Attr.lean b/src/Lean/Server/CodeActions/Attr.lean index e59345b66f..2c21b8004e 100644 --- a/src/Lean/Server/CodeActions/Attr.lean +++ b/src/Lean/Server/CodeActions/Attr.lean @@ -3,8 +3,12 @@ Copyright (c) 2023 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Lean.Server.CodeActions.Basic +public import Lean.Server.CodeActions.Basic + +public section /-! # Initial setup for code action attributes diff --git a/src/Lean/Server/CodeActions/Basic.lean b/src/Lean/Server/CodeActions/Basic.lean index 82584ccd4b..245ae06965 100644 --- a/src/Lean/Server/CodeActions/Basic.lean +++ b/src/Lean/Server/CodeActions/Basic.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Server.FileWorker.RequestHandling -import Lean.Server.InfoUtils +public import Lean.Server.FileWorker.RequestHandling +public import Lean.Server.InfoUtils + +public section namespace Lean.Server @@ -65,7 +69,7 @@ When implementing your own `CodeActionProvider`, we assume that no long-running If you need to create a code-action with a long-running computation, you can use the `lazy?` field on `LazyCodeAction` to perform the computation after the user has clicked on the code action in their editor. -/ -def CodeActionProvider := CodeActionParams → Snapshot → RequestM (Array LazyCodeAction) +@[expose] def CodeActionProvider := CodeActionParams → Snapshot → RequestM (Array LazyCodeAction) deriving instance Inhabited for CodeActionProvider private builtin_initialize builtinCodeActionProviders : IO.Ref (NameMap CodeActionProvider) ← diff --git a/src/Lean/Server/CodeActions/Provider.lean b/src/Lean/Server/CodeActions/Provider.lean index c060e86110..021971c863 100644 --- a/src/Lean/Server/CodeActions/Provider.lean +++ b/src/Lean/Server/CodeActions/Provider.lean @@ -3,13 +3,17 @@ Copyright (c) 2023 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro -/ +module + prelude -import Std.Data.Iterators.Producers.Range -import Std.Data.Iterators.Combinators.StepSize -import Lean.Elab.BuiltinTerm -import Lean.Elab.BuiltinNotation -import Lean.Server.InfoUtils -import Lean.Server.CodeActions.Attr +public import Std.Data.Iterators.Producers.Range +public import Std.Data.Iterators.Combinators.StepSize +public import Lean.Elab.BuiltinTerm +public import Lean.Elab.BuiltinNotation +public import Lean.Server.InfoUtils +public import Lean.Server.CodeActions.Attr + +public section /-! # Initial setup for code actions diff --git a/src/Lean/Server/CodeActions/UnknownIdentifier.lean b/src/Lean/Server/CodeActions/UnknownIdentifier.lean index 80406aa02a..8befb8c2c4 100644 --- a/src/Lean/Server/CodeActions/UnknownIdentifier.lean +++ b/src/Lean/Server/CodeActions/UnknownIdentifier.lean @@ -3,13 +3,17 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Server.FileWorker.Utils -import Lean.Data.Lsp.Internal -import Lean.Server.Requests -import Lean.Server.Completion.CompletionInfoSelection -import Lean.Server.CodeActions.Basic -import Lean.Server.Completion.CompletionUtils +public import Lean.Server.FileWorker.Utils +public import Lean.Data.Lsp.Internal +public import Lean.Server.Requests +public import Lean.Server.Completion.CompletionInfoSelection +public import Lean.Server.CodeActions.Basic +public import Lean.Server.Completion.CompletionUtils + +public section namespace Lean.Server.FileWorker diff --git a/src/Lean/Server/Completion.lean b/src/Lean/Server/Completion.lean index 05f00f2e48..31059ef272 100644 --- a/src/Lean/Server/Completion.lean +++ b/src/Lean/Server/Completion.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Marc Huisinga -/ +module + prelude -import Lean.Server.Completion.CompletionCollectors -import Lean.Server.RequestCancellation -import Std.Data.HashMap +public import Lean.Server.Completion.CompletionCollectors +public import Lean.Server.RequestCancellation +public import Std.Data.HashMap + +public section namespace Lean.Server.Completion open Lsp diff --git a/src/Lean/Server/Completion/CompletionCollectors.lean b/src/Lean/Server/Completion/CompletionCollectors.lean index b4aad7599e..e50a54daa2 100644 --- a/src/Lean/Server/Completion/CompletionCollectors.lean +++ b/src/Lean/Server/Completion/CompletionCollectors.lean @@ -3,13 +3,17 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Marc Huisinga -/ +module + prelude -import Lean.Data.FuzzyMatching -import Lean.Elab.Tactic.Doc -import Lean.Server.Completion.CompletionResolution -import Lean.Server.Completion.EligibleHeaderDecls -import Lean.Server.RequestCancellation -import Lean.Server.Completion.CompletionUtils +public import Lean.Data.FuzzyMatching +public import Lean.Elab.Tactic.Doc +public import Lean.Server.Completion.CompletionResolution +public import Lean.Server.Completion.EligibleHeaderDecls +public import Lean.Server.RequestCancellation +public import Lean.Server.Completion.CompletionUtils + +public section namespace Lean.Server.Completion open Elab @@ -209,7 +213,7 @@ section IdCompletionUtils (Name.mkStr p (s.extract 0 ⟨newLen - optDot - len⟩), newLen) (go id).1 - def bestLabelForDecl? (ctx : ContextInfo) (declName : Name) (id : Name) (danglingDot : Bool) : + private def bestLabelForDecl? (ctx : ContextInfo) (declName : Name) (id : Name) (danglingDot : Bool) : M (Option Name) := Prod.snd <$> StateT.run (s := none) do let matchUsingNamespace (ns : Name) : StateT (Option Name) M Unit := do let some label ← matchDecl? ns id danglingDot declName @@ -239,7 +243,7 @@ section IdCompletionUtils matchUsingNamespace ns matchUsingNamespace Name.anonymous - def completeNamespaces (ctx : ContextInfo) (id : Name) (danglingDot : Bool) : M Unit := do + private def completeNamespaces (ctx : ContextInfo) (id : Name) (danglingDot : Bool) : M Unit := do let env ← getEnv env.getNamespaceSet |>.forM fun ns => do unless ns.isInternal || env.contains ns do -- Ignore internal and namespaces that are also declaration names diff --git a/src/Lean/Server/Completion/CompletionInfoSelection.lean b/src/Lean/Server/Completion/CompletionInfoSelection.lean index 9d6620e1bd..84e26ccd66 100644 --- a/src/Lean/Server/Completion/CompletionInfoSelection.lean +++ b/src/Lean/Server/Completion/CompletionInfoSelection.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Marc Huisinga -/ +module + prelude -import Lean.Server.Completion.SyntheticCompletion +public import Lean.Server.Completion.SyntheticCompletion + +public section namespace Lean.Server.Completion open Elab diff --git a/src/Lean/Server/Completion/CompletionItemData.lean b/src/Lean/Server/Completion/CompletionItemData.lean index 313c960051..ffddeed5e4 100644 --- a/src/Lean/Server/Completion/CompletionItemData.lean +++ b/src/Lean/Server/Completion/CompletionItemData.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Server.FileSource +public import Lean.Server.FileSource + +public section namespace Lean.Lsp diff --git a/src/Lean/Server/Completion/CompletionResolution.lean b/src/Lean/Server/Completion/CompletionResolution.lean index f3d7caa770..1c8e6ce322 100644 --- a/src/Lean/Server/Completion/CompletionResolution.lean +++ b/src/Lean/Server/Completion/CompletionResolution.lean @@ -3,10 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Marc Huisinga -/ +module + prelude -import Lean.Server.Completion.CompletionItemData -import Lean.Server.Completion.CompletionInfoSelection -import Lean.Linter.Deprecated +public import Lean.Server.Completion.CompletionItemData +public import Lean.Server.Completion.CompletionInfoSelection +public import Lean.Linter.Deprecated + +public section namespace Lean.Lsp diff --git a/src/Lean/Server/Completion/CompletionUtils.lean b/src/Lean/Server/Completion/CompletionUtils.lean index ad8f06173e..c8f1893eb8 100644 --- a/src/Lean/Server/Completion/CompletionUtils.lean +++ b/src/Lean/Server/Completion/CompletionUtils.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Marc Huisinga -/ +module + prelude -import Init.Prelude -import Lean.Meta.WHNF +public import Init.Prelude +public import Lean.Meta.WHNF + +public section partial def String.charactersIn (a b : String) : Bool := go ⟨0⟩ ⟨0⟩ diff --git a/src/Lean/Server/Completion/EligibleHeaderDecls.lean b/src/Lean/Server/Completion/EligibleHeaderDecls.lean index ef2ec82b4a..e07fd259a8 100644 --- a/src/Lean/Server/Completion/EligibleHeaderDecls.lean +++ b/src/Lean/Server/Completion/EligibleHeaderDecls.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Meta.CompletionName +public import Lean.Meta.CompletionName + +public section namespace Lean.Server.Completion open Meta diff --git a/src/Lean/Server/Completion/ImportCompletion.lean b/src/Lean/Server/Completion/ImportCompletion.lean index 0954840c01..57fde5c23e 100644 --- a/src/Lean/Server/Completion/ImportCompletion.lean +++ b/src/Lean/Server/Completion/ImportCompletion.lean @@ -3,11 +3,18 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Data.NameTrie -import Lean.Util.LakePath -import Lean.Server.Completion.CompletionItemData -import Lean.Parser.Module +public import Lean.Data.NameTrie +public import Lean.Util.LakePath +public import Lean.Server.Completion.CompletionItemData +public import Lean.Parser.Module +meta import Lean.Parser.Module + +public section + +public section namespace ImportCompletion diff --git a/src/Lean/Server/Completion/SyntheticCompletion.lean b/src/Lean/Server/Completion/SyntheticCompletion.lean index 0473271f7c..c0b9a2563e 100644 --- a/src/Lean/Server/Completion/SyntheticCompletion.lean +++ b/src/Lean/Server/Completion/SyntheticCompletion.lean @@ -3,9 +3,14 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Server.InfoUtils -import Lean.Server.Completion.CompletionUtils +public import Lean.Server.InfoUtils +public import Lean.Server.Completion.CompletionUtils +meta import Lean.Parser.Term + +public section namespace Lean.Server.Completion open Elab diff --git a/src/Lean/Server/FileSource.lean b/src/Lean/Server/FileSource.lean index 243ddc0bef..d0193ddfe3 100644 --- a/src/Lean/Server/FileSource.lean +++ b/src/Lean/Server/FileSource.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Data.Lsp +public import Lean.Data.Lsp + +public section namespace Lean.Lsp diff --git a/src/Lean/Server/FileWorker.lean b/src/Lean/Server/FileWorker.lean index 5f4a7df95a..0ad4395123 100644 --- a/src/Lean/Server/FileWorker.lean +++ b/src/Lean/Server/FileWorker.lean @@ -4,30 +4,34 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ +module + prelude -import Init.System.IO -import Std.Sync.Channel +public import Init.System.IO +public import Std.Sync.Channel -import Lean.Environment +public import Lean.Environment -import Lean.Data.Lsp -import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.Lsp +public import Lean.Data.Json.FromToJson.Basic -import Lean.LoadDynlib -import Lean.Language.Lean +public import Lean.LoadDynlib +public import Lean.Language.Lean -import Lean.Server.Utils -import Lean.Server.AsyncList -import Lean.Server.References +public import Lean.Server.Utils +public import Lean.Server.AsyncList +public import Lean.Server.References -import Lean.Server.FileWorker.Utils -import Lean.Server.FileWorker.RequestHandling -import Lean.Server.FileWorker.WidgetRequests -import Lean.Server.FileWorker.SetupFile -import Lean.Server.Rpc.Basic -import Lean.Widget.InteractiveDiagnostic -import Lean.Server.Completion.ImportCompletion -import Lean.Server.CodeActions.UnknownIdentifier +public import Lean.Server.FileWorker.Utils +public import Lean.Server.FileWorker.RequestHandling +public import Lean.Server.FileWorker.WidgetRequests +public import Lean.Server.FileWorker.SetupFile +public import Lean.Server.Rpc.Basic +public import Lean.Widget.InteractiveDiagnostic +public import Lean.Server.Completion.ImportCompletion +public import Lean.Server.CodeActions.UnknownIdentifier + +public section /-! For general server architecture, see `README.md`. For details of IPC communication, see `Watchdog.lean`. diff --git a/src/Lean/Server/FileWorker/ExampleHover.lean b/src/Lean/Server/FileWorker/ExampleHover.lean index 3e413ce881..e2c291d3f4 100644 --- a/src/Lean/Server/FileWorker/ExampleHover.lean +++ b/src/Lean/Server/FileWorker/ExampleHover.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Lean.Elab.Do +public import Lean.Elab.Do + +public section /-! This module contains helpers used for formatting hovers according to docstring conventions. Links to diff --git a/src/Lean/Server/FileWorker/InlayHints.lean b/src/Lean/Server/FileWorker/InlayHints.lean index 7d0a49076f..6dbd15e3b8 100644 --- a/src/Lean/Server/FileWorker/InlayHints.lean +++ b/src/Lean/Server/FileWorker/InlayHints.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Server.GoTo -import Lean.Server.Requests +public import Lean.Server.GoTo +public import Lean.Server.Requests + +public section namespace Lean.Elab diff --git a/src/Lean/Server/FileWorker/RequestHandling.lean b/src/Lean/Server/FileWorker/RequestHandling.lean index 451b4c9608..bfcb106c0f 100644 --- a/src/Lean/Server/FileWorker/RequestHandling.lean +++ b/src/Lean/Server/FileWorker/RequestHandling.lean @@ -4,15 +4,20 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Marc Huisinga -/ -prelude -import Lean.Server.FileWorker.ExampleHover -import Lean.Server.FileWorker.InlayHints -import Lean.Server.FileWorker.SemanticHighlighting -import Lean.Server.FileWorker.SignatureHelp -import Lean.Server.Completion -import Lean.Server.References +module -import Lean.Widget.Diff +prelude +public import Lean.Server.FileWorker.ExampleHover +public import Lean.Server.FileWorker.InlayHints +public import Lean.Server.FileWorker.SemanticHighlighting +public import Lean.Server.FileWorker.SignatureHelp +public import Lean.Server.Completion +public import Lean.Server.References +meta import Lean.Parser.Module + +public import Lean.Widget.Diff + +public section namespace Lean.Server.FileWorker open Lsp diff --git a/src/Lean/Server/FileWorker/SemanticHighlighting.lean b/src/Lean/Server/FileWorker/SemanticHighlighting.lean index 664e8bb30b..0ccd2729b6 100644 --- a/src/Lean/Server/FileWorker/SemanticHighlighting.lean +++ b/src/Lean/Server/FileWorker/SemanticHighlighting.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Marc Huisinga -/ +module + prelude -import Lean.Server.Requests +public import Lean.Server.Requests + +public section namespace Lean.Server.FileWorker open Lsp diff --git a/src/Lean/Server/FileWorker/SetupFile.lean b/src/Lean/Server/FileWorker/SetupFile.lean index 606c02d5fd..5d07a8a656 100644 --- a/src/Lean/Server/FileWorker/SetupFile.lean +++ b/src/Lean/Server/FileWorker/SetupFile.lean @@ -3,12 +3,16 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Marc Huisinga -/ +module + prelude -import Init.System.IO -import Lean.Server.Utils -import Lean.Util.LakePath -import Lean.LoadDynlib -import Lean.Server.ServerTask +public import Init.System.IO +public import Lean.Server.Utils +public import Lean.Util.LakePath +public import Lean.LoadDynlib +public import Lean.Server.ServerTask + +public section namespace Lean.Server.FileWorker diff --git a/src/Lean/Server/FileWorker/SignatureHelp.lean b/src/Lean/Server/FileWorker/SignatureHelp.lean index f415277ec2..cadaa49aac 100644 --- a/src/Lean/Server/FileWorker/SignatureHelp.lean +++ b/src/Lean/Server/FileWorker/SignatureHelp.lean @@ -3,10 +3,15 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Server.InfoUtils -import Lean.Data.Lsp -import Init.Data.List.Sort.Basic +public import Lean.Server.InfoUtils +public import Lean.Data.Lsp +public import Init.Data.List.Sort.Basic +meta import Lean.Parser.Term + +public section namespace Lean.Server.FileWorker.SignatureHelp diff --git a/src/Lean/Server/FileWorker/Utils.lean b/src/Lean/Server/FileWorker/Utils.lean index cd27bf3e4a..e80dada466 100644 --- a/src/Lean/Server/FileWorker/Utils.lean +++ b/src/Lean/Server/FileWorker/Utils.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Marc Huisinga -/ +module + prelude -import Lean.Language.Lean.Types -import Lean.Server.Utils -import Lean.Server.Snapshots -import Lean.Server.AsyncList -import Lean.Server.Rpc.Basic +public import Lean.Language.Lean.Types +public import Lean.Server.Utils +public import Lean.Server.Snapshots +public import Lean.Server.AsyncList +public import Lean.Server.Rpc.Basic + +public section namespace Lean.Server.FileWorker open Snapshots @@ -47,7 +51,7 @@ structure EditableDocumentCore where /-- Initial processing snapshot. -/ initSnap : Language.Lean.InitialSnapshot /-- Old representation for backward compatibility. -/ - cmdSnaps : AsyncList IO.Error Snapshot := mkCmdSnaps initSnap + cmdSnaps : AsyncList IO.Error Snapshot := private_decl% mkCmdSnaps initSnap /-- Interactive versions of diagnostics reported so far. Filled by `reportSnapshots` and read by `handleGetInteractiveDiagnosticsRequest`. diff --git a/src/Lean/Server/FileWorker/WidgetRequests.lean b/src/Lean/Server/FileWorker/WidgetRequests.lean index 1e913a519e..2282d8dfc6 100644 --- a/src/Lean/Server/FileWorker/WidgetRequests.lean +++ b/src/Lean/Server/FileWorker/WidgetRequests.lean @@ -4,14 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ -prelude -import Lean.Widget.Basic -import Lean.Widget.InteractiveCode -import Lean.Widget.InteractiveGoal -import Lean.Widget.InteractiveDiagnostic +module -import Lean.Server.Rpc.RequestHandling -import Lean.Server.FileWorker.RequestHandling +prelude +public import Lean.Widget.Basic +public import Lean.Widget.InteractiveCode +public import Lean.Widget.InteractiveGoal +public import Lean.Widget.InteractiveDiagnostic + +public import Lean.Server.Rpc.RequestHandling +public import Lean.Server.FileWorker.RequestHandling + +public section /-! Registers all widget-related RPC procedures. -/ diff --git a/src/Lean/Server/GoTo.lean b/src/Lean/Server/GoTo.lean index 521edcae3d..9bfbbfe7b3 100644 --- a/src/Lean/Server/GoTo.lean +++ b/src/Lean/Server/GoTo.lean @@ -4,13 +4,18 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Lars König, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Lean.Util.Path -import Lean.Server.Utils -import Lean.Data.Lsp.Internal -import Lean.Util.CollectFVars -import Lean.Util.ForEachExpr +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Util.Path +public import Lean.Server.Utils +public import Lean.Data.Lsp.Internal +public import Lean.Util.CollectFVars +public import Lean.Util.ForEachExpr +meta import Lean.Parser.Module + +public section namespace Lean.Server diff --git a/src/Lean/Server/InfoUtils.lean b/src/Lean/Server/InfoUtils.lean index 752756552a..3aab2c98cd 100644 --- a/src/Lean/Server/InfoUtils.lean +++ b/src/Lean/Server/InfoUtils.lean @@ -4,10 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.DocString -import Lean.PrettyPrinter -import Lean.Parser.Tactic.Doc +public import Lean.DocString +public import Lean.PrettyPrinter +public import Lean.Parser.Tactic.Doc +meta import Lean.Parser.Term + +public section namespace Lean.Elab diff --git a/src/Lean/Server/References.lean b/src/Lean/Server/References.lean index 7e48db8375..bfe663da30 100644 --- a/src/Lean/Server/References.lean +++ b/src/Lean/Server/References.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Joscha Mennicken -/ +module + prelude -import Lean.Data.Lsp.Internal -import Lean.Data.Lsp.Extra -import Lean.Server.Utils -import Lean.Elab.Import -import Std.Data.TreeSet.Basic +public import Lean.Data.Lsp.Internal +public import Lean.Data.Lsp.Extra +public import Lean.Server.Utils +public import Lean.Elab.Import +public import Std.Data.TreeSet.Basic + +public section /-! # Representing collected and deduplicated definitions and usages -/ diff --git a/src/Lean/Server/RequestCancellation.lean b/src/Lean/Server/RequestCancellation.lean index f879624bc9..2d9c5370b6 100644 --- a/src/Lean/Server/RequestCancellation.lean +++ b/src/Lean/Server/RequestCancellation.lean @@ -3,9 +3,13 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Init.System.Promise -import Lean.Server.ServerTask +public import Init.System.Promise +public import Lean.Server.ServerTask + +public section namespace Lean.Server diff --git a/src/Lean/Server/Requests.lean b/src/Lean/Server/Requests.lean index 13cc8ea228..5a59590322 100644 --- a/src/Lean/Server/Requests.lean +++ b/src/Lean/Server/Requests.lean @@ -4,22 +4,26 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Marc Huisinga -/ +module + prelude -import Lean.DeclarationRange +public import Lean.DeclarationRange -import Lean.Data.Json.Basic -import Lean.Data.Lsp -import Lean.Elab.Command +public import Lean.Data.Json.Basic +public import Lean.Data.Lsp +public import Lean.Elab.Command -import Lean.Server.RequestCancellation -import Lean.Server.ServerTask +public import Lean.Server.RequestCancellation +public import Lean.Server.ServerTask -import Lean.Server.FileSource -import Lean.Server.FileWorker.Utils +public import Lean.Server.FileSource +public import Lean.Server.FileWorker.Utils -import Lean.Server.Rpc.Basic +public import Lean.Server.Rpc.Basic -import Std.Sync.Mutex +public import Std.Sync.Mutex + +public section /-- Checks whether `r` contains `hoverPos`, taking into account EOF according to `text`. -/ def Lean.FileMap.rangeContainsHoverPos (text : Lean.FileMap) (r : String.Range) diff --git a/src/Lean/Server/Rpc.lean b/src/Lean/Server/Rpc.lean index 1cad524cb4..44782b41f7 100644 --- a/src/Lean/Server/Rpc.lean +++ b/src/Lean/Server/Rpc.lean @@ -4,7 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Server.Rpc.Basic -import Lean.Server.Rpc.Deriving -import Lean.Server.Rpc.RequestHandling +public import Lean.Server.Rpc.Basic +public import Lean.Server.Rpc.Deriving +public import Lean.Server.Rpc.RequestHandling + +public section diff --git a/src/Lean/Server/Rpc/Basic.lean b/src/Lean/Server/Rpc/Basic.lean index 6fcfc94eb8..a1395f8a3d 100644 --- a/src/Lean/Server/Rpc/Basic.lean +++ b/src/Lean/Server/Rpc/Basic.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Init.Dynamic -import Lean.Data.Json.FromToJson.Basic +public import Init.Dynamic +public import Lean.Data.Json.FromToJson.Basic + +public section /-! Allows LSP clients to make Remote Procedure Calls to the server. diff --git a/src/Lean/Server/Rpc/Deriving.lean b/src/Lean/Server/Rpc/Deriving.lean index 122eb0443c..17cf38550e 100644 --- a/src/Lean/Server/Rpc/Deriving.lean +++ b/src/Lean/Server/Rpc/Deriving.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ -prelude -import Lean.Elab.Command -import Lean.Elab.Term -import Lean.Elab.Deriving.Basic +module -import Lean.Server.Rpc.Basic +prelude +public import Lean.Elab.Command +public import Lean.Elab.Term +public import Lean.Elab.Deriving.Basic + +public import Lean.Server.Rpc.Basic + +public section namespace Lean.Server.RpcEncodable @@ -57,7 +61,7 @@ private def deriveStructureInstance (indVal : InductiveVal) (params : Array Expr ) private def matchAltTerm := Lean.Parser.Term.matchAlt (rhsParser := Lean.Parser.termParser) -instance : Coe (TSyntax ``matchAltTerm) (TSyntax ``Parser.Term.matchAlt) where coe s := ⟨s⟩ +private instance : Coe (TSyntax ``matchAltTerm) (TSyntax ``Parser.Term.matchAlt) where coe s := ⟨s⟩ private def deriveInductiveInstance (indVal : InductiveVal) (params : Array Expr) (encInstBinders : Array (TSyntax ``bracketedBinder)) : TermElabM Command := do diff --git a/src/Lean/Server/Rpc/RequestHandling.lean b/src/Lean/Server/Rpc/RequestHandling.lean index dc5dbcd269..47c9d22923 100644 --- a/src/Lean/Server/Rpc/RequestHandling.lean +++ b/src/Lean/Server/Rpc/RequestHandling.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ -prelude -import Lean.Data.Lsp.Extra -import Lean.Server.Requests +module -import Lean.Server.Rpc.Basic +prelude +public import Lean.Data.Lsp.Extra +public import Lean.Server.Requests + +public import Lean.Server.Rpc.Basic + +public section namespace Lean.Server diff --git a/src/Lean/Server/ServerTask.lean b/src/Lean/Server/ServerTask.lean index cfe1aada21..7f66e7b03e 100644 --- a/src/Lean/Server/ServerTask.lean +++ b/src/Lean/Server/ServerTask.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section /-! This file provides a thin `ServerTask` wrapper over the `Task` API. diff --git a/src/Lean/Server/Snapshots.lean b/src/Lean/Server/Snapshots.lean index 88347df7fc..6330b9066e 100644 --- a/src/Lean/Server/Snapshots.lean +++ b/src/Lean/Server/Snapshots.lean @@ -4,13 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Init.System.IO +public import Init.System.IO -import Lean.Elab.Import -import Lean.Elab.Command +public import Lean.Elab.Import +public import Lean.Elab.Command -import Lean.Widget.InteractiveDiagnostic +public import Lean.Widget.InteractiveDiagnostic + +public section /-! One can think of this module as being a partial reimplementation of Lean.Elab.Frontend which also stores a snapshot of the world after diff --git a/src/Lean/Server/Test.lean b/src/Lean/Server/Test.lean index 18751b7b1c..60c15605a1 100644 --- a/src/Lean/Server/Test.lean +++ b/src/Lean/Server/Test.lean @@ -4,6 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Server.Test.Cancel -import Lean.Server.Test.Runner +public import Lean.Server.Test.Cancel +public import Lean.Server.Test.Runner + +public section diff --git a/src/Lean/Server/Test/Cancel.lean b/src/Lean/Server/Test/Cancel.lean index 164c0ff35c..9607de0fe8 100644 --- a/src/Lean/Server/Test/Cancel.lean +++ b/src/Lean/Server/Test/Cancel.lean @@ -4,8 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Elab.Tactic.Basic +public import Lean.Elab.Tactic.Basic +meta import Lean.Elab.Tactic.Basic + +public section /-! Helpers for testing cancellation in interactive tests. Put here because of `initialize` restrictions diff --git a/src/Lean/Server/Test/Runner.lean b/src/Lean/Server/Test/Runner.lean index 018847581e..9e1d486143 100644 --- a/src/Lean/Server/Test/Runner.lean +++ b/src/Lean/Server/Test/Runner.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Lsp -import Lean.Widget +public import Lean.Data.Lsp +public import Lean.Widget + +public section open Lean open Lean.Lsp open Lean.JsonRpc diff --git a/src/Lean/Server/Utils.lean b/src/Lean/Server/Utils.lean index c18a09c6bc..b344b0d4fe 100644 --- a/src/Lean/Server/Utils.lean +++ b/src/Lean/Server/Utils.lean @@ -4,13 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki, Marc Huisinga -/ +module + prelude -import Init.System.Uri -import Lean.Data.Lsp.Communication -import Lean.Data.Lsp.Diagnostics -import Lean.Data.Lsp.Extra -import Lean.Data.Lsp.TextSync -import Lean.Server.InfoUtils +public import Init.System.Uri +public import Lean.Data.Lsp.Communication +public import Lean.Data.Lsp.Diagnostics +public import Lean.Data.Lsp.Extra +public import Lean.Data.Lsp.TextSync +public import Lean.Server.InfoUtils + +public section namespace IO diff --git a/src/Lean/Server/Watchdog.lean b/src/Lean/Server/Watchdog.lean index eb3ea8a9cb..f7e4accbdc 100644 --- a/src/Lean/Server/Watchdog.lean +++ b/src/Lean/Server/Watchdog.lean @@ -4,19 +4,23 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga, Wojciech Nawrocki -/ -prelude -import Init.System.IO -import Std.Sync.Mutex -import Init.Data.ByteArray +module -import Lean.Data.FuzzyMatching -import Lean.Data.Lsp -import Lean.Server.Utils -import Lean.Server.Requests -import Lean.Server.References -import Lean.Server.ServerTask -import Lean.Server.Completion.CompletionUtils -import Init.Data.List.Sort +prelude +public import Init.System.IO +public import Std.Sync.Mutex +public import Init.Data.ByteArray + +public import Lean.Data.FuzzyMatching +public import Lean.Data.Lsp +public import Lean.Server.Utils +public import Lean.Server.Requests +public import Lean.Server.References +public import Lean.Server.ServerTask +public import Lean.Server.Completion.CompletionUtils +public import Init.Data.List.Sort + +public section /-! For general server architecture, see `README.md`. This module implements the watchdog process. @@ -26,7 +30,7 @@ For general server architecture, see `README.md`. This module implements the wat Most LSP clients only send us file diffs, so to facilitate sending entire file contents to freshly restarted workers, the watchdog needs to maintain the current state of each file. It can also use this state to detect changes to the header and thus restart the corresponding worker, freeing its -imports. +public imports. TODO(WN): We may eventually want to keep track of approximately (since this isn't knowable exactly) where in diff --git a/src/Lean/Setup.lean b/src/Lean/Setup.lean index 5c5dab94f9..13f421a3f2 100644 --- a/src/Lean/Setup.lean +++ b/src/Lean/Setup.lean @@ -3,10 +3,14 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Mac Malone -/ +module + prelude -import Lean.Data.Json.Parser -import Lean.Data.Json.FromToJson.Basic -import Lean.Util.LeanOptions +public import Lean.Data.Json.Parser +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Util.LeanOptions + +public section /-! # Module Setup Information diff --git a/src/Lean/Shell.lean b/src/Lean/Shell.lean index 167fa4c478..7e5e699a0d 100644 --- a/src/Lean/Shell.lean +++ b/src/Lean/Shell.lean @@ -3,10 +3,14 @@ Copyright (c) 2025 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Mac Malone -/ +module + prelude -import Lean.Elab.Frontend -import Lean.Elab.ParseImportsFast -import Lean.Compiler.IR.EmitC +public import Lean.Elab.Frontend +public import Lean.Elab.ParseImportsFast +public import Lean.Compiler.IR.EmitC + +public section /- Lean companion to `shell.cpp` -/ diff --git a/src/Lean/Structure.lean b/src/Lean/Structure.lean index 10b0af3dcd..01bef37500 100644 --- a/src/Lean/Structure.lean +++ b/src/Lean/Structure.lean @@ -5,11 +5,15 @@ Authors: Leonardo de Moura Helper functions for retrieving structure information. -/ +module + prelude -import Init.Control.Option -import Lean.Environment -import Lean.ProjFns -import Lean.Exception +public import Init.Control.Option +public import Lean.Environment +public import Lean.ProjFns +public import Lean.Exception + +public section namespace Lean diff --git a/src/Lean/SubExpr.lean b/src/Lean/SubExpr.lean index 40c5edd047..826a4e6c89 100644 --- a/src/Lean/SubExpr.lean +++ b/src/Lean/SubExpr.lean @@ -3,10 +3,14 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Daniel Selsam, Wojciech Nawrocki, E.W.Ayers -/ +module + prelude -import Lean.Meta.Basic -import Lean.Data.Json.Basic -import Init.Control.Option +public import Lean.Meta.Basic +public import Lean.Data.Json.Basic +public import Init.Control.Option + +public section namespace Lean @@ -19,7 +23,7 @@ by computing the value of the 4-ary representation `1 :: childIdxs`, since n-ary without leading zeros are unique. Note that `pos` is initialized to `1` (case `childIdxs == []`). See also `SubExpr`. -/ -def SubExpr.Pos := Nat +@[expose] def SubExpr.Pos := Nat namespace SubExpr.Pos diff --git a/src/Lean/Syntax.lean b/src/Lean/Syntax.lean index 0f2ad08ff0..3151b33dd4 100644 --- a/src/Lean/Syntax.lean +++ b/src/Lean/Syntax.lean @@ -3,12 +3,16 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Sebastian Ullrich, Leonardo de Moura -/ +module + prelude -import Init.Data.Range -import Init.Data.Hashable -import Lean.Data.Name -import Lean.Data.Format -import Init.Data.Option.Coe +public import Init.Data.Slice +public import Init.Data.Hashable +public import Lean.Data.Name +public import Lean.Data.Format +public import Init.Data.Option.Coe + +public section /-- A position range inside a string. This type is mostly in combination with syntax trees, @@ -75,7 +79,7 @@ deriving instance BEq for SourceInfo inductive IsNode : Syntax → Prop where | mk (info : SourceInfo) (kind : SyntaxNodeKind) (args : Array Syntax) : IsNode (Syntax.node info kind args) -def SyntaxNode : Type := {s : Syntax // IsNode s } +@[expose] def SyntaxNode : Type := {s : Syntax // IsNode s } def unreachIsNodeMissing {β} : IsNode Syntax.missing → β := nofun def unreachIsNodeAtom {β} {info val} : IsNode (Syntax.atom info val) → β := nofun diff --git a/src/Lean/ToExpr.lean b/src/Lean/ToExpr.lean index b864f69d99..04853b17ed 100644 --- a/src/Lean/ToExpr.lean +++ b/src/Lean/ToExpr.lean @@ -3,11 +3,15 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.ToLevel -import Init.Data.BitVec.Basic -import Init.Data.SInt.Basic +public import Lean.Expr +public import Lean.ToLevel +public import Init.Data.BitVec.Basic +public import Init.Data.SInt.Basic + +public section universe u namespace Lean @@ -207,7 +211,7 @@ where | .num p n ..=> mkApp2 (mkConst ``Lean.Name.num) (go p) (toExpr n) instance : ToExpr Name where - toExpr := Name.toExprAux + toExpr := private Name.toExprAux toTypeExpr := mkConst ``Name instance {α : Type u} [ToLevel.{u}] [ToExpr α] : ToExpr (Option α) := @@ -225,7 +229,7 @@ instance {α : Type u} [ToLevel.{u}] [ToExpr α] : ToExpr (List α) := let type := toTypeExpr α let nil := mkApp (mkConst ``List.nil [toLevel.{u}]) type let cons := mkApp (mkConst ``List.cons [toLevel.{u}]) type - { toExpr := List.toExprAux nil cons, + { toExpr := private List.toExprAux nil cons, toTypeExpr := mkApp (mkConst ``List [toLevel.{u}]) type } instance {α : Type u} [ToLevel.{u}] [ToExpr α] : ToExpr (Array α) := diff --git a/src/Lean/ToLevel.lean b/src/Lean/ToLevel.lean index bc97cadd4d..d3844f4529 100644 --- a/src/Lean/ToLevel.lean +++ b/src/Lean/ToLevel.lean @@ -3,8 +3,12 @@ Copyright (c) 2023 Kyle Miller. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller, Alex Keizer -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section /-! # `ToLevel` class diff --git a/src/Lean/Util.lean b/src/Lean/Util.lean index 81e0d41292..6fe6edcd52 100644 --- a/src/Lean/Util.lean +++ b/src/Lean/Util.lean @@ -3,36 +3,40 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectFVars -import Lean.Util.CollectLevelParams -import Lean.Util.CollectMVars -import Lean.Util.CollectLevelMVars -import Lean.Util.CollectLooseBVars -import Lean.Util.FindMVar -import Lean.Util.FindLevelMVar -import Lean.Util.MonadCache -import Lean.Util.PPExt -import Lean.Util.Path -import Lean.Util.Profile -import Lean.Util.RecDepth -import Lean.Util.ShareCommon -import Lean.Util.Sorry -import Lean.Util.Trace -import Lean.Util.FindExpr -import Lean.Util.ReplaceExpr -import Lean.Util.ForEachExpr -import Lean.Util.ForEachExprWhere -import Lean.Util.ReplaceLevel -import Lean.Util.FoldConsts -import Lean.Util.SCC -import Lean.Util.TestExtern -import Lean.Util.OccursCheck -import Lean.Util.HasConstCache -import Lean.Util.Heartbeats -import Lean.Util.SearchPath -import Lean.Util.SafeExponentiation -import Lean.Util.NumObjs -import Lean.Util.NumApps -import Lean.Util.FVarSubset -import Lean.Util.SortExprs +public import Lean.Util.CollectFVars +public import Lean.Util.CollectLevelParams +public import Lean.Util.CollectMVars +public import Lean.Util.CollectLevelMVars +public import Lean.Util.CollectLooseBVars +public import Lean.Util.FindMVar +public import Lean.Util.FindLevelMVar +public import Lean.Util.MonadCache +public import Lean.Util.PPExt +public import Lean.Util.Path +public import Lean.Util.Profile +public import Lean.Util.RecDepth +public import Lean.Util.ShareCommon +public import Lean.Util.Sorry +public import Lean.Util.Trace +public import Lean.Util.FindExpr +public import Lean.Util.ReplaceExpr +public import Lean.Util.ForEachExpr +public import Lean.Util.ForEachExprWhere +public import Lean.Util.ReplaceLevel +public import Lean.Util.FoldConsts +public import Lean.Util.SCC +public import Lean.Util.TestExtern +public import Lean.Util.OccursCheck +public import Lean.Util.HasConstCache +public import Lean.Util.Heartbeats +public import Lean.Util.SearchPath +public import Lean.Util.SafeExponentiation +public import Lean.Util.NumObjs +public import Lean.Util.NumApps +public import Lean.Util.FVarSubset +public import Lean.Util.SortExprs + +public section diff --git a/src/Lean/Util/CollectAxioms.lean b/src/Lean/Util/CollectAxioms.lean index 163d5bdaa0..472b42cba6 100644 --- a/src/Lean/Util/CollectAxioms.lean +++ b/src/Lean/Util/CollectAxioms.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.MonadEnv -import Lean.Util.FoldConsts +public import Lean.MonadEnv +public import Lean.Util.FoldConsts + +public section namespace Lean diff --git a/src/Lean/Util/CollectFVars.lean b/src/Lean/Util/CollectFVars.lean index 7ce8c56aef..129dae8903 100644 --- a/src/Lean/Util/CollectFVars.lean +++ b/src/Lean/Util/CollectFVars.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.LocalContext +public import Lean.Expr +public import Lean.LocalContext + +public section namespace Lean.CollectFVars diff --git a/src/Lean/Util/CollectLevelMVars.lean b/src/Lean/Util/CollectLevelMVars.lean index 140e70b46e..13f983e8bd 100644 --- a/src/Lean/Util/CollectLevelMVars.lean +++ b/src/Lean/Util/CollectLevelMVars.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/CollectLevelParams.lean b/src/Lean/Util/CollectLevelParams.lean index 898e476ac1..676bba05ae 100644 --- a/src/Lean/Util/CollectLevelParams.lean +++ b/src/Lean/Util/CollectLevelParams.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/CollectLooseBVars.lean b/src/Lean/Util/CollectLooseBVars.lean index a85d94fb4a..4f4424732e 100644 --- a/src/Lean/Util/CollectLooseBVars.lean +++ b/src/Lean/Util/CollectLooseBVars.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kyle Miller -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section /-! # Collecting set of loose bound variables diff --git a/src/Lean/Util/CollectMVars.lean b/src/Lean/Util/CollectMVars.lean index a5ddc025e4..93debd3bb0 100644 --- a/src/Lean/Util/CollectMVars.lean +++ b/src/Lean/Util/CollectMVars.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/Diff.lean b/src/Lean/Util/Diff.lean index 861d051b0a..ffb69822b8 100644 --- a/src/Lean/Util/Diff.lean +++ b/src/Lean/Util/Diff.lean @@ -3,12 +3,17 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: David Thrane Christiansen -/ +module + prelude -import Init.Data.Array.Subarray.Split -import Init.Data.Slice.Array.Iterator -import Init.Data.Range -import Std.Data.HashMap.Basic -import Init.Omega +public import Init.Data.Array.Subarray.Split +public import Init.Data.Slice.Array.Iterator +public import Init.Data.Range +public import Std.Data.HashMap.Basic +public import Init.Omega +import Init.Data.Iterators.Combinators.ULift -- TODO: necessary because of codegen issue + +public section namespace Lean.Diff /-- @@ -58,7 +63,7 @@ structure Histogram.Entry (α : Type u) (lsize rsize : Nat) where rightWF : rightCount = 0 ↔ rightIndex = none /-- A histogram for arrays maps each element to a count and, if applicable, an index.-/ -def Histogram (α : Type u) (lsize rsize : Nat) [BEq α] [Hashable α] := +@[expose] def Histogram (α : Type u) (lsize rsize : Nat) [BEq α] [Hashable α] := Std.HashMap α (Histogram.Entry α lsize rsize) @@ -107,7 +112,6 @@ def matchPrefix (left right : Subarray α) : Array α × Subarray α × Subarray termination_by left.size - pref.size go #[] - /-- Given two `Subarray`s, find their common suffix and return their differing prefixes -/ def matchSuffix (left right : Subarray α) : Subarray α × Subarray α × Array α := let rec go (i : Nat) : Subarray α × Subarray α × Array α := diff --git a/src/Lean/Util/FVarSubset.lean b/src/Lean/Util/FVarSubset.lean index b4103dd6a8..74488dc17f 100644 --- a/src/Lean/Util/FVarSubset.lean +++ b/src/Lean/Util/FVarSubset.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.CollectFVars -import Lean.Util.FindExpr +public import Lean.Util.CollectFVars +public import Lean.Util.FindExpr + +public section namespace Lean.Expr diff --git a/src/Lean/Util/FindExpr.lean b/src/Lean/Util/FindExpr.lean index cb8a72e972..161c0e2ff7 100644 --- a/src/Lean/Util/FindExpr.lean +++ b/src/Lean/Util/FindExpr.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean namespace Expr diff --git a/src/Lean/Util/FindLevelMVar.lean b/src/Lean/Util/FindLevelMVar.lean index be156308e2..1bfd563690 100644 --- a/src/Lean/Util/FindLevelMVar.lean +++ b/src/Lean/Util/FindLevelMVar.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Daniel Selsam -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/FindMVar.lean b/src/Lean/Util/FindMVar.lean index e53c620238..11df3087a2 100644 --- a/src/Lean/Util/FindMVar.lean +++ b/src/Lean/Util/FindMVar.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/FoldConsts.lean b/src/Lean/Util/FoldConsts.lean index 107e5f79a6..a023fc9990 100644 --- a/src/Lean/Util/FoldConsts.lean +++ b/src/Lean/Util/FoldConsts.lean @@ -3,10 +3,14 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.PtrSet -import Lean.Declaration +public import Lean.Expr +public import Lean.Util.PtrSet +public import Lean.Declaration + +public section namespace Lean namespace Expr diff --git a/src/Lean/Util/ForEachExpr.lean b/src/Lean/Util/ForEachExpr.lean index 5e9ab0e24c..e8c7280184 100644 --- a/src/Lean/Util/ForEachExpr.lean +++ b/src/Lean/Util/ForEachExpr.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.MonadCache +public import Lean.Expr +public import Lean.Util.MonadCache + +public section namespace Lean /-! diff --git a/src/Lean/Util/ForEachExprWhere.lean b/src/Lean/Util/ForEachExprWhere.lean index 88a5e18e1e..3694625b3b 100644 --- a/src/Lean/Util/ForEachExprWhere.lean +++ b/src/Lean/Util/ForEachExprWhere.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.MonadCache +public import Lean.Expr +public import Lean.Util.MonadCache + +public section namespace Lean /-! diff --git a/src/Lean/Util/HasConstCache.lean b/src/Lean/Util/HasConstCache.lean index 4e81d7ffcb..787d3c7929 100644 --- a/src/Lean/Util/HasConstCache.lean +++ b/src/Lean/Util/HasConstCache.lean @@ -3,9 +3,13 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Std.Data.HashMap.Raw +public import Lean.Expr +public import Std.Data.HashMap.Raw + +public section namespace Lean diff --git a/src/Lean/Util/Heartbeats.lean b/src/Lean/Util/Heartbeats.lean index a6b0a48a6c..41bec21906 100644 --- a/src/Lean/Util/Heartbeats.lean +++ b/src/Lean/Util/Heartbeats.lean @@ -3,8 +3,12 @@ Copyright (c) 2023 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Kim Morrison -/ +module + prelude -import Lean.CoreM +public import Lean.CoreM + +public section /-! # Heartbeats diff --git a/src/Lean/Util/InstantiateLevelParams.lean b/src/Lean/Util/InstantiateLevelParams.lean index 7dc5a71ba7..642468daf3 100644 --- a/src/Lean/Util/InstantiateLevelParams.lean +++ b/src/Lean/Util/InstantiateLevelParams.lean @@ -3,8 +3,12 @@ Copyright (c) 2022 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.ReplaceExpr +public import Lean.Util.ReplaceExpr + +public section namespace Lean.Expr diff --git a/src/Lean/Util/LakePath.lean b/src/Lean/Util/LakePath.lean index 322d4216f6..e361d1a9c2 100644 --- a/src/Lean/Util/LakePath.lean +++ b/src/Lean/Util/LakePath.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section def Lean.determineLakePath : IO System.FilePath := do if let some lakePath ← IO.getEnv "LAKE" then diff --git a/src/Lean/Util/LeanOptions.lean b/src/Lean/Util/LeanOptions.lean index 750ac3c7a5..6b9682a91c 100644 --- a/src/Lean/Util/LeanOptions.lean +++ b/src/Lean/Util/LeanOptions.lean @@ -3,9 +3,13 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Marc Huisinga -/ +module + prelude -import Lean.Data.KVMap -import Lean.Data.Json.FromToJson.Basic +public import Lean.Data.KVMap +public import Lean.Data.Json.FromToJson.Basic + +public section namespace Lean diff --git a/src/Lean/Util/MonadBacktrack.lean b/src/Lean/Util/MonadBacktrack.lean index 6c33f838f0..a853f38144 100644 --- a/src/Lean/Util/MonadBacktrack.lean +++ b/src/Lean/Util/MonadBacktrack.lean @@ -3,9 +3,13 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Control.Except -import Init.Data.Option.Coe +public import Init.Control.Except +public import Init.Data.Option.Coe + +public section namespace Lean diff --git a/src/Lean/Util/MonadCache.lean b/src/Lean/Util/MonadCache.lean index d543310778..999dc0031b 100644 --- a/src/Lean/Util/MonadCache.lean +++ b/src/Lean/Util/MonadCache.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Control.StateRef -import Std.Data.HashMap.Basic +public import Init.Control.StateRef +public import Std.Data.HashMap.Basic + +public section namespace Lean /-- Interface for caching results. -/ @@ -56,7 +60,7 @@ instance {α β : Type} {m : Type → Type} [BEq α] [Hashable α] [Monad m] [Mo end MonadHashMapCacheAdapter -def MonadCacheT {ω} (α β : Type) (m : Type → Type) [STWorld ω m] [BEq α] [Hashable α] := StateRefT (Std.HashMap α β) m +@[expose] def MonadCacheT {ω} (α β : Type) (m : Type → Type) [STWorld ω m] [BEq α] [Hashable α] := StateRefT (Std.HashMap α β) m namespace MonadCacheT @@ -80,7 +84,7 @@ instance [Alternative m] : Alternative (MonadCacheT α β m) := inferInstanceAs end MonadCacheT /- Similar to `MonadCacheT`, but using `StateT` instead of `StateRefT` -/ -def MonadStateCacheT (α β : Type) (m : Type → Type) [BEq α] [Hashable α] := StateT (Std.HashMap α β) m +@[expose] def MonadStateCacheT (α β : Type) (m : Type → Type) [BEq α] [Hashable α] := StateT (Std.HashMap α β) m namespace MonadStateCacheT diff --git a/src/Lean/Util/NumApps.lean b/src/Lean/Util/NumApps.lean index 028cf860ed..9237d63d7b 100644 --- a/src/Lean/Util/NumApps.lean +++ b/src/Lean/Util/NumApps.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.PtrSet +public import Lean.Expr +public import Lean.Util.PtrSet + +public section namespace Lean.Expr namespace NumApps diff --git a/src/Lean/Util/NumObjs.lean b/src/Lean/Util/NumObjs.lean index 54e70ec17b..0aacbf5054 100644 --- a/src/Lean/Util/NumObjs.lean +++ b/src/Lean/Util/NumObjs.lean @@ -3,9 +3,13 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr -import Lean.Util.PtrSet +public import Lean.Expr +public import Lean.Util.PtrSet + +public section namespace Lean.Expr namespace NumObjs diff --git a/src/Lean/Util/OccursCheck.lean b/src/Lean/Util/OccursCheck.lean index 1f811090b4..f7c24e7cbb 100644 --- a/src/Lean/Util/OccursCheck.lean +++ b/src/Lean/Util/OccursCheck.lean @@ -3,8 +3,12 @@ Copyright (c) 2021 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.MetavarContext +public import Lean.MetavarContext + +public section namespace Lean diff --git a/src/Lean/Util/PPExt.lean b/src/Lean/Util/PPExt.lean index 6f44e49081..1febb9d0a9 100644 --- a/src/Lean/Util/PPExt.lean +++ b/src/Lean/Util/PPExt.lean @@ -3,11 +3,15 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura -/ +module + prelude -import Lean.Environment -import Lean.MetavarContext -import Lean.Data.OpenDecl -import Lean.Elab.InfoTree.Types +public import Lean.Environment +public import Lean.MetavarContext +public import Lean.Data.OpenDecl +public import Lean.Elab.InfoTree.Types + +public section namespace Lean register_builtin_option pp.raw : Bool := { diff --git a/src/Lean/Util/Path.lean b/src/Lean/Util/Path.lean index 28529840af..cd4992d840 100644 --- a/src/Lean/Util/Path.lean +++ b/src/Lean/Util/Path.lean @@ -8,8 +8,12 @@ paths containing package roots: an import `A.B.C` resolves to `path/A/B/C.olean` for the first entry `path` in `LEAN_PATH` with a directory `A/`. `import A` resolves to `path/A.olean`. -/ +module + prelude -import Init.System.IO +public import Init.System.IO + +public section namespace Lean open System diff --git a/src/Lean/Util/Profile.lean b/src/Lean/Util/Profile.lean index ea665a9dcd..9600b35492 100644 --- a/src/Lean/Util/Profile.lean +++ b/src/Lean/Util/Profile.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Sebastian Ullrich. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Sebastian Ullrich -/ +module + prelude -import Init.Data.OfScientific -import Lean.Data.Options +public import Init.Data.OfScientific +public import Lean.Data.Options + +public section namespace Lean diff --git a/src/Lean/Util/Profiler.lean b/src/Lean/Util/Profiler.lean index 65fb44a181..c008b9f032 100644 --- a/src/Lean/Util/Profiler.lean +++ b/src/Lean/Util/Profiler.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich -/ +module + prelude -import Lean.Util.Trace +public import Lean.Util.Trace + +public section /-! `trace.profiler.output` Firefox Profiler integration -/ diff --git a/src/Lean/Util/PtrSet.lean b/src/Lean/Util/PtrSet.lean index 52ad8c2220..9e98ca5d49 100644 --- a/src/Lean/Util/PtrSet.lean +++ b/src/Lean/Util/PtrSet.lean @@ -3,10 +3,14 @@ Copyright (c) 2023 Leonardo de Moura. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.Data.Hashable -import Std.Data.HashSet.Basic -import Std.Data.HashMap.Basic +public import Init.Data.Hashable +public import Std.Data.HashSet.Basic +public import Std.Data.HashMap.Basic + +public section namespace Lean @@ -22,7 +26,7 @@ unsafe instance : BEq (Ptr α) where /-- Set of pointers. It is a low-level auxiliary datastructure used for traversing DAGs. -/ -unsafe def PtrSet (α : Type) := +@[expose] unsafe def PtrSet (α : Type) := Std.HashSet (Ptr α) unsafe def mkPtrSet {α : Type} (capacity : Nat := 64) : PtrSet α := @@ -37,7 +41,7 @@ unsafe abbrev PtrSet.contains (s : PtrSet α) (a : α) : Bool := /-- Map of pointers. It is a low-level auxiliary datastructure used for traversing DAGs. -/ -unsafe def PtrMap (α : Type) (β : Type) := +@[expose] unsafe def PtrMap (α : Type) (β : Type) := Std.HashMap (Ptr α) β unsafe def mkPtrMap {α β : Type} (capacity : Nat := 64) : PtrMap α β := diff --git a/src/Lean/Util/RecDepth.lean b/src/Lean/Util/RecDepth.lean index 1d6e61855b..a44f3c0194 100644 --- a/src/Lean/Util/RecDepth.lean +++ b/src/Lean/Util/RecDepth.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Data.Options +public import Lean.Data.Options + +public section namespace Lean diff --git a/src/Lean/Util/Recognizers.lean b/src/Lean/Util/Recognizers.lean index 1f950dd4d2..889bbe1e8a 100644 --- a/src/Lean/Util/Recognizers.lean +++ b/src/Lean/Util/Recognizers.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Environment +public import Lean.Environment + +public section namespace Lean namespace Expr diff --git a/src/Lean/Util/ReplaceExpr.lean b/src/Lean/Util/ReplaceExpr.lean index 7a4fff6c68..747ae4b7d4 100644 --- a/src/Lean/Util/ReplaceExpr.lean +++ b/src/Lean/Util/ReplaceExpr.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura, Gabriel Ebner, Sebastian Ullrich -/ +module + prelude -import Lean.Expr -import Lean.Util.PtrSet +public import Lean.Expr +public import Lean.Util.PtrSet + +public section namespace Lean.Expr diff --git a/src/Lean/Util/ReplaceLevel.lean b/src/Lean/Util/ReplaceLevel.lean index e159c3e20b..9b6a72016f 100644 --- a/src/Lean/Util/ReplaceLevel.lean +++ b/src/Lean/Util/ReplaceLevel.lean @@ -3,8 +3,12 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean namespace Level diff --git a/src/Lean/Util/SCC.lean b/src/Lean/Util/SCC.lean index 1b0ba35dde..16899f5c20 100644 --- a/src/Lean/Util/SCC.lean +++ b/src/Lean/Util/SCC.lean @@ -3,9 +3,13 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Std.Data.HashMap.Basic -import Init.Data.Option.Coe +public import Std.Data.HashMap.Basic +public import Init.Data.Option.Coe + +public section namespace Lean.SCC /-! diff --git a/src/Lean/Util/SafeExponentiation.lean b/src/Lean/Util/SafeExponentiation.lean index 7c6aa5cdd9..95a23f1deb 100644 --- a/src/Lean/Util/SafeExponentiation.lean +++ b/src/Lean/Util/SafeExponentiation.lean @@ -3,8 +3,12 @@ Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.CoreM +public import Lean.CoreM + +public section namespace Lean diff --git a/src/Lean/Util/SearchPath.lean b/src/Lean/Util/SearchPath.lean index d5b1eb2fac..0ef4dc3eca 100644 --- a/src/Lean/Util/SearchPath.lean +++ b/src/Lean/Util/SearchPath.lean @@ -3,10 +3,15 @@ Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.ToExpr -import Lean.Util.Path -import Lean.Elab.Term +public import Lean.ToExpr +public import Lean.Util.Path +public import Lean.Elab.Term +meta import Lean.Elab.Term + +public section open Lean diff --git a/src/Lean/Util/ShareCommon.lean b/src/Lean/Util/ShareCommon.lean index 34747a71f2..e209d21d02 100644 --- a/src/Lean/Util/ShareCommon.lean +++ b/src/Lean/Util/ShareCommon.lean @@ -3,12 +3,16 @@ Copyright (c) 2020 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Init.ShareCommon -import Std.Data.HashSet.Basic -import Std.Data.HashMap.Basic -import Lean.Data.PersistentHashMap -import Lean.Data.PersistentHashSet +public import Init.ShareCommon +public import Std.Data.HashSet.Basic +public import Std.Data.HashMap.Basic +public import Lean.Data.PersistentHashMap +public import Lean.Data.PersistentHashSet + +public section open ShareCommon namespace Lean.ShareCommon diff --git a/src/Lean/Util/Sorry.lean b/src/Lean/Util/Sorry.lean index d7c68de456..186eaad6ad 100644 --- a/src/Lean/Util/Sorry.lean +++ b/src/Lean/Util/Sorry.lean @@ -3,9 +3,13 @@ Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Util.FindExpr -import Lean.Declaration +public import Lean.Util.FindExpr +public import Lean.Declaration + +public section namespace Lean diff --git a/src/Lean/Util/SortExprs.lean b/src/Lean/Util/SortExprs.lean index 11d40d7bb7..07c689f8b4 100644 --- a/src/Lean/Util/SortExprs.lean +++ b/src/Lean/Util/SortExprs.lean @@ -3,8 +3,12 @@ Copyright (c) 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Leonardo de Moura -/ +module + prelude -import Lean.Expr +public import Lean.Expr + +public section namespace Lean diff --git a/src/Lean/Util/TestExtern.lean b/src/Lean/Util/TestExtern.lean index 23da256238..6239e9d86a 100644 --- a/src/Lean/Util/TestExtern.lean +++ b/src/Lean/Util/TestExtern.lean @@ -3,18 +3,22 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ +module + prelude -import Lean.Elab.SyntheticMVars -import Lean.Elab.Command -import Lean.Meta.Tactic.Unfold -import Lean.Meta.Eval -import Lean.Compiler.ImplementedByAttr +public import Lean.Elab.Command +meta import Lean.Meta.Tactic.Unfold +meta import Lean.Meta.Eval +meta import Lean.Compiler.ImplementedByAttr +meta import Lean.Elab.Command + +public section open Lean Elab Meta Command Term Compiler syntax (name := testExternCmd) "test_extern " term : command -@[command_elab testExternCmd] unsafe def elabTestExtern : CommandElab +@[command_elab testExternCmd] meta unsafe def elabTestExtern : CommandElab | `(test_extern $t:term) => liftTermElabM do let t ← elabTermAndSynthesize t none match t.getAppFn with diff --git a/src/Lean/Util/Trace.lean b/src/Lean/Util/Trace.lean index dca5378758..9b3ffac628 100644 --- a/src/Lean/Util/Trace.lean +++ b/src/Lean/Util/Trace.lean @@ -3,9 +3,13 @@ Copyright (c) 2018 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Sebastian Ullrich, Leonardo de Moura -/ +module + prelude -import Lean.Elab.Exception -import Lean.Log +public import Lean.Elab.Exception +public import Lean.Log + +public section /-! # Trace messages diff --git a/src/Lean/Widget.lean b/src/Lean/Widget.lean index 5d3f7e3703..8327a1367c 100644 --- a/src/Lean/Widget.lean +++ b/src/Lean/Widget.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Widget.InteractiveCode -import Lean.Widget.InteractiveDiagnostic -import Lean.Widget.InteractiveGoal -import Lean.Widget.TaggedText -import Lean.Widget.UserWidget +public import Lean.Widget.InteractiveCode +public import Lean.Widget.InteractiveDiagnostic +public import Lean.Widget.InteractiveGoal +public import Lean.Widget.TaggedText +public import Lean.Widget.UserWidget + +public section diff --git a/src/Lean/Widget/Basic.lean b/src/Lean/Widget/Basic.lean index b32a1c92d9..d41b88b97f 100644 --- a/src/Lean/Widget/Basic.lean +++ b/src/Lean/Widget/Basic.lean @@ -3,12 +3,16 @@ Copyright (c) 2022 Wojciech Nawrocki. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Elab.InfoTree -import Lean.Message -import Lean.Server.Rpc.Basic -import Lean.Server.InfoUtils -import Lean.Widget.Types +public import Lean.Elab.InfoTree +public import Lean.Message +public import Lean.Server.Rpc.Basic +public import Lean.Server.InfoUtils +public import Lean.Widget.Types + +public section namespace Lean.Widget diff --git a/src/Lean/Widget/Diff.lean b/src/Lean/Widget/Diff.lean index 1fda3d85a3..30490d8657 100644 --- a/src/Lean/Widget/Diff.lean +++ b/src/Lean/Widget/Diff.lean @@ -4,12 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers -/ +module + prelude -import Lean.Meta.PPGoal -import Lean.Widget.InteractiveCode -import Lean.Widget.InteractiveGoal -import Lean.Data.Lsp.Extra -import Lean.Elab.InfoTree +public import Lean.Meta.PPGoal +public import Lean.Widget.InteractiveCode +public import Lean.Widget.InteractiveGoal +public import Lean.Data.Lsp.Extra +public import Lean.Elab.InfoTree namespace Lean.Widget @@ -252,7 +254,7 @@ def diffInteractiveGoal (useAfter : Bool) (g₀ : MVarId) (i₁ : InteractiveGoa /-- Modifies `goalsAfter` with additional information about how it is different to `goalsBefore`. If `useAfter` is `true` then `igs₁` is the set of interactive goals _after_ the tactic has been applied. Otherwise `igs₁` is the set of interactive goals _before_. -/ -def diffInteractiveGoals (useAfter : Bool) (info : Elab.TacticInfo) (igs₁ : InteractiveGoals) : MetaM InteractiveGoals := do +public def diffInteractiveGoals (useAfter : Bool) (info : Elab.TacticInfo) (igs₁ : InteractiveGoals) : MetaM InteractiveGoals := do if ! showTacticDiff.get (← getOptions) then return igs₁ else let goals₀ := if useAfter then info.goalsBefore else info.goalsAfter let parentMap : MVarIdMap MVarIdSet ← info.goalsBefore.foldlM (init := ∅) (fun s g => do diff --git a/src/Lean/Widget/InteractiveCode.lean b/src/Lean/Widget/InteractiveCode.lean index 83b3f23ed3..58f54945b2 100644 --- a/src/Lean/Widget/InteractiveCode.lean +++ b/src/Lean/Widget/InteractiveCode.lean @@ -4,11 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Server.Rpc.Basic -import Lean.Server.InfoUtils -import Lean.Widget.TaggedText -import Lean.Widget.Basic +public import Lean.Server.Rpc.Basic +public import Lean.Server.InfoUtils +public import Lean.Widget.TaggedText +public import Lean.Widget.Basic + +public section /-! RPC infrastructure for storing and formatting code fragments, in particular `Expr`s, with environment and subexpression information. -/ diff --git a/src/Lean/Widget/InteractiveDiagnostic.lean b/src/Lean/Widget/InteractiveDiagnostic.lean index a4705b0dc4..27820bb2fd 100644 --- a/src/Lean/Widget/InteractiveDiagnostic.lean +++ b/src/Lean/Widget/InteractiveDiagnostic.lean @@ -4,12 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Linter.UnusedVariables -import Lean.Server.Utils -import Lean.Widget.InteractiveGoal -import Init.Data.Slice.Array.Basic -import Init.Data.Array.Subarray.Split +public import Lean.Linter.UnusedVariables +public import Lean.Server.Utils +public import Lean.Widget.InteractiveGoal +public import Init.Data.Slice.Array.Basic +public import Init.Data.Array.Subarray.Split + +public section namespace Lean.Widget open Lsp Server diff --git a/src/Lean/Widget/InteractiveGoal.lean b/src/Lean/Widget/InteractiveGoal.lean index 56ca994923..c3a54a84d2 100644 --- a/src/Lean/Widget/InteractiveGoal.lean +++ b/src/Lean/Widget/InteractiveGoal.lean @@ -4,10 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Meta.PPGoal -import Lean.Widget.InteractiveCode -import Lean.Data.Lsp.Extra +public import Lean.Meta.PPGoal +public import Lean.Widget.InteractiveCode +public import Lean.Data.Lsp.Extra + +public section /-! Functionality related to tactic-mode and term-mode goals with embedded `CodeWithInfos`. -/ diff --git a/src/Lean/Widget/TaggedText.lean b/src/Lean/Widget/TaggedText.lean index 978fee8f5b..0e1960be64 100644 --- a/src/Lean/Widget/TaggedText.lean +++ b/src/Lean/Widget/TaggedText.lean @@ -4,9 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Data.Json.FromToJson.Basic -import Lean.Server.Rpc.Basic +public import Lean.Data.Json.FromToJson.Basic +public import Lean.Server.Rpc.Basic + +public section namespace Lean.Widget open Server @@ -75,11 +79,11 @@ private structure TaggedState where deriving Inhabited instance : Std.Format.MonadPrettyFormat (StateM TaggedState) where - pushOutput s := modify fun ⟨out, ts, col⟩ => ⟨out.appendText s, ts, col + s.length⟩ - pushNewline indent := modify fun ⟨out, ts, _⟩ => ⟨out.appendText ("\n".pushn ' ' indent), ts, indent⟩ - currColumn := return (←get).column - startTag n := modify fun ⟨out, ts, col⟩ => ⟨TaggedText.text "", (n, col, out) :: ts, col⟩ - endTags n := modify fun ⟨out, ts, col⟩ => + pushOutput s := private modify fun ⟨out, ts, col⟩ => ⟨out.appendText s, ts, col + s.length⟩ + pushNewline indent := private modify fun ⟨out, ts, _⟩ => ⟨out.appendText ("\n".pushn ' ' indent), ts, indent⟩ + currColumn := private return (←get).column + startTag n := private modify fun ⟨out, ts, col⟩ => ⟨TaggedText.text "", (n, col, out) :: ts, col⟩ + endTags n := private modify fun ⟨out, ts, col⟩ => let (ended, left) := (ts.take n, ts.drop n) let out' := ended.foldl (init := out) fun acc (n, col', top) => top.appendTag (n, col') acc ⟨out', left, col⟩ diff --git a/src/Lean/Widget/Types.lean b/src/Lean/Widget/Types.lean index 2f4097997d..71ea3c5967 100644 --- a/src/Lean/Widget/Types.lean +++ b/src/Lean/Widget/Types.lean @@ -4,8 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Wojciech Nawrocki -/ +module + prelude -import Lean.Server.Rpc.Basic +public import Lean.Server.Rpc.Basic + +public section namespace Lean.Widget diff --git a/src/Lean/Widget/UserWidget.lean b/src/Lean/Widget/UserWidget.lean index b41df56de8..3d7b97cbe2 100644 --- a/src/Lean/Widget/UserWidget.lean +++ b/src/Lean/Widget/UserWidget.lean @@ -4,10 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: E.W.Ayers, Wojciech Nawrocki -/ +module + prelude -import Lean.Elab.Eval -import Lean.Server.Rpc.RequestHandling -import Lean.Widget.Types +public import Lean.Elab.Eval +public import Lean.Server.Rpc.RequestHandling +public import Lean.Widget.Types +meta import Lean.Parser.Term +meta import Lean.Elab.Command + +public section namespace Lean.Widget open Meta Elab @@ -45,7 +51,7 @@ private abbrev ModuleRegistry := SimplePersistentEnvExtension (UInt64 × Name × Expr) (Std.TreeMap UInt64 (Name × Expr)) -builtin_initialize moduleRegistry : ModuleRegistry ← +private builtin_initialize moduleRegistry : ModuleRegistry ← registerSimplePersistentEnvExtension { addImportedFn := fun xss => xss.foldl (Array.foldl (fun s n => s.insert n.1 n.2)) ∅ addEntryFn := fun s n => s.insert n.1 n.2 @@ -158,7 +164,7 @@ private abbrev PanelWidgetsExt := SimpleScopedEnvExtension (UInt64 × Name) (Std.TreeMap UInt64 (List PanelWidgetsExtEntry)) -builtin_initialize panelWidgetsExt : PanelWidgetsExt ← +private builtin_initialize panelWidgetsExt : PanelWidgetsExt ← registerSimpleScopedEnvExtension { addEntry := fun s (h, n) => s.insert h (.global n :: s.getD h []) initial := .empty @@ -258,7 +264,7 @@ Note that persistent erasure is not possible, i.e., syntax (name := showPanelWidgetsCmd) "show_panel_widgets " "[" sepBy1(showWidgetSpec, ", ") "]" : command open Command in -@[command_elab showPanelWidgetsCmd] def elabShowPanelWidgetsCmd : CommandElab +@[command_elab showPanelWidgetsCmd] meta def elabShowPanelWidgetsCmd : CommandElab | `(show_panel_widgets [ $ws ,*]) => liftTermElabM do for w in ws.getElems do match w with @@ -305,7 +311,7 @@ In particular, ` : Json` works. -/ syntax (name := widgetCmd) "#widget " widgetInstanceSpec : command open Command in -@[command_elab widgetCmd] def elabWidgetCmd : CommandElab +@[command_elab widgetCmd] meta def elabWidgetCmd : CommandElab | stx@`(#widget $s) => liftTermElabM do let wi : Expr ← elabWidgetInstanceSpec s let wi : WidgetInstance ← evalWidgetInstance wi diff --git a/src/Std/Do/SPred/Notation.lean b/src/Std/Do/SPred/Notation.lean index 9dd59f23fd..d8c7b62f5a 100644 --- a/src/Std/Do/SPred/Notation.lean +++ b/src/Std/Do/SPred/Notation.lean @@ -35,7 +35,7 @@ macro_rules /-- Remove an `spred` layer from a `term` syntax object. -/ -- inverts the rules above. -meta def SPred.Notation.unpack [Monad m] [MonadRef m] [MonadQuotation m] : Term → m Term +partial def SPred.Notation.unpack [Monad m] [MonadRef m] [MonadQuotation m] : Term → m Term | `(spred($P)) => do `($P) | `(($P)) => do `(($(← unpack P))) | `(if $c then $t else $e) => do diff --git a/src/Std/Do/Triple/Basic.lean b/src/Std/Do/Triple/Basic.lean index b3582673ce..532a6c12b4 100644 --- a/src/Std/Do/Triple/Basic.lean +++ b/src/Std/Do/Triple/Basic.lean @@ -7,7 +7,7 @@ module prelude public import Std.Do.WP -public import Std.Do.SPred +meta import Std.Do.SPred.Notation @[expose] public section diff --git a/stage0/src/stdlib_flags.h b/stage0/src/stdlib_flags.h index 79a0e58edd..0b833d9dc4 100644 --- a/stage0/src/stdlib_flags.h +++ b/stage0/src/stdlib_flags.h @@ -1,5 +1,7 @@ #include "util/options.h" +// Dear CI, please update stage0 + namespace lean { options get_default_options() { options opts; diff --git a/tests/bench/simp_local.lean b/tests/bench/simp_local.lean index 3432226d94..50bf03ea91 100644 --- a/tests/bench/simp_local.lean +++ b/tests/bench/simp_local.lean @@ -34,6 +34,7 @@ axiom iter_succ : iter (s i) g x = iter i g (iter i g x) noncomputable def steps : N := s (s (s (s (s (s (s z)))))) +set_option maxHeartbeats 250000 set_option maxRecDepth 100000 set_option Elab.async false diff --git a/tests/bench/speedcenter.exec.velcom.yaml b/tests/bench/speedcenter.exec.velcom.yaml index 29cfa60777..4efdcfd8c2 100644 --- a/tests/bench/speedcenter.exec.velcom.yaml +++ b/tests/bench/speedcenter.exec.velcom.yaml @@ -20,13 +20,13 @@ cmd: | # build only up to make-stdlib so Lake doesn't repeat its output, then finish the build to get # the executables for further benchmarks, ignore output - bash -c 'set -eo pipefail; find ${BUILD:-../../build/release}/stage2 -name "*.olean" -delete; make LEAN_OPTS="-Dprofiler=true -Dprofiler.threshold=9999999 --stats" -C ${BUILD:-../../build/release}/stage2 --output-sync -j$(nproc) make_stdlib 2>&1 | ./accumulate_profile.py; make -C ${BUILD:-../../build/release}/stage2 -j$(nproc) 1>&2' + bash -c 'set -eo pipefail; find ${BUILD:-../../build/release}/stage3 -name "*.olean" -delete; make LEAN_OPTS="-Dprofiler=true -Dprofiler.threshold=9999999 --stats" -C ${BUILD:-../../build/release}/stage3 --output-sync -j$(nproc) make_stdlib 2>&1 | ./accumulate_profile.py; make -C ${BUILD:-../../build/release}/stage3 -j$(nproc) 1>&2' max_runs: 2 parse_output: true # initialize stage2 cmake + warmup build_config: cmd: | - bash -c 'make -C ${BUILD:-../../build/release} stage2 -j$(nproc)' + bash -c 'make -C ${BUILD:-../../build/release} stage3 -j$(nproc)' - attributes: description: stdlib size tags: [deterministic, fast] diff --git a/tests/lean/1021.lean.expected.out b/tests/lean/1021.lean.expected.out index 28eda0adff..49c6d6b856 100644 --- a/tests/lean/1021.lean.expected.out +++ b/tests/lean/1021.lean.expected.out @@ -1,8 +1,8 @@ some { range := - { pos := { line := 189, column := 0 }, charUtf16 := 0, endPos := { line := 194, column := 31 }, + { pos := { line := 194, column := 0 }, charUtf16 := 0, endPos := { line := 199, column := 31 }, endCharUtf16 := 31 }, selectionRange := - { pos := { line := 189, column := 46 }, charUtf16 := 46, endPos := { line := 189, column := 58 }, + { pos := { line := 194, column := 46 }, charUtf16 := 46, endPos := { line := 194, column := 58 }, endCharUtf16 := 58 } } diff --git a/tests/lean/run/PPTopDownAnalyze.lean b/tests/lean/run/PPTopDownAnalyze.lean index 770e2dfa44..d9680cb70a 100644 --- a/tests/lean/run/PPTopDownAnalyze.lean +++ b/tests/lean/run/PPTopDownAnalyze.lean @@ -354,10 +354,8 @@ set_option pp.analyze.trustSubtypeMk true in #testDelabN MonadLift.noConfusionType #testDelabN MonadExcept.noConfusion #testDelabN MonadFinally.noConfusion -#testDelabN Lean.Elab.InfoTree.goalsAt?.match_1 #testDelabN Array.mk.injEq #testDelabN Lean.PrefixTree.empty -#testDelabN Lean.PersistentHashMap.getCollisionNodeSize.match_1 #testDelabN and_false #testDelabN Lean.Server.FileWorker.handlePlainTermGoal #testDelabN Lean.Server.FileWorker.handlePlainGoal diff --git a/tests/lean/run/matchEqs.lean b/tests/lean/run/matchEqs.lean index 2e06c51335..fce7963d33 100644 --- a/tests/lean/run/matchEqs.lean +++ b/tests/lean/run/matchEqs.lean @@ -23,6 +23,3 @@ test% f.match_1 theorem ex (x : List Nat) : f x > 0 := by simp [f] split <;> decide - -test% Lean.RBNode.balance1.match_1 -#check @Lean.RBNode.balance1.match_1.splitter diff --git a/tests/pkg/rebuild/test.sh b/tests/pkg/rebuild/test.sh index 705828e6f7..becede2639 100755 --- a/tests/pkg/rebuild/test.sh +++ b/tests/pkg/rebuild/test.sh @@ -11,6 +11,8 @@ cat < Rebuild/Basic.lean module +set_option compiler.small 0 + public def hello := "world" public def testSpec (xs : List Nat) : List Nat := xs.map (fun x => x + 1)