Skip to content

Commit de6aeda

Browse files
committed
Merge remote-tracking branch 'upstream/nightly-with-mathlib' into improve-ord-api
2 parents 29fc46b + efe2ab4 commit de6aeda

File tree

620 files changed

+232430
-191509
lines changed

Some content is hidden

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

620 files changed

+232430
-191509
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ add_custom_target(make_stdlib ALL
689689
# The actual rule is in a separate makefile because we want to prefix it with '+' to use the Make job server
690690
# for a parallelized nested build, but CMake doesn't let us do that.
691691
# We use `lean` from the previous stage, but `leanc`, headers, etc. from the current stage
692-
COMMAND $(MAKE) -f ${CMAKE_BINARY_DIR}/stdlib.make Init Std Lean
692+
COMMAND $(MAKE) -f ${CMAKE_BINARY_DIR}/stdlib.make Init Std Lean Leanc
693693
VERBATIM)
694694

695695
# if we have LLVM enabled, then build `lean.h.bc` which has the LLVM bitcode
@@ -768,7 +768,7 @@ if(${STAGE} GREATER 0 AND EXISTS ${LEAN_SOURCE_DIR}/Leanc.lean AND NOT ${CMAKE_S
768768
add_custom_target(leanc ALL
769769
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/leanc
770770
DEPENDS leanshared
771-
COMMAND $(MAKE) -f ${CMAKE_BINARY_DIR}/stdlib.make Leanc
771+
COMMAND $(MAKE) -f ${CMAKE_BINARY_DIR}/stdlib.make leanc
772772
VERBATIM)
773773
endif()
774774

@@ -823,7 +823,6 @@ endif()
823823

824824
# Escape for `make`. Yes, twice.
825825
string(REPLACE "$" "\\\$$" CMAKE_EXE_LINKER_FLAGS_MAKE "${CMAKE_EXE_LINKER_FLAGS}")
826-
string(REPLACE "$" "$$" CMAKE_EXE_LINKER_FLAGS_MAKE_MAKE "${CMAKE_EXE_LINKER_FLAGS_MAKE}")
827826
configure_file(${LEAN_SOURCE_DIR}/stdlib.make.in ${CMAKE_BINARY_DIR}/stdlib.make)
828827

829828
# hacky

src/Init/Classical.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ noncomputable def epsilon {α : Sort u} [h : Nonempty α] (p : α → Prop) : α
107107
theorem epsilon_spec_aux {α : Sort u} (h : Nonempty α) (p : α → Prop) : (∃ y, p y) → p (@epsilon α h p) :=
108108
(strongIndefiniteDescription p h).property
109109

110-
theorem epsilon_spec {α : Sort u} {p : α → Prop} (hex : ∃ y, p y) : p (@epsilon α (nonempty_of_exists hex) p) :=
111-
epsilon_spec_aux (nonempty_of_exists hex) p hex
110+
theorem epsilon_spec {α : Sort u} {p : α → Prop} (hex : ∃ y, p y) : p (@epsilon α hex.nonempty p) :=
111+
epsilon_spec_aux hex.nonempty p hex
112112

113113
theorem epsilon_singleton {α : Sort u} (x : α) : @epsilon α ⟨x⟩ (fun y => y = x) = x :=
114114
@epsilon_spec α (fun y => y = x) ⟨x, rfl⟩

src/Init/Core.lean

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,10 +1212,7 @@ abbrev noConfusionEnum {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f :
12121212
instance : Inhabited Prop where
12131213
default := True
12141214

1215-
deriving instance Inhabited for NonScalar, PNonScalar, True, ForInStep
1216-
1217-
theorem nonempty_of_exists {α : Sort u} {p : α → Prop} : Exists (fun x => p x) → Nonempty α
1218-
| ⟨w, _⟩ => ⟨w⟩
1215+
deriving instance Inhabited for NonScalar, PNonScalar, True
12191216

12201217
/-! # Subsingleton -/
12211218

@@ -1389,16 +1386,7 @@ instance Sum.nonemptyLeft [h : Nonempty α] : Nonempty (Sum α β) :=
13891386
instance Sum.nonemptyRight [h : Nonempty β] : Nonempty (Sum α β) :=
13901387
Nonempty.elim h (fun b => ⟨Sum.inr b⟩)
13911388

1392-
instance {α : Type u} {β : Type v} [DecidableEq α] [DecidableEq β] : DecidableEq (Sum α β) := fun a b =>
1393-
match a, b with
1394-
| Sum.inl a, Sum.inl b =>
1395-
if h : a = b then isTrue (h ▸ rfl)
1396-
else isFalse fun h' => Sum.noConfusion h' fun h' => absurd h' h
1397-
| Sum.inr a, Sum.inr b =>
1398-
if h : a = b then isTrue (h ▸ rfl)
1399-
else isFalse fun h' => Sum.noConfusion h' fun h' => absurd h' h
1400-
| Sum.inr _, Sum.inl _ => isFalse fun h => Sum.noConfusion h
1401-
| Sum.inl _, Sum.inr _ => isFalse fun h => Sum.noConfusion h
1389+
deriving instance DecidableEq for Sum
14021390

14031391
end
14041392

src/Init/Data/Array/Lex/Lemmas.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ namespace Array
2323
@[simp, grind =] theorem lt_toList [LT α] {xs ys : Array α} : xs.toList < ys.toList ↔ xs < ys := Iff.rfl
2424
@[simp, grind =] theorem le_toList [LT α] {xs ys : Array α} : xs.toList ≤ ys.toList ↔ xs ≤ ys := Iff.rfl
2525

26-
protected theorem not_lt_iff_ge [LT α] {l₁ l₂ : List α} : ¬ l₁ < l₂l₂l₁ := Iff.rfl
27-
protected theorem not_le_iff_gt [DecidableEq α] [LT α] [DecidableLT α] {l₁ l₂ : List α} :
28-
¬ l₁l₂l₂ < l₁ :=
26+
protected theorem not_lt_iff_ge [LT α] {xs ys : Array α} : ¬ xs < ysysxs := Iff.rfl
27+
protected theorem not_le_iff_gt [DecidableEq α] [LT α] [DecidableLT α] {xs ys : Array α} :
28+
¬ xsysys < xs :=
2929
Decidable.not_not
3030

3131
@[simp] theorem lex_empty [BEq α] {lt : α → α → Bool} {xs : Array α} : xs.lex #[] lt = false := by

src/Init/Data/Array/OfFn.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ theorem ofFn_succ {f : Fin (n+1) → α} :
2626
ofFn f = (ofFn (fun (i : Fin n) => f i.castSucc)).push (f ⟨n, by omega⟩) := by
2727
ext i h₁ h₂
2828
· simp
29-
· simp [getElem_push]
30-
split <;> rename_i h₃
31-
· rfl
32-
· congr
33-
simp at h₁ h₂
34-
omega
29+
· simp only [getElem_ofFn, getElem_push, size_ofFn, Fin.castSucc_mk, left_eq_dite_iff,
30+
Nat.not_lt]
31+
simp only [size_ofFn] at h₁
32+
intro h₃
33+
simp only [show i = n by omega]
3534

3635
@[simp] theorem _root_.List.toArray_ofFn {f : Fin n → α} : (List.ofFn f).toArray = Array.ofFn f := by
3736
ext <;> simp

src/Init/Data/BitVec/Lemmas.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ theorem msb_sshiftRight {n : Nat} {x : BitVec w} :
22612261
theorem sshiftRight_add {x : BitVec w} {m n : Nat} :
22622262
x.sshiftRight (m + n) = (x.sshiftRight m).sshiftRight n := by
22632263
ext i
2264-
simp [getElem_sshiftRight, getLsbD_sshiftRight, Nat.add_assoc]
2264+
simp only [getElem_sshiftRight, Nat.add_assoc, msb_sshiftRight, dite_eq_ite]
22652265
by_cases h₂ : n + i < w
22662266
· simp [h₂]
22672267
· simp only [h₂, ↓reduceIte]

src/Init/Data/Float.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ This function does not reduce in the kernel. It is compiled to the C inequality
161161
match a, b with
162162
| ⟨a⟩, ⟨b⟩ => floatSpec.decLe a b
163163

164-
instance floatDecLt (a b : Float) : Decidable (a < b) := Float.decLt a b
165-
instance floatDecLe (a b : Float) : Decidable (a ≤ b) := Float.decLe a b
164+
attribute [instance] Float.decLt Float.decLe
166165

167166
/--
168167
Converts a floating-point number to a string.

src/Init/Data/Float32.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Compares two floating point numbers for strict inequality.
145145
146146
This function does not reduce in the kernel. It is compiled to the C inequality operator.
147147
-/
148-
@[extern "lean_float32_decLt"] opaque Float32.decLt (a b : Float32) : Decidable (a < b) :=
148+
@[extern "lean_float32_decLt", instance] opaque Float32.decLt (a b : Float32) : Decidable (a < b) :=
149149
match a, b with
150150
| ⟨a⟩, ⟨b⟩ => float32Spec.decLt a b
151151

@@ -154,13 +154,10 @@ Compares two floating point numbers for non-strict inequality.
154154
155155
This function does not reduce in the kernel. It is compiled to the C inequality operator.
156156
-/
157-
@[extern "lean_float32_decLe"] opaque Float32.decLe (a b : Float32) : Decidable (a ≤ b) :=
157+
@[extern "lean_float32_decLe", instance] opaque Float32.decLe (a b : Float32) : Decidable (a ≤ b) :=
158158
match a, b with
159159
| ⟨a⟩, ⟨b⟩ => float32Spec.decLe a b
160160

161-
instance float32DecLt (a b : Float32) : Decidable (a < b) := Float32.decLt a b
162-
instance float32DecLe (a b : Float32) : Decidable (a ≤ b) := Float32.decLe a b
163-
164161
/--
165162
Converts a floating-point number to a string.
166163

src/Init/Data/Hashable.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ instance : Hashable UInt64 where
5757
instance : Hashable USize where
5858
hash n := n.toUInt64
5959

60-
instance : Hashable ByteArray where
61-
hash as := as.foldl (fun r a => mixHash r (hash a)) 7
62-
6360
instance : Hashable (Fin n) where
6461
hash v := v.val.toUInt64
6562

src/Init/Data/Int/LemmasAux.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ theorem toNat_lt_toNat {n m : Int} (hn : 0 < m) : n.toNat < m.toNat ↔ n < m :=
121121
/-! ### min and max -/
122122

123123
@[simp] protected theorem min_assoc : ∀ (a b c : Int), min (min a b) c = min a (min b c) := by omega
124-
instance : Std.Associative (α := Nat) min := ⟨Nat.min_assoc⟩
124+
instance : Std.Associative (α := Int) min := ⟨Int.min_assoc⟩
125125

126126
@[simp] protected theorem min_self_assoc {m n : Int} : min m (min m n) = min m n := by
127127
rw [← Int.min_assoc, Int.min_self]
@@ -130,7 +130,7 @@ instance : Std.Associative (α := Nat) min := ⟨Nat.min_assoc⟩
130130
rw [Int.min_comm m n, ← Int.min_assoc, Int.min_self]
131131

132132
@[simp] protected theorem max_assoc (a b c : Int) : max (max a b) c = max a (max b c) := by omega
133-
instance : Std.Associative (α := Nat) max := ⟨Nat.max_assoc⟩
133+
instance : Std.Associative (α := Int) max := ⟨Int.max_assoc⟩
134134

135135
@[simp] protected theorem max_self_assoc {m n : Int} : max m (max m n) = max m n := by
136136
rw [← Int.max_assoc, Int.max_self]

0 commit comments

Comments
 (0)