Theorem: CategoryTheory.Presieve.isSeparatedFor_and_exists_isAmalgamation_iff_isSheafFor
File: Mathlib/CategoryTheory/Sites/SheafOfTypes.lean

tactic: rw [IsSeparatedFor, ← forall_and]
state_before: C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
⊢ (IsSeparatedFor P R ∧
      ∀ (x : FamilyOfElements P R), FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t) ↔
    IsSheafFor P R

tactic: apply forall_congr'
state_before: C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
⊢ (∀ (x : FamilyOfElements P R),
      (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
        (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t)) ↔
    IsSheafFor P R

tactic: intro x
state_before: case h
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
⊢ ∀ (a : FamilyOfElements P R),
    (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation a t₁ → FamilyOfElements.IsAmalgamation a t₂ → t₁ = t₂) ∧
        (FamilyOfElements.Compatible a → ∃ t, FamilyOfElements.IsAmalgamation a t) ↔
      FamilyOfElements.Compatible a → ∃! t, FamilyOfElements.IsAmalgamation a t

tactic: constructor
state_before: case h
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
⊢ (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
      (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t) ↔
    FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t

tactic: intro z hx
state_before: case h.mp
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
⊢ (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
      (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t) →
    FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t

tactic: exact exists_unique_of_exists_of_unique (z.2 hx) z.1
state_before: case h.mp
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
z :
  (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
    (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t)
hx : FamilyOfElements.Compatible x
⊢ ∃! t, FamilyOfElements.IsAmalgamation x t

tactic: intro h
state_before: case h.mpr
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
⊢ (FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t) →
    (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
      (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t)

tactic: refine' ⟨_, ExistsUnique.exists ∘ h⟩
state_before: case h.mpr
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
h : FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t
⊢ (∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂) ∧
    (FamilyOfElements.Compatible x → ∃ t, FamilyOfElements.IsAmalgamation x t)

tactic: intro t₁ t₂ ht₁ ht₂
state_before: case h.mpr
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
h : FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t
⊢ ∀ (t₁ t₂ : P.obj X.op), FamilyOfElements.IsAmalgamation x t₁ → FamilyOfElements.IsAmalgamation x t₂ → t₁ = t₂

tactic: apply (h _).unique ht₁ ht₂
state_before: case h.mpr
C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
h : FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t
t₁ t₂ : P.obj X.op
ht₁ : FamilyOfElements.IsAmalgamation x t₁
ht₂ : FamilyOfElements.IsAmalgamation x t₂
⊢ t₁ = t₂

tactic: exact is_compatible_of_exists_amalgamation x ⟨_, ht₂⟩
state_before: C : Type u₁
inst✝ : Category C
P Q U : Cᵒᵖ ⥤ Type w
X Y : C
S : Sieve X
R : Presieve X
J J₂ : GrothendieckTopology C
x : FamilyOfElements P R
h : FamilyOfElements.Compatible x → ∃! t, FamilyOfElements.IsAmalgamation x t
t₁ t₂ : P.obj X.op
ht₁ : FamilyOfElements.IsAmalgamation x t₁
ht₂ : FamilyOfElements.IsAmalgamation x t₂
⊢ FamilyOfElements.Compatible x