-- Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean
theorem iUnion_negAt_plusPart_union :
    (⋃ s, negAt s '' (plusPart A)) ∪ (A ∩ (⋃ w, {x | x.1 w = 0})) = A

Proof state:
case h.refine_1.inr
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}
⊢ x ∈ A

Tactic:
exact h.left

Result:
no goals

Proof state:
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
⊢ (⋃ s, ⇑(negAt s) '' plusPart A) ∪ A ∩ ⋃ w, {x | x.1 w = 0} = A

Tactic:
ext x

Result:
case h
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ x ∈ (⋃ s, ⇑(negAt s) '' plusPart A) ∪ A ∩ ⋃ w, {x | x.1 w = 0} ↔ x ∈ A

Proof state:
case h.refine_1
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ ((∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}) → x ∈ A

Tactic:
rintro (⟨s, ⟨x, ⟨hx, _⟩, rfl⟩⟩ | h)

Result:
case h.refine_1.inl.intro.intro.intro.intro
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
s : Set { w // w.IsReal }
x : mixedSpace K
hx : x ∈ A
right✝ : x ∈ {x | ∀ (w : { w // w.IsReal }), 0 < x.1 w}
⊢ (negAt s) x ∈ A

case h.refine_1.inr
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}
⊢ x ∈ A

Proof state:
case h
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ x ∈ (⋃ s, ⇑(negAt s) '' plusPart A) ∪ A ∩ ⋃ w, {x | x.1 w = 0} ↔ x ∈ A

Tactic:
rw [Set.mem_union, Set.mem_inter_iff, Set.mem_iUnion, Set.mem_iUnion]

Result:
case h
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ ((∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}) ↔ x ∈ A

Proof state:
case h.refine_1.inl.intro.intro.intro.intro
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
s : Set { w // w.IsReal }
x : mixedSpace K
hx : x ∈ A
right✝ : x ∈ {x | ∀ (w : { w // w.IsReal }), 0 < x.1 w}
⊢ (fun w => |x.1 w|, x.2) ∈ A

Tactic:
rwa [← hA]

Result:
no goals

Proof state:
case h.refine_1.inl.intro.intro.intro.intro
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
s : Set { w // w.IsReal }
x : mixedSpace K
hx : x ∈ A
right✝ : x ∈ {x | ∀ (w : { w // w.IsReal }), 0 < x.1 w}
⊢ (negAt s) x ∈ A

Tactic:
simp_rw (config := {singlePass := true}) [hA, negAt_apply_abs_isReal, negAt_apply_snd]

Result:
case h.refine_1.inl.intro.intro.intro.intro
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
s : Set { w // w.IsReal }
x : mixedSpace K
hx : x ∈ A
right✝ : x ∈ {x | ∀ (w : { w // w.IsReal }), 0 < x.1 w}
⊢ (fun w => |x.1 w|, x.2) ∈ A

Proof state:
case h.refine_2.inl
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∃ a, x.1 a = 0
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}

Tactic:
exact Or.inr ⟨h, hx⟩

Result:
no goals

Proof state:
case h.refine_2
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}

Tactic:
obtain hx | hx := exists_or_forall_not (fun w ↦ x.1 w = 0)

Result:
case h.refine_2.inl
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∃ a, x.1 a = 0
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}

case h.refine_2.inr
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}

Proof state:
case h.refine_2.inr
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}

Tactic:
refine Or.inl ⟨signSet x,
  (mem_negAt_plusPart_of_mem A hA h hx).mpr ⟨fun w hw ↦ ?_, fun w hw ↦ ?_⟩⟩

Result:
case h.refine_2.inr.refine_1
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
w : { w // w.IsReal }
hw : w ∈ signSet x
⊢ x.1 w < 0

case h.refine_2.inr.refine_2
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
w : { w // w.IsReal }
hw : w ∉ signSet x
⊢ x.1 w > 0

Proof state:
case h.refine_2.inr.refine_1
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
w : { w // w.IsReal }
hw : w ∈ signSet x
⊢ x.1 w < 0

Tactic:
exact lt_of_le_of_ne hw (hx w)

Result:
no goals

Proof state:
case h.refine_2.inr.refine_2
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
hx : ∀ (a : { w // w.IsReal }), ¬x.1 a = 0
w : { w // w.IsReal }
hw : w ∉ signSet x
⊢ x.1 w > 0

Tactic:
exact lt_of_le_of_ne (lt_of_not_ge hw).le (Ne.symm (hx w))

Result:
no goals

Proof state:
case h
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ ((∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}) ↔ x ∈ A

Tactic:
refine ⟨?_, fun h ↦ ?_⟩

Result:
case h.refine_1
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
⊢ ((∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}) → x ∈ A

case h.refine_2
K : Type u_1
inst✝ : Field K
A : Set (mixedSpace K)
hA : ∀ (x : mixedSpace K), x ∈ A ↔ (fun w => |x.1 w|, x.2) ∈ A
x : mixedSpace K
h : x ∈ A
⊢ (∃ i, x ∈ ⇑(negAt i) '' plusPart A) ∨ x ∈ A ∧ ∃ i, x ∈ {x | x.1 i = 0}