Skip to content

Commit a34a832

Browse files
committed
Merge branch 'master' into wojciech/extdtreemap_diff2
2 parents 8049f9a + e548fa4 commit a34a832

File tree

1,037 files changed

+170549
-110076
lines changed

Some content is hidden

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

1,037 files changed

+170549
-110076
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
4444
set(CADICAL_CXX c++)
4545
if (CADICAL_USE_CUSTOM_CXX)
4646
set(CADICAL_CXX ${CMAKE_CXX_COMPILER})
47-
set(CADICAL_CXXFLAGS "${LEAN_EXTRA_CXX_FLAGS}")
47+
# Use same platform flags as for Lean executables, in particular from `prepare-llvm-linux.sh`,
48+
# but not Lean-specific `LEAN_EXTRA_CXX_FLAGS` such as fsanitize.
49+
set(CADICAL_CXXFLAGS "${CMAKE_CXX_FLAGS}")
4850
set(CADICAL_LDFLAGS "-Wl,-rpath=\\$$ORIGIN/../lib")
4951
endif()
5052
find_program(CCACHE ccache)

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ if(LLVM AND ${STAGE} GREATER 0)
448448
# - In particular, `host/bin/llvm-config` produces flags like `-Lllvm-host/lib/libLLVM`, while
449449
# we need the path to be `-Lllvm/lib/libLLVM`. Thus, we perform this replacement here.
450450
string(REPLACE "llvm-host" "llvm" LEANSHARED_LINKER_FLAGS ${LEANSHARED_LINKER_FLAGS})
451-
string(REPLACE "llvm-host" "llvm" LEAN_EXTRA_CXX_FLAGS ${LEAN_EXTRA_CXX_FLAGS})
452-
message(VERBOSE "leanshared linker flags: '${LEANSHARED_LINKER_FLAGS}' | lean extra cxx flags '${LEAN_EXTR_CXX_FLAGS}'")
451+
string(REPLACE "llvm-host" "llvm" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
452+
message(VERBOSE "leanshared linker flags: '${LEANSHARED_LINKER_FLAGS}' | lean extra cxx flags '${CMAKE_CXX_FLAGS}'")
453453
endif()
454454

455455
# get rid of unused parts of C++ stdlib

src/Init/Data/Int/Basic.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ set_option bootstrap.genMatcherCode false in
278278
def decNonneg (m : @& Int) : Decidable (NonNeg m) :=
279279
match m with
280280
| ofNat m => isTrue <| NonNeg.mk m
281-
| -[_ +1] => isFalse <| fun h => nomatch h
281+
| -[i +1] => isFalse <| fun h =>
282+
have : ∀ j, (j = -[i +1]) → NonNeg j → False := fun _ hj hnn =>
283+
Int.NonNeg.casesOn (motive := fun j _ => j = -[i +1] → False) hnn
284+
(fun _ h => Int.noConfusion h) hj
285+
this -[i +1] rfl h
282286

283287
/-- Decides whether `a ≤ b`.
284288

src/Init/Data/List/Nat/Perm.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ theorem set_set_perm {as : List α} {i j : Nat} (h₁ : i < as.length) (h₂ : j
6060

6161
namespace Perm
6262

63-
/-- Variant of `List.Perm.take` specifying the the permutation is constant after `i` elementwise. -/
63+
/-- Variant of `List.Perm.take` specifying that the permutation is constant after `i` elementwise. -/
6464
theorem take_of_getElem? {l₁ l₂ : List α} (h : l₁ ~ l₂) {i : Nat} (w : ∀ j, i ≤ j → l₁[j]? = l₂[j]?) :
6565
l₁.take i ~ l₂.take i := by
6666
refine h.take (Perm.of_eq ?_)
6767
ext1 j
6868
simpa using w (i + j) (by omega)
6969

70-
/-- Variant of `List.Perm.drop` specifying the the permutation is constant before `i` elementwise. -/
70+
/-- Variant of `List.Perm.drop` specifying that the permutation is constant before `i` elementwise. -/
7171
theorem drop_of_getElem? {l₁ l₂ : List α} (h : l₁ ~ l₂) {i : Nat} (w : ∀ j, j < i → l₁[j]? = l₂[j]?) :
7272
l₁.drop i ~ l₂.drop i := by
7373
refine h.drop (Perm.of_eq ?_)

src/Init/Data/Slice/Notation.lean

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ prelude
99
public import Init.Data.Range.Polymorphic.PRange
1010

1111
set_option doc.verso true
12+
set_option linter.missingDocs true
1213

1314
public section
1415

@@ -30,6 +31,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
3031
The type of the resulting slices is {lit}`γ`.
3132
-/
3233
class Rcc.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
34+
/--
35+
Slices {name}`carrier` from {lean}`range.lower` to {lean}`range.upper`, both inclusive.
36+
-/
3337
mkSlice (carrier : α) (range : Rcc β) : γ
3438

3539
/--
@@ -39,6 +43,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
3943
The type of resulting the slices is {lit}`γ`.
4044
-/
4145
class Rco.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
46+
/--
47+
Slices {name}`carrier` from {lean}`range.lower` (inclusive) to {lean}`range.upper` (exclusive).
48+
-/
4249
mkSlice (carrier : α) (range : Rco β) : γ
4350

4451
/--
@@ -48,6 +55,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
4855
The type of the resulting slices is {lit}`γ`.
4956
-/
5057
class Rci.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
58+
/--
59+
Slices {name}`carrier` from {lean}`range.lower` (inclusive).
60+
-/
5161
mkSlice (carrier : α) (range : Rci β) : γ
5262

5363
/--
@@ -57,6 +67,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
5767
The type of the resulting slices is {lit}`γ`.
5868
-/
5969
class Roc.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
70+
/--
71+
Slices {name}`carrier` from {lean}`range.lower` (exclusive) to {lean}`range.upper` (inclusive).
72+
-/
6073
mkSlice (carrier : α) (range : Roc β) : γ
6174

6275
/--
@@ -66,6 +79,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
6679
The type of the resulting slices is {lit}`γ`.
6780
-/
6881
class Roo.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
82+
/--
83+
Slices {name}`carrier` from {lean}`range.lower` to {lean}`range.upper`, both exclusive.
84+
-/
6985
mkSlice (carrier : α) (range : Roo β) : γ
7086

7187
/--
@@ -75,6 +91,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
7591
The type of the resulting slices is {lit}`γ`.
7692
-/
7793
class Roi.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
94+
/--
95+
Slices {name}`carrier` from {lean}`range.lower` (exclusive).
96+
-/
7897
mkSlice (carrier : α) (range : Roi β) : γ
7998

8099
/--
@@ -84,6 +103,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
84103
The type of the resulting slices is {lit}`γ`.
85104
-/
86105
class Ric.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
106+
/--
107+
Slices {name}`carrier` up to {lean}`range.upper` (inclusive).
108+
-/
87109
mkSlice (carrier : α) (range : Ric β) : γ
88110

89111
/--
@@ -93,6 +115,9 @@ This typeclass indicates how to obtain slices of elements of {lit}`α` over rang
93115
The type of the resulting slices is {lit}`γ`.
94116
-/
95117
class Rio.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
118+
/--
119+
Slices {name}`carrier` up to {lean}`range.upper` (exclusive).
120+
-/
96121
mkSlice (carrier : α) (range : Rio β) : γ
97122

98123
/--
@@ -102,6 +127,9 @@ index type {lit}`β`.
102127
The type of the resulting slices is {lit}`γ`.
103128
-/
104129
class Rii.Sliceable (α : Type u) (β : outParam (Type v)) (γ : outParam (Type w)) where
130+
/--
131+
Slices {name}`carrier` with no bounds.
132+
-/
105133
mkSlice (carrier : α) (range : Rii β) : γ
106134

107135
macro_rules

src/Init/Data/String/Pattern/Pred.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ instance : Std.Iterators.Finite (ForwardCharPredSearcher p s) Id :=
7979
instance : Std.Iterators.IteratorLoop (ForwardCharPredSearcher p s) Id Id :=
8080
.defaultImplementation
8181

82+
@[default_instance]
8283
instance {p : Char → Bool} : ToForwardSearcher p (ForwardCharPredSearcher p) where
8384
toSearcher := iter p
8485

86+
@[default_instance]
8587
instance {p : Char → Bool} : ForwardPattern p := .defaultImplementation
8688

8789
instance {p : Char → Prop} [DecidablePred p] : ToForwardSearcher p (ForwardCharPredSearcher p) where
@@ -153,9 +155,11 @@ instance : Std.Iterators.Finite (BackwardCharPredSearcher s) Id :=
153155
instance : Std.Iterators.IteratorLoop (BackwardCharPredSearcher s) Id Id :=
154156
.defaultImplementation
155157

158+
@[default_instance]
156159
instance {p : Char → Bool} : ToBackwardSearcher p BackwardCharPredSearcher where
157160
toSearcher := iter p
158161

162+
@[default_instance]
159163
instance {p : Char → Bool} : BackwardPattern p := ToBackwardSearcher.defaultImplementation
160164

161165
instance {p : Char → Prop} [DecidablePred p] : ToBackwardSearcher p BackwardCharPredSearcher where

src/Init/Data/Sum/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public section
1313
/-!
1414
# Disjoint union of types
1515
16-
This file defines basic operations on the the sum type `α ⊕ β`.
16+
This file defines basic operations on the sum type `α ⊕ β`.
1717
1818
`α ⊕ β` is the type made of a copy of `α` and a copy of `β`. It is also called *disjoint union*.
1919

src/Init/GetElem.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ theorem getElem_of_getElem? [GetElem? cont idx elem dom] [LawfulGetElem cont idx
240240
{c : cont} {i : idx} [Decidable (dom c i)] (h : c[i]? = some e) : Exists fun h : dom c i => c[i] = e :=
241241
getElem?_eq_some_iff.mp h
242242

243+
theorem of_getElem_eq [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]
244+
{c : cont} {i : idx} [Decidable (dom c i)] {h} (_ : c[i] = e) : dom c i := h
245+
243246
@[simp] theorem some_getElem_eq_getElem?_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom]
244247
{c : cont} {i : idx} [Decidable (dom c i)] (h : dom c i):
245248
(some c[i] = c[i]?) ↔ True := by

src/Init/Grind/Config.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ structure Config where
202202
```
203203
-/
204204
funCC := true
205+
/--
206+
When `true`, use reducible transparency when trying to close goals.
207+
In this setting, only declarations marked with `@[reducible]` are unfolded during
208+
definitional equality tests.
209+
210+
This option does not affect the canonicalizer or how theorem patterns are internalized;
211+
reducible declarations are always unfolded in those contexts.
212+
-/
213+
reducible := true
205214
deriving Inhabited, BEq
206215

207216
/--

src/Init/Grind/Util.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,15 @@ See comment at `alreadyNorm`
122122
theorem em (p : Prop) : alreadyNorm p ∨ alreadyNorm (¬ p) :=
123123
Classical.em p
124124

125+
/--
126+
Marker for grind-solved subproofs in `exact? +grind` suggestions.
127+
When `exact?` uses grind as a discharger, it wraps the proof in this marker
128+
so that the unexpander can replace it with `(by grind)` in the suggestion.
129+
-/
130+
@[inline] def Marker {α : Sort u} (a : α) : α := a
131+
132+
@[app_unexpander Marker]
133+
meta def markerUnexpander : PrettyPrinter.Unexpander := fun _ => do
134+
`(by grind)
135+
125136
end Lean.Grind

0 commit comments

Comments
 (0)