Skip to content

Commit 7643ee4

Browse files
Garmelonmathlib4-botleanprover-community-mathlib4-botkim-emleanprover-community-mathlib4-bot
authored
chore: bump toolchain to v4.30.0-rc1 (#469)
Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com> Co-authored-by: leanprover-community-mathlib4-bot <129911861+leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Kim Morrison <kim@tqft.net> Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Chris Henson <chrishenson.net@gmail.com> Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com> Co-authored-by: Kim Morrison <477956+kim-em@users.noreply.github.com> Co-authored-by: Ching-Tsun Chou <chingtsun.chou@gmail.com> Co-authored-by: Alexandre Rademaker <arademaker@gmail.com> Co-authored-by: mathlib-nightly-testing[bot] <mathlib-nightly-testing[bot]@users.noreply.github.com> Co-authored-by: mathlib-nightly-testing[bot] <258991302+mathlib-nightly-testing[bot]@users.noreply.github.com>
1 parent d1dbe1e commit 7643ee4

24 files changed

Lines changed: 237 additions & 88 deletions

File tree

Cslib/Computability/Automata/DA/Congr.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ the equivalence class corresponding to `s`. -/
5858
@[simp]
5959
theorem congr_language_eq {a : Quotient c.eq} : language (FinAcc.mk c.toDA {a}) = eqvCls a := by
6060
ext
61-
grind
61+
#adaptation_note
62+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
63+
constructor <;>
64+
· intro h
65+
simpa [mem_language, Accepts, congr_mtr_eq] using h
6266

6367
end FinAcc
6468

Cslib/Computability/Automata/DA/ToNA.lean

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ open scoped FLTS NA.FinAcc in
5454
theorem toNAFinAcc_language_eq {a : DA.FinAcc State Symbol} :
5555
language a.toNAFinAcc = language a := by
5656
ext xs
57+
#adaptation_note
58+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
5759
constructor
58-
· grind
60+
· simp_all [mem_language a xs, Accepts, toNAFinAcc, toNA, FLTS.toLTS_mtr]
5961
· intro _
6062
use a.start
61-
grind
63+
simp_all [Accepts, toNAFinAcc, toNA, FLTS.toLTS_mtr]
6264

6365
end FinAcc
6466

@@ -70,16 +72,19 @@ def toNABuchi (a : DA.Buchi State Symbol) : NA.Buchi State Symbol :=
7072
{ a.toNA with accept := a.accept }
7173

7274
open ωAcceptor in
73-
open scoped NA.Buchi in
7475
/-- The `NA.Buchi` constructed from a `DA.Buchi` has the same ω-language. -/
7576
@[simp, scoped grind _=_]
7677
theorem toNABuchi_language_eq {a : DA.Buchi State Symbol} :
7778
language a.toNABuchi = language a := by
7879
ext xs; constructor
79-
· grind
80-
· intro _
80+
#adaptation_note
81+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
82+
· simp_all [Accepts, language, toNABuchi]
83+
· intro h
8184
use (a.run xs)
82-
grind
85+
split_ands
86+
· grind
87+
· exact Filter.frequently_map.mp h
8388

8489
end Buchi
8590

Cslib/Computability/Automata/EpsilonNA/ToNA.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ theorem toNAFinAcc_language_eq {ena : εNA.FinAcc State Symbol} :
5252
ext xs
5353
have : ∀ s s', ena.saturate.MTr s (xs.map some) s' = ena.saturate.noε.MTr s xs s' := by
5454
simp [LTS.noε_saturate_mTr]
55-
grind
55+
#adaptation_note
56+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
57+
grind [Accepts]
5658

5759
end Automata.εNA.FinAcc
5860

Cslib/Computability/Automata/NA/BuchiEquiv.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ theorem reindex_language_eq {f : State ≃ State'} {nba : Buchi State Symbol} :
6060
ext xs
6161
constructor
6262
· rintro ⟨ss', h_run', h_acc'⟩
63-
grind [reindex_run_iff]
63+
#adaptation_note
64+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
65+
simp only [mem_language, Accepts]
66+
exact frequently_principal.mp (· (reindex_run_iff.mp h_run') h_acc')
6467
· rintro ⟨ss, h_run, h_acc⟩
6568
use ss.map f
6669
constructor <;> grind [reindex_run_iff']

Cslib/Computability/Automata/NA/Concat.lean

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,31 @@ theorem finConcat_language_eq [Inhabited Symbol] :
159159
obtain ⟨xs, ss, h_ωtr, rfl, rfl⟩ := LTS.Total.extend_omegaExecution h_mtr
160160
have hc : (finConcat na1 na2).Run (xl ++ω xs) ss := by grind [Run]
161161
have hr : (ss xl.length).isRight := by grind
162-
obtain ⟨n, _⟩ := concat_run_proj hc hr
162+
obtain ⟨n, _, _, ss2, h_run2, _⟩ := concat_run_proj hc hr
163163
refine ⟨xl.take n, ?_, xl.drop n, ?_, ?_⟩
164164
· grind [totalize_language_eq, take_append_of_le_length]
165165
· have : ss xl.length = (ss.drop n) (xl.length - n) := by grind
166-
grind [drop_append_of_le_length, take_append_of_le_length, totalize_run_mtr]
166+
#adaptation_note
167+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
168+
have : ss xl.length = inr (ss2 (xl.length - n)) := by grind
169+
have hl : (ss2 (xl.length - n)).isLeft := by grind
170+
obtain ⟨s2, t2, h_mtr2, _, _, _⟩ := totalize_run_mtr h_run2 hl
171+
refine ⟨s2, ?_, t2, ?_, ?_⟩ <;> grind [drop_append_of_le_length, take_append_of_le_length]
167172
· exact xl.take_append_drop n
168173
· rintro ⟨xl1, h_xl1, xl2, h_xl2, rfl⟩
169174
rw [← totalize_language_eq] at h_xl1
170175
obtain ⟨_, h_s2, _, _, h_mtr2⟩ := h_xl2
171-
obtain ⟨_, _, h_run2, _, _⟩ := totalize_mtr_run h_s2 h_mtr2
176+
obtain ⟨_, ss2, h_run2, _, _⟩ := totalize_mtr_run h_s2 h_mtr2
172177
obtain ⟨ss, ⟨_, h_ωtr⟩, _⟩ := concat_run_exists h_xl1 h_run2
173-
grind [
174-
finConcat, List.length_append, take_append_of_le_length,
175-
extract_eq_drop_take, =_ append_append_ωSequence, get_drop xl2.length xl1.length ss,
176-
LTS.OmegaExecution.extract_mTr h_ωtr (zero_le (xl1.length + xl2.length))
177-
]
178+
#adaptation_note
179+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
180+
have h_mtr := LTS.OmegaExecution.extract_mTr h_ωtr (zero_le (xl1.length + xl2.length))
181+
simp [← append_append_ωSequence, extract_eq_drop_take,
182+
take_append_of_le_length, ← List.length_append] at h_mtr
183+
have : ss (xl1.length + xl2.length) = (ss.drop xl1.length) xl2.length := by grind
184+
have : ss (xl1.length + xl2.length) = inr (ss2 xl2.length) := by grind
185+
refine ⟨ss 0, ?_, ss (xl1.length + xl2.length), ?_, ?_⟩ <;>
186+
grind [finConcat, List.length_append]
178187

179188
end FinAcc
180189

Cslib/Computability/Automata/NA/Loop.lean

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ theorem loop_language_eq [Inhabited Symbol] :
145145
rintro xs ⟨ss, h_run, h_acc⟩
146146
obtain ⟨k, h1, h2⟩ : ∃ k > 0, (ss k).isLeft :=
147147
by grind [FinAcc.loop, frequently_atTop'.mp h_acc 0]
148-
obtain ⟨n, _⟩ := loop_run_one_iter h_run h1 h2
149-
refine ⟨xs.take n, by grind, xs.drop n, ?_, by simp⟩
148+
#adaptation_note
149+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
150+
obtain ⟨n, _, h, _⟩ := loop_run_one_iter h_run h1 h2
151+
refine ⟨xs.take n, h, xs.drop n, ?_, by simp⟩
150152
refine ⟨ss.drop n, by grind, ?_⟩
151153
apply (drop_frequently_iff_frequently n).mpr
152154
grind
@@ -191,10 +193,13 @@ theorem loop_language_eq [Inhabited Symbol] (h : ¬ language na = 0) :
191193
obtain ⟨h1, h2⟩ : 0 < xl.length ∧ (ss xl.length).isLeft := by
192194
simp only [mem_singleton_iff] at h_acc
193195
grind
194-
obtain ⟨n, h_n, _, _, h_ωtr'⟩ := loop_run_one_iter h_run h1 h2
196+
obtain ⟨n, h_n, h_take, h_drop, h_ωtr'⟩ := loop_run_one_iter h_run h1 h2
195197
left; refine ⟨xl.take n, ?_, xl.drop n, ?_, ?_⟩
196-
· grind [totalize_language_eq, take_append_of_le_length]
197-
· refine ⟨ss n, by grind, ss xl.length, by grind, ?_⟩
198+
· #adaptation_note
199+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
200+
change List.take n xl ∈ language na - 1 -- canonicalize membership instance
201+
grind [totalize_language_eq, take_append_of_le_length]
202+
· refine ⟨ss n, by aesop, ss xl.length, by grind, ?_⟩
198203
have := LTS.OmegaExecution.extract_mTr h_ωtr' (show 0 ≤ xl.length - n by grind)
199204
have : n + (xl.length - n) = xl.length := by grind
200205
have : ((xl ++ω xs).drop n).extract 0 (xl.length - n) = xl.drop n := by

Cslib/Computability/Automata/NA/Sum.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ theorem iSum_language_eq {na : (i : I) → NA (State i) Symbol} {acc : (i : I)
7171
constructor
7272
· rintro ⟨ss, h_run, h_acc⟩
7373
simp only [mem_iUnion] at h_acc
74-
grind
74+
#adaptation_note
75+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
76+
grind [Accepts]
7577
· rintro ⟨i, ss_i, _⟩
7678
use ss_i.map (Sigma.mk i)
7779
simp only [mem_iUnion]

Cslib/Computability/Automata/NA/ToDA.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ open scoped DA.FinAcc LTS in
4242
theorem toDAFinAcc_language_eq {na : NA.FinAcc State Symbol} :
4343
language na.toDAFinAcc = language na := by
4444
ext xs
45-
grind
45+
#adaptation_note
46+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
47+
grind [Accepts]
4648

4749
end FinAcc
4850

Cslib/Computability/Languages/Congruences/BuchiCongruence.lean

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ lemma buchiCongruence_transfer
8484
( xl ∈ na.pairViaLang na.accept s t → ∃ r ∈ na.accept, r ∈ sl ) := by
8585
have h_eq : na.BuchiCongruence.eq xl yl := by
8686
apply Quotient.exact
87+
#adaptation_note
88+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
89+
have : ⟦xl⟧ = a := mem_singleton_iff.mp <| mem_preimage.mp hc
90+
have : ⟦yl⟧ = a := mem_singleton_iff.mp <| mem_preimage.mp hc'
8791
grind
8892
have := h_eq s t
8993
have h_yl : yl ∈ na.pairLang s t := by grind
@@ -121,14 +125,26 @@ theorem buchiFamily_cover [Inhabited Symbol] [Finite State] :
121125
use ⟦ xs.take (f 0) ⟧, b
122126
apply mem_buchiFamily.mpr
123127
use xs.take (f 0), xs.drop (f 0) |>.toSegs (f · - f 0)
128+
#adaptation_note
129+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
124130
split_ands
125-
· grind
131+
· rfl
126132
· intro k
127133
specialize h_color {f k, f (k + 1)}
128134
have := @h_mono 0 k
129135
have := @h_mono k (k + 1)
130-
grind [extract_drop, Finset.insert_nonempty, Finset.singleton_nonempty, min'_insert,
131-
min'_singleton, max'_insert, max'_singleton, toSegs_def, Language.mem_sub_one]
136+
simp only [Language.mem_sub_one, toSegs_def]
137+
split_ands
138+
· have : b = color {f k, f (k + 1)} := by grind
139+
simp_all only [extract_drop, color]
140+
split_ifs with h
141+
· have : f k ≤ f (k + 1) := by lia
142+
have : f 0 + (f k - f 0) = f k := by lia
143+
have : f 0 + (f (k + 1) - f 0) = f (k + 1) := by lia
144+
simp_all
145+
rfl
146+
· simp at h
147+
· grind
132148
· grind [Nat.base_zero_strictMono h_mono]
133149

134150
-- This intermediate result is split out of the proof of `buchiCongruence_saturation` below

Cslib/Computability/Languages/Language.lean

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ theorem mem_biInf {I : Type*} (s : Set I) (l : I → Language α) (x : List α)
3030
(x ∈ ⨅ i ∈ s, l i) ↔ ∀ i ∈ s, x ∈ l i :=
3131
mem_iInter₂
3232

33+
#adaptation_note
34+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
3335
@[simp]
3436
theorem mem_biSup {I : Type*} (s : Set I) (l : I → Language α) (x : List α) :
35-
(x ∈ ⨆ i ∈ s, l i) ↔ ∃ i ∈ s, x ∈ l i := by
36-
constructor <;> intro h
37-
· have := mem_iUnion₂.mp h
38-
grind
39-
· apply mem_iUnion₂.mpr
40-
grind
37+
(x ∈ ⨆ i ∈ s, l i) ↔ ∃ i ∈ s, x ∈ l i where
38+
mp h := bex_def.mp (mem_iUnion₂.mp h)
39+
mpr h := mem_iUnion₂.mpr (bex_def.mpr h)
4140

4241
theorem le_one_iff_eq : l ≤ 1 ↔ l = 0 ∨ l = 1 :=
4342
subset_singleton_iff_eq
@@ -50,17 +49,23 @@ theorem mem_sub_one (x : List α) : x ∈ (l - 1) ↔ x ∈ l ∧ x ≠ [] :=
5049
theorem reverse_sub (l m : Language α) : (l - m).reverse = l.reverse - m.reverse := by
5150
ext x; simp [mem_sub]
5251

52+
#adaptation_note
53+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
5354
@[scoped grind =]
5455
theorem sub_one_mul : (l - 1) * l = l * l - 1 := by
5556
ext x; constructor
5657
· rintro ⟨u, h_u, v, h_v, rfl⟩
5758
constructor
58-
· refine ⟨u, ?_, v, ?_⟩ <;> grind
59-
· grind [append_eq_nil_iff, mem_one]
59+
· exact ⟨u, Set.mem_of_mem_inter_left h_u, v, h_v, rfl⟩
60+
· by_contra h
61+
have := mem_sub_one u |>.mp h_u
62+
have := mem_one (u ++ v) |>.mp h
63+
grind [append_eq_nil_iff]
6064
· rintro ⟨⟨u, h_u, v, h_v, rfl⟩, h_x⟩
6165
rcases eq_or_ne u [] with (rfl | h_u')
62-
· refine ⟨v, ?_, [], ?_⟩ <;> grind [mem_sub, mem_one]
63-
· refine ⟨u, ?_, v, ?_⟩ <;> grind
66+
· use v, (mem_sub l 1 v |>.mpr) ⟨h_v, Not.intro h_x⟩, []
67+
grind [mem_sub, mem_one]
68+
· use u, (mem_sub_one u).mpr ⟨h_u, h_u'⟩, v
6469

6570
@[scoped grind =]
6671
theorem mul_sub_one : l * (l - 1) = l * l - 1 := by
@@ -70,15 +75,17 @@ theorem mul_sub_one : l * (l - 1) = l * l - 1 := by
7075
_ = (l.reverse * l.reverse - 1).reverse := by rw [sub_one_mul]
7176
_ = _ := by rw [reverse_sub, reverse_one, reverse_mul, reverse_reverse]
7277

78+
#adaptation_note
79+
/-- A grind regression found moving to nightly-2026-03-31 (changes from lean#13166) -/
7380
@[scoped grind =]
7481
theorem kstar_sub_one : l∗ - 1 = (l - 1) * l∗ := by
7582
ext x; constructor
7683
· rintro ⟨h1, h2⟩
7784
obtain ⟨xl, rfl, h_xl⟩ := kstar_def_nonempty l ▸ h1
7885
have h3 : ¬ xl = [] := by grind [one_def]
7986
obtain ⟨x, xl', h_xl'⟩ := exists_cons_of_ne_nil h3
80-
have := h_xl x
81-
refine ⟨x, ?_, xl'.flatten, ?_, ?_⟩ <;> grind [join_mem_kstar]
87+
subst h_xl'
88+
refine ⟨x, mem_preimage.mp (h_xl x ?_), xl'.flatten, join_mem_kstar ?_, ?_⟩ <;> grind
8289
· rintro ⟨y, ⟨h_y, h_1⟩, z, h_z, rfl⟩
8390
refine ⟨?_, ?_⟩
8491
· apply (show l * l∗ ≤ l∗ by exact mul_kstar_le_kstar)

0 commit comments

Comments
 (0)