data.lazy_list.basic
⟷
Mathlib.Data.LazyList.Basic
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-/
-import Mathbin.Control.Traversable.Equiv
-import Mathbin.Control.Traversable.Instances
-import Mathbin.Data.LazyList
+import Control.Traversable.Equiv
+import Control.Traversable.Instances
+import Data.LazyList
#align_import data.lazy_list.basic from "leanprover-community/mathlib"@"4d392a6c9c4539cbeca399b3ee0afea398fbd2eb"
mathlib commit https://github.com/leanprover-community/mathlib/commit/63721b2c3eba6c325ecf8ae8cca27155a4f6306f
@@ -25,10 +25,10 @@ universe u
namespace Thunk
-#print Thunk.pure /-
+#print Thunk.mk /-
/-- Creates a thunk with a (non-lazy) constant value. -/
-def pure {α} (x : α) : Thunk α := fun _ => x
-#align thunk.mk Thunk.pure
+def mk {α} (x : α) : Thunk α := fun _ => x
+#align thunk.mk Thunk.mk
-/
instance {α : Type u} [DecidableEq α] : DecidableEq (Thunk α)
@@ -74,7 +74,7 @@ instance {α : Type u} [DecidableEq α] : DecidableEq (LazyList α)
protected def traverse {m : Type u → Type u} [Applicative m] {α β : Type u} (f : α → m β) :
LazyList α → m (LazyList β)
| LazyList.nil => pure LazyList.nil
- | LazyList.cons x xs => LazyList.cons <$> f x <*> Thunk.pure <$> traverse (xs ())
+ | LazyList.cons x xs => LazyList.cons <$> f x <*> Thunk.mk <$> traverse (xs ())
#align lazy_list.traverse LazyList.traverse
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.lazy_list.basic
-! leanprover-community/mathlib commit 4d392a6c9c4539cbeca399b3ee0afea398fbd2eb
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Control.Traversable.Equiv
import Mathbin.Control.Traversable.Instances
import Mathbin.Data.LazyList
+#align_import data.lazy_list.basic from "leanprover-community/mathlib"@"4d392a6c9c4539cbeca399b3ee0afea398fbd2eb"
+
/-!
## Definitions on lazy lists
mathlib commit https://github.com/leanprover-community/mathlib/commit/5dc6092d09e5e489106865241986f7f2ad28d4c8
@@ -86,7 +86,7 @@ instance : Traversable LazyList
map := @LazyList.traverse id _
traverse := @LazyList.traverse
-instance : IsLawfulTraversable LazyList :=
+instance : LawfulTraversable LazyList :=
by
apply Equiv.isLawfulTraversable' list_equiv_lazy_list <;> intros <;> skip <;> ext
· induction x; rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -28,9 +28,11 @@ universe u
namespace Thunk
+#print Thunk.pure /-
/-- Creates a thunk with a (non-lazy) constant value. -/
def pure {α} (x : α) : Thunk α := fun _ => x
#align thunk.mk Thunk.pure
+-/
instance {α : Type u} [DecidableEq α] : DecidableEq (Thunk α)
| a, b =>
@@ -163,21 +165,27 @@ instance : Monad LazyList where
pure := @LazyList.singleton
bind := @LazyList.bind
+#print LazyList.append_nil /-
theorem append_nil {α} (xs : LazyList α) : xs.append LazyList.nil = xs :=
by
induction xs; rfl
simp [LazyList.append, xs_ih]
ext; congr
#align lazy_list.append_nil LazyList.append_nil
+-/
+#print LazyList.append_assoc /-
theorem append_assoc {α} (xs ys zs : LazyList α) :
(xs.append ys).append zs = xs.append (ys.append zs) := by induction xs <;> simp [append, *]
#align lazy_list.append_assoc LazyList.append_assoc
+-/
+#print LazyList.append_bind /-
theorem append_bind {α β} (xs : LazyList α) (ys : Thunk (LazyList α)) (f : α → LazyList β) :
(@LazyList.append _ xs ys).bind f = (xs.bind f).append ((ys ()).bind f) := by
induction xs <;> simp [LazyList.bind, append, *, append_assoc, append, LazyList.bind]
#align lazy_list.append_bind LazyList.append_bind
+-/
instance : LawfulMonad LazyList
where
@@ -223,16 +231,20 @@ theorem mem_nil {α} (x : α) : x ∈ @LazyList.nil α ↔ False :=
#align lazy_list.mem_nil LazyList.mem_nil
-/
+#print LazyList.mem_cons /-
@[simp]
theorem mem_cons {α} (x y : α) (ys : Thunk (LazyList α)) :
x ∈ @LazyList.cons α y ys ↔ x = y ∨ x ∈ ys () :=
Iff.rfl
#align lazy_list.mem_cons LazyList.mem_cons
+-/
+#print LazyList.forall_mem_cons /-
theorem forall_mem_cons {α} {p : α → Prop} {a : α} {l : Thunk (LazyList α)} :
(∀ x ∈ @LazyList.cons _ a l, p x) ↔ p a ∧ ∀ x ∈ l (), p x := by
simp only [Membership.Mem, LazyList.Mem, or_imp, forall_and, forall_eq]
#align lazy_list.forall_mem_cons LazyList.forall_mem_cons
+-/
/-! ### map for partial functions -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -51,9 +51,9 @@ def listEquivLazyList (α : Type _) : List α ≃ LazyList α
toFun := LazyList.ofList
invFun := LazyList.toList
right_inv := by
- intro ; induction x; rfl; simp! [*]
+ intro; induction x; rfl; simp! [*]
ext; cases x; rfl
- left_inv := by intro ; induction x; rfl; simp! [*]
+ left_inv := by intro; induction x; rfl; simp! [*]
#align lazy_list.list_equiv_lazy_list LazyList.listEquivLazyList
-/
@@ -181,8 +181,8 @@ theorem append_bind {α β} (xs : LazyList α) (ys : Thunk (LazyList α)) (f :
instance : LawfulMonad LazyList
where
- pure_bind := by intros ; apply append_nil
- bind_assoc := by intros ; dsimp [(· >>= ·)]; induction x <;> simp [LazyList.bind, append_bind, *]
+ pure_bind := by intros; apply append_nil
+ bind_assoc := by intros; dsimp [(· >>= ·)]; induction x <;> simp [LazyList.bind, append_bind, *]
id_map := by
intros
simp [(· <$> ·)]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -28,12 +28,6 @@ universe u
namespace Thunk
-/- warning: thunk.mk -> Thunk.pure is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}}, α -> (Thunkₓ.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}}, α -> (Thunk.{u1} α)
-Case conversion may be inaccurate. Consider using '#align thunk.mk Thunk.pureₓ'. -/
/-- Creates a thunk with a (non-lazy) constant value. -/
def pure {α} (x : α) : Thunk α := fun _ => x
#align thunk.mk Thunk.pure
@@ -169,12 +163,6 @@ instance : Monad LazyList where
pure := @LazyList.singleton
bind := @LazyList.bind
-/- warning: lazy_list.append_nil -> LazyList.append_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (xs : LazyList.{u1} α), Eq.{succ u1} (LazyList.{u1} α) (LazyList.append.{u1} α xs (fun (_ : Unit) => LazyList.nil.{u1} α)) xs
-but is expected to have type
- forall {α : Type.{u1}} (xs : LazyList.{u1} α), Eq.{succ u1} (LazyList.{u1} α) (LazyList.append.{u1} α xs (Thunk.pure.{u1} (LazyList.{u1} α) (LazyList.nil.{u1} α))) xs
-Case conversion may be inaccurate. Consider using '#align lazy_list.append_nil LazyList.append_nilₓ'. -/
theorem append_nil {α} (xs : LazyList α) : xs.append LazyList.nil = xs :=
by
induction xs; rfl
@@ -182,22 +170,10 @@ theorem append_nil {α} (xs : LazyList α) : xs.append LazyList.nil = xs :=
ext; congr
#align lazy_list.append_nil LazyList.append_nil
-/- warning: lazy_list.append_assoc -> LazyList.append_assoc is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (xs : LazyList.{u1} α) (ys : LazyList.{u1} α) (zs : LazyList.{u1} α), Eq.{succ u1} (LazyList.{u1} α) (LazyList.append.{u1} α (LazyList.append.{u1} α xs (fun (_ : Unit) => ys)) (fun (_ : Unit) => zs)) (LazyList.append.{u1} α xs (fun (_ : Unit) => LazyList.append.{u1} α ys (fun (_ : Unit) => zs)))
-but is expected to have type
- forall {α : Type.{u1}} (xs : LazyList.{u1} α) (ys : LazyList.{u1} α) (zs : LazyList.{u1} α), Eq.{succ u1} (LazyList.{u1} α) (LazyList.append.{u1} α (LazyList.append.{u1} α xs (Thunk.mk.{u1} (LazyList.{u1} α) (fun (x._@.Init.Core._hyg.266 : Unit) => ys))) (Thunk.mk.{u1} (LazyList.{u1} α) (fun (x._@.Init.Core._hyg.266 : Unit) => zs))) (LazyList.append.{u1} α xs (Thunk.mk.{u1} (LazyList.{u1} α) (fun (x._@.Init.Core._hyg.266 : Unit) => LazyList.append.{u1} α ys (Thunk.mk.{u1} (LazyList.{u1} α) (fun (x._@.Init.Core._hyg.266 : Unit) => zs)))))
-Case conversion may be inaccurate. Consider using '#align lazy_list.append_assoc LazyList.append_assocₓ'. -/
theorem append_assoc {α} (xs ys zs : LazyList α) :
(xs.append ys).append zs = xs.append (ys.append zs) := by induction xs <;> simp [append, *]
#align lazy_list.append_assoc LazyList.append_assoc
-/- warning: lazy_list.append_bind -> LazyList.append_bind is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} (xs : LazyList.{u1} α) (ys : Thunkₓ.{u1} (LazyList.{u1} α)) (f : α -> (LazyList.{u2} β)), Eq.{succ u2} (LazyList.{u2} β) (LazyList.bind.{u1, u2} α β (LazyList.append.{u1} α xs ys) f) (LazyList.append.{u2} β (LazyList.bind.{u1, u2} α β xs f) (fun (_ : Unit) => LazyList.bind.{u1, u2} α β (ys Unit.unit) f))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} (xs : LazyList.{u2} α) (ys : Thunk.{u2} (LazyList.{u2} α)) (f : α -> (LazyList.{u1} β)), Eq.{succ u1} (LazyList.{u1} β) (LazyList.bind.{u2, u1} α β (LazyList.append.{u2} α xs ys) f) (LazyList.append.{u1} β (LazyList.bind.{u2, u1} α β xs f) (Thunk.mk.{u1} (LazyList.{u1} β) (fun (x._@.Init.Core._hyg.266 : Unit) => LazyList.bind.{u2, u1} α β (Thunk.get.{u2} (LazyList.{u2} α) ys) f)))
-Case conversion may be inaccurate. Consider using '#align lazy_list.append_bind LazyList.append_bindₓ'. -/
theorem append_bind {α β} (xs : LazyList α) (ys : Thunk (LazyList α)) (f : α → LazyList β) :
(@LazyList.append _ xs ys).bind f = (xs.bind f).append ((ys ()).bind f) := by
induction xs <;> simp [LazyList.bind, append, *, append_assoc, append, LazyList.bind]
@@ -213,12 +189,6 @@ instance : LawfulMonad LazyList
induction x <;> simp [LazyList.bind, *, singleton, append]
ext ⟨⟩; rfl
-/- warning: lazy_list.mfirst -> LazyList.mfirstₓ is a dubious translation:
-lean 3 declaration is
- forall {m : Type.{u1} -> Type.{u2}} [_inst_1 : Alternative.{u1, u2} m] {α : Type.{u3}} {β : Type.{u1}}, (α -> (m β)) -> (LazyList.{u3} α) -> (m β)
-but is expected to have type
- forall {m : Type.{u3} -> Type.{u2}} [_inst_1 : Alternative.{u3, u2} m] {α : Type.{u1}} {β : Type.{u3}}, (α -> (m β)) -> (LazyList.{u1} α) -> (m β)
-Case conversion may be inaccurate. Consider using '#align lazy_list.mfirst LazyList.mfirstₓₓ'. -/
/-- Try applying function `f` to every element of a `lazy_list` and
return the result of the first attempt that succeeds. -/
def mfirst {m} [Alternative m] {α β} (f : α → m β) : LazyList α → m β
@@ -253,24 +223,12 @@ theorem mem_nil {α} (x : α) : x ∈ @LazyList.nil α ↔ False :=
#align lazy_list.mem_nil LazyList.mem_nil
-/
-/- warning: lazy_list.mem_cons -> LazyList.mem_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} (x : α) (y : α) (ys : Thunkₓ.{u1} (LazyList.{u1} α)), Iff (Membership.Mem.{u1, u1} α (LazyList.{u1} α) (LazyList.hasMem.{u1} α) x (LazyList.cons.{u1} α y ys)) (Or (Eq.{succ u1} α x y) (Membership.Mem.{u1, u1} α (LazyList.{u1} α) (LazyList.hasMem.{u1} α) x (ys Unit.unit)))
-but is expected to have type
- forall {α : Type.{u1}} (x : α) (y : α) (ys : Thunk.{u1} (LazyList.{u1} α)), Iff (Membership.mem.{u1, u1} α (LazyList.{u1} α) (LazyList.instMembershipLazyList.{u1} α) x (LazyList.cons.{u1} α y ys)) (Or (Eq.{succ u1} α x y) (Membership.mem.{u1, u1} α (LazyList.{u1} α) (LazyList.instMembershipLazyList.{u1} α) x (Thunk.get.{u1} (LazyList.{u1} α) ys)))
-Case conversion may be inaccurate. Consider using '#align lazy_list.mem_cons LazyList.mem_consₓ'. -/
@[simp]
theorem mem_cons {α} (x y : α) (ys : Thunk (LazyList α)) :
x ∈ @LazyList.cons α y ys ↔ x = y ∨ x ∈ ys () :=
Iff.rfl
#align lazy_list.mem_cons LazyList.mem_cons
-/- warning: lazy_list.forall_mem_cons -> LazyList.forall_mem_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {p : α -> Prop} {a : α} {l : Thunkₓ.{u1} (LazyList.{u1} α)}, Iff (forall (x : α), (Membership.Mem.{u1, u1} α (LazyList.{u1} α) (LazyList.hasMem.{u1} α) x (LazyList.cons.{u1} α a l)) -> (p x)) (And (p a) (forall (x : α), (Membership.Mem.{u1, u1} α (LazyList.{u1} α) (LazyList.hasMem.{u1} α) x (l Unit.unit)) -> (p x)))
-but is expected to have type
- forall {α : Type.{u1}} {p : α -> Prop} {a : α} {l : Thunk.{u1} (LazyList.{u1} α)}, Iff (forall (x : α), (Membership.mem.{u1, u1} α (LazyList.{u1} α) (LazyList.instMembershipLazyList.{u1} α) x (LazyList.cons.{u1} α a l)) -> (p x)) (And (p a) (forall (x : α), (Membership.mem.{u1, u1} α (LazyList.{u1} α) (LazyList.instMembershipLazyList.{u1} α) x (Thunk.get.{u1} (LazyList.{u1} α) l)) -> (p x)))
-Case conversion may be inaccurate. Consider using '#align lazy_list.forall_mem_cons LazyList.forall_mem_consₓ'. -/
theorem forall_mem_cons {α} {p : α → Prop} {a : α} {l : Thunk (LazyList α)} :
(∀ x ∈ @LazyList.cons _ a l, p x) ↔ p a ∧ ∀ x ∈ l (), p x := by
simp only [Membership.Mem, LazyList.Mem, or_imp, forall_and, forall_eq]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -57,18 +57,9 @@ def listEquivLazyList (α : Type _) : List α ≃ LazyList α
toFun := LazyList.ofList
invFun := LazyList.toList
right_inv := by
- intro
- induction x
- rfl
- simp! [*]
- ext
- cases x
- rfl
- left_inv := by
- intro
- induction x
- rfl
- simp! [*]
+ intro ; induction x; rfl; simp! [*]
+ ext; cases x; rfl
+ left_inv := by intro ; induction x; rfl; simp! [*]
#align lazy_list.list_equiv_lazy_list LazyList.listEquivLazyList
-/
@@ -102,24 +93,17 @@ instance : Traversable LazyList
instance : IsLawfulTraversable LazyList :=
by
apply Equiv.isLawfulTraversable' list_equiv_lazy_list <;> intros <;> skip <;> ext
- · induction x
- rfl
+ · induction x; rfl
simp! [Equiv.map, Functor.map] at *
- simp [*]
- rfl
- · induction x
- rfl
+ simp [*]; rfl
+ · induction x; rfl
simp! [Equiv.map, Functor.mapConst] at *
- simp [*]
- rfl
+ simp [*]; rfl
· induction x
- · simp! [Traversable.traverse, Equiv.traverse, functor_norm]
- rfl
- simp! [Equiv.map, Functor.mapConst, Traversable.traverse] at *
- rw [x_ih]
+ · simp! [Traversable.traverse, Equiv.traverse, functor_norm]; rfl
+ simp! [Equiv.map, Functor.mapConst, Traversable.traverse] at *; rw [x_ih]
dsimp [list_equiv_lazy_list, Equiv.traverse, to_list, Traversable.traverse, List.traverse]
- simp! [functor_norm]
- rfl
+ simp! [functor_norm]; rfl
#print LazyList.init /-
/-- `init xs`, if `xs` non-empty, drops the last element of the list.
@@ -221,13 +205,8 @@ theorem append_bind {α β} (xs : LazyList α) (ys : Thunk (LazyList α)) (f :
instance : LawfulMonad LazyList
where
- pure_bind := by
- intros
- apply append_nil
- bind_assoc := by
- intros
- dsimp [(· >>= ·)]
- induction x <;> simp [LazyList.bind, append_bind, *]
+ pure_bind := by intros ; apply append_nil
+ bind_assoc := by intros ; dsimp [(· >>= ·)]; induction x <;> simp [LazyList.bind, append_bind, *]
id_map := by
intros
simp [(· <$> ·)]
mathlib commit https://github.com/leanprover-community/mathlib/commit/8b8ba04e2f326f3f7cf24ad129beda58531ada61
@@ -260,7 +260,7 @@ instance {α} : Membership α (LazyList α) :=
#print LazyList.Mem.decidable /-
instance Mem.decidable {α} [DecidableEq α] (x : α) : ∀ xs : LazyList α, Decidable (x ∈ xs)
- | LazyList.nil => Decidable.false
+ | LazyList.nil => decidableFalse
| LazyList.cons y ys =>
if h : x = y then Decidable.isTrue (Or.inl h)
else decidable_of_decidable_of_iff (mem.decidable (ys ())) (by simp [*, (· ∈ ·), LazyList.Mem])
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -84,7 +84,7 @@ instance : LawfulTraversable LazyList := by
· simp only [List.traverse, map_pure]; rfl
· replace ih : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
- · rfl
+ rfl
· apply ih
/-- `init xs`, if `xs` non-empty, drops the last element of the list.
@@ -5,7 +5,7 @@ Authors: Simon Hudon
-/
import Mathlib.Control.Traversable.Equiv
import Mathlib.Control.Traversable.Instances
-import Mathlib.Data.LazyList
+import Std.Data.LazyList
import Mathlib.Lean.Thunk
#align_import data.lazy_list.basic from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -82,7 +82,7 @@ instance : LawfulTraversable LazyList := by
· simp only [traverse, Equiv.traverse, listEquivLazyList, Equiv.coe_fn_mk, Equiv.coe_fn_symm_mk]
induction' xs using LazyList.rec with _ tl ih _ ih
· simp only [List.traverse, map_pure]; rfl
- · have : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
+ · replace ih : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
· rfl
· apply ih
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -26,7 +26,7 @@ namespace LazyList
open Function
/-- Isomorphism between strict and lazy lists. -/
-def listEquivLazyList (α : Type _) : List α ≃ LazyList α where
+def listEquivLazyList (α : Type*) : List α ≃ LazyList α where
toFun := LazyList.ofList
invFun := LazyList.toList
right_inv := by
@@ -6,6 +6,7 @@ Authors: Simon Hudon
import Mathlib.Control.Traversable.Equiv
import Mathlib.Control.Traversable.Instances
import Mathlib.Data.LazyList
+import Mathlib.Lean.Thunk
#align_import data.lazy_list.basic from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
@@ -20,27 +21,6 @@ TODO: move the `LazyList.lean` file from core to mathlib.
universe u
-namespace Thunk
-
--- Porting note: `Thunk.pure` appears to do the same thing.
-#align thunk.mk Thunk.pure
-
--- Porting note: Added `Thunk.ext` to get `ext` tactic to work.
-@[ext]
-theorem ext {α : Type u} {a b : Thunk α} (eq : a.get = b.get) : a = b := by
- have ⟨_⟩ := a
- have ⟨_⟩ := b
- congr
- exact funext fun _ ↦ eq
-
-instance {α : Type u} [DecidableEq α] : DecidableEq (Thunk α) := by
- intro a b
- have : a = b ↔ a.get = b.get := ⟨by intro x; rw [x], by intro; ext; assumption⟩
- rw [this]
- infer_instance
-
-end Thunk
-
namespace LazyList
open Function
@@ -2,16 +2,13 @@
Copyright (c) 2018 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.lazy_list.basic
-! leanprover-community/mathlib commit 1f0096e6caa61e9c849ec2adbd227e960e9dff58
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Control.Traversable.Equiv
import Mathlib.Control.Traversable.Instances
import Mathlib.Data.LazyList
+#align_import data.lazy_list.basic from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
+
/-!
## Definitions on lazy lists
@@ -89,7 +89,7 @@ instance : Traversable LazyList where
map := @LazyList.traverse Id _
traverse := @LazyList.traverse
-instance : IsLawfulTraversable LazyList := by
+instance : LawfulTraversable LazyList := by
apply Equiv.isLawfulTraversable' listEquivLazyList <;> intros <;> ext <;> rename_i f xs
· induction' xs using LazyList.rec with _ _ _ _ ih
· rfl
@@ -49,21 +49,20 @@ namespace LazyList
open Function
/-- Isomorphism between strict and lazy lists. -/
-def listEquivLazyList (α : Type _) : List α ≃ LazyList α
- where
+def listEquivLazyList (α : Type _) : List α ≃ LazyList α where
toFun := LazyList.ofList
invFun := LazyList.toList
right_inv := by
intro xs
induction' xs using LazyList.rec with _ _ _ _ ih
- rfl
- simpa only [toList, ofList, cons.injEq, true_and]
- rw [Thunk.get, ih]
+ · rfl
+ · simpa only [toList, ofList, cons.injEq, true_and]
+ · rw [Thunk.get, ih]
left_inv := by
intro xs
induction xs
- rfl
- simpa [ofList, toList]
+ · rfl
+ · simpa [ofList, toList]
#align lazy_list.list_equiv_lazy_list LazyList.listEquivLazyList
-- Porting note: Added a name to make the recursion work.
@@ -86,31 +85,30 @@ protected def traverse {m : Type u → Type u} [Applicative m] {α β : Type u}
| LazyList.cons x xs => LazyList.cons <$> f x <*> Thunk.pure <$> xs.get.traverse f
#align lazy_list.traverse LazyList.traverse
-instance : Traversable LazyList
- where
+instance : Traversable LazyList where
map := @LazyList.traverse Id _
traverse := @LazyList.traverse
instance : IsLawfulTraversable LazyList := by
apply Equiv.isLawfulTraversable' listEquivLazyList <;> intros <;> ext <;> rename_i f xs
· induction' xs using LazyList.rec with _ _ _ _ ih
- rfl
- simpa only [Equiv.map, Functor.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk,
- LazyList.traverse, Seq.seq, toList, ofList, cons.injEq, true_and]
- ext; apply ih
+ · rfl
+ · simpa only [Equiv.map, Functor.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk,
+ LazyList.traverse, Seq.seq, toList, ofList, cons.injEq, true_and]
+ · ext; apply ih
· simp only [Equiv.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk, comp,
Functor.mapConst]
induction' xs using LazyList.rec with _ _ _ _ ih
- rfl
- simpa only [toList, ofList, LazyList.traverse, Seq.seq, Functor.map, cons.injEq, true_and]
- congr; apply ih
+ · rfl
+ · simpa only [toList, ofList, LazyList.traverse, Seq.seq, Functor.map, cons.injEq, true_and]
+ · congr; apply ih
· simp only [traverse, Equiv.traverse, listEquivLazyList, Equiv.coe_fn_mk, Equiv.coe_fn_symm_mk]
induction' xs using LazyList.rec with _ tl ih _ ih
- simp only [List.traverse, map_pure]; rfl
- have : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
- simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
- . rfl
- . apply ih
+ · simp only [List.traverse, map_pure]; rfl
+ · have : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
+ simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
+ · rfl
+ · apply ih
/-- `init xs`, if `xs` non-empty, drops the last element of the list.
Otherwise, return the empty list. -/
@@ -167,17 +165,17 @@ instance : Monad LazyList where
-- Porting note: Added `Thunk.pure` to definition.
theorem append_nil {α} (xs : LazyList α) : xs.append (Thunk.pure LazyList.nil) = xs := by
induction' xs using LazyList.rec with _ _ _ _ ih
- . rfl
- . simpa only [append, cons.injEq, true_and]
- . ext; apply ih
+ · rfl
+ · simpa only [append, cons.injEq, true_and]
+ · ext; apply ih
#align lazy_list.append_nil LazyList.append_nil
theorem append_assoc {α} (xs ys zs : LazyList α) :
(xs.append ys).append zs = xs.append (ys.append zs) := by
induction' xs using LazyList.rec with _ _ _ _ ih
- . rfl
- . simpa only [append, cons.injEq, true_and]
- . ext; apply ih
+ · rfl
+ · simpa only [append, cons.injEq, true_and]
+ · ext; apply ih
#align lazy_list.append_assoc LazyList.append_assoc
-- Porting note: Rewrote proof of `append_bind`.
@@ -197,9 +195,9 @@ instance : LawfulMonad LazyList := LawfulMonad.mk'
intro _ _ f xs
simp only [bind, Functor.map, pure, singleton]
induction' xs using LazyList.rec with _ _ _ _ ih
- . rfl
- . simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
- . ext; apply ih)
+ · rfl
+ · simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
+ · ext; apply ih)
(pure_bind := by
intros
simp only [bind, pure, singleton, LazyList.bind]
@@ -207,15 +205,15 @@ instance : LawfulMonad LazyList := LawfulMonad.mk'
(bind_assoc := by
intro _ _ _ xs _ _
induction' xs using LazyList.rec with _ _ _ _ ih
- . rfl
- . simp only [bind, LazyList.bind, append_bind]; congr
- . congr; funext; apply ih)
+ · rfl
+ · simp only [bind, LazyList.bind, append_bind]; congr
+ · congr; funext; apply ih)
(id_map := by
intro _ xs
induction' xs using LazyList.rec with _ _ _ _ ih
- . rfl
- . simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
- . ext; apply ih)
+ · rfl
+ · simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
+ · ext; apply ih)
-- Porting note: This is a dubious translation. In the warning, u1 and u3 are swapped.
/-- Try applying function `f` to every element of a `LazyList` and
@@ -55,10 +55,10 @@ def listEquivLazyList (α : Type _) : List α ≃ LazyList α
invFun := LazyList.toList
right_inv := by
intro xs
- induction xs using LazyList.rec
+ induction' xs using LazyList.rec with _ _ _ _ ih
rfl
simpa only [toList, ofList, cons.injEq, true_and]
- rename_i ih; rw [Thunk.get, ih]
+ rw [Thunk.get, ih]
left_inv := by
intro xs
induction xs
@@ -93,25 +93,24 @@ instance : Traversable LazyList
instance : IsLawfulTraversable LazyList := by
apply Equiv.isLawfulTraversable' listEquivLazyList <;> intros <;> ext <;> rename_i f xs
- · induction xs using LazyList.rec
+ · induction' xs using LazyList.rec with _ _ _ _ ih
rfl
simpa only [Equiv.map, Functor.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk,
LazyList.traverse, Seq.seq, toList, ofList, cons.injEq, true_and]
- rename_i ih; ext; apply ih
+ ext; apply ih
· simp only [Equiv.map, listEquivLazyList, Equiv.coe_fn_symm_mk, Equiv.coe_fn_mk, comp,
Functor.mapConst]
- induction xs using LazyList.rec
+ induction' xs using LazyList.rec with _ _ _ _ ih
rfl
simpa only [toList, ofList, LazyList.traverse, Seq.seq, Functor.map, cons.injEq, true_and]
- rename_i ih; congr; apply ih
+ congr; apply ih
· simp only [traverse, Equiv.traverse, listEquivLazyList, Equiv.coe_fn_mk, Equiv.coe_fn_symm_mk]
- induction xs using LazyList.rec
+ induction' xs using LazyList.rec with _ tl ih _ ih
simp only [List.traverse, map_pure]; rfl
- rename_i tl ih
have : tl.get.traverse f = ofList <$> tl.get.toList.traverse f := ih
simp only [traverse._eq_2, ih, Functor.map_map, seq_map_assoc, toList, List.traverse, map_seq]
- rfl
- rename_i ih; apply ih
+ . rfl
+ . apply ih
/-- `init xs`, if `xs` non-empty, drops the last element of the list.
Otherwise, return the empty list. -/
@@ -167,16 +166,18 @@ instance : Monad LazyList where
-- Porting note: Added `Thunk.pure` to definition.
theorem append_nil {α} (xs : LazyList α) : xs.append (Thunk.pure LazyList.nil) = xs := by
- induction xs using LazyList.rec; rfl
- simpa only [append, cons.injEq, true_and]
- ext; rename_i ih; apply ih
+ induction' xs using LazyList.rec with _ _ _ _ ih
+ . rfl
+ . simpa only [append, cons.injEq, true_and]
+ . ext; apply ih
#align lazy_list.append_nil LazyList.append_nil
theorem append_assoc {α} (xs ys zs : LazyList α) :
(xs.append ys).append zs = xs.append (ys.append zs) := by
- induction xs using LazyList.rec; rfl
- simpa only [append, cons.injEq, true_and]
- ext; rename_i ih; apply ih
+ induction' xs using LazyList.rec with _ _ _ _ ih
+ . rfl
+ . simpa only [append, cons.injEq, true_and]
+ . ext; apply ih
#align lazy_list.append_assoc LazyList.append_assoc
-- Porting note: Rewrote proof of `append_bind`.
@@ -195,23 +196,26 @@ instance : LawfulMonad LazyList := LawfulMonad.mk'
(bind_pure_comp := by
intro _ _ f xs
simp only [bind, Functor.map, pure, singleton]
- induction xs using LazyList.rec; rfl
- simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
- rename_i ih; ext; apply ih)
+ induction' xs using LazyList.rec with _ _ _ _ ih
+ . rfl
+ . simp only [bind._eq_2, append, traverse._eq_2, Id.map_eq, cons.injEq, true_and]; congr
+ . ext; apply ih)
(pure_bind := by
intros
simp only [bind, pure, singleton, LazyList.bind]
apply append_nil)
(bind_assoc := by
- intros; rename_i xs _ _
- induction xs using LazyList.rec; rfl
- simp only [bind, LazyList.bind, append_bind]; congr
- rename_i ih; congr; funext; apply ih)
+ intro _ _ _ xs _ _
+ induction' xs using LazyList.rec with _ _ _ _ ih
+ . rfl
+ . simp only [bind, LazyList.bind, append_bind]; congr
+ . congr; funext; apply ih)
(id_map := by
intro _ xs
- induction xs using LazyList.rec; rfl
- simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
- rename_i ih; ext; apply ih)
+ induction' xs using LazyList.rec with _ _ _ _ ih
+ . rfl
+ . simpa only [Functor.map, traverse._eq_2, id_eq, Id.map_eq, Seq.seq, cons.injEq, true_and]
+ . ext; apply ih)
-- Porting note: This is a dubious translation. In the warning, u1 and u3 are swapped.
/-- Try applying function `f` to every element of a `LazyList` and
The unported dependencies are