Skip to content

Commit 9f39872

Browse files
committed
Merge remote-tracking branch 'upstream/new_codegen' into decidable-as-bool
2 parents 0660e69 + 3347096 commit 9f39872

File tree

250 files changed

+18062
-18810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+18062
-18810
lines changed

src/Init/ByCases.lean

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,3 @@ theorem apply_ite (f : α → β) (P : Prop) [Decidable P] (x y : α) :
4242
/-- A `dite` whose results do not actually depend on the condition may be reduced to an `ite`. -/
4343
@[simp] theorem dite_eq_ite [Decidable P] :
4444
(dite P (fun _ => a) (fun _ => b)) = ite P a b := rfl
45-
46-
@[deprecated "Use `ite_eq_right_iff`" (since := "2024-09-18")]
47-
theorem ite_some_none_eq_none [Decidable P] :
48-
(if P then some x else none) = none ↔ ¬ P := by
49-
simp only [ite_eq_right_iff, reduceCtorEq]
50-
rfl
51-
52-
@[deprecated "Use `Option.ite_none_right_eq_some`" (since := "2024-09-18")]
53-
theorem ite_some_none_eq_some [Decidable P] :
54-
(if P then some x else none) = some y ↔ P ∧ x = y := by
55-
split <;> simp_all
56-
57-
@[deprecated "Use `dite_eq_right_iff" (since := "2024-09-18")]
58-
theorem dite_some_none_eq_none [Decidable P] {x : P → α} :
59-
(if h : P then some (x h) else none) = none ↔ ¬P := by
60-
simp
61-
62-
@[deprecated "Use `Option.dite_none_right_eq_some`" (since := "2024-09-18")]
63-
theorem dite_some_none_eq_some [Decidable P] {x : P → α} {y : α} :
64-
(if h : P then some (x h) else none) = some y ↔ ∃ h : P, x h = y := by
65-
by_cases h : P <;> simp [h]

src/Init/Core.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ theorem Function.comp_def {α β δ} (f : β → δ) (g : α → β) : f ∘ g =
5151
@[simp] theorem Function.false_comp {f : α → β} : ((fun _ => false) ∘ f) = fun _ => false := by
5252
rfl
5353

54+
@[simp] theorem Function.comp_id (f : α → β) : f ∘ id = f := rfl
55+
@[simp] theorem Function.id_comp (f : α → β) : id ∘ f = f := rfl
56+
5457
attribute [simp] namedPattern
5558

5659
/--
@@ -2522,9 +2525,6 @@ class Antisymm (r : α → α → Prop) : Prop where
25222525
/-- An antisymmetric relation `r` satisfies `r a b → r b a → a = b`. -/
25232526
antisymm (a b : α) : r a b → r b a → a = b
25242527

2525-
@[deprecated Antisymm (since := "2024-10-16"), inherit_doc Antisymm]
2526-
abbrev _root_.Antisymm (r : α → α → Prop) : Prop := Std.Antisymm r
2527-
25282528
/-- `Asymm X r` means that the binary relation `r` on `X` is asymmetric, that is,
25292529
`r a b → ¬ r b a`. -/
25302530
class Asymm (r : α → α → Prop) : Prop where

src/Init/Data/Array/Basic.lean

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ variable {α : Type u}
3636

3737
namespace Array
3838

39-
@[deprecated toList (since := "2024-09-10")] abbrev data := @toList
40-
4139
/-! ### Preliminary theorems -/
4240

4341
@[simp, grind] theorem size_set {xs : Array α} {i : Nat} {v : α} (h : i < xs.size) :
@@ -148,8 +146,6 @@ namespace Array
148146

149147
theorem size_eq_length_toList {xs : Array α} : xs.size = xs.toList.length := rfl
150148

151-
@[deprecated toList_toArray (since := "2024-09-09")] abbrev data_toArray := @List.toList_toArray
152-
153149
/-! ### Externs -/
154150

155151
/--
@@ -1487,8 +1483,6 @@ The resulting arrays are appended.
14871483
def flatMapM [Monad m] (f : α → m (Array β)) (as : Array α) : m (Array β) :=
14881484
as.foldlM (init := empty) fun bs a => do return bs ++ (← f a)
14891485

1490-
@[deprecated flatMapM (since := "2024-10-16")] abbrev concatMapM := @flatMapM
1491-
14921486
/--
14931487
Applies a function that returns an array to each element of an array. The resulting arrays are
14941488
appended.
@@ -1501,8 +1495,6 @@ Examples:
15011495
def flatMap (f : α → Array β) (as : Array α) : Array β :=
15021496
as.foldl (init := empty) fun bs a => bs ++ f a
15031497

1504-
@[deprecated flatMap (since := "2024-10-16")] abbrev concatMap := @flatMap
1505-
15061498
/--
15071499
Appends the contents of array of arrays into a single array. The resulting array contains the same
15081500
elements as the nested arrays in the same order.

src/Init/Data/Array/Bootstrap.lean

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -159,34 +159,4 @@ theorem foldl_eq_foldl_toList {f : β → α → β} {init : β} {xs : Array α}
159159
xs.foldl f init = xs.toList.foldl f init:= by
160160
simp
161161

162-
@[deprecated foldlM_toList (since := "2024-09-09")]
163-
abbrev foldlM_eq_foldlM_data := @foldlM_toList
164-
165-
@[deprecated foldl_toList (since := "2024-09-09")]
166-
abbrev foldl_eq_foldl_data := @foldl_toList
167-
168-
@[deprecated foldrM_eq_reverse_foldlM_toList (since := "2024-09-09")]
169-
abbrev foldrM_eq_reverse_foldlM_data := @foldrM_eq_reverse_foldlM_toList
170-
171-
@[deprecated foldrM_toList (since := "2024-09-09")]
172-
abbrev foldrM_eq_foldrM_data := @foldrM_toList
173-
174-
@[deprecated foldr_toList (since := "2024-09-09")]
175-
abbrev foldr_eq_foldr_data := @foldr_toList
176-
177-
@[deprecated push_toList (since := "2024-09-09")]
178-
abbrev push_data := @push_toList
179-
180-
@[deprecated toListImpl_eq (since := "2024-09-09")]
181-
abbrev toList_eq := @toListImpl_eq
182-
183-
@[deprecated pop_toList (since := "2024-09-09")]
184-
abbrev pop_data := @toList_pop
185-
186-
@[deprecated toList_append (since := "2024-09-09")]
187-
abbrev append_data := @toList_append
188-
189-
@[deprecated toList_appendList (since := "2024-09-09")]
190-
abbrev appendList_data := @toList_appendList
191-
192162
end Array

src/Init/Data/Array/Lemmas.lean

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,11 +4704,6 @@ theorem get!_eq_getD_getElem? [Inhabited α] (xs : Array α) (i : Nat) :
47044704
set_option linter.deprecated false in
47054705
@[deprecated get!_eq_getD_getElem? (since := "2025-02-12")] abbrev get!_eq_getElem? := @get!_eq_getD_getElem?
47064706

4707-
4708-
@[deprecated mem_of_back? (since := "2024-10-21")] abbrev mem_of_back?_eq_some := @mem_of_back?
4709-
4710-
@[deprecated getElem?_size_le (since := "2024-10-21")] abbrev get?_len_le := @getElem?_size_le
4711-
47124707
set_option linter.deprecated false in
47134708
@[deprecated "`Array.get?` is deprecated, use `a[i]?` instead." (since := "2025-02-12")]
47144709
theorem get?_eq_get?_toList (xs : Array α) (i : Nat) : xs.get? i = xs.toList.get? i := by
@@ -4717,45 +4712,11 @@ theorem get?_eq_get?_toList (xs : Array α) (i : Nat) : xs.get? i = xs.toList.ge
47174712
set_option linter.deprecated false in
47184713
@[deprecated get!_eq_getD_getElem? (since := "2025-02-12")] abbrev get!_eq_get? := @get!_eq_getD_getElem?
47194714

4720-
@[deprecated getElem?_push_lt (since := "2024-10-21")] abbrev get?_push_lt := @getElem?_push_lt
4721-
4722-
@[deprecated getElem?_push_eq (since := "2024-10-21")] abbrev get?_push_eq := @getElem?_push_eq
4723-
4724-
@[deprecated getElem?_push (since := "2024-10-21")] abbrev get?_push := @getElem?_push
4725-
4726-
@[deprecated getElem?_size (since := "2024-10-21")] abbrev get?_size := @getElem?_size
4727-
47284715
@[deprecated getElem_set_self (since := "2025-01-17")]
47294716
theorem get_set_eq (xs : Array α) (i : Nat) (v : α) (h : i < xs.size) :
47304717
(xs.set i v h)[i]'(by simp [h]) = v := by
47314718
simp only [set, ← getElem_toList, List.getElem_set_self]
47324719

4733-
@[deprecated foldl_toList_eq_flatMap (since := "2024-10-16")]
4734-
abbrev foldl_toList_eq_bind := @foldl_toList_eq_flatMap
4735-
4736-
@[deprecated foldl_toList_eq_flatMap (since := "2024-10-16")]
4737-
abbrev foldl_data_eq_bind := @foldl_toList_eq_flatMap
4738-
4739-
@[deprecated getElem_mem (since := "2024-10-17")]
4740-
abbrev getElem?_mem := @getElem_mem
4741-
4742-
@[deprecated getElem_fin_eq_getElem_toList (since := "2024-10-17")]
4743-
abbrev getElem_fin_eq_toList_get := @getElem_fin_eq_getElem_toList
4744-
4745-
@[deprecated "Use reverse direction of `getElem?_toList`" (since := "2024-10-17")]
4746-
abbrev getElem?_eq_toList_getElem? := @getElem?_toList
4747-
4748-
@[deprecated getElem?_swap (since := "2024-10-17")] abbrev get?_swap := @getElem?_swap
4749-
4750-
@[deprecated getElem_push (since := "2024-10-21")] abbrev get_push := @getElem_push
4751-
@[deprecated getElem_push_lt (since := "2024-10-21")] abbrev get_push_lt := @getElem_push_lt
4752-
@[deprecated getElem_push_eq (since := "2024-10-21")] abbrev get_push_eq := @getElem_push_eq
4753-
4754-
@[deprecated back!_eq_back? (since := "2024-10-31")] abbrev back_eq_back? := @back!_eq_back?
4755-
@[deprecated back!_push (since := "2024-10-31")] abbrev back_push := @back!_push
4756-
@[deprecated eq_push_pop_back!_of_size_ne_zero (since := "2024-10-31")]
4757-
abbrev eq_push_pop_back_of_size_ne_zero := @eq_push_pop_back!_of_size_ne_zero
4758-
47594720
@[deprecated set!_is_setIfInBounds (since := "2024-11-24")] abbrev set_is_setIfInBounds := @set!_eq_setIfInBounds
47604721
@[deprecated size_setIfInBounds (since := "2024-11-24")] abbrev size_setD := @size_setIfInBounds
47614722
@[deprecated getElem_setIfInBounds_eq (since := "2024-11-24")] abbrev getElem_setD_eq := @getElem_setIfInBounds_self

src/Init/Data/BEq.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EquivBEq (α) [BEq α] : Prop extends PartialEquivBEq α, ReflBEq α
2727
theorem BEq.symm [BEq α] [PartialEquivBEq α] {a b : α} : a == b → b == a :=
2828
PartialEquivBEq.symm
2929

30-
theorem BEq.comm [BEq α] [PartialEquivBEq α] {a b : α} : (a == b) = (b == a) :=
30+
@[grind] theorem BEq.comm [BEq α] [PartialEquivBEq α] {a b : α} : (a == b) = (b == a) :=
3131
Bool.eq_iff_iff.2 ⟨BEq.symm, BEq.symm⟩
3232

3333
theorem bne_comm [BEq α] [PartialEquivBEq α] {a b : α} : (a != b) = (b != a) := by

src/Init/Data/BitVec/Basic.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ with `BitVec.toInt` results in the value `i.bmod (2^n)`.
150150
protected def ofInt (n : Nat) (i : Int) : BitVec n := .ofNatLT (i % (Int.ofNat (2^n))).toNat (by
151151
apply (Int.toNat_lt _).mpr
152152
· apply Int.emod_lt_of_pos
153-
exact Int.ofNat_pos.mpr (Nat.two_pow_pos _)
153+
exact Int.natCast_pos.mpr (Nat.two_pow_pos _)
154154
· apply Int.emod_nonneg
155155
intro eq
156156
apply Nat.ne_of_gt (Nat.two_pow_pos n)
@@ -436,8 +436,6 @@ def setWidth' {n w : Nat} (le : n ≤ w) (x : BitVec n) : BitVec w :=
436436
apply Nat.lt_of_lt_of_le x.isLt
437437
exact Nat.pow_le_pow_right (by trivial) le)
438438

439-
@[deprecated setWidth' (since := "2024-09-18"), inherit_doc setWidth'] abbrev zeroExtend' := @setWidth'
440-
441439
/--
442440
Returns `zeroExtend (w+n) x <<< n` without needing to compute `x % 2^(2+n)`.
443441
-/

src/Init/Data/BitVec/Bitblast.lean

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ theorem msb_neg {w : Nat} {x : BitVec w} :
516516
rw [(show w = w - 1 + 1 by omega), Int.pow_succ] at this
517517
omega
518518

519-
@[simp] theorem BitVec.setWidth_neg_of_le {x : BitVec v} (h : w ≤ v) : BitVec.setWidth w (-x) = -BitVec.setWidth w x := by
519+
@[simp] theorem setWidth_neg_of_le {x : BitVec v} (h : w ≤ v) : BitVec.setWidth w (-x) = -BitVec.setWidth w x := by
520520
simp [← BitVec.signExtend_eq_setWidth_of_le _ h, BitVec.signExtend_neg_of_le h]
521521

522522
/-! ### abs -/
@@ -668,11 +668,6 @@ theorem setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow (x : BitVec w) (i
668668
getLsbD_zero, and_eq_false_imp, and_eq_true, decide_eq_true_eq, and_imp]
669669
by_cases hi : x.getLsbD i <;> simp [hi] <;> omega
670670

671-
@[deprecated setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow (since := "2024-09-18"),
672-
inherit_doc setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow]
673-
abbrev zeroExtend_truncate_succ_eq_zeroExtend_truncate_add_twoPow :=
674-
@setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow
675-
676671
/--
677672
Recurrence lemma: multiplying `x` with the first `s` bits of `y` is the
678673
same as truncating `y` to `s` bits, then zero extending to the original length,
@@ -699,10 +694,6 @@ theorem mulRec_eq_mul_signExtend_setWidth (x y : BitVec w) (s : Nat) :
699694
by_cases hy : y.getLsbD (s' + 1) <;> simp [hy]
700695
rw [heq, ← BitVec.mul_add, ← setWidth_setWidth_succ_eq_setWidth_setWidth_add_twoPow]
701696

702-
@[deprecated mulRec_eq_mul_signExtend_setWidth (since := "2024-09-18"),
703-
inherit_doc mulRec_eq_mul_signExtend_setWidth]
704-
abbrev mulRec_eq_mul_signExtend_truncate := @mulRec_eq_mul_signExtend_setWidth
705-
706697
theorem getLsbD_mul (x y : BitVec w) (i : Nat) :
707698
(x * y).getLsbD i = (mulRec x y w).getLsbD i := by
708699
simp only [mulRec_eq_mul_signExtend_setWidth]

0 commit comments

Comments
 (0)