Skip to content

Commit f120792

Browse files
chore: bump to 2025-06-05
Also reduce warnings count
1 parent 52403cd commit f120792

15 files changed

+95
-53
lines changed

Manual/Classes.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ set_option pp.rawOnError true
2626

2727
set_option linter.unusedVariables false
2828

29-
3029
set_option maxRecDepth 100000
3130
#doc (Manual) "Type Classes" =>
3231
%%%
@@ -269,7 +268,7 @@ def Heap.bubbleUp [Ord α] (i : Nat) (xs : Heap α) : Heap α :=
269268
else
270269
let j := i / 2
271270
if Ord.compare xs.contents[i] xs.contents[j] == .lt then
272-
Heap.bubbleUp j {xs with contents := xs.contents.swap i j}
271+
Heap.bubbleUp j { xs with contents := xs.contents.swap i j }
273272
else xs
274273

275274
def Heap.insert [Ord α] (x : α) (xs : Heap α) : Heap α :=

Manual/Elaboration.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ example (b : B) : ⟨b.1, b.2⟩ = b := rfl
185185
error: type mismatch
186186
rfl
187187
has type
188-
?m.848 = ?m.848 : Prop
188+
?m.854 = ?m.854 : Prop
189189
but is expected to have type
190190
e1 = e2 : Prop
191191
-/

Manual/Language/InductiveTypes.lean

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,9 @@ mutual
582582
inductive FreshList (α : Type) (r : α → α → Prop) : Type where
583583
| nil : FreshList α r
584584
| cons (x : α) (xs : FreshList α r) (fresh : Fresh r x xs)
585-
inductive Fresh (r : α → FreshList α → Prop) : α → FreshList α r → Prop where
585+
inductive Fresh
586+
(r : α → FreshList α → Prop) :
587+
α → FreshList α r → Prop where
586588
| nil : Fresh r x .nil
587589
| cons : r x y → (f : Fresh r x ys) → Fresh r x (.cons y ys f)
588590
end
@@ -659,11 +661,16 @@ These mutually-inductive types are a somewhat complicated way to represent run-l
659661
mutual
660662
inductive RLE : List α → Type where
661663
| nil : RLE []
662-
| run (x : α) (n : Nat) : n ≠ 0 → PrefixRunOf n x xs ys → RLE ys → RLE xs
664+
| run (x : α) (n : Nat) :
665+
n ≠ 0 → PrefixRunOf n x xs ys → RLE ys → RLE xs
663666

664667
inductive PrefixRunOf : Nat → α → List α → List α → Type where
665-
| zero (noMore : ¬∃zs, xs = x :: zs := by simp) : PrefixRunOf 0 x xs xs
666-
| succ : PrefixRunOf n x xs ys → PrefixRunOf (n + 1) x (x :: xs) ys
668+
| zero
669+
(noMore : ¬∃zs, xs = x :: zs := by simp) :
670+
PrefixRunOf 0 x xs xs
671+
| succ :
672+
PrefixRunOf n x xs ys →
673+
PrefixRunOf (n + 1) x (x :: xs) ys
667674
end
668675

669676
example : RLE [1, 1, 2, 2, 3, 1, 1, 1] :=
@@ -682,11 +689,18 @@ Specifying {name}`PrefixRunOf` as a {lean}`Prop` would be sensible, but it canno
682689
mutual
683690
inductive RLE : List α → Type where
684691
| nil : RLE []
685-
| run (x : α) (n : Nat) : n ≠ 0 → PrefixRunOf n x xs ys → RLE ys → RLE xs
692+
| run
693+
(x : α) (n : Nat) :
694+
n ≠ 0 → PrefixRunOf n x xs ys → RLE ys →
695+
RLE xs
686696

687697
inductive PrefixRunOf : Nat → α → List α → List α → Prop where
688-
| zero (noMore : ¬∃zs, xs = x :: zs := by simp) : PrefixRunOf 0 x xs xs
689-
| succ : PrefixRunOf n x xs ys → PrefixRunOf (n + 1) x (x :: xs) ys
698+
| zero
699+
(noMore : ¬∃zs, xs = x :: zs := by simp) :
700+
PrefixRunOf 0 x xs xs
701+
| succ :
702+
PrefixRunOf n x xs ys →
703+
PrefixRunOf (n + 1) x (x :: xs) ys
690704
end
691705
```
692706
```leanOutput rleBad

Manual/Meta/ElanOpt.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ def elanOptDef.descr : InlineDescr where
109109
toHtml :=
110110
open Verso.Output.Html in
111111
some <| fun goB id data content => do
112-
let .arr #[.str name, _jsonKind, meta] := data
112+
let .arr #[.str name, _jsonKind, metadata] := data
113113
| HtmlT.logError s!"Failed to deserialize metadata for Elan option def: {data}"; content.mapM goB
114114

115115
let idAttr := (← read).traverseState.htmlId id
116116

117-
let .ok meta := FromJson.fromJson? (α := Option String) meta
118-
| HtmlT.logError s!"Failed to deserialize argument metadata for Elan option def: {meta}"; content.mapM goB
117+
let .ok metadata := FromJson.fromJson? (α := Option String) metadata
118+
| HtmlT.logError s!"Failed to deserialize argument metadata for Elan option def: {metadata}"; content.mapM goB
119119

120-
if let some mv := meta then
120+
if let some mv := metadata then
121121
pure {{<code {{idAttr}} class="elan-opt">{{name}}" "{{mv}}</code>}}
122122
else
123123
pure {{<code {{idAttr}} class="elan-opt">{{name}}</code>}}

Manual/Meta/LakeOpt.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def lakeOptDef.descr : InlineDescr where
107107
toHtml :=
108108
open Verso.Output.Html in
109109
some <| fun goB id data content => do
110-
let .arr #[.str name, _jsonKind, meta] := data
110+
let .arr #[.str name, _jsonKind, metadata] := data
111111
| HtmlT.logError s!"Failed to deserialize metadata for Lake option def: {data}"; content.mapM goB
112112

113113
let idAttr := (← read).traverseState.htmlId id
114114

115-
let .ok meta := FromJson.fromJson? (α := Option String) meta
116-
| HtmlT.logError s!"Failed to deserialize argument metadata for Lake option def: {meta}"; content.mapM goB
115+
let .ok metadata := FromJson.fromJson? (α := Option String) metadata
116+
| HtmlT.logError s!"Failed to deserialize argument metadata for Lake option def: {metadata}"; content.mapM goB
117117

118-
if let some mv := meta then
118+
if let some mv := metadata then
119119
pure {{<code {{idAttr}} class="lake-opt">{{name}}"="{{mv}}</code>}}
120120
else
121121
pure {{<code {{idAttr}} class="lake-opt">{{name}}</code>}}
@@ -149,7 +149,7 @@ def lakeOpt.descr : InlineDescr where
149149

150150
toHtml :=
151151
open Verso.Output.Html in
152-
some <| fun goB id data content => do
152+
some <| fun goB _ data content => do
153153
let .arr #[.str name, .str original] := data
154154
| HtmlT.logError s!"Failed to deserialize metadata for Lake option ref: {data}"; content.mapM goB
155155

Manual/Meta/ParserAlias.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def parserAlias.descr : BlockDescr where
128128
if autoGroupArgs then
129129
some {{"Automatically wraps arguments in a " <code>"null"</code> " node unless there's exactly one"}}
130130
else none
131-
let meta :=
131+
let metadata :=
132132
match grp with
133133
| none => {{<p>{{arity}}</p>}}
134134
| some g => {{<ul><li>{{arity}}</li><li>{{g}}</li></ul>}}
@@ -139,7 +139,7 @@ def parserAlias.descr : BlockDescr where
139139
<span class="label">"parser alias"</span>
140140
<pre class="signature hl lean block">{{← (Highlighted.seq #[x, args]).toHtml}}</pre>
141141
<div class="text">
142-
{{meta}}
142+
{{metadata}}
143143
{{← contents.mapM goB}}
144144
</div>
145145
</div>

Manual/Meta/Syntax.lean

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def withOpenedNamespaces (nss : List Name) (act : DocElabM α) : DocElabM α :=
915915

916916

917917
inductive SearchableTag where
918-
| meta
918+
| metavar
919919
| keyword
920920
| literalIdent
921921
| ws
@@ -924,13 +924,13 @@ deriving DecidableEq, Ord, Repr
924924
open Lean.Syntax in
925925
instance : Quote SearchableTag where
926926
quote
927-
| .meta => mkCApp ``SearchableTag.meta #[]
927+
| .metavar => mkCApp ``SearchableTag.metavar #[]
928928
| .keyword => mkCApp ``SearchableTag.keyword #[]
929929
| .literalIdent => mkCApp ``SearchableTag.literalIdent #[]
930930
| .ws => mkCApp ``SearchableTag.ws #[]
931931

932932
def SearchableTag.toKey : SearchableTag → String
933-
| .meta => "meta"
933+
| .metavar => "meta"
934934
| .keyword => "keyword"
935935
| .literalIdent => "literalIdent"
936936
| .ws => "ws"
@@ -941,7 +941,7 @@ instance : ToJson SearchableTag where
941941
toJson := SearchableTag.toJson
942942

943943
def SearchableTag.fromJson? : Json → Except String SearchableTag
944-
| .str "meta" => pure .meta
944+
| .str "meta" => pure .metavar
945945
| .str "keyword" => pure .keyword
946946
| .str "literalIdent" => pure .literalIdent
947947
| .str "ws" => pure .ws
@@ -967,7 +967,7 @@ def searchableJson (ss : Array (SearchableTag × String)) : Json :=
967967
partial def searchable (cat : Name) (txt : TaggedText GrammarTag) : Array (SearchableTag × String) :=
968968
(go txt *> get).run' #[] |> fixup
969969
where
970-
dots : SearchableTag × String := (.meta, "…")
970+
dots : SearchableTag × String := (.metavar, "…")
971971
go : TaggedText GrammarTag → StateM (Array (SearchableTag × String)) String
972972
| .text s => do
973973
ws s
@@ -1007,9 +1007,9 @@ where
10071007
if st.isEmpty then return st
10081008
-- Don't parenthesize just "..."
10091009
| ")" | ")?" | ")*" =>
1010-
if let some st' := suffixMatches #[(· == (.meta, "(")) , (· == dots)] st then return st'.push dots
1010+
if let some st' := suffixMatches #[(· == (.metavar, "(")) , (· == dots)] st then return st'.push dots
10111011
| _ => pure ()
1012-
return st.push (.meta, s)
1012+
return st.push (.metavar, s)
10131013
pure s
10141014
| .tag other txt => do
10151015
go txt
@@ -1019,7 +1019,7 @@ where
10191019
| `command => Id.run do
10201020
-- Drop leading ellipses from commands
10211021
for h : i in [0:s.size] do
1022-
if s[i] ∉ [dots, (.meta, "?"), (.ws, " ")] then return s.extract i s.size
1022+
if s[i] ∉ [dots, (.metavar, "?"), (.ws, " ")] then return s.extract i s.size
10231023
return s
10241024
| _ => s
10251025
ws (s : String) : StateM (Array (SearchableTag × String)) Unit := do
@@ -1051,7 +1051,7 @@ where
10511051
-- Don't push ellipsis onto ellipsis
10521052
if let some _ := suffixMatches #[(· == dots)] st then st
10531053
-- Don't alternate ellipses
1054-
else if let some st' := suffixMatches #[(· == dots), (· == (.meta, "|"))] st then st'.push dots
1054+
else if let some st' := suffixMatches #[(· == dots), (· == (.metavar, "|"))] st then st'.push dots
10551055
else st.push dots
10561056

10571057

@@ -1061,19 +1061,19 @@ where
10611061

10621062
/-- info: some #[(Manual.SearchableTag.keyword, "aaa")] -/
10631063
#guard_msgs in
1064-
#eval searchable.suffixMatches #[(· == (.meta, "(")), (· == searchable.dots)] #[(.keyword, "aaa"),(.meta, "("), (.ws, " "),(.meta, "…")]
1064+
#eval searchable.suffixMatches #[(· == (.metavar, "(")), (· == searchable.dots)] #[(.keyword, "aaa"),(.metavar, "("), (.ws, " "),(.metavar, "…")]
10651065

10661066
/-- info: some #[(Manual.SearchableTag.keyword, "aaa")] -/
10671067
#guard_msgs in
1068-
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.keyword, "aaa"),(.meta, "…"), (.ws, " ")]
1068+
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.keyword, "aaa"),(.metavar, "…"), (.ws, " ")]
10691069

10701070
/-- info: some #[] -/
10711071
#guard_msgs in
1072-
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.meta, "…"), (.ws, " ")]
1072+
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.metavar, "…"), (.ws, " ")]
10731073

10741074
/-- info: some #[] -/
10751075
#guard_msgs in
1076-
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.meta, "…")]
1076+
#eval searchable.suffixMatches #[(· == searchable.dots)] #[(.metavar, "…")]
10771077

10781078
open Manual.Meta.PPrint Grammar in
10791079
/--

Manual/Monads/Lift.lean

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ def getByte (n : Nat) : Except String UInt8 :=
212212
pure n.toUInt8
213213
else throw s!"Out of range: {n}"
214214

215-
def getBytes (input : Array Nat) : StateT (Array UInt8) (Except String) Unit := do
215+
def getBytes (input : Array Nat) :
216+
StateT (Array UInt8) (Except String) Unit := do
216217
input.forM fun i =>
217218
liftM (Except.tryCatch (some <$> getByte i) fun _ => pure none) >>=
218219
fun
@@ -233,7 +234,10 @@ Ideally, state updates would be performed within the {name}`tryCatch` call direc
233234

234235
Attempting to save bytes and handled exceptions does not work, however, because the arguments to {name}`Except.tryCatch` have type {lean}`Except String Unit`:
235236
```lean (error := true) (name := getBytesErr) (keep := false)
236-
def getBytes' (input : Array Nat) : StateT (Array String) (StateT (Array UInt8) (Except String)) Unit := do
237+
def getBytes' (input : Array Nat) :
238+
StateT (Array String)
239+
(StateT (Array UInt8)
240+
(Except String)) Unit := do
237241
input.forM fun i =>
238242
liftM
239243
(Except.tryCatch
@@ -254,7 +258,10 @@ It provides the inner action with an interpreter for the outer monad.
254258
In the case of {name}`StateT`, this interpreter expects that the inner monad returns a tuple that includes the updated state, and takes care of providing the initial state and extracting the updated state from the tuple.
255259

256260
```lean
257-
def getBytes' (input : Array Nat) : StateT (Array String) (StateT (Array UInt8) (Except String)) Unit := do
261+
def getBytes' (input : Array Nat) :
262+
StateT (Array String)
263+
(StateT (Array UInt8)
264+
(Except String)) Unit := do
258265
input.forM fun i =>
259266
control fun run =>
260267
(Except.tryCatch

Manual/Monads/Syntax.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ When iterating over multiple collections, iteration stops when any of the collec
563563

564564
When iterating over the valid indices for an array with {keywordOf Lean.Parser.Term.doFor}`for`, naming the membership proof allows the tactic that searches for proofs that array indices are in bounds to succeed.
565565
```lean (keep := false)
566-
def satisfyingIndices (p : α → Prop) [DecidablePred p] (xs : Array α) : Array Nat := Id.run do
566+
def satisfyingIndices
567+
(p : α → Prop) [DecidablePred p]
568+
(xs : Array α) : Array Nat := Id.run do
567569
let mut out := #[]
568570
for h : i in [0:xs.size] do
569571
if p xs[i] then out := out.push i

Manual/RecursiveDefs/Structural.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ open Verso.Genre.Manual.InlineLean
1717

1818
open Lean.Elab.Tactic.GuardMsgs.WhitespaceMode
1919

20+
set_option guard_msgs.diff true
21+
2022
#doc (Manual) "Structural Recursion" =>
2123
%%%
2224
tag := "structural-recursion"
@@ -157,7 +159,8 @@ The decreasing parameter's type must be an inductive type.
157159
In {lean}`notInductive`, a function is specified as the decreasing parameter:
158160

159161
```lean (error := true) (name := badnoindct)
160-
def notInductive (x : Nat → Nat) : Nat := notInductive (fun n => x (n+1))
162+
def notInductive (x : Nat → Nat) : Nat :=
163+
notInductive (fun n => x (n+1))
161164
termination_by structural x
162165
```
163166
```leanOutput badnoindct
@@ -573,7 +576,7 @@ set_option pp.all true in
573576
trace: [Elab.definition.body] half : Nat → Nat :=
574577
fun (x : Nat) =>
575578
half.match_1.{1} (fun (x : Nat) => Nat) x (fun (_ : Unit) => Nat.zero) (fun (_ : Unit) => Nat.zero)
576-
fun (n : Nat) => Nat.succ (half n)
579+
fun (n : Nat) => Nat.succ (_root_.half n)
577580
-/
578581
#guard_msgs in
579582
def half : Nat → Nat

0 commit comments

Comments
 (0)