Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bump/nightly-2024-04-22' into …
Browse files Browse the repository at this point in the history
…lean4-pr-3756
  • Loading branch information
FR-vdash-bot committed Apr 24, 2024
2 parents 3837547 + 4cc7203 commit f89639d
Show file tree
Hide file tree
Showing 49 changed files with 131 additions and 2,147 deletions.
1 change: 0 additions & 1 deletion Std.lean
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ import Std.Tactic.OpenPrivate
import Std.Tactic.PermuteGoals
import Std.Tactic.PrintDependents
import Std.Tactic.PrintPrefix
import Std.Tactic.Relation.Rfl
import Std.Tactic.SeqFocus
import Std.Tactic.ShowUnused
import Std.Tactic.SqueezeScope
Expand Down
5 changes: 0 additions & 5 deletions Std/Classes/BEq.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ class PartialEquivBEq (α) [BEq α] : Prop where
symm : (a : α) == b → b == a
/-- Transitivity for `BEq`. If `a == b` and `b == c` then `a == c`. -/
trans : (a : α) == b → b == c → a == c

@[simp] theorem beq_eq_false_iff_ne [BEq α] [LawfulBEq α]
(a b : α) : (a == b) = false ↔ a ≠ b := by
rw [ne_eq, ← beq_iff_eq a b]
cases a == b <;> decide
2 changes: 1 addition & 1 deletion Std/CodeAction/Attr.lean
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ initialize
if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
modifyEnv (tacticSeqCodeActionExt.addEntry · (decl, ← mkTacticSeqCodeAction decl))
else
let args ← args.mapM resolveGlobalConstNoOverloadWithInfo
let args ← args.mapM realizeGlobalConstNoOverloadWithInfo
if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
modifyEnv (tacticCodeActionExt.addEntry · (⟨decl, args⟩, ← mkTacticCodeAction decl))
| _ => pure ()
Expand Down
4 changes: 2 additions & 2 deletions Std/CodeAction/Deprecated.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def deprecatedCodeActionProvider : CodeActionProvider := fun params snap => do
let mut i := 0
let doc ← readDoc
let mut msgs := #[]
for diag in snap.interactiveDiags do
if let some #[.deprecated] := diag.tags? then
for m in snap.msgLog.msgs do
if m.data.isDeprecationWarning then
if h : _ then
msgs := msgs.push (snap.cmdState.messages.msgs[i])
i := i + 1
Expand Down
8 changes: 4 additions & 4 deletions Std/Data/Array/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ namespace Subarray
The empty subarray.
-/
protected def empty : Subarray α where
as := #[]
array := #[]
start := 0
stop := 0
h₁ := Nat.le_refl 0
h₂ := Nat.le_refl 0
start_le_stop := Nat.le_refl 0
stop_le_array_size := Nat.le_refl 0

instance : EmptyCollection (Subarray α) :=
⟨Subarray.empty⟩
Expand Down Expand Up @@ -198,7 +198,7 @@ def popHead? (as : Subarray α) : Option (α × Subarray α) :=
let tail :=
{ as with
start := as.start + 1
h₁ := Nat.le_of_lt_succ $ Nat.succ_lt_succ h }
start_le_stop := Nat.le_of_lt_succ $ Nat.succ_lt_succ h }
some (head, tail)
else
none
Expand Down
25 changes: 12 additions & 13 deletions Std/Data/Array/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Gabriel Ebner
-/
import Std.Data.Nat.Lemmas
import Std.Data.List.Lemmas
import Std.Data.Array.Init.Lemmas
import Std.Data.Array.Basic
Expand All @@ -20,12 +19,6 @@ import Std.Util.ProofWanted
@[simp] theorem getElem!_fin [GetElem Cont Nat Elem Dom] (a : Cont) (i : Fin n)
[Decidable (Dom a i)] [Inhabited Elem] : a[i]! = a[i.1]! := rfl

theorem getElem?_pos [GetElem Cont Idx Elem Dom]
(a : Cont) (i : Idx) (h : Dom a i) [Decidable (Dom a i)] : a[i]? = a[i] := dif_pos h

theorem getElem?_neg [GetElem Cont Idx Elem Dom]
(a : Cont) (i : Idx) (h : ¬Dom a i) [Decidable (Dom a i)] : a[i]? = none := dif_neg h

@[simp] theorem mkArray_data (n : Nat) (v : α) : (mkArray n v).data = List.replicate n v := rfl

@[simp] theorem getElem_mkArray (n : Nat) (v : α) (h : i < (mkArray n v).size) :
Expand Down Expand Up @@ -93,13 +86,19 @@ theorem get?_push_eq (a : Array α) (x : α) : (a.push x)[a.size]? = some x := b
rw [getElem?_pos, get_push_eq]

theorem get?_push {a : Array α} : (a.push x)[i]? = if i = a.size then some x else a[i]? := by
split
. next heq => rw [heq, getElem?_pos, get_push_eq]
· next hne =>
match Nat.lt_trichotomy i a.size with
| Or.inl g =>
have h1 : i < a.size + 1 := by omega
have h2 : i ≠ a.size := by omega
simp [getElem?, size_push, g, h1, h2, get_push_lt]
| Or.inr (Or.inl heq) =>
simp [heq, getElem?_pos, get_push_eq]
| Or.inr (Or.inr g) =>
simp only [getElem?, size_push]
split <;> split <;> try simp only [*, get_push_lt]
· next p q => exact Or.elim (Nat.eq_or_lt_of_le (Nat.le_of_lt_succ p)) hne q
· next p q => exact p (Nat.lt.step q)
have h1 : ¬ (i < a.size) := by omega
have h2 : ¬ (i < a.size + 1) := by omega
have h3 : i ≠ a.size := by omega
simp [h1, h2, h3]

@[simp] theorem get?_size {a : Array α} : a[a.size]? = none := by
simp only [getElem?, Nat.lt_irrefl, dite_false]
Expand Down
1 change: 0 additions & 1 deletion Std/Data/Array/Match.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Copyright (c) 2023 F. G. Dorais. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: F. G. Dorais
-/
import Std.Data.Nat.Lemmas

namespace Array

Expand Down
2 changes: 0 additions & 2 deletions Std/Data/Array/Merge.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/

import Std.Data.Nat.Lemmas

namespace Array

/--
Expand Down
1 change: 0 additions & 1 deletion Std/Data/BinomialHeap/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: Leonardo de Moura, Jannis Limperg, Mario Carneiro
-/
import Std.Classes.Order
import Std.Control.ForInStep.Basic
import Std.Data.Nat.Lemmas

namespace Std
namespace BinomialHeap
Expand Down
5 changes: 1 addition & 4 deletions Std/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joe Hendrix
-/
import Std.Data.Bool
import Std.Data.Fin.Lemmas
import Std.Data.Nat.Lemmas
import Std.Util.ProofWanted
import Std.Tactic.Alias

namespace BitVec

Expand Down
1 change: 1 addition & 0 deletions Std/Data/ByteArray.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright (c) 2023 François G. Dorais. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: François G. Dorais
-/
import Std.Data.Array.Init.Lemmas
import Std.Data.Array.Lemmas

namespace ByteArray
Expand Down
2 changes: 1 addition & 1 deletion Std/Data/HashMap/WF.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
import Std.Data.HashMap.Basic
import Std.Data.List.Lemmas
import Std.Data.Array.Lemmas
import Std.Data.Nat.Lemmas

namespace Std.HashMap
namespace Imp
Expand Down
1 change: 0 additions & 1 deletion Std/Data/Int.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Std.Data.Int.DivMod
import Std.Data.Int.Gcd
import Std.Data.Int.Lemmas
import Std.Data.Int.Order
Loading

0 comments on commit f89639d

Please sign in to comment.