l3lab/ntp-mathlib huggingface dataset:
theorem two_lt_lineCount [Finite P] [Finite L] (p : P) : 2 < lineCount L p := by
  

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Finite P
inst✝ : Finite L
p : P
⊢ 2 < lineCount L p

Next tactic:
simpa only [lineCount_eq L p, Nat.succ_lt_succ_iff] using one_lt_order P L
theorem two_lt_pointCount [Finite P] [Finite L] (l : L) : 2 < pointCount P l := by
  

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Finite P
inst✝ : Finite L
l : L
⊢ 2 < pointCount P l

Next tactic:
simpa only [pointCount_eq P l, Nat.succ_lt_succ_iff] using one_lt_order P L
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
⊢ Fintype.card P = order P L ^ 2 + order P L + 1

Next tactic:
cases nonempty_fintype L
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  

Proof state:
case intro
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
⊢ Fintype.card P = order P L ^ 2 + order P L + 1

Next tactic:
obtain ⟨p, -⟩ := @exists_config P L _ _
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  

Proof state:
case intro.intro
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
⊢ Fintype.card P = order P L ^ 2 + order P L + 1

Next tactic:
let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    

Proof state:
case intro.intro
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
⊢ Fintype.card P = order P L ^ 2 + order P L + 1

Next tactic:
have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
      convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p))
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
⊢ Fintype.card { q // q ≠ p } + 1 = Fintype.card P

Next tactic:
apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
      

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
⊢ Fintype.card { q // q ≠ p } = Fintype.card P - Nat.succ 0

Next tactic:
convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p))
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
      convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p))
    have h2 : ∀ l : { l : L // p ∈ l }, Fintype.card { q // q ∈ l.1 ∧ q ≠ p } = order P L := by
      

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P
⊢ ∀ (l : { l // p ∈ l }), Fintype.card { q // q ∈ ↑l ∧ q ≠ p } = order P L

Next tactic:
intro l
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
      convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p))
    have h2 : ∀ l : { l : L // p ∈ l }, Fintype.card { q // q ∈ l.1 ∧ q ≠ p } = order P L := by
      intro l
      

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P
l : { l // p ∈ l }
⊢ Fintype.card { q // q ∈ ↑l ∧ q ≠ p } = order P L

Next tactic:
rw [← Fintype.card_congr (Equiv.subtypeSubtypeEquivSubtypeInter (· ∈ l.val) (· ≠ p)),
        Fintype.card_subtype_compl fun x : Subtype (· ∈ l.val) => x.val = p, ←
        Nat.card_eq_fintype_card]
theorem card_points [Fintype P] [Finite L] : Fintype.card P = order P L ^ 2 + order P L + 1 := by
  cases nonempty_fintype L
  obtain ⟨p, -⟩ := @exists_config P L _ _
  let ϕ : { q // q ≠ p } ≃ Σl : { l : L // p ∈ l }, { q // q ∈ l.1 ∧ q ≠ p } :=
    { toFun := fun q => ⟨⟨mkLine q.2, (mkLine_ax q.2).2⟩, q, (mkLine_ax q.2).1, q.2⟩
      invFun := fun lq => ⟨lq.2, lq.2.2.2⟩
      left_inv := fun q => Subtype.ext rfl
      right_inv := fun lq =>
        Sigma.subtype_ext
          (Subtype.ext
            ((eq_or_eq (mkLine_ax lq.2.2.2).1 (mkLine_ax lq.2.2.2).2 lq.2.2.1 lq.1.2).resolve_left
              lq.2.2.2))
          rfl }
  classical
    have h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P := by
      apply (eq_tsub_iff_add_eq_of_le (Nat.succ_le_of_lt (Fintype.card_pos_iff.mpr ⟨p⟩))).mp
      convert (Fintype.card_subtype_compl _).trans (congr_arg _ (Fintype.card_subtype_eq p))
    have h2 : ∀ l : { l : L // p ∈ l }, Fintype.card { q // q ∈ l.1 ∧ q ≠ p } = order P L := by
      intro l
      rw [← Fintype.card_congr (Equiv.subtypeSubtypeEquivSubtypeInter (· ∈ l.val) (· ≠ p)),
        Fintype.card_subtype_compl fun x : Subtype (· ∈ l.val) => x.val = p, ←
        Nat.card_eq_fintype_card]
      

Proof state:
P : Type u_1
L : Type u_2
inst✝³ : Membership P L
inst✝² : ProjectivePlane P L
inst✝¹ : Fintype P
inst✝ : Finite L
val✝ : Fintype L
p : P
ϕ : { q // q ≠ p } ≃ (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p } :=
  {
    toFun := fun q =>
      { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
        snd :=
          { val := ↑q,
            property :=
              (_ : ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } },
    invFun := fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) },
    left_inv :=
      (_ :
        ∀ (q : { q // q ≠ p }),
          (fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) })
              ((fun q =>
                  { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                    snd :=
                      { val := ↑q,
                        property :=
                          (_ :
                            ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧
                              ↑q ≠ p) } })
                q) =
            q),
    right_inv :=
      (_ :
        ∀ (lq : (l : { l // p ∈ l }) × { q // q ∈ ↑l ∧ q ≠ p }),
          (fun q =>
                { fst := { val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) },
                  snd :=
                    { val := ↑q,
                      property :=
                        (_ :
                          ↑q ∈ ↑{ val := mkLine (_ : ↑q ≠ p), property := (_ : p ∈ mkLine (_ : ↑q ≠ p)) } ∧ ↑q ≠ p) } })
              ((fun lq => { val := ↑lq.snd, property := (_ : ↑lq.snd ≠ p) }) lq) =
            lq) }
h1 : Fintype.card { q // q ≠ p } + 1 = Fintype.card P
l : { l // p ∈ l }
⊢ Nat.card { x // x ∈ ↑l } - Fintype.card { x // ↑x = p } = order P L

Next tactic:
refine' tsub_eq_of_eq_add ((pointCount_eq P l.1).trans _)
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) :
    Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) =
      (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
  

Proof state:
X : Type u_1
x : X
⊢ AddMonoidHom.comp toFreeAbelianGroup (singleAddHom x) = (AddMonoidHom.flip (smulAddHom ℤ (FreeAbelianGroup X))) (of x)

Next tactic:
ext
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) :
    Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) =
      (smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
  ext
  

Proof state:
case h1
X : Type u_1
x : X
⊢ (AddMonoidHom.comp toFreeAbelianGroup (singleAddHom x)) 1 =
    ((AddMonoidHom.flip (smulAddHom ℤ (FreeAbelianGroup X))) (of x)) 1

Next tactic:
simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul,
    toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
    toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
  

Proof state:
X : Type u_1
⊢ AddMonoidHom.comp toFinsupp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ)

Next tactic:
ext x y
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
    toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
  ext x y; 

Proof state:
case H.h1.h
X : Type u_1
x y : X
⊢ ((AddMonoidHom.comp (AddMonoidHom.comp toFinsupp toFreeAbelianGroup) (singleAddHom x)) 1) y =
    ((AddMonoidHom.comp (AddMonoidHom.id (X →₀ ℤ)) (singleAddHom x)) 1) y

Next tactic:
simp only [AddMonoidHom.id_comp]
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
    toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
  ext x y; simp only [AddMonoidHom.id_comp]
  

Proof state:
case H.h1.h
X : Type u_1
x y : X
⊢ ((AddMonoidHom.comp (AddMonoidHom.comp toFinsupp toFreeAbelianGroup) (singleAddHom x)) 1) y = ((singleAddHom x) 1) y

Next tactic:
rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom]
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
    toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
  ext x y; simp only [AddMonoidHom.id_comp]
  rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom]
  

Proof state:
case H.h1.h
X : Type u_1
x y : X
⊢ ((AddMonoidHom.comp toFinsupp ((AddMonoidHom.flip (smulAddHom ℤ (FreeAbelianGroup X))) (of x))) 1) y =
    ((singleAddHom x) 1) y

Next tactic:
simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply,
    one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply]
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp :
    toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by
  

Proof state:
X : Type u_1
⊢ AddMonoidHom.comp toFreeAbelianGroup toFinsupp = AddMonoidHom.id (FreeAbelianGroup X)

Next tactic:
ext
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp :
    toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by
  ext
  

Proof state:
case H
X : Type u_1
x✝ : X
⊢ (AddMonoidHom.comp toFreeAbelianGroup toFinsupp) (of x✝) = (AddMonoidHom.id (FreeAbelianGroup X)) (of x✝)

Next tactic:
rw [toFreeAbelianGroup, toFinsupp, AddMonoidHom.comp_apply, lift.of,
    liftAddHom_apply_single, AddMonoidHom.flip_apply, smulAddHom_apply, one_smul,
    AddMonoidHom.id_apply]
@[simp]
theorem Finsupp.toFreeAbelianGroup_toFinsupp {X} (x : FreeAbelianGroup X) :
    Finsupp.toFreeAbelianGroup (FreeAbelianGroup.toFinsupp x) = x := by
  

Proof state:
X✝ : Type u_1
X : Type u_2
x : FreeAbelianGroup X
⊢ toFreeAbelianGroup (toFinsupp x) = x

Next tactic:
rw [← AddMonoidHom.comp_apply, Finsupp.toFreeAbelianGroup_comp_toFinsupp, AddMonoidHom.id_apply]
@[simp]
theorem toFinsupp_of (x : X) : toFinsupp (of x) = Finsupp.single x 1 := by
  

Proof state:
X : Type u_1
x : X
⊢ toFinsupp (of x) = fun₀ | x => 1

Next tactic:
simp only [toFinsupp, lift.of]
@[simp]
theorem toFinsupp_toFreeAbelianGroup (f : X →₀ ℤ) :
    FreeAbelianGroup.toFinsupp (Finsupp.toFreeAbelianGroup f) = f := by
  

Proof state:
X : Type u_1
f : X →₀ ℤ
⊢ toFinsupp (toFreeAbelianGroup f) = f

Next tactic:
rw [← AddMonoidHom.comp_apply, toFinsupp_comp_toFreeAbelianGroup, AddMonoidHom.id_apply]
theorem mem_support_iff (x : X) (a : FreeAbelianGroup X) : x ∈ a.support ↔ coeff x a ≠ 0 := by
  

Proof state:
X : Type u_1
x : X
a : FreeAbelianGroup X
⊢ x ∈ support a ↔ (coeff x) a ≠ 0

Next tactic:
rw [support, Finsupp.mem_support_iff]
theorem mem_support_iff (x : X) (a : FreeAbelianGroup X) : x ∈ a.support ↔ coeff x a ≠ 0 := by
  rw [support, Finsupp.mem_support_iff]
  

Proof state:
X : Type u_1
x : X
a : FreeAbelianGroup X
⊢ (toFinsupp a) x ≠ 0 ↔ (coeff x) a ≠ 0

Next tactic:
exact Iff.rfl
theorem not_mem_support_iff (x : X) (a : FreeAbelianGroup X) : x ∉ a.support ↔ coeff x a = 0 := by
  

Proof state:
X : Type u_1
x : X
a : FreeAbelianGroup X
⊢ x ∉ support a ↔ (coeff x) a = 0

Next tactic:
rw [support, Finsupp.not_mem_support_iff]