Skip to content

Commit

Permalink
chore: move to v4.11.0-rc1 (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em authored Aug 5, 2024
1 parent 41bc768 commit 021e272
Show file tree
Hide file tree
Showing 31 changed files with 41 additions and 1,990 deletions.
4 changes: 0 additions & 4 deletions Batteries.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Batteries.Classes.BEq
import Batteries.Classes.Cast
import Batteries.Classes.Order
import Batteries.Classes.RatCast
Expand Down Expand Up @@ -64,12 +63,10 @@ import Batteries.Lean.NameMapAttribute
import Batteries.Lean.PersistentHashMap
import Batteries.Lean.PersistentHashSet
import Batteries.Lean.Position
import Batteries.Lean.SMap
import Batteries.Lean.Syntax
import Batteries.Lean.System.IO
import Batteries.Lean.TagAttribute
import Batteries.Lean.Util.EnvSearch
import Batteries.Lean.Util.Path
import Batteries.Linter
import Batteries.Linter.UnnecessarySeqFocus
import Batteries.Linter.UnreachableTactic
Expand Down Expand Up @@ -101,7 +98,6 @@ import Batteries.Tactic.Unreachable
import Batteries.Tactic.Where
import Batteries.Test.Internal.DummyLabelAttr
import Batteries.Util.Cache
import Batteries.Util.CheckTactic
import Batteries.Util.ExtendedBinder
import Batteries.Util.LibraryNote
import Batteries.Util.Pickle
Expand Down
18 changes: 0 additions & 18 deletions Batteries/Classes/BEq.lean

This file was deleted.

18 changes: 0 additions & 18 deletions Batteries/Data/Array/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Copyright (c) 2021 Floris van Doorn. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Arthur Paulino, Floris van Doorn, Jannis Limperg
-/
import Batteries.Data.List.Init.Attach
import Batteries.Data.Array.Init.Lemmas

/-!
Expand Down Expand Up @@ -130,23 +129,6 @@ protected def maxI [ord : Ord α] [Inhabited α]
(xs : Array α) (start := 0) (stop := xs.size) : α :=
xs.minI (ord := ord.opposite) start stop

/--
Unsafe implementation of `attachWith`, taking advantage of the fact that the representation of
`Array {x // P x}` is the same as the input `Array α`.
-/
@[inline] private unsafe def attachWithImpl
(xs : Array α) (P : α → Prop) (_ : ∀ x ∈ xs, P x) : Array {x // P x} := unsafeCast xs

/-- `O(1)`. "Attach" a proof `P x` that holds for all the elements of `xs` to produce a new array
with the same elements but in the type `{x // P x}`. -/
@[implemented_by attachWithImpl] def attachWith
(xs : Array α) (P : α → Prop) (H : ∀ x ∈ xs, P x) : Array {x // P x} :=
⟨xs.data.attachWith P fun x h => H x (Array.Mem.mk h)⟩

/-- `O(1)`. "Attach" the proof that the elements of `xs` are in `xs` to produce a new array
with the same elements but in the type `{x // x ∈ xs}`. -/
@[inline] def attach (xs : Array α) : Array {x // x ∈ xs} := xs.attachWith _ fun _ => id

/--
`O(|join L|)`. `join L` concatenates all the arrays in `L` into one array.
* `join #[#[a], #[], #[b, c], #[d, e, f]] = #[a, b, c, d, e, f]`
Expand Down
5 changes: 0 additions & 5 deletions Batteries/Data/Char.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ Authors: Jannis Limperg
import Batteries.Data.UInt
import Batteries.Tactic.Alias

@[ext] theorem Char.ext : {a b : Char} → a.val = b.val → a = b
| ⟨_,_⟩, ⟨_,_⟩, rfl => rfl

theorem Char.ext_iff {x y : Char} : x = y ↔ x.val = y.val := ⟨congrArg _, Char.ext⟩

theorem Char.le_antisymm_iff {x y : Char} : x = y ↔ x ≤ y ∧ y ≤ x :=
Char.ext_iff.trans UInt32.le_antisymm_iff

Expand Down
1 change: 0 additions & 1 deletion Batteries/Data/HashMap/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Authors: Leonardo de Moura, Mario Carneiro
import Batteries.Data.AssocList
import Batteries.Data.Nat.Basic
import Batteries.Data.Array.Monadic
import Batteries.Classes.BEq

namespace Batteries.HashMap

Expand Down
10 changes: 5 additions & 5 deletions Batteries/Data/HashMap/WF.lean
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ theorem exists_of_update (self : Buckets α β) (i d h) :
∃ l₁ l₂, self.1.data = l₁ ++ self.1[i] :: l₂ ∧ List.length l₁ = i.toNat ∧
(self.update i d h).1.data = l₁ ++ d :: l₂ := by
simp only [Array.data_length, Array.ugetElem_eq_getElem, Array.getElem_eq_data_getElem]
exact List.exists_of_set' h
exact List.exists_of_set h

theorem update_update (self : Buckets α β) (i d d' h h') :
(self.update i d h).update i d' h' = self.update i d' h := by
Expand Down Expand Up @@ -95,11 +95,11 @@ where
· next H =>
refine (go (i+1) _ _ fun j hj => ?a).trans ?b <;> simp
· case a =>
simp [List.getD_eq_getElem?, List.getElem?_set, Option.map_eq_map]; split
simp [List.getD_eq_getElem?_getD, List.getElem?_set, Option.map_eq_map]; split
· cases source.data[j]? <;> rfl
· next H => exact hs _ (Nat.lt_of_le_of_ne (Nat.le_of_lt_succ hj) (Ne.symm H))
· case b =>
refine have ⟨l₁, l₂, h₁, _, eq⟩ := List.exists_of_set' H; eq ▸ ?_
refine have ⟨l₁, l₂, h₁, _, eq⟩ := List.exists_of_set H; eq ▸ ?_
rw [h₁]
simp only [Buckets.size_eq, List.map_append, List.map_cons, AssocList.toList,
List.length_nil, Nat.sum_append, Nat.sum_cons, Nat.zero_add, Array.data_length]
Expand Down Expand Up @@ -315,7 +315,7 @@ theorem WF.mapVal {α β γ} {f : α → β → γ} [BEq α] [Hashable α]
have ⟨h₁, h₂⟩ := H.out
simp only [Imp.mapVal, h₁, Buckets.mapVal, WF_iff]; refine ⟨?_, ?_, fun i h => ?_⟩
· simp only [Buckets.size, Array.map_data, List.map_map]; congr; funext l; simp
· simp only [Array.map_data, List.forall_mem_map_iff]
· simp only [Array.map_data, List.forall_mem_map]
simp only [AssocList.toList_mapVal, List.pairwise_map]
exact fun _ => h₂.1 _
· simp only [Array.size_map, AssocList.All, Array.getElem_map, AssocList.toList_mapVal,
Expand Down Expand Up @@ -361,7 +361,7 @@ theorem WF.filterMap {α β γ} {f : α → β → Option γ} [BEq α] [Hashable
simp only [Array.mapM_eq_mapM_data, bind, StateT.bind, H2, List.map_map, Nat.zero_add, g]
intro bk sz h e'; cases e'
refine .mk (by simp [Buckets.size]) ⟨?_, fun i h => ?_⟩
· simp only [List.forall_mem_map_iff, List.toList_toAssocList]
· simp only [List.forall_mem_map, List.toList_toAssocList]
refine fun l h => (List.pairwise_reverse.2 ?_).imp (mt PartialEquivBEq.symm)
have := H.out.2.1 _ h
rw [← List.pairwise_map (R := (¬ · == ·))] at this ⊢
Expand Down
1 change: 0 additions & 1 deletion Batteries/Data/List.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Batteries.Data.List.Basic
import Batteries.Data.List.Count
import Batteries.Data.List.EraseIdx
import Batteries.Data.List.Init.Attach
import Batteries.Data.List.Init.Lemmas
import Batteries.Data.List.Lemmas
import Batteries.Data.List.Pairwise
Expand Down
Loading

0 comments on commit 021e272

Please sign in to comment.