-- Mathlib/AlgebraicGeometry/EllipticCurve/Projective.lean
lemma addMap_of_Z_eq_zero_right {P : PointClass F} {Q : Fin 3 → F} (hP : W.NonsingularLift P)
    (hQ : W.Nonsingular Q) (hQz : Q z = 0) : W.addMap P ⟦Q⟧ = P

Proof state:
F : Type u
inst✝ : Field F
W : Projective F
P : PointClass F
Q : Fin 3 → F
hP : W.NonsingularLift P
hQ : W.Nonsingular Q
hQz : Q z = 0
⊢ W.addMap P ⟦Q⟧ = P

Tactic:
rcases P with ⟨P⟩

Result:
case mk
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Proof state:
case mk
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Tactic:
by_cases hPz : P z = 0

Result:
case pos
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : P z = 0
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

case neg
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : ¬P z = 0
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Proof state:
case pos
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : P z = 0
⊢ (MulAction.orbitRel Fˣ (Fin 3 → F)) ![0, 1, 0] P

Tactic:
exact Setoid.symm <| equiv_zero_of_Z_eq_zero hP hPz

Result:
no goals

Proof state:
case neg
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : ¬P z = 0
⊢ ⟦P⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Tactic:
rfl

Result:
no goals

Proof state:
case neg
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : ¬P z = 0
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Tactic:
erw [addMap_eq, add_of_Z_eq_zero_right hQ.left hPz hQz,
  smul_eq _ (((isUnit_Y_of_Z_eq_zero hQ hQz).pow 2).mul <| Ne.isUnit hPz).neg]

Result:
case neg
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : ¬P z = 0
⊢ ⟦P⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Proof state:
case pos
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : P z = 0
⊢ W.addMap (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P) ⟦Q⟧ = Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P

Tactic:
erw [addMap_eq, add_of_Z_eq_zero hP hQ hPz hQz,
  smul_eq _ <| (isUnit_Y_of_Z_eq_zero hP hPz).pow 4, Quotient.eq]

Result:
case pos
F : Type u
inst✝ : Field F
W : Projective F
P✝ : PointClass F
Q : Fin 3 → F
hQ : W.Nonsingular Q
hQz : Q z = 0
P : Fin 3 → F
hP : W.NonsingularLift (Quot.mk (⇑(MulAction.orbitRel Fˣ (Fin 3 → F))) P)
hPz : P z = 0
⊢ (MulAction.orbitRel Fˣ (Fin 3 → F)) ![0, 1, 0] P