Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓to navigate, Ctrl+🖱️to focus. On Mac, use Cmdinstead of Ctrl.
/-
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura

! This file was ported from Lean 3 source module data.stream.init
! leanprover-community/mathlib commit 207cfac9fcd06138865b5d04f7091e46d9320432
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Std.Tactic.Ext
import Mathlib.Data.Stream.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Init.Data.List.Basic
import Mathlib.Data.List.Basic

/-!
# Streams a.k.a. infinite lists a.k.a. infinite sequences

Porting note:
This file used to be in the core library. It was moved to `mathlib` and renamed to `init` to avoid
name clashes.  -/

open Nat Function Option

namespace Stream'

variable {
α: Type u
α
:
Type u: Type (u+1)
Type u
} {
β: Type v
β
:
Type v: Type (v+1)
Type v
} {
δ: Type w
δ
:
Type w: Type (w+1)
Type w
}
instance: {α : Type u} → [inst : Inhabited α] → Inhabited (Stream' α)
instance
[
Inhabited: Sort ?u.14 → Sort (max1?u.14)
Inhabited
α: Type u
α
] :
Inhabited: Sort ?u.17 → Sort (max1?u.17)
Inhabited
(
Stream': Type ?u.18 → Type ?u.18
Stream'
α: Type u
α
) := ⟨
Stream'.const: {α : Type ?u.26} → αStream' α
Stream'.const
default: {α : Sort ?u.30} → [self : Inhabited α] → α
default
protected theorem
eta: ∀ {α : Type u} (s : Stream' α), head s :: tail s = s
eta
(
s: Stream' α
s
:
Stream': Type ?u.223 → Type ?u.223
Stream'
α: Type u
α
) : (
head: {α : Type ?u.229} → Stream' αα
head
s: Stream' α
s
::
tail: {α : Type ?u.234} → Stream' αStream' α
tail
s: Stream' α
s
) =
s: Stream' α
s
:=
funext: ∀ {α : Sort ?u.1149} {β : αSort ?u.1148} {f g : (x : α) → β x}, (∀ (x : α), f x = g x) → f = g
funext
fun
i: ?m.1161
i
=>

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

s: Stream' α

i:


(head s :: tail s) i = s i
α: Type u

β: Type v

δ: Type w

s: Stream' α


zero
(head s :: tail s) zero = s zero
α: Type u

β: Type v

δ: Type w

s: Stream' α

n✝:


succ
(head s :: tail s) (succ n✝) = s (succ n✝)
α: Type u

β: Type v

δ: Type w

s: Stream' α

i:


(head s :: tail s) i = s i
α: Type u

β: Type v

δ: Type w

s: Stream' α


zero
(head s :: tail s) zero = s zero
α: Type u

β: Type v

δ: Type w

s: Stream' α

n✝:


succ
(head s :: tail s) (succ n✝) = s (succ n✝)
α: Type u

β: Type v

δ: Type w

s: Stream' α

i:


(head s :: tail s) i = s i

Goals accomplished! 🐙
#align stream.eta
Stream'.eta: ∀ {α : Type u} (s : Stream' α), head s :: tail s = s
Stream'.eta
@[ext] protected theorem
ext: ∀ {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
ext
{
s₁: Stream' α
s₁
s₂: Stream' α
s₂
:
Stream': Type ?u.1254 → Type ?u.1254
Stream'
α: Type u
α
} : (∀
n: ?m.1259
n
,
nth: {α : Type ?u.1263} → Stream' αα
nth
s₁: Stream' α
s₁
n: ?m.1259
n
=
nth: {α : Type ?u.1268} → Stream' αα
nth
s₂: Stream' α
s₂
n: ?m.1259
n
) →
s₁: Stream' α
s₁
=
s₂: Stream' α
s₂
:= fun
h: ?m.1282
h
=>
funext: ∀ {α : Sort ?u.1286} {β : αSort ?u.1285} {f g : (x : α) → β x}, (∀ (x : α), f x = g x) → f = g
funext
h: ?m.1282
h
#align stream.ext
Stream'.ext: ∀ {α : Type u} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
@[simp] theorem
nth_zero_cons: ∀ (a : α) (s : Stream' α), nth (a :: s) 0 = a
nth_zero_cons
(
a: α
a
:
α: Type u
α
) (
s: Stream' α
s
:
Stream': Type ?u.1322 → Type ?u.1322
Stream'
α: Type u
α
) :
nth: {α : Type ?u.1326} → Stream' αα
nth
(
a: α
a
::
s: Stream' α
s
)
0: ?m.2233
0
=
a: α
a
:=
rfl: ∀ {α : Sort ?u.2247} {a : α}, a = a
rfl
#align stream.nth_zero_cons
Stream'.nth_zero_cons: ∀ {α : Type u} (a : α) (s : Stream' α), nth (a :: s) 0 = a
Stream'.nth_zero_cons
@[simp] theorem
head_cons: ∀ {α : Type u} (a : α) (s : Stream' α), head (a :: s) = a
head_cons
(
a: α
a
:
α: Type u
α
) (
s: Stream' α
s
:
Stream': Type ?u.2290 → Type ?u.2290
Stream'
α: Type u
α
) :
head: {α : Type ?u.2294} → Stream' αα
head
(
a: α
a
::
s: Stream' α
s
) =
a: α
a
:=
rfl: ∀ {α : Sort ?u.3204} {a : α}, a = a
rfl
#align stream.head_cons
Stream'.head_cons: ∀ {α : Type u} (a : α) (s : Stream' α), head (a :: s) = a
Stream'.head_cons
@[simp] theorem
tail_cons: ∀ {α : Type u} (a : α) (s : Stream' α), tail (a :: s) = s
tail_cons
(
a: α
a
:
α: Type u
α
) (
s: Stream' α
s
:
Stream': Type ?u.3247 → Type ?u.3247
Stream'
α: Type u
α
) :
tail: {α : Type ?u.3251} → Stream' αStream' α
tail
(
a: α
a
::
s: Stream' α
s
) =
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.4163} {a : α}, a = a
rfl
#align stream.tail_cons
Stream'.tail_cons: ∀ {α : Type u} (a : α) (s : Stream' α), tail (a :: s) = s
Stream'.tail_cons
@[simp] theorem
nth_drop: ∀ {α : Type u} (n m : ) (s : Stream' α), nth (drop m s) n = nth s (n + m)
nth_drop
(
n:
n
m:
m
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.4221 → Type ?u.4221
Stream'
α: Type u
α
) :
nth: {α : Type ?u.4225} → Stream' αα
nth
(
drop: {α : Type ?u.4227} → Stream' αStream' α
drop
m:
m
s: Stream' α
s
)
n:
n
=
nth: {α : Type ?u.4235} → Stream' αα
nth
s: Stream' α
s
(
n:
n
+
m:
m
) :=
rfl: ∀ {α : Sort ?u.4284} {a : α}, a = a
rfl
#align stream.nth_drop
Stream'.nth_drop: ∀ {α : Type u} (n m : ) (s : Stream' α), nth (drop m s) n = nth s (n + m)
Stream'.nth_drop
theorem
tail_eq_drop: ∀ {α : Type u} (s : Stream' α), tail s = drop 1 s
tail_eq_drop
(
s: Stream' α
s
:
Stream': Type ?u.4334 → Type ?u.4334
Stream'
α: Type u
α
) :
tail: {α : Type ?u.4338} → Stream' αStream' α
tail
s: Stream' α
s
=
drop: {α : Type ?u.4344} → Stream' αStream' α
drop
1: ?m.4347
1
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.4363} {a : α}, a = a
rfl
#align stream.tail_eq_drop
Stream'.tail_eq_drop: ∀ {α : Type u} (s : Stream' α), tail s = drop 1 s
Stream'.tail_eq_drop
@[simp] theorem
drop_drop: ∀ {α : Type u} (n m : ) (s : Stream' α), drop n (drop m s) = drop (n + m) s
drop_drop
(
n:
n
m:
m
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.4382 → Type ?u.4382
Stream'
α: Type u
α
) :
drop: {α : Type ?u.4386} → Stream' αStream' α
drop
n:
n
(
drop: {α : Type ?u.4388} → Stream' αStream' α
drop
m:
m
s: Stream' α
s
) =
drop: {α : Type ?u.4397} → Stream' αStream' α
drop
(
n:
n
+
m:
m
)
s: Stream' α
s
:=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

n, m:

s: Stream' α


drop n (drop m s) = drop (n + m) s
α: Type u

β: Type v

δ: Type w

n, m:

s: Stream' α

n✝:


a
nth (drop n (drop m s)) n✝ = nth (drop (n + m) s) n✝
α: Type u

β: Type v

δ: Type w

n, m:

s: Stream' α

n✝:


a
nth (drop n (drop m s)) n✝ = nth (drop (n + m) s) n✝
α: Type u

β: Type v

δ: Type w

n, m:

s: Stream' α


drop n (drop m s) = drop (n + m) s

Goals accomplished! 🐙
#align stream.drop_drop
Stream'.drop_drop: ∀ {α : Type u} (n m : ) (s : Stream' α), drop n (drop m s) = drop (n + m) s
Stream'.drop_drop
@[simp] theorem
nth_tail: ∀ {α : Type u} {n : } {s : Stream' α}, nth (tail s) n = nth s (n + 1)
nth_tail
{
s: Stream' α
s
:
Stream': Type ?u.4622 → Type ?u.4622
Stream'
α: Type u
α
} :
s: Stream' α
s
.
tail: {α : Type ?u.4626} → Stream' αStream' α
tail
.
nth: {α : Type ?u.4629} → Stream' αα
nth
n: ?m.4619
n
=
s: Stream' α
s
.
nth: {α : Type ?u.4634} → Stream' αα
nth
(
n: ?m.4619
n
+
1: ?m.4643
1
) :=
rfl: ∀ {α : Sort ?u.4707} {a : α}, a = a
rfl
@[simp] theorem
tail_drop': ∀ {α : Type u} {i : } {s : Stream' α}, tail (drop i s) = drop (i + 1) s
tail_drop'
{
s: Stream' α
s
:
Stream': Type ?u.4767 → Type ?u.4767
Stream'
α: Type u
α
} :
tail: {α : Type ?u.4771} → Stream' αStream' α
tail
(
drop: {α : Type ?u.4773} → Stream' αStream' α
drop
i: ?m.4764
i
s: Stream' α
s
) =
s: Stream' α
s
.
drop: {α : Type ?u.4782} → Stream' αStream' α
drop
(
i: ?m.4764
i
+
1: ?m.4792
1
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

i:

s: Stream' α


tail (drop i s) = drop (i + 1) s
α: Type u

β: Type v

δ: Type w

i:

s: Stream' α

n✝:


a
nth (tail (drop i s)) n✝ = nth (drop (i + 1) s) n✝
α: Type u

β: Type v

δ: Type w

i:

s: Stream' α

n✝:


a
nth (tail (drop i s)) n✝ = nth (drop (i + 1) s) n✝
α: Type u

β: Type v

δ: Type w

i:

s: Stream' α


tail (drop i s) = drop (i + 1) s

Goals accomplished! 🐙
@[simp] theorem
drop_tail': ∀ {α : Type u} {i : } {s : Stream' α}, drop i (tail s) = drop (i + 1) s
drop_tail'
{
s: Stream' α
s
:
Stream': Type ?u.5239 → Type ?u.5239
Stream'
α: Type u
α
} :
drop: {α : Type ?u.5243} → Stream' αStream' α
drop
i: ?m.5236
i
(
tail: {α : Type ?u.5245} → Stream' αStream' α
tail
s: Stream' α
s
) =
s: Stream' α
s
.
drop: {α : Type ?u.5254} → Stream' αStream' α
drop
(
i: ?m.5236
i
+
1: ?m.5264
1
) :=
rfl: ∀ {α : Sort ?u.5329} {a : α}, a = a
rfl
theorem
tail_drop: ∀ (n : ) (s : Stream' α), tail (drop n s) = drop n (tail s)
tail_drop
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.5413 → Type ?u.5413
Stream'
α: Type u
α
) :
tail: {α : Type ?u.5417} → Stream' αStream' α
tail
(
drop: {α : Type ?u.5419} → Stream' αStream' α
drop
n:
n
s: Stream' α
s
) =
drop: {α : Type ?u.5428} → Stream' αStream' α
drop
n:
n
(
tail: {α : Type ?u.5430} → Stream' αStream' α
tail
s: Stream' α
s
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

n:

s: Stream' α


tail (drop n s) = drop n (tail s)

Goals accomplished! 🐙
#align stream.tail_drop
Stream'.tail_drop: ∀ {α : Type u} (n : ) (s : Stream' α), tail (drop n s) = drop n (tail s)
Stream'.tail_drop
theorem
nth_succ: ∀ (n : ) (s : Stream' α), nth s (succ n) = nth (tail s) n
nth_succ
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.5539 → Type ?u.5539
Stream'
α: Type u
α
) :
nth: {α : Type ?u.5543} → Stream' αα
nth
s: Stream' α
s
(
succ:
succ
n:
n
) =
nth: {α : Type ?u.5548} → Stream' αα
nth
(
tail: {α : Type ?u.5550} → Stream' αStream' α
tail
s: Stream' α
s
)
n:
n
:=
rfl: ∀ {α : Sort ?u.5561} {a : α}, a = a
rfl
#align stream.nth_succ
Stream'.nth_succ: ∀ {α : Type u} (n : ) (s : Stream' α), nth s (succ n) = nth (tail s) n
Stream'.nth_succ
@[simp] theorem
nth_succ_cons: ∀ {α : Type u} (n : ) (s : Stream' α) (x : α), nth (x :: s) (succ n) = nth s n
nth_succ_cons
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.5596 → Type ?u.5596
Stream'
α: Type u
α
) (
x: α
x
:
α: Type u
α
) :
nth: {α : Type ?u.5602} → Stream' αα
nth
(
x: α
x
::
s: Stream' α
s
)
n:
n
.
succ:
succ
=
nth: {α : Type ?u.6509} → Stream' αα
nth
s: Stream' α
s
n:
n
:=
rfl: ∀ {α : Sort ?u.6518} {a : α}, a = a
rfl
#align stream.nth_succ_cons
Stream'.nth_succ_cons: ∀ {α : Type u} (n : ) (s : Stream' α) (x : α), nth (x :: s) (succ n) = nth s n
Stream'.nth_succ_cons
@[simp] theorem
drop_zero: ∀ {α : Type u} {s : Stream' α}, drop 0 s = s
drop_zero
{
s: Stream' α
s
:
Stream': Type ?u.6579 → Type ?u.6579
Stream'
α: Type u
α
} :
s: Stream' α
s
.
drop: {α : Type ?u.6583} → Stream' αStream' α
drop
0: ?m.6590
0
=
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.6606} {a : α}, a = a
rfl
theorem
drop_succ: ∀ (n : ) (s : Stream' α), drop (succ n) s = drop n (tail s)
drop_succ
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.6647 → Type ?u.6647
Stream'
α: Type u
α
) :
drop: {α : Type ?u.6651} → Stream' αStream' α
drop
(
succ:
succ
n:
n
)
s: Stream' α
s
=
drop: {α : Type ?u.6657} → Stream' αStream' α
drop
n:
n
(
tail: {α : Type ?u.6659} → Stream' αStream' α
tail
s: Stream' α
s
) :=
rfl: ∀ {α : Sort ?u.6671} {a : α}, a = a
rfl
#align stream.drop_succ
Stream'.drop_succ: ∀ {α : Type u} (n : ) (s : Stream' α), drop (succ n) s = drop n (tail s)
Stream'.drop_succ
theorem
head_drop: ∀ {α : Type u} (a : Stream' α) (n : ), head (drop n a) = nth a n
head_drop
(
a: Stream' α
a
:
Stream': Type ?u.6724 → Type ?u.6724
Stream'
α: Type u
α
) (
n:
n
:
: Type
) : (
a: Stream' α
a
.
drop: {α : Type ?u.6730} → Stream' αStream' α
drop
n:
n
).
head: {α : Type ?u.6738} → Stream' αα
head
=
a: Stream' α
a
.
nth: {α : Type ?u.6742} → Stream' αα
nth
n:
n
:=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

a: Stream' α

n:


head (drop n a) = nth a n

Goals accomplished! 🐙
#align stream.head_drop
Stream'.head_drop: ∀ {α : Type u} (a : Stream' α) (n : ), head (drop n a) = nth a n
Stream'.head_drop
theorem
cons_injective2: Injective2 cons
cons_injective2
:
Function.Injective2: {α : Sort ?u.6882} → {β : Sort ?u.6881} → {γ : Sort ?u.6880} → (αβγ) → Prop
Function.Injective2
(
cons: {α : Type ?u.6893} → αStream' αStream' α
cons
:
α: Type u
α
Stream': Type ?u.6890 → Type ?u.6890
Stream'
α: Type u
α
Stream': Type ?u.6892 → Type ?u.6892
Stream'
α: Type u
α
) := fun
x: ?m.6907
x
y: ?m.6910
y
s: ?m.6913
s
t: ?m.6916
t
h: ?m.6919
h
=> ⟨

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


x = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


x = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


nth (x :: s) 0 = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


x = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


nth (y :: t) 0 = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


x = y
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t


y = y

Goals accomplished! 🐙
,
Stream'.ext: ∀ {α : Type ?u.6930} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
fun
n: ?m.6939
n
=>

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth s n = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth s n = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth (x :: s) (succ n) = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth s n = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth (y :: t) (succ n) = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth s n = nth t n
α: Type u

β: Type v

δ: Type w

x, y: α

s, t: Stream' α

h: x :: s = y :: t

n:


nth t n = nth t n

Goals accomplished! 🐙
#align stream.cons_injective2
Stream'.cons_injective2: ∀ {α : Type u}, Injective2 cons
Stream'.cons_injective2
theorem
cons_injective_left: ∀ (s : Stream' α), Injective fun x => x :: s
cons_injective_left
(
s: Stream' α
s
:
Stream': Type ?u.7026 → Type ?u.7026
Stream'
α: Type u
α
) :
Function.Injective: {α : Sort ?u.7030} → {β : Sort ?u.7029} → (αβ) → Prop
Function.Injective
fun
x: ?m.7034
x
=>
cons: {α : Type ?u.7036} → αStream' αStream' α
cons
x: ?m.7034
x
s: Stream' α
s
:=
cons_injective2: ∀ {α : Type ?u.7049}, Injective2 cons
cons_injective2
.
left: ∀ {α : Sort ?u.7051} {β : Sort ?u.7052} {γ : Sort ?u.7053} {f : αβγ}, Injective2 f∀ (b : β), Injective fun a => f a b
left
_: ?m.7064
_
#align stream.cons_injective_left
Stream'.cons_injective_left: ∀ {α : Type u} (s : Stream' α), Injective fun x => x :: s
Stream'.cons_injective_left
theorem
cons_injective_right: ∀ {α : Type u} (x : α), Injective (cons x)
cons_injective_right
(
x: α
x
:
α: Type u
α
) :
Function.Injective: {α : Sort ?u.7097} → {β : Sort ?u.7096} → (αβ) → Prop
Function.Injective
(
cons: {α : Type ?u.7100} → αStream' αStream' α
cons
x: α
x
) :=
cons_injective2: ∀ {α : Type ?u.7113}, Injective2 cons
cons_injective2
.
right: ∀ {α : Sort ?u.7115} {β : Sort ?u.7116} {γ : Sort ?u.7117} {f : αβγ}, Injective2 f∀ (a : α), Injective (f a)
right
_: ?m.7127
_
#align stream.cons_injective_right
Stream'.cons_injective_right: ∀ {α : Type u} (x : α), Injective (cons x)
Stream'.cons_injective_right
theorem
all_def: ∀ (p : αProp) (s : Stream' α), All p s = ∀ (n : ), p (nth s n)
all_def
(
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
) (
s: Stream' α
s
:
Stream': Type ?u.7159 → Type ?u.7159
Stream'
α: Type u
α
) :
All: {α : Type ?u.7163} → (αProp) → Stream' αProp
All
p: αProp
p
s: Stream' α
s
= ∀
n: ?m.7171
n
,
p: αProp
p
(
nth: {α : Type ?u.7174} → Stream' αα
nth
s: Stream' α
s
n: ?m.7171
n
) :=
rfl: ∀ {α : Sort ?u.7184} {a : α}, a = a
rfl
#align stream.all_def
Stream'.all_def: ∀ {α : Type u} (p : αProp) (s : Stream' α), All p s = ∀ (n : ), p (nth s n)
Stream'.all_def
theorem
any_def: ∀ {α : Type u} (p : αProp) (s : Stream' α), Any p s = n, p (nth s n)
any_def
(
p: αProp
p
:
α: Type u
α
Prop: Type
Prop
) (
s: Stream' α
s
:
Stream': Type ?u.7205 → Type ?u.7205
Stream'
α: Type u
α
) :
Any: {α : Type ?u.7209} → (αProp) → Stream' αProp
Any
p: αProp
p
s: Stream' α
s
= ∃
n: ?m.7219
n
,
p: αProp
p
(
nth: {α : Type ?u.7221} → Stream' αα
nth
s: Stream' α
s
n: ?m.7219
n
) :=
rfl: ∀ {α : Sort ?u.7230} {a : α}, a = a
rfl
#align stream.any_def
Stream'.any_def: ∀ {α : Type u} (p : αProp) (s : Stream' α), Any p s = n, p (nth s n)
Stream'.any_def
@[simp] theorem
mem_cons: ∀ {α : Type u} (a : α) (s : Stream' α), a a :: s
mem_cons
(
a: α
a
:
α: Type u
α
) (
s: Stream' α
s
:
Stream': Type ?u.7249 → Type ?u.7249
Stream'
α: Type u
α
) :
a: α
a
a: α
a
::
s: Stream' α
s
:=
Exists.intro: ∀ {α : Sort ?u.8183} {p : αProp} (w : α), p wExists p
Exists.intro
0: ?m.8193
0
rfl: ∀ {α : Sort ?u.8203} {a : α}, a = a
rfl
#align stream.mem_cons
Stream'.mem_cons: ∀ {α : Type u} (a : α) (s : Stream' α), a a :: s
Stream'.mem_cons
theorem
mem_cons_of_mem: ∀ {α : Type u} {a : α} {s : Stream' α} (b : α), a sa b :: s
mem_cons_of_mem
{
a: α
a
:
α: Type u
α
} {
s: Stream' α
s
:
Stream': Type ?u.8251 → Type ?u.8251
Stream'
α: Type u
α
} (
b: α
b
:
α: Type u
α
) :
a: α
a
s: Stream' α
s
a: α
a
b: α
b
::
s: Stream' α
s
:= fun
n:
n
,
h: (fun b => a = b) (nth s n)
h
⟩ =>
Exists.intro: ∀ {α : Sort ?u.9245} {p : αProp} (w : α), p wExists p
Exists.intro
(
succ:
succ
n:
n
) (

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth (b :: s) (succ n))
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth (b :: s) (succ n))
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth (tail (b :: s)) n)
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth (b :: s) (succ n))
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth s n)
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => a = b) (nth (b :: s) (succ n))
α: Type u

β: Type v

δ: Type w

a: α

s: Stream' α

b: α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => nth s n = b) (nth s n)

Goals accomplished! 🐙
) #align stream.mem_cons_of_mem
Stream'.mem_cons_of_mem: ∀ {α : Type u} {a : α} {s : Stream' α} (b : α), a sa b :: s
Stream'.mem_cons_of_mem
theorem
eq_or_mem_of_mem_cons: ∀ {α : Type u} {a b : α} {s : Stream' α}, a b :: sa = b a s
eq_or_mem_of_mem_cons
{
a: α
a
b: α
b
:
α: Type u
α
} {
s: Stream' α
s
:
Stream': Type ?u.9392 → Type ?u.9392
Stream'
α: Type u
α
} : (
a: α
a
b: α
b
::
s: Stream' α
s
) →
a: α
a
=
b: α
b
a: α
a
s: Stream' α
s
:= fun
n:
n
,
h: (fun b => a = b) (nth (b :: s) n)
h
⟩ =>

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n:

h: (fun b => a = b) (nth (b :: s) n)


a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

h: a = nth (b :: s) zero


zero
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n:

h: (fun b => a = b) (nth (b :: s) n)


a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

h: a = nth (b :: s) zero


zero
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

h: a = nth (b :: s) zero


zero
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

h: a = nth (b :: s) zero


zero.h
a = b
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

h: a = nth (b :: s) zero


zero
a = b a s

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n:

h: (fun b => a = b) (nth (b :: s) n)


a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (tail (b :: s)) n'


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth s n'


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth s n'


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth s n'


succ.h
a s
α: Type u

β: Type v

δ: Type w

a, b: α

s: Stream' α

x✝: a b :: s

n':

h: a = nth (b :: s) (succ n')


succ
a = b a s

Goals accomplished! 🐙
#align stream.eq_or_mem_of_mem_cons
Stream'.eq_or_mem_of_mem_cons: ∀ {α : Type u} {a b : α} {s : Stream' α}, a b :: sa = b a s
Stream'.eq_or_mem_of_mem_cons
theorem
mem_of_nth_eq: ∀ {n : } {s : Stream' α} {a : α}, a = nth s na s
mem_of_nth_eq
{
n:
n
:
Nat: Type
Nat
} {
s: Stream' α
s
:
Stream': Type ?u.10623 → Type ?u.10623
Stream'
α: Type u
α
} {
a: α
a
:
α: Type u
α
} :
a: α
a
=
nth: {α : Type ?u.10630} → Stream' αα
nth
s: Stream' α
s
n:
n
a: α
a
s: Stream' α
s
:= fun
h: ?m.10672
h
=>
Exists.intro: ∀ {α : Sort ?u.10674} {p : αProp} (w : α), p wExists p
Exists.intro
n:
n
h: ?m.10672
h
#align stream.mem_of_nth_eq
Stream'.mem_of_nth_eq: ∀ {α : Type u} {n : } {s : Stream' α} {a : α}, a = nth s na s
Stream'.mem_of_nth_eq
section Map variable (
f: αβ
f
:
α: Type u
α
β: Type v
β
) theorem
drop_map: ∀ {α : Type u} {β : Type v} (f : αβ) (n : ) (s : Stream' α), drop n (map f s) = map f (drop n s)
drop_map
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.10715 → Type ?u.10715
Stream'
α: Type u
α
) :
drop: {α : Type ?u.10719} → Stream' αStream' α
drop
n:
n
(
map: {α : Type ?u.10722} → {β : Type ?u.10721} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
) =
map: {α : Type ?u.10736} → {β : Type ?u.10735} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
drop: {α : Type ?u.10742} → Stream' αStream' α
drop
n:
n
s: Stream' α
s
) :=
Stream'.ext: ∀ {α : Type ?u.10752} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
fun
_: ?m.10761
_
=>
rfl: ∀ {α : Sort ?u.10763} {a : α}, a = a
rfl
#align stream.drop_map
Stream'.drop_map: ∀ {α : Type u} {β : Type v} (f : αβ) (n : ) (s : Stream' α), drop n (map f s) = map f (drop n s)
Stream'.drop_map
@[simp] theorem
nth_map: ∀ {α : Type u} {β : Type v} (f : αβ) (n : ) (s : Stream' α), nth (map f s) n = f (nth s n)
nth_map
(
n:
n
:
Nat: Type
Nat
) (
s: Stream' α
s
:
Stream': Type ?u.10816 → Type ?u.10816
Stream'
α: Type u
α
) :
nth: {α : Type ?u.10820} → Stream' αα
nth
(
map: {α : Type ?u.10823} → {β : Type ?u.10822} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
)
n:
n
=
f: αβ
f
(
nth: {α : Type ?u.10835} → Stream' αα
nth
s: Stream' α
s
n:
n
) :=
rfl: ∀ {α : Sort ?u.10842} {a : α}, a = a
rfl
#align stream.nth_map
Stream'.nth_map: ∀ {α : Type u} {β : Type v} (f : αβ) (n : ) (s : Stream' α), nth (map f s) n = f (nth s n)
Stream'.nth_map
theorem
tail_map: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), tail (map f s) = map f (tail s)
tail_map
(
s: Stream' α
s
:
Stream': Type ?u.10885 → Type ?u.10885
Stream'
α: Type u
α
) :
tail: {α : Type ?u.10889} → Stream' αStream' α
tail
(
map: {α : Type ?u.10892} → {β : Type ?u.10891} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
) =
map: {α : Type ?u.10906} → {β : Type ?u.10905} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
tail: {α : Type ?u.10912} → Stream' αStream' α
tail
s: Stream' α
s
) :=
rfl: ∀ {α : Sort ?u.10921} {a : α}, a = a
rfl
#align stream.tail_map
Stream'.tail_map: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), tail (map f s) = map f (tail s)
Stream'.tail_map
@[simp] theorem
head_map: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), head (map f s) = f (head s)
head_map
(
s: Stream' α
s
:
Stream': Type ?u.10963 → Type ?u.10963
Stream'
α: Type u
α
) :
head: {α : Type ?u.10967} → Stream' αα
head
(
map: {α : Type ?u.10970} → {β : Type ?u.10969} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
) =
f: αβ
f
(
head: {α : Type ?u.10982} → Stream' αα
head
s: Stream' α
s
) :=
rfl: ∀ {α : Sort ?u.10988} {a : α}, a = a
rfl
#align stream.head_map
Stream'.head_map: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), head (map f s) = f (head s)
Stream'.head_map
theorem
map_eq: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), map f s = f (head s) :: map f (tail s)
map_eq
(
s: Stream' α
s
:
Stream': Type ?u.11032 → Type ?u.11032
Stream'
α: Type u
α
) :
map: {α : Type ?u.11037} → {β : Type ?u.11036} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
=
f: αβ
f
(
head: {α : Type ?u.11048} → Stream' αα
head
s: Stream' α
s
)::
map: {α : Type ?u.11052} → {β : Type ?u.11051} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
tail: {α : Type ?u.11060} → Stream' αStream' α
tail
s: Stream' α
s
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


map f s = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


map f s = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


head (map f s) :: tail (map f s) = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


map f s = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


head (map f s) :: map f (tail s) = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


map f s = f (head s) :: map f (tail s)
α: Type u

β: Type v

δ: Type w

f: αβ

s: Stream' α


f (head s) :: map f (tail s) = f (head s) :: map f (tail s)

Goals accomplished! 🐙
#align stream.map_eq
Stream'.map_eq: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), map f s = f (head s) :: map f (tail s)
Stream'.map_eq
theorem
map_cons: ∀ (a : α) (s : Stream' α), map f (a :: s) = f a :: map f s
map_cons
(
a: α
a
:
α: Type u
α
) (
s: Stream' α
s
:
Stream': Type ?u.12069 → Type ?u.12069
Stream'
α: Type u
α
) :
map: {α : Type ?u.12074} → {β : Type ?u.12073} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
a: α
a
::
s: Stream' α
s
) =
f: αβ
f
a: α
a
::
map: {α : Type ?u.12985} → {β : Type ?u.12984} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
:=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


map f (a :: s) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


map f (a :: s) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


head (map f (a :: s)) :: tail (map f (a :: s)) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


map f (a :: s) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


head (f (head (a :: s)) :: map f (tail (a :: s))) :: tail (f (head (a :: s)) :: map f (tail (a :: s))) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


head (f (head (a :: s)) :: map f (tail (a :: s))) :: tail (f (head (a :: s)) :: map f (tail (a :: s))) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


head (f (head (a :: s)) :: map f (tail (a :: s))) :: tail (f (head (a :: s)) :: map f (tail (a :: s))) = f a :: map f s
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α


map f (a :: s) = f a :: map f s

Goals accomplished! 🐙
#align stream.map_cons
Stream'.map_cons: ∀ {α : Type u} {β : Type v} (f : αβ) (a : α) (s : Stream' α), map f (a :: s) = f a :: map f s
Stream'.map_cons
@[simp] theorem
map_id: ∀ {α : Type u} (s : Stream' α), map id s = s
map_id
(
s: Stream' α
s
:
Stream': Type ?u.14839 → Type ?u.14839
Stream'
α: Type u
α
) :
map: {α : Type ?u.14844} → {β : Type ?u.14843} → (αβ) → Stream' αStream' β
map
id: {α : Sort ?u.14847} → αα
id
s: Stream' α
s
=
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.14860} {a : α}, a = a
rfl
#align stream.map_id
Stream'.map_id: ∀ {α : Type u} (s : Stream' α), map id s = s
Stream'.map_id
@[simp] theorem
map_map: ∀ {α : Type u} {β : Type v} {δ : Type w} (g : βδ) (f : αβ) (s : Stream' α), map g (map f s) = map (g f) s
map_map
(
g: βδ
g
:
β: Type v
β
δ: Type w
δ
) (
f: αβ
f
:
α: Type u
α
β: Type v
β
) (
s: Stream' α
s
:
Stream': Type ?u.14901 → Type ?u.14901
Stream'
α: Type u
α
) :
map: {α : Type ?u.14906} → {β : Type ?u.14905} → (αβ) → Stream' αStream' β
map
g: βδ
g
(
map: {α : Type ?u.14913} → {β : Type ?u.14912} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
) =
map: {α : Type ?u.14926} → {β : Type ?u.14925} → (αβ) → Stream' αStream' β
map
(
g: βδ
g
f: αβ
f
)
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.14954} {a : α}, a = a
rfl
#align stream.map_map
Stream'.map_map: ∀ {α : Type u} {β : Type v} {δ : Type w} (g : βδ) (f : αβ) (s : Stream' α), map g (map f s) = map (g f) s
Stream'.map_map
@[simp] theorem
map_tail: ∀ (s : Stream' α), map f (tail s) = tail (map f s)
map_tail
(
s: Stream' α
s
:
Stream': Type ?u.15020 → Type ?u.15020
Stream'
α: Type u
α
) :
map: {α : Type ?u.15025} → {β : Type ?u.15024} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
tail: {α : Type ?u.15031} → Stream' αStream' α
tail
s: Stream' α
s
) =
tail: {α : Type ?u.15038} → Stream' αStream' α
tail
(
map: {α : Type ?u.15041} → {β : Type ?u.15040} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
) :=
rfl: ∀ {α : Sort ?u.15056} {a : α}, a = a
rfl
#align stream.map_tail
Stream'.map_tail: ∀ {α : Type u} {β : Type v} (f : αβ) (s : Stream' α), map f (tail s) = tail (map f s)
Stream'.map_tail
theorem
mem_map: ∀ {a : α} {s : Stream' α}, a sf a map f s
mem_map
{
a: α
a
:
α: Type u
α
} {
s: Stream' α
s
:
Stream': Type ?u.15117 → Type ?u.15117
Stream'
α: Type u
α
} :
a: α
a
s: Stream' α
s
f: αβ
f
a: α
a
map: {α : Type ?u.15166} → {β : Type ?u.15165} → (αβ) → Stream' αStream' β
map
f: αβ
f
s: Stream' α
s
:= fun
n:
n
,
h: (fun b => a = b) (nth s n)
h
⟩ =>
Exists.intro: ∀ {α : Sort ?u.15227} {p : αProp} (w : α), p wExists p
Exists.intro
n:
n
(

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => f a = b) (nth (map f s) n)
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => f a = b) (nth (map f s) n)
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => f a = b) (f (nth s n))
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => f a = b) (nth (map f s) n)
α: Type u

β: Type v

δ: Type w

f: αβ

a: α

s: Stream' α

x✝: a s

n:

h: (fun b => a = b) (nth s n)


(fun b => f (nth s n) = b) (f (nth s n))

Goals accomplished! 🐙
) #align stream.mem_map
Stream'.mem_map: ∀ {α : Type u} {β : Type v} (f : αβ) {a : α} {s : Stream' α}, a sf a map f s
Stream'.mem_map
theorem
exists_of_mem_map: ∀ {α : Type u} {β : Type v} {f : αβ} {b : β} {s : Stream' α}, b map f sa, a s f a = b
exists_of_mem_map
{
f: αβ
f
} {
b: β
b
:
β: Type v
β
} {
s: Stream' α
s
:
Stream': Type ?u.15363 → Type ?u.15363
Stream'
α: Type u
α
} :
b: β
b
map: {α : Type ?u.15384} → {β : Type ?u.15383} → (αβ) → Stream' αStream' β
map
f: ?m.15358
f
s: Stream' α
s
→ ∃
a: ?m.15413
a
,
a: ?m.15413
a
s: Stream' α
s
f: ?m.15358
f
a: ?m.15413
a
=
b: β
b
:= fun
n:
n
,
h: (fun b_1 => b = b_1) (nth (map f s) n)
h
⟩ => ⟨
nth: {α : Type ?u.15489} → Stream' αα
nth
s: Stream' α
s
n:
n
, ⟨
n:
n
,
rfl: ∀ {α : Sort ?u.15510} {a : α}, a = a
rfl
⟩,
h: (fun b_1 => b = b_1) (nth (map f s) n)
h
.
symm: ∀ {α : Sort ?u.15516} {a b : α}, a = bb = a
symm
#align stream.exists_of_mem_map
Stream'.exists_of_mem_map: ∀ {α : Type u} {β : Type v} {f : αβ} {b : β} {s : Stream' α}, b map f sa, a s f a = b
Stream'.exists_of_mem_map
end Map section Zip variable (
f: αβδ
f
:
α: Type u
α
β: Type v
β
δ: Type w
δ
) theorem
drop_zip: ∀ (n : ) (s₁ : Stream' α) (s₂ : Stream' β), drop n (zip f s₁ s₂) = zip f (drop n s₁) (drop n s₂)
drop_zip
(
n:
n
:
Nat: Type
Nat
) (
s₁: Stream' α
s₁
:
Stream': Type ?u.15640 → Type ?u.15640
Stream'
α: Type u
α
) (
s₂: Stream' β
s₂
:
Stream': Type ?u.15643 → Type ?u.15643
Stream'
β: Type v
β
) :
drop: {α : Type ?u.15647} → Stream' αStream' α
drop
n:
n
(
zip: {α : Type ?u.15651} → {β : Type ?u.15650} → {δ : Type ?u.15649} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
s₁: Stream' α
s₁
s₂: Stream' β
s₂
) =
zip: {α : Type ?u.15672} → {β : Type ?u.15671} → {δ : Type ?u.15670} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
(
drop: {α : Type ?u.15682} → Stream' αStream' α
drop
n:
n
s₁: Stream' α
s₁
) (
drop: {α : Type ?u.15687} → Stream' αStream' α
drop
n:
n
s₂: Stream' β
s₂
) :=
Stream'.ext: ∀ {α : Type ?u.15698} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
fun
_: ?m.15707
_
=>
rfl: ∀ {α : Sort ?u.15709} {a : α}, a = a
rfl
#align stream.drop_zip
Stream'.drop_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (n : ) (s₁ : Stream' α) (s₂ : Stream' β), drop n (zip f s₁ s₂) = zip f (drop n s₁) (drop n s₂)
Stream'.drop_zip
@[simp] theorem
nth_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (n : ) (s₁ : Stream' α) (s₂ : Stream' β), nth (zip f s₁ s₂) n = f (nth s₁ n) (nth s₂ n)
nth_zip
(
n:
n
:
Nat: Type
Nat
) (
s₁: Stream' α
s₁
:
Stream': Type ?u.15783 → Type ?u.15783
Stream'
α: Type u
α
) (
s₂: Stream' β
s₂
:
Stream': Type ?u.15786 → Type ?u.15786
Stream'
β: Type v
β
) :
nth: {α : Type ?u.15790} → Stream' αα
nth
(
zip: {α : Type ?u.15794} → {β : Type ?u.15793} → {δ : Type ?u.15792} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
s₁: Stream' α
s₁
s₂: Stream' β
s₂
)
n:
n
=
f: αβδ
f
(
nth: {α : Type ?u.15812} → Stream' αα
nth
s₁: Stream' α
s₁
n:
n
) (
nth: {α : Type ?u.15815} → Stream' αα
nth
s₂: Stream' β
s₂
n:
n
) :=
rfl: ∀ {α : Sort ?u.15823} {a : α}, a = a
rfl
#align stream.nth_zip
Stream'.nth_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (n : ) (s₁ : Stream' α) (s₂ : Stream' β), nth (zip f s₁ s₂) n = f (nth s₁ n) (nth s₂ n)
Stream'.nth_zip
theorem
head_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), head (zip f s₁ s₂) = f (head s₁) (head s₂)
head_zip
(
s₁: Stream' α
s₁
:
Stream': Type ?u.15879 → Type ?u.15879
Stream'
α: Type u
α
) (
s₂: Stream' β
s₂
:
Stream': Type ?u.15882 → Type ?u.15882
Stream'
β: Type v
β
) :
head: {α : Type ?u.15886} → Stream' αα
head
(
zip: {α : Type ?u.15890} → {β : Type ?u.15889} → {δ : Type ?u.15888} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
s₁: Stream' α
s₁
s₂: Stream' β
s₂
) =
f: αβδ
f
(
head: {α : Type ?u.15908} → Stream' αα
head
s₁: Stream' α
s₁
) (
head: {α : Type ?u.15911} → Stream' αα
head
s₂: Stream' β
s₂
) :=
rfl: ∀ {α : Sort ?u.15918} {a : α}, a = a
rfl
#align stream.head_zip
Stream'.head_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), head (zip f s₁ s₂) = f (head s₁) (head s₂)
Stream'.head_zip
theorem
tail_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), tail (zip f s₁ s₂) = zip f (tail s₁) (tail s₂)
tail_zip
(
s₁: Stream' α
s₁
:
Stream': Type ?u.15947 → Type ?u.15947
Stream'
α: Type u
α
) (
s₂: Stream' β
s₂
:
Stream': Type ?u.15950 → Type ?u.15950
Stream'
β: Type v
β
) :
tail: {α : Type ?u.15954} → Stream' αStream' α
tail
(
zip: {α : Type ?u.15958} → {β : Type ?u.15957} → {δ : Type ?u.15956} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
s₁: Stream' α
s₁
s₂: Stream' β
s₂
) =
zip: {α : Type ?u.15979} → {β : Type ?u.15978} → {δ : Type ?u.15977} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
(
tail: {α : Type ?u.15989} → Stream' αStream' α
tail
s₁: Stream' α
s₁
) (
tail: {α : Type ?u.15994} → Stream' αStream' α
tail
s₂: Stream' β
s₂
) :=
rfl: ∀ {α : Sort ?u.16004} {a : α}, a = a
rfl
#align stream.tail_zip
Stream'.tail_zip: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), tail (zip f s₁ s₂) = zip f (tail s₁) (tail s₂)
Stream'.tail_zip
theorem
zip_eq: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), zip f s₁ s₂ = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
zip_eq
(
s₁: Stream' α
s₁
:
Stream': Type ?u.16064 → Type ?u.16064
Stream'
α: Type u
α
) (
s₂: Stream' β
s₂
:
Stream': Type ?u.16067 → Type ?u.16067
Stream'
β: Type v
β
) :
zip: {α : Type ?u.16073} → {β : Type ?u.16072} → {δ : Type ?u.16071} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
s₁: Stream' α
s₁
s₂: Stream' β
s₂
=
f: αβδ
f
(
head: {α : Type ?u.16090} → Stream' αα
head
s₁: Stream' α
s₁
) (
head: {α : Type ?u.16093} → Stream' αα
head
s₂: Stream' β
s₂
)::
zip: {α : Type ?u.16098} → {β : Type ?u.16097} → {δ : Type ?u.16096} → (αβδ) → Stream' αStream' βStream' δ
zip
f: αβδ
f
(
tail: {α : Type ?u.16110} → Stream' αStream' α
tail
s₁: Stream' α
s₁
) (
tail: {α : Type ?u.16115} → Stream' αStream' α
tail
s₂: Stream' β
s₂
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


zip f s₁ s₂ = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


zip f s₁ s₂ = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


head (zip f s₁ s₂) :: tail (zip f s₁ s₂) = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


head (zip f s₁ s₂) :: tail (zip f s₁ s₂) = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


head (zip f s₁ s₂) :: tail (zip f s₁ s₂) = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
α: Type u

β: Type v

δ: Type w

f: αβδ

s₁: Stream' α

s₂: Stream' β


zip f s₁ s₂ = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)

Goals accomplished! 🐙
#align stream.zip_eq
Stream'.zip_eq: ∀ {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : Stream' α) (s₂ : Stream' β), zip f s₁ s₂ = f (head s₁) (head s₂) :: zip f (tail s₁) (tail s₂)
Stream'.zip_eq
@[simp] theorem
nth_enum: ∀ {α : Type u} (s : Stream' α) (n : ), nth (enum s) n = (n, nth s n)
nth_enum
(
s: Stream' α
s
:
Stream': Type ?u.17161 → Type ?u.17161
Stream'
α: Type u
α
) (
n:
n
:
: Type
) :
nth: {α : Type ?u.17167} → Stream' αα
nth
(
enum: {α : Type ?u.17169} → Stream' αStream' ( × α)
enum
s: Stream' α
s
)
n:
n
= (
n:
n
,
s: Stream' α
s
.
nth: {α : Type ?u.17181} → Stream' αα
nth
n:
n
) :=
rfl: ∀ {α : Sort ?u.17192} {a : α}, a = a
rfl
#align stream.nth_enum
Stream'.nth_enum: ∀ {α : Type u} (s : Stream' α) (n : ), nth (enum s) n = (n, nth s n)
Stream'.nth_enum
theorem
enum_eq_zip: ∀ (s : Stream' α), enum s = zip Prod.mk nats s
enum_eq_zip
(
s: Stream' α
s
:
Stream': Type ?u.17229 → Type ?u.17229
Stream'
α: Type u
α
) :
enum: {α : Type ?u.17233} → Stream' αStream' ( × α)
enum
s: Stream' α
s
=
zip: {α : Type ?u.17241} → {β : Type ?u.17240} → {δ : Type ?u.17239} → (αβδ) → Stream' αStream' βStream' δ
zip
Prod.mk: {α : Type ?u.17246} → {β : Type ?u.17245} → αβα × β
Prod.mk
nats: Stream'
nats
s: Stream' α
s
:=
rfl: ∀ {α : Sort ?u.17264} {a : α}, a = a
rfl
#align stream.enum_eq_zip
Stream'.enum_eq_zip: ∀ {α : Type u} (s : Stream' α), enum s = zip Prod.mk nats s
Stream'.enum_eq_zip
end Zip @[simp] theorem
mem_const: ∀ {α : Type u} (a : α), a const a
mem_const
(
a: α
a
:
α: Type u
α
) :
a: α
a
const: {α : Type ?u.17303} → αStream' α
const
a: α
a
:=
Exists.intro: ∀ {α : Sort ?u.17320} {p : αProp} (w : α), p wExists p
Exists.intro
0: ?m.17330
0
rfl: ∀ {α : Sort ?u.17340} {a : α}, a = a
rfl
#align stream.mem_const
Stream'.mem_const: ∀ {α : Type u} (a : α), a const a
Stream'.mem_const
theorem
const_eq: ∀ {α : Type u} (a : α), const a = a :: const a
const_eq
(
a: α
a
:
α: Type u
α
) :
const: {α : Type ?u.17375} → αStream' α
const
a: α
a
=
a: α
a
::
const: {α : Type ?u.17380} → αStream' α
const
a: α
a
:=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

a: α


const a = a :: const a
α: Type u

β: Type v

δ: Type w

a: α


a
∀ (n : ), nth (const a) n = nth (a :: const a) n
α: Type u

β: Type v

δ: Type w

a: α


a
∀ (n : ), nth (const a) n = nth (a :: const a) n
α: Type u

β: Type v

δ: Type w

a: α


const a = a :: const a
α: Type u

β: Type v

δ: Type w

a: α

n:


a
nth (const a) n = nth (a :: const a) n
α: Type u

β: Type v

δ: Type w

a: α


const a = a :: const a
α: Type u

β: Type v

δ: Type w

a: α


a.zero
α: Type u

β: Type v

δ: Type w

a: α

n✝:


a.succ
nth (const a) (succ n✝) = nth (a :: const a) (succ n✝)
α: Type u

β: Type v

δ: Type w

a: α

n:


a
nth (const a) n = nth (a :: const a) n
α: Type u

β: Type v

δ: Type w

a: α


a.zero
α: Type u

β: Type v

δ: Type w

a: α

n✝:


a.succ
nth (const a) (succ n✝) = nth (a :: const a) (succ n✝)
α: Type u

β: Type v

δ: Type w

a: α

n:


a
nth (const a) n = nth (a :: const a) n

Goals accomplished! 🐙
#align stream.const_eq
Stream'.const_eq: ∀ {α : Type u} (a : α), const a = a :: const a
Stream'.const_eq
@[simp] theorem
tail_const: ∀ {α : Type u} (a : α), tail (const a) = const a
tail_const
(
a: α
a
:
α: Type u
α
) :
tail: {α : Type ?u.18399} → Stream' αStream' α
tail
(
const: {α : Type ?u.18401} → αStream' α
const
a: α
a
) =
const: {α : Type ?u.18408} → αStream' α
const
a: α
a
:= suffices
tail: {α : Type ?u.18416} → Stream' αStream' α
tail
(
a: α
a
::
const: {α : Type ?u.18422} → αStream' α
const
a: α
a
) =
const: {α : Type ?u.19328} → αStream' α
const
a: α
a
by
α: Type u

β: Type v

δ: Type w

a: α

this: tail (a :: const a) = const a


α: Type u

β: Type v

δ: Type w

a: α

this: tail (const a) = const a


α: Type u

β: Type v

δ: Type w

a: α

this: tail (const a) = const a



Goals accomplished! 🐙
rfl: ∀ {α : Sort ?u.19332} {a : α}, a = a
rfl
#align stream.tail_const
Stream'.tail_const: ∀ {α : Type u} (a : α), tail (const a) = const a
Stream'.tail_const
@[simp] theorem
map_const: ∀ {α : Type u} {β : Type v} (f : αβ) (a : α), map f (const a) = const (f a)
map_const
(
f: αβ
f
:
α: Type u
α
β: Type v
β
) (
a: α
a
:
α: Type u
α
) :
map: {α : Type ?u.19428} → {β : Type ?u.19427} → (αβ) → Stream' αStream' β
map
f: αβ
f
(
const: {α : Type ?u.19434} → αStream' α
const
a: α
a
) =
const: {α : Type ?u.19440} → αStream' α
const
(
f: αβ
f
a: α
a
) :=
rfl: ∀ {α : Sort ?u.19448} {a : α}, a = a
rfl
#align stream.map_const
Stream'.map_const: ∀ {α : Type u} {β : Type v} (f : αβ) (a : α), map f (const a) = const (f a)
Stream'.map_const
@[simp] theorem
nth_const: ∀ {α : Type u} (n : ) (a : α), nth (const a) n = a
nth_const
(
n:
n
:
Nat: Type
Nat
) (
a: α
a
:
α: Type u
α
) :
nth: {α : Type ?u.19490} → Stream' αα
nth
(
const: {α : Type ?u.19492} → αStream' α
const
a: α
a
)
n:
n
=
a: α
a
:=
rfl: ∀ {α : Sort ?u.19502} {a : α}, a = a
rfl
#align stream.nth_const
Stream'.nth_const: ∀ {α : Type u} (n : ) (a : α), nth (const a) n = a
Stream'.nth_const
@[simp] theorem
drop_const: ∀ {α : Type u} (n : ) (a : α), drop n (const a) = const a
drop_const
(
n:
n
:
Nat: Type
Nat
) (
a: α
a
:
α: Type u
α
) :
drop: {α : Type ?u.19535} → Stream' αStream' α
drop
n:
n
(
const: {α : Type ?u.19537} → αStream' α
const
a: α
a
) =
const: {α : Type ?u.19544} → αStream' α
const
a: α
a
:=
Stream'.ext: ∀ {α : Type ?u.19551} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
fun
_: ?m.19560
_
=>
rfl: ∀ {α : Sort ?u.19562} {a : α}, a = a
rfl
#align stream.drop_const
Stream'.drop_const: ∀ {α : Type u} (n : ) (a : α), drop n (const a) = const a
Stream'.drop_const
@[simp] theorem
head_iterate: ∀ {α : Type u} (f : αα) (a : α), head (iterate f a) = a
head_iterate
(
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
head: {α : Type ?u.19604} → Stream' αα
head
(
iterate: {α : Type ?u.19606} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
) =
a: α
a
:=
rfl: ∀ {α : Sort ?u.19619} {a : α}, a = a
rfl
#align stream.head_iterate
Stream'.head_iterate: ∀ {α : Type u} (f : αα) (a : α), head (iterate f a) = a
Stream'.head_iterate
theorem
nth_succ_iterate': ∀ {α : Type u} (n : ) (f : αα) (a : α), nth (iterate f a) (succ n) = f (nth (iterate f a) n)
nth_succ_iterate'
(
n:
n
:
Nat: Type
Nat
) (
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
nth: {α : Type ?u.19670} → Stream' αα
nth
(
iterate: {α : Type ?u.19672} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
) (
succ:
succ
n:
n
) =
f: αα
f
(
nth: {α : Type ?u.19681} → Stream' αα
nth
(
iterate: {α : Type ?u.19683} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
)
n:
n
) :=
rfl: ∀ {α : Sort ?u.19695} {a : α}, a = a
rfl
theorem
tail_iterate: ∀ (f : αα) (a : α), tail (iterate f a) = iterate f (f a)
tail_iterate
(
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
tail: {α : Type ?u.19735} → Stream' αStream' α
tail
(
iterate: {α : Type ?u.19737} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
) =
iterate: {α : Type ?u.19747} → (αα) → αStream' α
iterate
f: αα
f
(
f: αα
f
a: α
a
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αα

a: α


tail (iterate f a) = iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n:


a
nth (tail (iterate f a)) n = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

f: αα

a: α


tail (iterate f a) = iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n:


a
nth (tail (iterate f a)) n = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n:


a
nth (iterate f a) (n + 1) = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n:


a
nth (iterate f a) (n + 1) = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

f: αα

a: α


tail (iterate f a) = iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


a.zero
nth (iterate f a) (zero + 1) = nth (iterate f (f a)) zero
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α


tail (iterate f a) = iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


a.zero
nth (iterate f a) (zero + 1) = nth (iterate f (f a)) zero
α: Type u

β: Type v

δ: Type w

f: αα

a: α


a.zero
nth (iterate f a) (zero + 1) = nth (iterate f (f a)) zero
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αα

a: α


tail (iterate f a) = iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
f (nth (iterate f a) (n' + 1)) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
f (nth (iterate f (f a)) n') = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
nth (iterate f a) (succ n' + 1) = nth (iterate f (f a)) (succ n')
α: Type u

β: Type v

δ: Type w

f: αα

a: α

n':

ih: nth (iterate f a) (n' + 1) = nth (iterate f (f a)) n'


a.succ
f (nth (iterate f (f a)) n') = f (nth (iterate f (f a)) n')

Goals accomplished! 🐙
#align stream.tail_iterate
Stream'.tail_iterate: ∀ {α : Type u} (f : αα) (a : α), tail (iterate f a) = iterate f (f a)
Stream'.tail_iterate
theorem
iterate_eq: ∀ (f : αα) (a : α), iterate f a = a :: iterate f (f a)
iterate_eq
(
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
iterate: {α : Type ?u.19947} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
=
a: α
a
::
iterate: {α : Type ?u.19955} → (αα) → αStream' α
iterate
f: αα
f
(
f: αα
f
a: α
a
) :=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

f: αα

a: α


iterate f a = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


iterate f a = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: tail (iterate f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: tail (iterate f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


iterate f a = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: tail (iterate f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: iterate f (f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: iterate f (f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


head (iterate f a) :: iterate f (f a) = a :: iterate f (f a)
α: Type u

β: Type v

δ: Type w

f: αα

a: α


iterate f a = a :: iterate f (f a)

Goals accomplished! 🐙
#align stream.iterate_eq
Stream'.iterate_eq: ∀ {α : Type u} (f : αα) (a : α), iterate f a = a :: iterate f (f a)
Stream'.iterate_eq
@[simp] theorem
nth_zero_iterate: ∀ {α : Type u} (f : αα) (a : α), nth (iterate f a) 0 = a
nth_zero_iterate
(
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
nth: {α : Type ?u.20969} → Stream' αα
nth
(
iterate: {α : Type ?u.20971} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
)
0: ?m.20981
0
=
a: α
a
:=
rfl: ∀ {α : Sort ?u.20995} {a : α}, a = a
rfl
#align stream.nth_zero_iterate
Stream'.nth_zero_iterate: ∀ {α : Type u} (f : αα) (a : α), nth (iterate f a) 0 = a
Stream'.nth_zero_iterate
theorem
nth_succ_iterate: ∀ {α : Type u} (n : ) (f : αα) (a : α), nth (iterate f a) (succ n) = nth (iterate f (f a)) n
nth_succ_iterate
(
n:
n
:
Nat: Type
Nat
) (
f: αα
f
:
α: Type u
α
α: Type u
α
) (
a: α
a
:
α: Type u
α
) :
nth: {α : Type ?u.21046} → Stream' αα
nth
(
iterate: {α : Type ?u.21048} → (αα) → αStream' α
iterate
f: αα
f
a: α
a
) (
succ:
succ
n:
n
) =
nth: {α : Type ?u.21057} → Stream' αα
nth
(
iterate: {α : Type ?u.21059} → (αα) → αStream' α
iterate
f: αα
f
(
f: αα
f
a: α
a
))
n:
n
:=

Goals accomplished! 🐙
α: Type u

β: Type v

δ: Type w

n:

f: αα

a: α


nth (iterate f a) (succ n) = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

n:

f: αα

a: α


nth (iterate f a) (succ n) = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

n:

f: αα

a: α


nth (tail (iterate f a)) n = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

n:

f: αα

a: α


nth (iterate f a) (succ n) = nth (iterate f (f a)) n
α: Type u

β: Type v

δ: Type w

n:

f: αα

a: α


nth (iterate f (f a)) n = nth (iterate f (f a)) n

Goals accomplished! 🐙
#align stream.nth_succ_iterate
Stream'.nth_succ_iterate: ∀ {α : Type u} (n : ) (f : αα) (a : α), nth (iterate f a) (succ n) = nth (iterate f (f a)) n
Stream'.nth_succ_iterate
section Bisim variable (
R: Stream' αStream' αProp
R
:
Stream': Type ?u.23385 → Type ?u.23385
Stream'
α: Type u
α
Stream': Type ?u.21141 → Type ?u.21141
Stream'
α: Type u
α
Prop: Type
Prop
) /-- equivalence relation -/ local infixl:50 " ~ " => R /-- Streams `s₁` and `s₂` are defined to be bisimulations if their heads are equal and tails are bisimulations. -/ def
IsBisimulation: {α : Type u} → (Stream' αStream' αProp) → Prop
IsBisimulation
:= ∀ ⦃
s₁: ?m.23395
s₁
s₂: ?m.23398
s₂
⦄,
s₁: ?m.23395
s₁
~
s₂: ?m.23398
s₂
head: {α : Type ?u.23404} → Stream' αα
head
s₁: ?m.23395
s₁
=
head: {α : Type ?u.23409} → Stream' αα
head
s₂: ?m.23398
s₂
tail: {α : Type ?u.23414} → Stream' αStream' α
tail
s₁: ?m.23395
s₁
~
tail: {α : Type ?u.23419} → Stream' αStream' α
tail
s₂: ?m.23398
s₂
#align stream.is_bisimulation
Stream'.IsBisimulation: {α : Type u} → (Stream' αStream' αProp) → Prop
Stream'.IsBisimulation
theorem
nth_of_bisim: IsBisimulation R∀ {s₁ s₂ : Stream' α} (n : ), R s₁ s₂nth s₁ n = nth s₂ n R (drop (n + 1) s₁) (drop (n + 1) s₂)
nth_of_bisim
(bisim :
IsBisimulation: {α : Type ?u.23456} → (Stream' αStream' αProp) → Prop
IsBisimulation
R: Stream' αStream' αProp
R
) : ∀ {
s₁: ?m.23469
s₁
s₂: ?m.23472
s₂
} (
n: ?m.23475
n
),
s₁: ?m.23469
s₁
~
s₂: ?m.23472
s₂
nth: {α : Type ?u.23481} → Stream' αα
nth
s₁: ?m.23469
s₁
n: ?m.23475
n
=
nth: {α : Type ?u.23485} → Stream' αα
nth
s₂: ?m.23472
s₂
n: ?m.23475
n
drop: {α : Type ?u.23490} → Stream' αStream' α
drop
(
n: ?m.23475
n
+
1: ?m.23497
1
)
s₁: ?m.23469
s₁
~
drop: {α : Type ?u.23551} → Stream' αStream' α
drop
(
n: ?m.23475
n
+
1: ?m.23558
1
)
s₂: ?m.23472
s₂
| _, _,
0:
0
,
h: R x✝¹ x✝
h
=> bisim
h: R x✝¹ x✝
h
| _, _,
n:
n
+ 1,
h: R x✝¹ x✝
h
=> match bisim
h: R x✝¹ x✝
h
with | ⟨_,
trel: R (tail x✝¹) (tail x✝)
trel
⟩ =>
nth_of_bisim: IsBisimulation R∀ {s₁ s₂ : Stream' α} (n : ), R s₁ s₂nth s₁ n = nth s₂ n R (drop (n + 1) s₁) (drop (n + 1) s₂)
nth_of_bisim
bisim
n:
n
trel: R (tail x✝¹) (tail x✝)
trel
#align stream.nth_of_bisim
Stream'.nth_of_bisim: ∀ {α : Type u} (R : Stream' αStream' αProp), IsBisimulation R∀ {s₁ s₂ : Stream' α} (n : ), R s₁ s₂nth s₁ n = nth s₂ n R (drop (n + 1) s₁) (drop (n + 1) s₂)
Stream'.nth_of_bisim
-- If two streams are bisimilar, then they are equal theorem
eq_of_bisim: IsBisimulation R∀ {s₁ s₂ : Stream' α}, R s₁ s₂s₁ = s₂
eq_of_bisim
(bisim :
IsBisimulation: {α : Type ?u.24235} → (Stream' αStream' αProp) → Prop
IsBisimulation
R: Stream' αStream' αProp
R
) : ∀ {
s₁: ?m.24248
s₁
s₂: ?m.24251
s₂
},
s₁: ?m.24248
s₁
~
s₂: ?m.24251
s₂
s₁: ?m.24248
s₁
=
s₂: ?m.24251
s₂
:= fun
r: ?m.24265
r
=>
Stream'.ext: ∀ {α : Type ?u.24267} {s₁ s₂ : Stream' α}, (∀ (n : ), nth s₁ n = nth s₂ n) → s₁ = s₂
Stream'.ext
fun
n: ?m.24276
n
=>
And.left: ∀ {a b : Prop}, a ba
And.left
(
nth_of_bisim: ∀ {α : Type ?u.24280} (R : Stream' αStream' αProp), IsBisimulation R∀ {s₁ s₂ : Stream' α} (n : ), R s₁ s₂nth s₁ n = nth s₂ n R (drop (n + 1) s₁) (drop (n + 1) s₂)
nth_of_bisim
R: Stream' αStream' αProp
R
bisim
n: ?m.24276
n
r: ?m.24265
r
) #align stream.eq_of_bisim
Stream'.eq_of_bisim: ∀ {α : Type u} (R : Stream' αStream' αProp), IsBisimulation R∀ {s₁ s₂ : Stream' α}, R s₁ s₂s₁ = s₂
Stream'.eq_of_bisim
end Bisim theorem
bisim_simple: ∀ {α : Type u} (s₁ s₂ : Stream' α), head s₁ = head s₂s₁ = tail s₁s₂ = tail s₂s₁ = s₂
bisim_simple
(
s₁: Stream' α
s₁
s₂: Stream' α
s₂
:
Stream': Type ?u.24334 → Type ?u.24334
Stream'
α: Type u
α
) :
head: {α : Type ?u.24339} → Stream' αα
head
s₁: Stream' α
s₁
=
head: {α : Type ?u.24344} → Stream' αα
head
s₂: Stream' α
s₂
s₁: Stream' α
s₁
=
tail: {α : Type ?u.24353} → Stream' αStream' α
tail
s₁: Stream' α
s₁
s₂: Stream' α
s₂
=