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: adaptations for nightly-2024-10-17 #37

Merged
merged 5 commits into from
Oct 18, 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 ImportGraph/Imports.lean
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ partial
def transitiveFilteredUpstream (node : Name) (graph : NameMap (Array Name))
(filter : Name → Bool) (replacement : Option Name := none):
List Name :=
(graph.find! node).toList.bind fun source =>
(graph.find! node).toList.flatMap fun source =>
( if filter source then
-- Add the transitive edges going through the filtered node `source`.
-- If there is a replacement node, add an additional edge `repl → node`.
Expand All @@ -156,12 +156,12 @@ def filterGraph (graph : NameMap (Array Name)) (filter : Name → Bool)
(replacement : Option Name := none) : NameMap (Array Name) :=
-- Create a list of all files imported by any of the filtered files
-- and remove all imports starting with `Mathlib` to avoid loops.
let replImports := graph.toList.bind
let replImports := graph.toList.flatMap
(fun ⟨n, i⟩ => if filter n then i.toList else [])
|>.eraseDups |>.filter (¬ Name.isPrefixOf `Mathlib ·) |>.toArray
let graph := graph.filterMap (fun node edges => if filter node then none else some <|
-- If the node `node` is not filtered, modify the `edges` going into `node`.
edges.toList.bind (fun source =>
edges.toList.flatMap (fun source =>
if filter source then
transitiveFilteredUpstream source graph filter (replacement := replacement)
else [source]) |>.eraseDups.toArray)
Expand Down
4 changes: 2 additions & 2 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "daf1ed91789811cf6bbb7bf2f4dad6b3bad8fbf4",
"rev": "389fb58a2ff92e1ede0db37b1fedcb9a6162df94",
"name": "batteries",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inputRev": "nightly-testing",
"inherited": false,
"configFile": "lakefile.lean"}],
"name": "importGraph",
Expand Down
2 changes: 1 addition & 1 deletion lakefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rev = "main"
[[require]]
name = "batteries"
scope = "leanprover-community"
rev = "main"
rev = "nightly-testing"

[[lean_lib]]
name = "ImportGraph"
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:v4.13.0-rc1
leanprover/lean4:nightly-2024-10-17