-- Mathlib/NumberTheory/NumberField/Embeddings.lean
lemma card_isUnramified_compl [NumberField k] [IsGalois k K] :
    #({w : InfinitePlace K | w.IsUnramified k} : Finset _)ᶜ =
      #({w : InfinitePlace k | w.IsUnramifiedIn K} : Finset _)ᶜ * (finrank k K / 2)

Proof state:
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ #(MulAction.orbit (K ≃ₐ[k] K) w).toFinset = Fintype.card (K ≃ₐ[k] K) / 2

Tactic:
rw [← MulAction.card_orbit_mul_card_stabilizer_eq_card_group _ w,
  ← Nat.card_eq_fintype_card (α := Stab w), InfinitePlace.card_stabilizer, if_neg,
  Nat.mul_div_cancel _ zero_lt_two, Set.toFinset_card]

Result:
case hnc
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ ¬IsUnramified k w

Proof state:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
⊢ w' ∈
      filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
        (filter (fun w => IsUnramified k w) univ)ᶜ ↔
    w' ∈ (MulAction.orbit (K ≃ₐ[k] K) w).toFinset

Tactic:
simp only [compl_filter, filter_congr_decidable, mem_filter, mem_univ, true_and,
  @eq_comm _ (comap w' _), Set.mem_toFinset, mem_orbit_iff, and_iff_right_iff_imp]

Result:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
⊢ w.comap (algebraMap k K) = w'.comap (algebraMap k K) → ¬IsUnramified k w'

Proof state:
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
⊢ #(filter (fun w => IsUnramified k w) univ)ᶜ = #(filter (fun w => IsUnramifiedIn K w) univ)ᶜ * (finrank k K / 2)

Tactic:
letI := Module.Finite.of_restrictScalars_finite ℚ k K

Result:
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
⊢ #(filter (fun w => IsUnramified k w) univ)ᶜ = #(filter (fun w => IsUnramifiedIn K w) univ)ᶜ * (finrank k K / 2)

Proof state:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
⊢ w.comap (algebraMap k K) = w'.comap (algebraMap k K) → ¬IsUnramified k w'

Tactic:
intro e

Result:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
e : w.comap (algebraMap k K) = w'.comap (algebraMap k K)
⊢ ¬IsUnramified k w'

Proof state:
case e_s
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
      (filter (fun w => IsUnramified k w) univ)ᶜ =
    (MulAction.orbit (K ≃ₐ[k] K) w).toFinset

Tactic:
ext w'

Result:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
⊢ w' ∈
      filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
        (filter (fun w => IsUnramified k w) univ)ᶜ ↔
    w' ∈ (MulAction.orbit (K ≃ₐ[k] K) w).toFinset

Proof state:
case intro
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : (fun x => x.comap (algebraMap k K)) w ∈ (filter (fun w => IsUnramifiedIn K w) univ)ᶜ
⊢ #(filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
        (filter (fun w => IsUnramified k w) univ)ᶜ) =
    Fintype.card (K ≃ₐ[k] K) / 2

Tactic:
simp only [mem_univ, forall_true_left, compl_filter, not_not, mem_filter, true_and] at hw

Result:
case intro
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ #(filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
        (filter (fun w => IsUnramified k w) univ)ᶜ) =
    Fintype.card (K ≃ₐ[k] K) / 2

Proof state:
case e_s.h
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
w' : InfinitePlace K
e : w.comap (algebraMap k K) = w'.comap (algebraMap k K)
⊢ ¬IsUnramified k w'

Tactic:
rwa [← isUnramifiedIn_comap, ← e]

Result:
no goals

Proof state:
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ #(filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
        (filter (fun w => IsUnramified k w) univ)ᶜ) =
    #(MulAction.orbit (K ≃ₐ[k] K) w).toFinset

Tactic:
congr

Result:
case e_s
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ filter (fun a => a.comap (algebraMap k K) = (fun x => x.comap (algebraMap k K)) w)
      (filter (fun w => IsUnramified k w) univ)ᶜ =
    (MulAction.orbit (K ≃ₐ[k] K) w).toFinset

Proof state:
case hnc
k : Type u_1
inst✝⁵ : Field k
K : Type u_2
inst✝⁴ : Field K
inst✝³ : Algebra k K
inst✝² : NumberField K
inst✝¹ : NumberField k
inst✝ : IsGalois k K
this : Module.Finite k K := Finite.of_restrictScalars_finite ℚ k K
w : InfinitePlace K
hw : ¬IsUnramifiedIn K (w.comap (algebraMap k K))
⊢ ¬IsUnramified k w

Tactic:
rwa [← isUnramifiedIn_comap]

Result:
no goals