l3lab/ntp-mathlib huggingface dataset:
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
⊢ replicate (Nat.succ n + 1) val = snoc (replicate (Nat.succ n) val) val

Next tactic:
case succ n ih =>
    rw [replicate_succ]
    conv => {
      rhs; rw [replicate_succ]
    }
    rw[snoc_cons, ih]
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
⊢ replicate (Nat.succ n + 1) val = snoc (replicate (Nat.succ n) val) val

Next tactic:
rw [replicate_succ]
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    rw [replicate_succ]
    

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
⊢ val ::ᵥ replicate (n + 1) val = snoc (replicate (Nat.succ n) val) val

Next tactic:
conv => {
      rhs; rw [replicate_succ]
    }
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    rw [replicate_succ]
    conv => 

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
| val ::ᵥ replicate (n + 1) val = snoc (replicate (Nat.succ n) val) val

Next tactic:
{
      rhs; rw [replicate_succ]
    }
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    rw [replicate_succ]
    conv => {
      

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
| val ::ᵥ replicate (n + 1) val = snoc (replicate (Nat.succ n) val) val

Next tactic:
rhs
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    rw [replicate_succ]
    conv => {
      rhs; 

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
| snoc (replicate (Nat.succ n) val) val

Next tactic:
rw [replicate_succ]
theorem replicate_succ_to_snoc (val : α) :
    replicate (n+1) val = (replicate n val).snoc val := by
  clear xs
  induction n
  case zero => rfl
  case succ n ih =>
    rw [replicate_succ]
    conv => {
      rhs; rw [replicate_succ]
    }
    

Proof state:
α : Type u_1
n✝ : ℕ
val : α
n : ℕ
ih : replicate (n + 1) val = snoc (replicate n val) val
⊢ val ::ᵥ replicate (n + 1) val = snoc (val ::ᵥ replicate n val) val

Next tactic:
rw[snoc_cons, ih]
/-- Define `C v` by *reverse* induction on `v : Vector α n`.
    That is, break the vector down starting from the right-most element, using `snoc`

    This function has two arguments: `nil` handles the base case on `C nil`,
    and `snoc` defines the inductive step using `∀ x : α, C xs → C (xs.snoc x)`.

    This can be used as `induction v using Vector.revInductionOn`. -/
@[elab_as_elim]
def revInductionOn {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (v : Vector α n)
    (nil : C nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (x : α), C xs → C (xs.snoc x)) :
    C v :=
  cast (by 

Proof state:
α : Type ?u.2387
C : {n : ℕ} → Vector α n → Sort u_1
n : ℕ
v : Vector α n
nil : C Vector.nil
snoc : {n : ℕ} → (xs : Vector α n) → (x : α) → C xs → C (Vector.snoc xs x)
⊢ (fun {n} v => C (reverse v)) (reverse v) = C v

Next tactic:
simp
/-- Define `C v` by *reverse* induction on `v : Vector α n`.
    That is, break the vector down starting from the right-most element, using `snoc`

    This function has two arguments: `nil` handles the base case on `C nil`,
    and `snoc` defines the inductive step using `∀ x : α, C xs → C (xs.snoc x)`.

    This can be used as `induction v using Vector.revInductionOn`. -/
@[elab_as_elim]
def revInductionOn {C : ∀ {n : ℕ}, Vector α n → Sort*} {n : ℕ} (v : Vector α n)
    (nil : C nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (x : α), C xs → C (xs.snoc x)) :
    C v :=
  cast (by simp) <| inductionOn
    (C := fun v => C v.reverse)
    v.reverse
    nil
    (@fun n x xs (r : C xs.reverse) => cast (by 

Proof state:
α : Type ?u.2387
C : {n : ℕ} → Vector α n → Sort u_1
n✝ : ℕ
v : Vector α n✝
nil : C Vector.nil
snoc : {n : ℕ} → (xs : Vector α n) → (x : α) → C xs → C (Vector.snoc xs x)
n : ℕ
x : α
xs : Vector α n
r : C (reverse xs)
⊢ C (Vector.snoc (reverse xs) x) = (fun {n} v => C (reverse v)) (x ::ᵥ xs)

Next tactic:
simp
/-- Define `C v w` by *reverse* induction on a pair of vectors `v : Vector α n` and
    `w : Vector β n`. -/
@[elab_as_elim]
def revInductionOn₂ {C : ∀ {n : ℕ}, Vector α n → Vector β n → Sort*} {n : ℕ}
    (v : Vector α n) (w : Vector β n)
    (nil : C nil nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (ys : Vector β n) (x : α) (y : β),
      C xs ys → C (xs.snoc x) (ys.snoc y)) :
    C v w :=
  cast (by 

Proof state:
α : Type ?u.2894
β : Type ?u.2897
C : {n : ℕ} → Vector α n → Vector β n → Sort u_1
n : ℕ
v : Vector α n
w : Vector β n
nil : C Vector.nil Vector.nil
snoc :
  {n : ℕ} →
    (xs : Vector α n) → (ys : Vector β n) → (x : α) → (y : β) → C xs ys → C (Vector.snoc xs x) (Vector.snoc ys y)
⊢ (fun {n} v w => C (reverse v) (reverse w)) (reverse v) (reverse w) = C v w

Next tactic:
simp
/-- Define `C v w` by *reverse* induction on a pair of vectors `v : Vector α n` and
    `w : Vector β n`. -/
@[elab_as_elim]
def revInductionOn₂ {C : ∀ {n : ℕ}, Vector α n → Vector β n → Sort*} {n : ℕ}
    (v : Vector α n) (w : Vector β n)
    (nil : C nil nil)
    (snoc : ∀ {n : ℕ} (xs : Vector α n) (ys : Vector β n) (x : α) (y : β),
      C xs ys → C (xs.snoc x) (ys.snoc y)) :
    C v w :=
  cast (by simp) <| inductionOn₂
    (C := fun v w => C v.reverse w.reverse)
    v.reverse
    w.reverse
    nil
    (@fun n x y xs ys (r : C xs.reverse ys.reverse) =>
      cast (by 

Proof state:
α : Type ?u.2894
β : Type ?u.2897
C : {n : ℕ} → Vector α n → Vector β n → Sort u_1
n✝ : ℕ
v : Vector α n✝
w : Vector β n✝
nil : C Vector.nil Vector.nil
snoc :
  {n : ℕ} →
    (xs : Vector α n) → (ys : Vector β n) → (x : α) → (y : β) → C xs ys → C (Vector.snoc xs x) (Vector.snoc ys y)
n : ℕ
x : α
y : β
xs : Vector α n
ys : Vector β n
r : C (reverse xs) (reverse ys)
⊢ C (Vector.snoc (reverse xs) x) (Vector.snoc (reverse ys) y) =
    (fun {n} v w => C (reverse v) (reverse w)) (x ::ᵥ xs) (y ::ᵥ ys)

Next tactic:
simp
@[simp]
theorem map_snoc : map f (xs.snoc x) = (map f xs).snoc (f x) := by
  

Proof state:
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type u_1
f : α → α✝
x : α
⊢ map f (snoc xs x) = snoc (map f xs) (f x)

Next tactic:
induction xs using Vector.inductionOn
@[simp]
theorem map_snoc : map f (xs.snoc x) = (map f xs).snoc (f x) := by
  induction xs using Vector.inductionOn <;> 

Proof state:
case h_nil
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type u_1
f : α → α✝
x : α
⊢ map f (snoc nil x) = snoc (map f nil) (f x)

Next tactic:
simp_all
@[simp]
theorem map_snoc : map f (xs.snoc x) = (map f xs).snoc (f x) := by
  induction xs using Vector.inductionOn <;> 

Proof state:
case h_cons
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type u_1
f : α → α✝
x : α
n✝ : ℕ
x✝ : α
w✝ : Vector α n✝
a✝ : map f (snoc w✝ x) = snoc (map f w✝) (f x)
⊢ map f (snoc (x✝ ::ᵥ w✝) x) = snoc (map f (x✝ ::ᵥ w✝)) (f x)

Next tactic:
simp_all
@[simp]
theorem mapAccumr_snoc :
    mapAccumr f (xs.snoc x) s
    = let q := f x s
      let r := mapAccumr f xs q.1
      (r.1, r.2.snoc q.2) := by
  

Proof state:
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type
β✝ : Type u_1
f : α → α✝ → α✝ × β✝
x : α
s : α✝
⊢ mapAccumr f (snoc xs x) s =
    let q := f x s;
    let r := mapAccumr f xs q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
induction xs using Vector.inductionOn
@[simp]
theorem mapAccumr_snoc :
    mapAccumr f (xs.snoc x) s
    = let q := f x s
      let r := mapAccumr f xs q.1
      (r.1, r.2.snoc q.2) := by
  induction xs using Vector.inductionOn
  · 

Proof state:
case h_nil
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type
β✝ : Type u_1
f : α → α✝ → α✝ × β✝
x : α
s : α✝
⊢ mapAccumr f (snoc nil x) s =
    let q := f x s;
    let r := mapAccumr f nil q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
rfl
@[simp]
theorem mapAccumr_snoc :
    mapAccumr f (xs.snoc x) s
    = let q := f x s
      let r := mapAccumr f xs q.1
      (r.1, r.2.snoc q.2) := by
  induction xs using Vector.inductionOn
  · rfl
  · 

Proof state:
case h_cons
α : Type u_2
n : ℕ
xs : Vector α n
α✝ : Type
β✝ : Type u_1
f : α → α✝ → α✝ × β✝
x : α
s : α✝
n✝ : ℕ
x✝ : α
w✝ : Vector α n✝
a✝ :
  mapAccumr f (snoc w✝ x) s =
    let q := f x s;
    let r := mapAccumr f w✝ q.1;
    (r.1, snoc r.2 q.2)
⊢ mapAccumr f (snoc (x✝ ::ᵥ w✝) x) s =
    let q := f x s;
    let r := mapAccumr f (x✝ ::ᵥ w✝) q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
simp[*]
@[simp]
theorem map₂_snoc : map₂ f (xs.snoc x) (ys.snoc y) = (map₂ f xs ys).snoc (f x y) := by
  

Proof state:
α : Type u_2
n : ℕ
β : Type u_3
xs : Vector α n
ys : Vector β n
α✝ : Type u_1
f : α → β → α✝
x : α
y : β
⊢ map₂ f (snoc xs x) (snoc ys y) = snoc (map₂ f xs ys) (f x y)

Next tactic:
induction xs, ys using Vector.inductionOn₂
@[simp]
theorem map₂_snoc : map₂ f (xs.snoc x) (ys.snoc y) = (map₂ f xs ys).snoc (f x y) := by
  induction xs, ys using Vector.inductionOn₂ <;> 

Proof state:
case nil
α : Type u_2
n : ℕ
β : Type u_3
xs : Vector α n
ys : Vector β n
α✝ : Type u_1
f : α → β → α✝
x : α
y : β
⊢ map₂ f (snoc nil x) (snoc nil y) = snoc (map₂ f nil nil) (f x y)

Next tactic:
simp_all
@[simp]
theorem map₂_snoc : map₂ f (xs.snoc x) (ys.snoc y) = (map₂ f xs ys).snoc (f x y) := by
  induction xs, ys using Vector.inductionOn₂ <;> 

Proof state:
case cons
α : Type u_2
n : ℕ
β : Type u_3
xs : Vector α n
ys : Vector β n
α✝ : Type u_1
f : α → β → α✝
x : α
y : β
n✝ : ℕ
a✝¹ : α
b✝ : β
x✝ : Vector α n✝
y✝ : Vector β n✝
a✝ : map₂ f (snoc x✝ x) (snoc y✝ y) = snoc (map₂ f x✝ y✝) (f x y)
⊢ map₂ f (snoc (a✝¹ ::ᵥ x✝) x) (snoc (b✝ ::ᵥ y✝) y) = snoc (map₂ f (a✝¹ ::ᵥ x✝) (b✝ ::ᵥ y✝)) (f x y)

Next tactic:
simp_all
@[simp]
theorem mapAccumr₂_snoc (f : α → β → σ → σ × φ) (x : α) (y : β) :
    mapAccumr₂ f (xs.snoc x) (ys.snoc y) c
    = let q := f x y c
      let r := mapAccumr₂ f xs ys q.1
      (r.1, r.2.snoc q.2) := by
  

Proof state:
α : Type
n : ℕ
β : Type
xs : Vector α n
ys : Vector β n
σ φ : Type
c : σ
f : α → β → σ → σ × φ
x : α
y : β
⊢ mapAccumr₂ f (snoc xs x) (snoc ys y) c =
    let q := f x y c;
    let r := mapAccumr₂ f xs ys q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
induction xs, ys using Vector.inductionOn₂
@[simp]
theorem mapAccumr₂_snoc (f : α → β → σ → σ × φ) (x : α) (y : β) :
    mapAccumr₂ f (xs.snoc x) (ys.snoc y) c
    = let q := f x y c
      let r := mapAccumr₂ f xs ys q.1
      (r.1, r.2.snoc q.2) := by
  induction xs, ys using Vector.inductionOn₂ <;> 

Proof state:
case nil
α : Type
n : ℕ
β : Type
xs : Vector α n
ys : Vector β n
σ φ : Type
c : σ
f : α → β → σ → σ × φ
x : α
y : β
⊢ mapAccumr₂ f (snoc nil x) (snoc nil y) c =
    let q := f x y c;
    let r := mapAccumr₂ f nil nil q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
simp_all
@[simp]
theorem mapAccumr₂_snoc (f : α → β → σ → σ × φ) (x : α) (y : β) :
    mapAccumr₂ f (xs.snoc x) (ys.snoc y) c
    = let q := f x y c
      let r := mapAccumr₂ f xs ys q.1
      (r.1, r.2.snoc q.2) := by
  induction xs, ys using Vector.inductionOn₂ <;> 

Proof state:
case cons
α : Type
n : ℕ
β : Type
xs : Vector α n
ys : Vector β n
σ φ : Type
c : σ
f : α → β → σ → σ × φ
x : α
y : β
n✝ : ℕ
a✝¹ : α
b✝ : β
x✝ : Vector α n✝
y✝ : Vector β n✝
a✝ :
  mapAccumr₂ f (snoc x✝ x) (snoc y✝ y) c =
    let q := f x y c;
    let r := mapAccumr₂ f x✝ y✝ q.1;
    (r.1, snoc r.2 q.2)
⊢ mapAccumr₂ f (snoc (a✝¹ ::ᵥ x✝) x) (snoc (b✝ ::ᵥ y✝) y) c =
    let q := f x y c;
    let r := mapAccumr₂ f (a✝¹ ::ᵥ x✝) (b✝ ::ᵥ y✝) q.1;
    (r.1, snoc r.2 q.2)

Next tactic:
simp_all
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
⊢ OrdConnected s

Next tactic:
rw [ordConnected_iff]
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  rw [ordConnected_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
⊢ ∀ x ∈ s, ∀ y ∈ s, x ≤ y → Icc x y ⊆ s

Next tactic:
intro x hx y hy hxy
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  rw [ordConnected_iff]
  intro x hx y hy hxy
  

Proof state:
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≤ y
⊢ Icc x y ⊆ s

Next tactic:
rcases eq_or_lt_of_le hxy with (rfl | hxy')
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  rw [ordConnected_iff]
  intro x hx y hy hxy
  rcases eq_or_lt_of_le hxy with (rfl | hxy'); · 

Proof state:
case inl
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
x : α
hx hy : x ∈ s
hxy : x ≤ x
⊢ Icc x x ⊆ s

Next tactic:
simpa
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  rw [ordConnected_iff]
  intro x hx y hy hxy
  rcases eq_or_lt_of_le hxy with (rfl | hxy'); · simpa
  

Proof state:
case inr
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≤ y
hxy' : x < y
⊢ Icc x y ⊆ s

Next tactic:
rw [← Ioc_insert_left hxy, ← Ioo_insert_right hxy']
theorem ordConnected_of_Ioo {α : Type*} [PartialOrder α] {s : Set α}
    (hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s) : OrdConnected s := by
  rw [ordConnected_iff]
  intro x hx y hy hxy
  rcases eq_or_lt_of_le hxy with (rfl | hxy'); · simpa
  rw [← Ioc_insert_left hxy, ← Ioo_insert_right hxy']
  

Proof state:
case inr
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s✝ t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
s : Set α
hs : ∀ x ∈ s, ∀ y ∈ s, x < y → Ioo x y ⊆ s
x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≤ y
hxy' : x < y
⊢ insert x (insert y (Ioo x y)) ⊆ s

Next tactic:
exact insert_subset_iff.2 ⟨hx, insert_subset_iff.2 ⟨hy, hs x hx y hy hxy'⟩⟩
theorem ordConnected_dual {s : Set α} : OrdConnected (OrderDual.ofDual ⁻¹' s) ↔ OrdConnected s :=
  ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t s : Set α
h : OrdConnected (⇑ofDual ⁻¹' s)
⊢ OrdConnected s

Next tactic:
simpa only [ordConnected_def] using h.dual
@[instance]
theorem ordConnected_singleton {α : Type*} [PartialOrder α] {a : α} :
    OrdConnected ({a} : Set α) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
a : α
⊢ OrdConnected {a}

Next tactic:
rw [← Icc_self]
@[instance]
theorem ordConnected_singleton {α : Type*} [PartialOrder α] {a : α} :
    OrdConnected ({a} : Set α) := by
  rw [← Icc_self]
  

Proof state:
α✝ : Type u_1
β : Type u_2
inst✝² : Preorder α✝
inst✝¹ : Preorder β
s t : Set α✝
α : Type u_3
inst✝ : PartialOrder α
a : α
⊢ OrdConnected (Icc a a)

Next tactic:
exact ordConnected_Icc
@[instance]
theorem ordConnected_image {E : Type*} [OrderIsoClass E α β] (e : E) {s : Set α}
    [hs : OrdConnected s] : OrdConnected (e '' s) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
E : Type u_3
inst✝ : OrderIsoClass E α β
e : E
s : Set α
hs : OrdConnected s
⊢ OrdConnected (⇑e '' s)

Next tactic:
erw [(e : α ≃o β).image_eq_preimage]
@[instance]
theorem ordConnected_image {E : Type*} [OrderIsoClass E α β] (e : E) {s : Set α}
    [hs : OrdConnected s] : OrdConnected (e '' s) := by
  erw [(e : α ≃o β).image_eq_preimage]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
E : Type u_3
inst✝ : OrderIsoClass E α β
e : E
s : Set α
hs : OrdConnected s
⊢ OrdConnected (⇑(OrderIso.symm ↑e) ⁻¹' s)

Next tactic:
apply ordConnected_preimage (e : α ≃o β).symm
@[instance]
theorem ordConnected_range {E : Type*} [OrderIsoClass E α β] (e : E) : OrdConnected (range e) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
E : Type u_3
inst✝ : OrderIsoClass E α β
e : E
⊢ OrdConnected (range ⇑e)

Next tactic:
simp_rw [← image_univ]
@[instance]
theorem ordConnected_range {E : Type*} [OrderIsoClass E α β] (e : E) : OrdConnected (range e) := by
  simp_rw [← image_univ]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
E : Type u_3
inst✝ : OrderIsoClass E α β
e : E
⊢ OrdConnected (⇑e '' univ)

Next tactic:
exact ordConnected_image (e : α ≃o β)
@[simp]
theorem dual_ordConnected_iff {s : Set α} : OrdConnected (ofDual ⁻¹' s) ↔ OrdConnected s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t s : Set α
⊢ OrdConnected (⇑ofDual ⁻¹' s) ↔ OrdConnected s

Next tactic:
simp_rw [ordConnected_def, toDual.surjective.forall, dual_Icc, Subtype.forall']
@[simp]
theorem dual_ordConnected_iff {s : Set α} : OrdConnected (ofDual ⁻¹' s) ↔ OrdConnected s := by
  simp_rw [ordConnected_def, toDual.surjective.forall, dual_Icc, Subtype.forall']
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t s : Set α
⊢ (∀ (x x_1 : { a // toDual a ∈ ⇑ofDual ⁻¹' s }), ⇑ofDual ⁻¹' Icc ↑x_1 ↑x ⊆ ⇑ofDual ⁻¹' s) ↔
    ∀ (x x_1 : { a // a ∈ s }), Icc ↑x ↑x_1 ⊆ s

Next tactic:
exact forall_swap
protected theorem _root_.IsAntichain.ordConnected (hs : IsAntichain (· ≤ ·) s) : s.OrdConnected :=
  ⟨fun x hx y hy z hz => by
    

Proof state:
α : Type u_1
inst✝ : PartialOrder α
s : Set α
hs : IsAntichain (fun x x_1 => x ≤ x_1) s
x : α
hx : x ∈ s
y : α
hy : y ∈ s
z : α
hz : z ∈ Icc x y
⊢ z ∈ s

Next tactic:
obtain rfl := hs.eq hx hy (hz.1.trans hz.2)
protected theorem _root_.IsAntichain.ordConnected (hs : IsAntichain (· ≤ ·) s) : s.OrdConnected :=
  ⟨fun x hx y hy z hz => by
    obtain rfl := hs.eq hx hy (hz.1.trans hz.2)
    

Proof state:
α : Type u_1
inst✝ : PartialOrder α
s : Set α
hs : IsAntichain (fun x x_1 => x ≤ x_1) s
x : α
hx : x ∈ s
z : α
hy : x ∈ s
hz : z ∈ Icc x x
⊢ z ∈ s

Next tactic:
rw [Icc_self, mem_singleton_iff] at hz
protected theorem _root_.IsAntichain.ordConnected (hs : IsAntichain (· ≤ ·) s) : s.OrdConnected :=
  ⟨fun x hx y hy z hz => by
    obtain rfl := hs.eq hx hy (hz.1.trans hz.2)
    rw [Icc_self, mem_singleton_iff] at hz
    

Proof state:
α : Type u_1
inst✝ : PartialOrder α
s : Set α
hs : IsAntichain (fun x x_1 => x ≤ x_1) s
x : α
hx : x ∈ s
z : α
hy : x ∈ s
hz : z = x
⊢ z ∈ s

Next tactic:
rwa [hz]
theorem ordConnected_of_uIcc_subset_left (h : ∀ y ∈ s, [[x, y]] ⊆ s) : OrdConnected s :=
  ordConnected_iff_uIcc_subset.2 fun y hy z hz =>
    calc
      [[y, z]] ⊆ [[y, x]] ∪ [[x, z]] := uIcc_subset_uIcc_union_uIcc
      _ = [[x, y]] ∪ [[x, z]] := by 

Proof state:
α : Type u_1
inst✝ : LinearOrder α
s : Set α
x : α
h : ∀ y ∈ s, [[x, y]] ⊆ s
y : α
hy : y ∈ s
z : α
hz : z ∈ s
⊢ [[y, x]] ∪ [[x, z]] = [[x, y]] ∪ [[x, z]]

Next tactic:
rw [uIcc_comm]
theorem ordConnected_iff_uIcc_subset_right (hx : x ∈ s) :
    OrdConnected s ↔ ∀ ⦃y⦄, y ∈ s → [[y, x]] ⊆ s := by
  

Proof state:
α : Type u_1
inst✝ : LinearOrder α
s : Set α
x : α
hx : x ∈ s
⊢ OrdConnected s ↔ ∀ ⦃y : α⦄, y ∈ s → [[y, x]] ⊆ s

Next tactic:
simp_rw [ordConnected_iff_uIcc_subset_left hx, uIcc_comm]
theorem coe_injective : @Function.Injective (VectorMeasure α M) (Set α → M) (⇑) := fun v w h => by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
h : ↑v = ↑w
⊢ v = w

Next tactic:
cases v
theorem coe_injective : @Function.Injective (VectorMeasure α M) (Set α → M) (⇑) := fun v w h => by
  cases v
  

Proof state:
case mk
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
w : VectorMeasure α M
measureOf'✝ : Set α → M
empty'✝ : measureOf'✝ ∅ = 0
not_measurable'✝ : ∀ ⦃i : Set α⦄, ¬MeasurableSet i → measureOf'✝ i = 0
m_iUnion'✝ :
  ∀ ⦃f : ℕ → Set α⦄,
    (∀ (i : ℕ), MeasurableSet (f i)) →
      Pairwise (Disjoint on f) → HasSum (fun i => measureOf'✝ (f i)) (measureOf'✝ (⋃ i, f i))
h : ↑{ measureOf' := measureOf'✝, empty' := empty'✝, not_measurable' := not_measurable'✝, m_iUnion' := m_iUnion'✝ } = ↑w
⊢ { measureOf' := measureOf'✝, empty' := empty'✝, not_measurable' := not_measurable'✝, m_iUnion' := m_iUnion'✝ } = w

Next tactic:
cases w
theorem coe_injective : @Function.Injective (VectorMeasure α M) (Set α → M) (⇑) := fun v w h => by
  cases v
  cases w
  

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
measureOf'✝¹ : Set α → M
empty'✝¹ : measureOf'✝¹ ∅ = 0
not_measurable'✝¹ : ∀ ⦃i : Set α⦄, ¬MeasurableSet i → measureOf'✝¹ i = 0
m_iUnion'✝¹ :
  ∀ ⦃f : ℕ → Set α⦄,
    (∀ (i : ℕ), MeasurableSet (f i)) →
      Pairwise (Disjoint on f) → HasSum (fun i => measureOf'✝¹ (f i)) (measureOf'✝¹ (⋃ i, f i))
measureOf'✝ : Set α → M
empty'✝ : measureOf'✝ ∅ = 0
not_measurable'✝ : ∀ ⦃i : Set α⦄, ¬MeasurableSet i → measureOf'✝ i = 0
m_iUnion'✝ :
  ∀ ⦃f : ℕ → Set α⦄,
    (∀ (i : ℕ), MeasurableSet (f i)) →
      Pairwise (Disjoint on f) → HasSum (fun i => measureOf'✝ (f i)) (measureOf'✝ (⋃ i, f i))
h :
  ↑{ measureOf' := measureOf'✝¹, empty' := empty'✝¹, not_measurable' := not_measurable'✝¹, m_iUnion' := m_iUnion'✝¹ } =
    ↑{ measureOf' := measureOf'✝, empty' := empty'✝, not_measurable' := not_measurable'✝, m_iUnion' := m_iUnion'✝ }
⊢ { measureOf' := measureOf'✝¹, empty' := empty'✝¹, not_measurable' := not_measurable'✝¹, m_iUnion' := m_iUnion'✝¹ } =
    { measureOf' := measureOf'✝, empty' := empty'✝, not_measurable' := not_measurable'✝, m_iUnion' := m_iUnion'✝ }

Next tactic:
congr
theorem ext_iff' (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, v i = w i := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
⊢ v = w ↔ ∀ (i : Set α), ↑v i = ↑w i

Next tactic:
rw [← coe_injective.eq_iff, Function.funext_iff]
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  

Proof state:
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
⊢ v = w ↔ ∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i

Next tactic:
constructor
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v w : VectorMeasure α M
⊢ v = w → ∀ (i : Set α), MeasurableSet i → ↑v i = ↑w i

Next tactic:
rintro rfl _ _
theorem ext_iff (v w : VectorMeasure α M) : v = w ↔ ∀ i : Set α, MeasurableSet i → v i = w i := by
  constructor
  · rintro rfl _ _
    

Proof state:
case mp
α : Type u_1
β : Type u_2
m : MeasurableSpace α
M : Type u_3
inst✝¹ : AddCommMonoid M
inst✝ : TopologicalSpace M
v : VectorMeasure α M
i✝ : Set α
a✝ : MeasurableSet i✝
⊢ ↑v i✝ = ↑v i✝

Next tactic:
rfl