-- Mathlib/Combinatorics/Derangements/Basic.lean
theorem RemoveNone.fiber_some (a : α) :
    RemoveNone.fiber (some a) = { f : Perm α | fixedPoints f ⊆ {a} }

Proof state:
case h.mp.intro.intro.intro.none
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : some ((removeNone F) x) = some x
Fx : F (some x) = none
⊢ x ∈ {a}

Tactic:
rwa [removeNone_none F Fx, F_none, Option.some_inj, eq_comm] at x_fixed

Result:
no goals

Proof state:
α : Type u_1
inst✝ : DecidableEq α
a : α
⊢ fiber (some a) = {f | fixedPoints ⇑f ⊆ {a}}

Tactic:
ext f

Result:
case h
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
⊢ f ∈ fiber (some a) ↔ f ∈ {f | fixedPoints ⇑f ⊆ {a}}

Proof state:
case neg
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
x_vs_a : ¬x = a
ne_1 : some x ≠ none
ne_2 : some x ≠ some a
⊢ some (f x) ≠ (Equiv.swap none (some a)) (some x)

Tactic:
rw [swap_apply_of_ne_of_ne ne_1 ne_2, (Option.some_injective α).ne_iff]

Result:
case neg
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
x_vs_a : ¬x = a
ne_1 : some x ≠ none
ne_2 : some x ≠ some a
⊢ f x ≠ x

Proof state:
case h.mp.intro.intro.intro.some
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : some ((removeNone F) x) = some x
y : α
Fx : F (some x) = some y
⊢ x ∈ {a}

Tactic:
exfalso

Result:
case h.mp.intro.intro.intro.some
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : some ((removeNone F) x) = some x
y : α
Fx : F (some x) = some y
⊢ False

Proof state:
case h.mpr
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
⊢ f ∈ fiber (some a)

Tactic:
use Equiv.Perm.decomposeOption.symm (some a, f)

Result:
case h
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
⊢ Perm.decomposeOption.symm (some a, f) ∈ derangements (Option α) ∧
    Perm.decomposeOption (Perm.decomposeOption.symm (some a, f)) = (some a, f)

Proof state:
case neg
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
x_vs_a : ¬x = a
ne_1 : some x ≠ none
ne_2 : some x ≠ some a
⊢ f x ≠ x

Tactic:
intro contra

Result:
case neg
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
x_vs_a : ¬x = a
ne_1 : some x ≠ none
ne_2 : some x ≠ some a
contra : f x = x
⊢ False

Proof state:
case h.mp.intro.intro.intro.some
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : some ((removeNone F) x) = some x
y : α
Fx : F (some x) = some y
⊢ False

Tactic:
rw [removeNone_some F ⟨y, Fx⟩] at x_fixed

Result:
case h.mp.intro.intro.intro.some
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : F (some x) = some x
y : α
Fx : F (some x) = some y
⊢ False

Proof state:
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : Option α
⊢ (Equiv.swap none (some a)) ((⇑(Equiv.swap none (some a)) ∘ ⇑(optionCongr f)) x) ≠ (Equiv.swap none (some a)) x

Tactic:
rcases x with - | x

Result:
case none
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
⊢ (Equiv.swap none (some a)) ((⇑(Equiv.swap none (some a)) ∘ ⇑(optionCongr f)) none) ≠ (Equiv.swap none (some a)) none

case some
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
⊢ (Equiv.swap none (some a)) ((⇑(Equiv.swap none (some a)) ∘ ⇑(optionCongr f)) (some x)) ≠
    (Equiv.swap none (some a)) (some x)

Proof state:
case h.mp.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : x ∈ fixedPoints ⇑(removeNone F)
⊢ x ∈ {a}

Tactic:
rw [mem_fixedPoints_iff] at x_fixed

Result:
case h.mp.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : (removeNone F) x = x
⊢ x ∈ {a}

Proof state:
case neg
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
h_opfp : f ∈ {f | fixedPoints ⇑f ⊆ {a}}
x : α
x_vs_a : ¬x = a
ne_1 : some x ≠ none
ne_2 : some x ≠ some a
contra : f x = x
⊢ False

Tactic:
exact x_vs_a (h_opfp contra)

Result:
no goals

Proof state:
case h.mp
α : Type u_1
inst✝ : DecidableEq α
a : α
f : Perm α
⊢ (∃ F ∈ derangements (Option α), F none = some a ∧ removeNone F = f) → f ∈ {f | fixedPoints ⇑f ⊆ {a}}

Tactic:
rintro ⟨F, F_derangement, F_none, rfl⟩ x x_fixed

Result:
case h.mp.intro.intro.intro
α : Type u_1
inst✝ : DecidableEq α
a : α
F : Perm (Option α)
F_derangement : F ∈ derangements (Option α)
F_none : F none = some a
x : α
x_fixed : x ∈ fixedPoints ⇑(removeNone F)
⊢ x ∈ {a}