l3lab/ntp-mathlib huggingface dataset:
instance : LawfulMonad
      Part where
  bind_pure_comp := @bind_some_eq_map
  id_map f := by cases f; rfl
  pure_bind := @bind_some
  bind_assoc := @bind_assoc
  map_const := by simp [Functor.mapConst, Functor.map]
  --Porting TODO : In Lean3 these were automatic by a tactic
  seqLeft_eq x y := ext'
    (by simp [SeqLeft.seqLeft, Part.bind, assert, Seq.seq, const, (· <$> ·), and_comm])
    (fun _ _ => rfl)
  seqRight_eq x y := ext'
    (by simp [SeqRight.seqRight, Part.bind, assert, Seq.seq, const, (· <$> ·), and_comm])
    (fun _ _ => rfl)
  pure_seq x y := ext'
    (by simp [Seq.seq, Part.bind, assert, (· <$> ·), pure])
    (fun _ _ => rfl)
  bind_map x y := ext'
    (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
α✝ β✝ : Type ?u.30825
x : Part (α✝ → β✝)
y : Part α✝
⊢ (do
        let x ← x
        x <$> y).Dom ↔
    (Seq.seq x fun x => y).Dom

Next tactic:
simp [(· >>= ·), Part.bind, assert, Seq.seq, get, (· <$> ·)]
theorem map_id' {f : α → α} (H : ∀ x : α, f x = x) (o) : map f o = o := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → α
H : ∀ (x : α), f x = x
o : Part α
⊢ map f o = o

Next tactic:
rw [show f = id from funext H]
theorem map_id' {f : α → α} (H : ∀ x : α, f x = x) (o) : map f o = o := by
  rw [show f = id from funext H]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
f : α → α
H : ∀ (x : α), f x = x
o : Part α
⊢ map id o = o

Next tactic:
exact id_map o
@[simp]
theorem bind_some_right (x : Part α) : x.bind some = x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
x : Part α
⊢ Part.bind x some = x

Next tactic:
erw [bind_some_eq_map]
@[simp]
theorem bind_some_right (x : Part α) : x.bind some = x := by
  erw [bind_some_eq_map]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
x : Part α
⊢ map (fun a => a) x = x

Next tactic:
simp [map_id']
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
⊢ x >>= f ≤ y ↔ ∀ a ∈ x, f a ≤ y

Next tactic:
constructor
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> 

Proof state:
case mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
⊢ x >>= f ≤ y → ∀ a ∈ x, f a ≤ y

Next tactic:
intro h
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> 

Proof state:
case mpr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
⊢ (∀ a ∈ x, f a ≤ y) → x >>= f ≤ y

Next tactic:
intro h
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · 

Proof state:
case mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : x >>= f ≤ y
⊢ ∀ a ∈ x, f a ≤ y

Next tactic:
intro a h' b
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    

Proof state:
case mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : x >>= f ≤ y
a : α
h' : a ∈ x
b : β
⊢ b ∈ f a → b ∈ y

Next tactic:
have h := h b
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    

Proof state:
case mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h✝ : x >>= f ≤ y
a : α
h' : a ∈ x
b : β
h : b ∈ x >>= f → b ∈ y
⊢ b ∈ f a → b ∈ y

Next tactic:
simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
    

Proof state:
case mp
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h✝ : x >>= f ≤ y
a : α
h' : a ∈ x
b : β
h : ∀ x_1 ∈ x, b ∈ f x_1 → b ∈ y
⊢ b ∈ f a → b ∈ y

Next tactic:
apply h _ h'
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
    apply h _ h'
  · 

Proof state:
case mpr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : ∀ a ∈ x, f a ≤ y
⊢ x >>= f ≤ y

Next tactic:
intro b h'
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
    apply h _ h'
  · intro b h'
    

Proof state:
case mpr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : ∀ a ∈ x, f a ≤ y
b : β
h' : b ∈ x >>= f
⊢ b ∈ y

Next tactic:
simp only [exists_prop, bind_eq_bind, mem_bind_iff] at h'
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
    apply h _ h'
  · intro b h'
    simp only [exists_prop, bind_eq_bind, mem_bind_iff] at h'
    

Proof state:
case mpr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : ∀ a ∈ x, f a ≤ y
b : β
h' : ∃ a ∈ x, b ∈ f a
⊢ b ∈ y

Next tactic:
rcases h' with ⟨a, h₀, h₁⟩
theorem bind_le {α} (x : Part α) (f : α → Part β) (y : Part β) :
    x >>= f ≤ y ↔ ∀ a, a ∈ x → f a ≤ y := by
  constructor <;> intro h
  · intro a h' b
    have h := h b
    simp only [and_imp, exists_prop, bind_eq_bind, mem_bind_iff, exists_imp] at h
    apply h _ h'
  · intro b h'
    simp only [exists_prop, bind_eq_bind, mem_bind_iff] at h'
    rcases h' with ⟨a, h₀, h₁⟩
    

Proof state:
case mpr.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_2
x : Part α
f : α → Part β
y : Part β
h : ∀ a ∈ x, f a ≤ y
b : β
a : α
h₀ : a ∈ x
h₁ : b ∈ f a
⊢ b ∈ y

Next tactic:
apply h _ h₀ _ h₁
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
⊢ a ∈ restrict p o h ↔ p ∧ a ∈ o

Next tactic:
dsimp [restrict, mem_eq]
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  dsimp [restrict, mem_eq]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
⊢ (∃ (h_1 : p), get o (_ : o.Dom) = a) ↔ p ∧ ∃ (h : o.Dom), get o h = a

Next tactic:
constructor
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  dsimp [restrict, mem_eq]; constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
⊢ (∃ (h_1 : p), get o (_ : o.Dom) = a) → p ∧ ∃ (h : o.Dom), get o h = a

Next tactic:
rintro ⟨h₀, h₁⟩
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  dsimp [restrict, mem_eq]; constructor
  · rintro ⟨h₀, h₁⟩
    

Proof state:
case mp.intro
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
h₀ : p
h₁ : get o (_ : o.Dom) = a
⊢ p ∧ ∃ (h : o.Dom), get o h = a

Next tactic:
exact ⟨h₀, ⟨_, h₁⟩⟩
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  dsimp [restrict, mem_eq]; constructor
  · rintro ⟨h₀, h₁⟩
    exact ⟨h₀, ⟨_, h₁⟩⟩
  

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
⊢ (p ∧ ∃ (h : o.Dom), get o h = a) → ∃ (h_1 : p), get o (_ : o.Dom) = a

Next tactic:
rintro ⟨h₀, _, h₂⟩
@[simp]
theorem mem_restrict (p : Prop) (o : Part α) (h : p → o.Dom) (a : α) :
    a ∈ restrict p o h ↔ p ∧ a ∈ o := by
  dsimp [restrict, mem_eq]; constructor
  · rintro ⟨h₀, h₁⟩
    exact ⟨h₀, ⟨_, h₁⟩⟩
  rintro ⟨h₀, _, h₂⟩; 

Proof state:
case mpr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
p : Prop
o : Part α
h : p → o.Dom
a : α
h₀ : p
w✝ : o.Dom
h₂ : get o w✝ = a
⊢ ∃ (h_1 : p), get o (_ : o.Dom) = a

Next tactic:
exact ⟨h₀, h₂⟩
@[to_additive]
theorem mul_mem_mul [Mul α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma * mb ∈ a * b := ⟨⟨ha.1, hb.1⟩, by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mul α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ get (a * b)
      (_ :
        ∃ (h : ((fun x x_1 => x * x_1) <$> a).Dom),
          ((fun b_1 => (fun y => map y ((fun x => b) ())) (get ((fun x x_1 => x * x_1) <$> a) b_1)) h).Dom) =
    ma * mb

Next tactic:
simp [← ha.2, ← hb.2]
@[to_additive]
theorem mul_mem_mul [Mul α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma * mb ∈ a * b := ⟨⟨ha.1, hb.1⟩, by simp [← ha.2, ← hb.2]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mul α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ get (a * b)
      (_ :
        ∃ (h : ((fun x x_1 => x * x_1) <$> a).Dom),
          ((fun b_1 => (fun y => map y ((fun x => b) ())) (get ((fun x x_1 => x * x_1) <$> a) b_1)) h).Dom) =
    get a (_ : a.Dom) * get b (_ : b.Dom)

Next tactic:
rfl
@[to_additive]
theorem some_mul_some [Mul α] (a b : α) : some a * some b = some (a * b) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mul α
a b : α
⊢ some a * some b = some (a * b)

Next tactic:
simp [mul_def]
@[to_additive]
theorem inv_mem_inv [Inv α] (a : Part α) (ma : α) (ha : ma ∈ a) : ma⁻¹ ∈ a⁻¹ :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inv α
a : Part α
ma : α
ha : ma ∈ a
⊢ ma⁻¹ ∈ a⁻¹

Next tactic:
simp [inv_def]
@[to_additive]
theorem inv_mem_inv [Inv α] (a : Part α) (ma : α) (ha : ma ∈ a) : ma⁻¹ ∈ a⁻¹ :=
  by simp [inv_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inv α
a : Part α
ma : α
ha : ma ∈ a
⊢ ∃ a_1 ∈ a, a_1⁻¹ = ma⁻¹

Next tactic:
aesop
@[to_additive]
theorem div_mem_div [Div α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma / mb ∈ a / b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Div α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma / mb ∈ a / b

Next tactic:
simp [div_def]
@[to_additive]
theorem div_mem_div [Div α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma / mb ∈ a / b := by simp [div_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Div α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 / a = ma / mb

Next tactic:
aesop
@[to_additive (attr := simp)]
theorem div_get_eq [Div α] (a b : Part α) (hab : Dom (a / b)) :
    (a / b).get hab = a.get (left_dom_of_div_dom hab) / b.get (right_dom_of_div_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Div α
a b : Part α
hab : (a / b).Dom
⊢ get (a / b) hab = get a (_ : a.Dom) / get b (_ : b.Dom)

Next tactic:
simp [div_def]
@[to_additive (attr := simp)]
theorem div_get_eq [Div α] (a b : Part α) (hab : Dom (a / b)) :
    (a / b).get hab = a.get (left_dom_of_div_dom hab) / b.get (right_dom_of_div_dom hab) :=
  by simp [div_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Div α
a b : Part α
hab : (a / b).Dom
⊢ get (Part.bind a fun y => map (fun x => y / x) b) (_ : (Part.bind a fun y => map (fun x => y / x) b).Dom) =
    get a (_ : a.Dom) / get b (_ : b.Dom)

Next tactic:
aesop
@[to_additive]
theorem some_div_some [Div α] (a b : α) : some a / some b = some (a / b) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Div α
a b : α
⊢ some a / some b = some (a / b)

Next tactic:
simp [div_def]
theorem mod_mem_mod [Mod α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma % mb ∈ a % b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mod α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma % mb ∈ a % b

Next tactic:
simp [mod_def]
theorem mod_mem_mod [Mod α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma % mb ∈ a % b := by simp [mod_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mod α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 % a = ma % mb

Next tactic:
aesop
@[simp]
theorem mod_get_eq [Mod α] (a b : Part α) (hab : Dom (a % b)) :
    (a % b).get hab = a.get (left_dom_of_mod_dom hab) % b.get (right_dom_of_mod_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mod α
a b : Part α
hab : (a % b).Dom
⊢ get (a % b) hab = get a (_ : a.Dom) % get b (_ : b.Dom)

Next tactic:
simp [mod_def]
@[simp]
theorem mod_get_eq [Mod α] (a b : Part α) (hab : Dom (a % b)) :
    (a % b).get hab = a.get (left_dom_of_mod_dom hab) % b.get (right_dom_of_mod_dom hab) :=
  by simp [mod_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mod α
a b : Part α
hab : (a % b).Dom
⊢ get (Part.bind a fun y => map (fun x => y % x) b) (_ : (Part.bind a fun y => map (fun x => y % x) b).Dom) =
    get a (_ : a.Dom) % get b (_ : b.Dom)

Next tactic:
aesop
theorem some_mod_some [Mod α] (a b : α) : some a % some b = some (a % b) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Mod α
a b : α
⊢ some a % some b = some (a % b)

Next tactic:
simp [mod_def]
theorem append_mem_append [Append α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ++ mb ∈ a ++ b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Append α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma ++ mb ∈ a ++ b

Next tactic:
simp [append_def]
theorem append_mem_append [Append α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ++ mb ∈ a ++ b := by simp [append_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Append α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 ++ a = ma ++ mb

Next tactic:
aesop
@[simp]
theorem append_get_eq [Append α] (a b : Part α) (hab : Dom (a ++ b)) :
    (a ++ b).get hab = a.get (left_dom_of_append_dom hab) ++ b.get (right_dom_of_append_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Append α
a b : Part α
hab : (a ++ b).Dom
⊢ get (a ++ b) hab = get a (_ : a.Dom) ++ get b (_ : b.Dom)

Next tactic:
simp [append_def]
@[simp]
theorem append_get_eq [Append α] (a b : Part α) (hab : Dom (a ++ b)) :
    (a ++ b).get hab = a.get (left_dom_of_append_dom hab) ++ b.get (right_dom_of_append_dom hab) :=
  by simp [append_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Append α
a b : Part α
hab : (a ++ b).Dom
⊢ get (Part.bind a fun y => map (fun x => y ++ x) b) (_ : (Part.bind a fun y => map (fun x => y ++ x) b).Dom) =
    get a (_ : a.Dom) ++ get b (_ : b.Dom)

Next tactic:
aesop
theorem some_append_some [Append α] (a b : α) : some a ++ some b = some (a ++ b) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Append α
a b : α
⊢ some a ++ some b = some (a ++ b)

Next tactic:
simp [append_def]
theorem inter_mem_inter [Inter α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ∩ mb ∈ a ∩ b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inter α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma ∩ mb ∈ a ∩ b

Next tactic:
simp [inter_def]
theorem inter_mem_inter [Inter α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ∩ mb ∈ a ∩ b := by simp [inter_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inter α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 ∩ a = ma ∩ mb

Next tactic:
aesop
@[simp]
theorem inter_get_eq [Inter α] (a b : Part α) (hab : Dom (a ∩ b)) :
    (a ∩ b).get hab = a.get (left_dom_of_inter_dom hab) ∩ b.get (right_dom_of_inter_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inter α
a b : Part α
hab : (a ∩ b).Dom
⊢ get (a ∩ b) hab = get a (_ : a.Dom) ∩ get b (_ : b.Dom)

Next tactic:
simp [inter_def]
@[simp]
theorem inter_get_eq [Inter α] (a b : Part α) (hab : Dom (a ∩ b)) :
    (a ∩ b).get hab = a.get (left_dom_of_inter_dom hab) ∩ b.get (right_dom_of_inter_dom hab) :=
  by simp [inter_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inter α
a b : Part α
hab : (a ∩ b).Dom
⊢ get (Part.bind a fun y => map (fun x => y ∩ x) b) (_ : (Part.bind a fun y => map (fun x => y ∩ x) b).Dom) =
    get a (_ : a.Dom) ∩ get b (_ : b.Dom)

Next tactic:
aesop
theorem some_inter_some [Inter α] (a b : α) : some a ∩ some b = some (a ∩ b) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Inter α
a b : α
⊢ some a ∩ some b = some (a ∩ b)

Next tactic:
simp [inter_def]
theorem union_mem_union [Union α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ∪ mb ∈ a ∪ b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Union α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma ∪ mb ∈ a ∪ b

Next tactic:
simp [union_def]
theorem union_mem_union [Union α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma ∪ mb ∈ a ∪ b := by simp [union_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Union α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 ∪ a = ma ∪ mb

Next tactic:
aesop
@[simp]
theorem union_get_eq [Union α] (a b : Part α) (hab : Dom (a ∪ b)) :
    (a ∪ b).get hab = a.get (left_dom_of_union_dom hab) ∪ b.get (right_dom_of_union_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Union α
a b : Part α
hab : (a ∪ b).Dom
⊢ get (a ∪ b) hab = get a (_ : a.Dom) ∪ get b (_ : b.Dom)

Next tactic:
simp [union_def]
@[simp]
theorem union_get_eq [Union α] (a b : Part α) (hab : Dom (a ∪ b)) :
    (a ∪ b).get hab = a.get (left_dom_of_union_dom hab) ∪ b.get (right_dom_of_union_dom hab) :=
  by simp [union_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Union α
a b : Part α
hab : (a ∪ b).Dom
⊢ get (Part.bind a fun y => map (fun x => y ∪ x) b) (_ : (Part.bind a fun y => map (fun x => y ∪ x) b).Dom) =
    get a (_ : a.Dom) ∪ get b (_ : b.Dom)

Next tactic:
aesop
theorem some_union_some [Union α] (a b : α) : some a ∪ some b = some (a ∪ b) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Union α
a b : α
⊢ some a ∪ some b = some (a ∪ b)

Next tactic:
simp [union_def]
theorem sdiff_mem_sdiff [SDiff α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma \ mb ∈ a \ b := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : SDiff α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ma \ mb ∈ a \ b

Next tactic:
simp [sdiff_def]
theorem sdiff_mem_sdiff [SDiff α] (a b : Part α) (ma mb : α) (ha : ma ∈ a) (hb : mb ∈ b) :
    ma \ mb ∈ a \ b := by simp [sdiff_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : SDiff α
a b : Part α
ma mb : α
ha : ma ∈ a
hb : mb ∈ b
⊢ ∃ a_1 ∈ a, ∃ a ∈ b, a_1 \ a = ma \ mb

Next tactic:
aesop
@[simp]
theorem sdiff_get_eq [SDiff α] (a b : Part α) (hab : Dom (a \ b)) :
    (a \ b).get hab = a.get (left_dom_of_sdiff_dom hab) \ b.get (right_dom_of_sdiff_dom hab) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : SDiff α
a b : Part α
hab : (a \ b).Dom
⊢ get (a \ b) hab = get a (_ : a.Dom) \ get b (_ : b.Dom)

Next tactic:
simp [sdiff_def]
@[simp]
theorem sdiff_get_eq [SDiff α] (a b : Part α) (hab : Dom (a \ b)) :
    (a \ b).get hab = a.get (left_dom_of_sdiff_dom hab) \ b.get (right_dom_of_sdiff_dom hab) :=
  by simp [sdiff_def]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : SDiff α
a b : Part α
hab : (a \ b).Dom
⊢ get (Part.bind a fun y => map (fun x => y \ x) b) (_ : (Part.bind a fun y => map (fun x => y \ x) b).Dom) =
    get a (_ : a.Dom) \ get b (_ : b.Dom)

Next tactic:
aesop
theorem some_sdiff_some [SDiff α] (a b : α) : some a \ some b = some (a \ b) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : SDiff α
a b : α
⊢ some a \ some b = some (a \ b)

Next tactic:
simp [sdiff_def]
@[simp]
theorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by
  

Proof state:
ι : Type u_1
I J J₁ J₂ : Box ι
π : TaggedPrepartition I
x : ι → ℝ
⊢ x ∈ iUnion π ↔ ∃ J ∈ π, x ∈ J

Next tactic:
convert Set.mem_iUnion₂
@[simp]
theorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by
  convert Set.mem_iUnion₂
  

Proof state:
case h.e'_2.h.e'_2.h.a
ι : Type u_1
I J J₁ J₂ : Box ι
π : TaggedPrepartition I
x : ι → ℝ
x✝ : Box ι
⊢ x✝ ∈ π ∧ x ∈ x✝ ↔ ∃ (_ : x✝ ∈ π.toPrepartition), x ∈ ↑x✝

Next tactic:
rw [Box.mem_coe, mem_toPrepartition, exists_prop]
theorem tag_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} (hJ : J ∈ π) {J'}
    (hJ' : J' ∈ πi J) : (π.biUnionTagged πi).tag J' = (πi J).tag J' := by
  

Proof state:
ι : Type u_1
I J : Box ι
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
hJ : J ∈ π
J' : Box ι
hJ' : J' ∈ πi J
⊢ TaggedPrepartition.tag (biUnionTagged π πi) J' = TaggedPrepartition.tag (πi J) J'

Next tactic:
rw [← π.biUnionIndex_of_mem (πi := fun J => (πi J).toPrepartition) hJ hJ']
theorem tag_biUnionTagged (π : Prepartition I) {πi : ∀ J, TaggedPrepartition J} (hJ : J ∈ π) {J'}
    (hJ' : J' ∈ πi J) : (π.biUnionTagged πi).tag J' = (πi J).tag J' := by
  rw [← π.biUnionIndex_of_mem (πi := fun J => (πi J).toPrepartition) hJ hJ']
  

Proof state:
ι : Type u_1
I J : Box ι
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
hJ : J ∈ π
J' : Box ι
hJ' : J' ∈ πi J
⊢ TaggedPrepartition.tag (biUnionTagged π πi) J' =
    TaggedPrepartition.tag (πi (biUnionIndex π (fun J => (πi J).toPrepartition) J')) J'

Next tactic:
rfl
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  

Proof state:
ι : Type u_1
I J : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
⊢ (∀ J ∈ biUnionTagged π πi, p (TaggedPrepartition.tag (biUnionTagged π πi) J) J) ↔
    ∀ J ∈ π, ∀ J' ∈ πi J, p (TaggedPrepartition.tag (πi J) J') J'

Next tactic:
simp only [mem_biUnionTagged]
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  simp only [mem_biUnionTagged]
  

Proof state:
ι : Type u_1
I J : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
⊢ (∀ (J : Box ι), (∃ J' ∈ π, J ∈ πi J') → p (TaggedPrepartition.tag (biUnionTagged π πi) J) J) ↔
    ∀ J ∈ π, ∀ J' ∈ πi J, p (TaggedPrepartition.tag (πi J) J') J'

Next tactic:
refine' ⟨fun H J hJ J' hJ' => _, fun H J' ⟨J, hJ, hJ'⟩ => _⟩
theorem forall_biUnionTagged (p : (ι → ℝ) → Box ι → Prop) (π : Prepartition I)
    (πi : ∀ J, TaggedPrepartition J) :
    (∀ J ∈ π.biUnionTagged πi, p ((π.biUnionTagged πi).tag J) J) ↔
      ∀ J ∈ π, ∀ J' ∈ πi J, p ((πi J).tag J') J' := by
  simp only [mem_biUnionTagged]
  refine' ⟨fun H J hJ J' hJ' => _, fun H J' ⟨J, hJ, hJ'⟩ => _⟩
  · 

Proof state:
case refine'_1
ι : Type u_1
I J✝ : Box ι
p : (ι → ℝ) → Box ι → Prop
π : Prepartition I
πi : (J : Box ι) → TaggedPrepartition J
H : ∀ (J : Box ι), (∃ J' ∈ π, J ∈ πi J') → p (TaggedPrepartition.tag (biUnionTagged π πi) J) J
J : Box ι
hJ : J ∈ π
J' : Box ι
hJ' : J' ∈ πi J
⊢ p (TaggedPrepartition.tag (πi J) J') J'

Next tactic:
rw [← π.tag_biUnionTagged hJ hJ']