Skip to content

Commit

Permalink
chore: update to Lean v4.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tydeu committed Dec 10, 2023
1 parent 0f72fdf commit 98a8cbd
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 44 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/build
/lakefile.olean
/.lake
2 changes: 1 addition & 1 deletion Alloy/Util/ShimElab.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
go stx :=
withRef stx <| withIncRecDepth <| withFreshMacroScope do
withTraceNode `ShimElab.step (fun _ => return stx) do
liftCoreM <| checkMaxHeartbeats "elaborator"
liftCoreM <| checkSystem "elaborator"
if let some (decl, stxNew?) ← liftMacroM <| expandMacroImpl? (← getEnv) stx then
withInfoTreeContext (mkInfoTree := mkCommandElabInfoTree decl stx) do
let stxNew ← liftMacroM <| liftExcept stxNew?
Expand Down
4 changes: 1 addition & 3 deletions examples/S/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/build
/lakefile.olean
/lake-packages/*
/.lake
lake-manifest.json
6 changes: 2 additions & 4 deletions examples/S/lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ package s {
require alloy from ".."/".."

module_data alloy.c.o : BuildJob FilePath
lean_lib S {
lean_lib S where
precompileModules := true
nativeFacets := #[Module.oFacet, `alloy.c.o]
}

@[default_target]
lean_exe s {
lean_exe s where
root := `Main
}

lean_lib Test
4 changes: 2 additions & 2 deletions examples/S/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set -ex
rm -rf build
rm -rf .lake
LAKE=${LAKE:-lake}
$LAKE build -U
$LAKE build Test -v
#build/bin/s # TODO: Segfaults for some reason
#.lake/build/bin/s # TODO: Segfaults for some reason
4 changes: 1 addition & 3 deletions examples/my_add/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/build
/lakefile.olean
/lake-packages/*
/.lake
lake-manifest.json
6 changes: 2 additions & 4 deletions examples/my_add/lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ package my_add
require alloy from ".."/".."

module_data alloy.c.o : BuildJob FilePath
lean_lib MyAdd {
lean_lib MyAdd where
precompileModules := true
nativeFacets := #[Module.oFacet, `alloy.c.o]
}

lean_lib Test

@[default_target]
lean_exe my_add {
lean_exe my_add where
root := `Main
}
4 changes: 2 additions & 2 deletions examples/my_add/test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set -ex
rm -rf build
rm -rf .lake
LAKE=${LAKE:-lake}
$LAKE build -U
$LAKE build Test -v
build/bin/my_add
.lake/build/bin/my_add
5 changes: 5 additions & 0 deletions lake-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{"version": 7,
"packagesDir": ".lake/packages",
"packages": [],
"name": "alloy",
"lakeDir": ".lake"}
3 changes: 1 addition & 2 deletions lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ package alloy
lean_lib Alloy

@[default_target]
lean_exe alloy {
lean_exe alloy where
root := `Main
supportInterpreter := true
}

--------------------------------------------------------------------------------
-- # Module Facets
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:4.1.0
leanprover/lean4:4.3.0
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pushd tests/compile
./test.sh
popd

find tests/run -type f -exec ${LAKE:-lake} env lean {} \;
find tests/run -type f | xargs -n1 ${LAKE:-lake} env lean

echo "all done"
4 changes: 1 addition & 3 deletions tests/compile/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/build
/lake-packages/*
/.lake
lake-manifest.json
lakefile.olean
2 changes: 1 addition & 1 deletion tests/compile/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ rm -rf build
LAKE=${LAKE:-lake}
$LAKE build -U
$LAKE build Eval -v
build/bin/run
.lake/build/bin/run
36 changes: 21 additions & 15 deletions tests/run/parseLeanH.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ import Lean.Elab.Command

open Lean Parser Elab Command

/- By Mario: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Undefine.20lambda/near/393694214-/
def Lean.Parser.Trie.isEmpty {α} (t : Trie α) : Bool := t matches .Node none .leaf
partial def Lean.Parser.Trie.erase {α} (t : Trie α) (s : String) : Trie α :=
let rec loop : Trie α → String.Pos → Option (Trie α)
| ⟨val, m⟩, i =>
match s.atEnd i with
| true => some (Trie.Node none m)
| false => do
let c := s.get i
let i := s.next i
let t ← m.find compare c
let t ← loop t i
let m := if t.isEmpty then m.erase compare c else m.insert compare c t
some ⟨val, m⟩
(loop t 0).getD t
partial def Lean.Data.Trie.erase {α} (t : Trie α) (s : String) : Trie α :=
let rec loop : Nat → Trie α → Trie α
| i, leaf v =>
if i < s.utf8ByteSize then leaf v else leaf none
| i, node1 v c' t' =>
if h : i < s.utf8ByteSize then
if c' = s.getUtf8Byte i h then
loop (i+1) t'
else
node1 v c' t'
else
node1 none c' t'
| i, node v cs ts =>
if h : i < s.utf8ByteSize then
let c := s.getUtf8Byte i h
match cs.findIdx? (· == c) with
| none => node v cs ts
| some idx => node v cs <| ts.setD idx <| loop (i+1) (ts.get! idx)
else
node none cs ts
loop 0 t

syntax "LEAN_CASSERT" "(" cExpr ")" ";" : cCmd
syntax "extern" str "{" : cCmd
Expand Down

0 comments on commit 98a8cbd

Please sign in to comment.