@@ -73,7 +73,7 @@ structure Path (N : ℕ) where
7373 nonempty : cells ≠ []
7474 head_first_row : (cells.head nonempty).1 = 0
7575 last_last_row : (cells.getLast nonempty).1 = Fin.last (N + 1 )
76- valid_move_seq : cells.Chain' Adjacent
76+ valid_move_seq : cells.IsChain Adjacent
7777
7878/-- The first monster on a path, or `none`. -/
7979noncomputable def Path.firstMonster (p : Path N) (m : MonsterData N) : Option (Cell N) :=
@@ -197,7 +197,7 @@ lemma Path.exists_mem_fst_eq (p : Path N) (r : Fin (N + 2)) : ∃ c ∈ p.cells,
197197 have hi' : i - 1 < i := by omega
198198 exact of_decide_eq_false (List.not_of_lt_findIdx hi') this
199199 have ha : Adjacent p.cells[i - 1 ] p.cells[i] := by
200- convert List.chain'_iff_get .1 p.valid_move_seq (i - 1 ) ?_
200+ convert List.isChain_iff_get .1 p.valid_move_seq (i - 1 ) ?_
201201 · simp [Nat.sub_add_cancel hi]
202202 · omega
203203 exact ha.le_of_lt h
@@ -223,7 +223,7 @@ lemma Path.findFstEq_fst (p : Path N) (r : Fin (N + 2)) : (p.findFstEq r).1 = r
223223 simpa using h
224224
225225lemma find?_eq_eq_find?_le {l : List (Cell N)} {r : Fin (N + 2 )} (hne : l ≠ [])
226- (hf : (l.head hne).1 ≤ r) (ha : l.Chain' Adjacent) :
226+ (hf : (l.head hne).1 ≤ r) (ha : l.IsChain Adjacent) :
227227 l.find? (fun c ↦ c.1 = r) = l.find? (fun c ↦ r ≤ c.1 ) := by
228228 induction l
229229 case nil => simp at hne
@@ -234,7 +234,7 @@ lemma find?_eq_eq_find?_le {l : List (Cell N)} {r : Fin (N + 2)} (hne : l ≠ []
234234 simp only [h, decide_false, Bool.false_eq_true, not_false_eq_true, List.find?_cons_of_neg, h']
235235 rcases tail with ⟨⟩ | ⟨htail, ttail⟩
236236 · simp
237- · simp only [List.chain'_cons_cons ] at ha
237+ · simp only [List.isChain_cons_cons ] at ha
238238 rcases ha with ⟨ha1, ha2⟩
239239 simp only [List.head_cons] at hf
240240 simp only [ne_eq, reduceCtorEq, not_false_eq_true, List.head_cons, ha2, true_implies] at hi
@@ -292,7 +292,7 @@ def Path.tail (p : Path N) : Path N where
292292 · exact p.last_last_row
293293 valid_move_seq := by
294294 split_ifs
295- · exact List.Chain' .tail p.valid_move_seq
295+ · exact List.IsChain .tail p.valid_move_seq
296296 · exact p.valid_move_seq
297297
298298lemma Path.tail_induction {motive : Path N → Prop } (ind : ∀ p, motive p.tail → motive p)
@@ -338,7 +338,8 @@ lemma Path.firstMonster_eq_of_findFstEq_mem {p : Path N} {m : MonsterData N}
338338 induction p using Path.tail_induction
339339 case base p h0 =>
340340 have hl := p.one_lt_length_cells
341- have adj : Adjacent p.cells[0 ] p.cells[1 ] := List.chain'_iff_get.1 p.valid_move_seq 0 (by omega)
341+ have adj : Adjacent p.cells[0 ] p.cells[1 ] :=
342+ List.isChain_iff_get.1 p.valid_move_seq 0 (by omega)
342343 simp_rw [Adjacent, Nat.dist] at adj
343344 have hc0 : (p.cells[0 ].1 : ℕ) = 0 := by
344345 convert Fin.ext_iff.1 p.head_first_row
@@ -384,7 +385,7 @@ lemma Path.findFstEq_fst_sub_one_mem (p : Path N) {r : Fin (N + 2)} (hr : r ≠
384385 simp [List.getElem_zero, head_first_row, hr] at h
385386 simp_rw [cells.find?_eq_head_dropWhile_not hd, Option.get_some]
386387 rw [← cells.takeWhile_append_dropWhile (p := fun c ↦ ! decide (r ≤ c.1 )),
387- List.chain'_append ] at valid_move_seq
388+ List.isChain_append ] at valid_move_seq
388389 have ha := valid_move_seq.2 .2
389390 simp only [List.head?_eq_head hd', List.getLast?_eq_getLast ht, Option.mem_def,
390391 Option.some.injEq, forall_eq'] at ha
@@ -421,7 +422,7 @@ def Path.ofFn {m : ℕ} (f : Fin m → Cell N) (hm : m ≠ 0)
421422 last_last_row := by
422423 simp [Fin.last, List.getLast_ofFn, hl]
423424 valid_move_seq := by
424- rwa [List.chain'_ofFn ]
425+ rwa [List.isChain_ofFn ]
425426
426427lemma Path.ofFn_cells {m : ℕ} (f : Fin m → Cell N) (hm : m ≠ 0 )
427428 (hf : (f ⟨0 , Nat.pos_of_ne_zero hm⟩).1 = 0 )
@@ -446,7 +447,7 @@ def Path.reflect (p : Path N) : Path N where
446447 rw [List.getLast_map]
447448 exact p.last_last_row
448449 valid_move_seq := by
449- refine List.chain'_map_of_chain' _ ?_ p.valid_move_seq
450+ refine List.isChain_map_of_isChain _ ?_ p.valid_move_seq
450451 intro x y h
451452 simp_rw [Adjacent, Nat.dist, Cell.reflect, Fin.rev] at h ⊢
452453 omega
0 commit comments