Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: don't import all of Lean #34

Merged
merged 3 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
- "4.6.0"
- "4.7.0"
- "4.8.0"
- "4.9.0-rc1"
- "nightly-2024-06-12"
- "4.9.0"
- "nightly-2024-07-12"
platform:
- os: ubuntu-latest
installer: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
# Mac runners are rare and expensive, so spot-check that the
# subprocess support seems OK but be less thorough
include:
- toolchain: "4.8.0"
- toolchain: "4.9.0"
platform:
os: macos-latest
installer: |
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/formalities.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
pull_request:

name: Formalities

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Don't 'import Lean', use precise imports
if: always()
run: |
! (find . -name "*.lean" -type f -print0 | xargs -0 grep -E -n '^import Lean$')

- name: Verify .lean files start with a copyright header.
run: |
FILES=$(find ./src ./demo ./demo-toml -not -path '*/.lake/*' -type f -name "*.lean" -exec perl -ne 'BEGIN { $/ = undef; } print "$ARGV\n" if !m{\A/-\nCopyright}; exit;' {} \;)
if [ -n "$FILES" ]; then
echo "Found .lean files which do not have a copyright header:"
echo "$FILES"
exit 1
else
echo "All copyright headers present."
fi
6 changes: 5 additions & 1 deletion Extract.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Lean
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import SubVerso.Examples.Env

open Lean
Expand Down
7 changes: 5 additions & 2 deletions demo-toml/Demo.lean
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-- This module serves as the root of the `Demo` library.
-- Import modules here that should be built as part of the library.
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import «Demo».Basic

import SubVerso.Examples
Expand Down
7 changes: 6 additions & 1 deletion demo-toml/Demo/Basic.lean
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
def hello := "world"
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
def hello := "world"
5 changes: 5 additions & 0 deletions demo-toml/Main.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import «Demo»

def main : IO Unit :=
Expand Down
7 changes: 5 additions & 2 deletions demo/Demo.lean
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
-- This module serves as the root of the `Demo` library.
-- Import modules here that should be built as part of the library.
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import «Demo».Basic

import SubVerso.Examples
Expand Down
7 changes: 6 additions & 1 deletion demo/Demo/Basic.lean
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
def hello := "world"
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
def hello := "world"
5 changes: 5 additions & 0 deletions demo/Main.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import «Demo»

def main : IO Unit :=
Expand Down
5 changes: 5 additions & 0 deletions demo/lakefile.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lake
open Lake DSL

Expand Down
5 changes: 5 additions & 0 deletions src/compat/SubVerso/Compat.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lean.Elab

open Lean Elab Term
Expand Down
10 changes: 8 additions & 2 deletions src/examples/SubVerso/Examples.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lean.Environment
import SubVerso.Highlighting
import SubVerso.Compat
import SubVerso.Examples.Env
import Lean.Environment


namespace SubVerso.Examples

Expand Down Expand Up @@ -284,7 +290,7 @@ elab_rules : command
let addScope x := mkIdentFrom x (addMacroScope mod x.getId sc)
let declName ← match sigName with
| `(Lean.Parser.Command.declId|$x:ident) => pure x
| `(Lean.Parser.Command.declId|$x:ident.{$u:ident,*}) => pure x
| `(Lean.Parser.Command.declId|$x:ident.{$_u:ident,*}) => pure x
| _ => throwErrorAt sigName "Unexpected format of name: {sigName}"
let target ← liftTermElabM <| Compat.realizeNameNoOverloads declName
let noClash ← match sigName with
Expand Down
6 changes: 5 additions & 1 deletion src/examples/SubVerso/Examples/Env.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Lean
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import SubVerso.Highlighting

open Lean
Expand Down
5 changes: 5 additions & 0 deletions src/highlighting/SubVerso/Highlighting.lean
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import SubVerso.Highlighting.Highlighted
import SubVerso.Highlighting.Code
8 changes: 7 additions & 1 deletion src/highlighting/SubVerso/Highlighting/Code.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Lean
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lean.Widget.InteractiveCode
import Lean.Widget.TaggedText


import SubVerso.Compat
import SubVerso.Highlighting.Highlighted

Expand Down
9 changes: 8 additions & 1 deletion src/highlighting/SubVerso/Highlighting/Highlighted.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import Lean
/-
Copyright (c) 2023-2024 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import Lean.Data.Json
import Lean.Expr
import Lean.SubExpr -- for the To/FromJSON FVarId instances

open Lean

Expand Down
Loading