Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Sep 9, 2024
1 parent 6a40b12 commit 4a3f033
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cache/IO.lean
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def packCache (hashMap : HashMap) (overwrite verbose unpackedOnly : Bool)
/-- Gets the set of all cached files -/
def getLocalCacheSet : IO <| Lean.RBTree String compare := do
let paths ← getFilesWithExtension CACHEDIR "ltar"
return .fromList (paths.data.map (·.withoutParent CACHEDIR |>.toString)) _
return .fromList (paths.toList.map (·.withoutParent CACHEDIR |>.toString)) _

def isPathFromMathlib (path : FilePath) : Bool :=
match path.components with
Expand Down
2 changes: 1 addition & 1 deletion Cache/Requests.lean
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def UPLOAD_URL : String :=
/-- Formats the config file for `curl`, containing the list of files to be uploaded -/
def mkPutConfigContent (fileNames : Array String) (token : String) : IO String := do
let token := if useFROCache then "" else s!"?{token}" -- the FRO cache doesn't pass the token here
let l ← fileNames.data.mapM fun fileName : String => do
let l ← fileNames.toList.mapM fun fileName : String => do
pure s!"-T {(IO.CACHEDIR / fileName).toString}\nurl = {mkFileURL UPLOAD_URL fileName}{token}"
return "\n".intercalate l

Expand Down
17 changes: 10 additions & 7 deletions Mathlib/Data/List/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1512,18 +1512,19 @@ theorem modifyLast.go_append_one (f : α → α) (a : α) (tl : List α) (r : Ar
rw [modifyLast.go, modifyLast.go]
case x_3 | x_3 => exact append_ne_nil_of_right_ne_nil tl (cons_ne_nil a [])
rw [modifyLast.go_append_one _ _ tl _, modifyLast.go_append_one _ _ tl (Array.push #[] hd)]
simp only [Array.toListAppend_eq, Array.push_data, Array.data_toArray, nil_append, append_assoc]
simp only [Array.toListAppend_eq, Array.push_toList, Array.toList_toArray, nil_append,
append_assoc]

theorem modifyLast_append_one (f : α → α) (a : α) (l : List α) :
modifyLast f (l ++ [a]) = l ++ [f a] := by
cases l with
| nil =>
simp only [nil_append, modifyLast, modifyLast.go, Array.toListAppend_eq, Array.data_toArray]
simp only [nil_append, modifyLast, modifyLast.go, Array.toListAppend_eq, Array.toList_toArray]
| cons _ tl =>
simp only [cons_append, modifyLast]
rw [modifyLast.go]
case x_3 => exact append_ne_nil_of_right_ne_nil tl (cons_ne_nil a [])
rw [modifyLast.go_append_one, Array.toListAppend_eq, Array.push_data, Array.data_toArray,
rw [modifyLast.go_append_one, Array.toListAppend_eq, Array.push_toList, Array.toList_toArray,
nil_append, cons_append, nil_append, cons_inj_right]
exact modifyLast_append_one _ _ tl

Expand Down Expand Up @@ -1574,11 +1575,13 @@ variable (f : α → Option α)
theorem lookmap.go_append (l : List α) (acc : Array α) :
lookmap.go f l acc = acc.toListAppend (lookmap f l) := by
cases l with
| nil => rfl
| nil => simp [go, lookmap]
| cons hd tl =>
rw [lookmap, go, go]
cases f hd with
| none => simp only [go_append tl _, Array.toListAppend_eq, append_assoc, Array.push_data]; rfl
| none =>
simp only [go_append tl _, Array.toListAppend_eq, append_assoc, Array.push_toList]
rfl
| some a => rfl

@[simp]
Expand All @@ -1588,13 +1591,13 @@ theorem lookmap_nil : [].lookmap f = [] :=
@[simp]
theorem lookmap_cons_none {a : α} (l : List α) (h : f a = none) :
(a :: l).lookmap f = a :: l.lookmap f := by
simp only [lookmap, lookmap.go, Array.toListAppend_eq, Array.data_toArray, nil_append]
simp only [lookmap, lookmap.go, Array.toListAppend_eq, Array.toList_toArray, nil_append]
rw [lookmap.go_append, h]; rfl

@[simp]
theorem lookmap_cons_some {a b : α} (l : List α) (h : f a = some b) :
(a :: l).lookmap f = b :: l := by
simp only [lookmap, lookmap.go, Array.toListAppend_eq, Array.data_toArray, nil_append]
simp only [lookmap, lookmap.go, Array.toListAppend_eq, Array.toList_toArray, nil_append]
rw [h]

theorem lookmap_some : ∀ l : List α, l.lookmap some = l
Expand Down
4 changes: 2 additions & 2 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "3f7971b12c43e7e5621b236218b30e98f7253291",
"rev": "14c6365a2001ae9fb916ad6931b985180b8377ef",
"name": "batteries",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing-2024-09-09",
"inputRev": "lean-pr-testing-5288",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/leanprover-community/quote4",
Expand Down
2 changes: 1 addition & 1 deletion lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ open Lake DSL
## Mathlib dependencies on upstream projects
-/

require "leanprover-community" / "batteries" @ git "nightly-testing-2024-09-09"
require "leanprover-community" / "batteries" @ git "lean-pr-testing-5288"
require "leanprover-community" / "Qq" @ git "master"
require "leanprover-community" / "aesop" @ git "master"
require "leanprover-community" / "proofwidgets" @ git "v0.0.42"
Expand Down

0 comments on commit 4a3f033

Please sign in to comment.