l3lab/ntp-mathlib huggingface dataset:
instance mono_pushout_of_mono_g [Mono g] : Mono (pushout.inl : Y ⟶ pushout f g) :=
  mono_of_cancel_zero _ fun {R} e h => by
    let u := biprod.lift e (0 : R ⟶ Z)
    have hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0 := by simpa
    have :=
      monoIsKernelOfCokernel _
        (BiproductToPushoutIsCokernel.isColimitBiproductToPushout f g)
    obtain ⟨d, hd⟩ := KernelFork.IsLimit.lift' this u hu
    dsimp at d
    dsimp at hd
    have : d ≫ (-g) = 0;
    calc
      d ≫ (-g) = d ≫ biprod.lift f (-g) ≫ biprod.snd := by rw [biprod.lift_snd]
      _ = biprod.lift e (0 : R ⟶ Z) ≫ biprod.snd := by rw [← Category.assoc, hd]
      _ = 0 := biprod.lift_snd _ _
    have : d = 0 := (cancel_mono (-g)).1 (by simpa)
    calc
      e = biprod.lift e (0 : R ⟶ Z) ≫ biprod.fst := by rw [biprod.lift_fst]
      _ = (d ≫ biprod.lift f (-g)) ≫ biprod.fst := by 

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono g
R : C
e : R ⟶ Y
h : e ≫ pushout.inl = 0
u : R ⟶ Y ⊞ Z := biprod.lift e 0
hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0
this✝¹ :
  IsLimit
    (KernelFork.ofι (biprod.lift f (-g))
      (_ : biprod.lift f (-g) ≫ Cofork.π (BiproductToPushoutIsCokernel.biproductToPushoutCofork f g) = 0))
d : R ⟶ X
hd : d ≫ biprod.lift f (-g) = biprod.lift e 0
this✝ : d ≫ (-g) = 0
this : d = 0
⊢ biprod.lift e 0 ≫ biprod.fst = (d ≫ biprod.lift f (-g)) ≫ biprod.fst

Next tactic:
rw [← hd]
instance mono_pushout_of_mono_g [Mono g] : Mono (pushout.inl : Y ⟶ pushout f g) :=
  mono_of_cancel_zero _ fun {R} e h => by
    let u := biprod.lift e (0 : R ⟶ Z)
    have hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0 := by simpa
    have :=
      monoIsKernelOfCokernel _
        (BiproductToPushoutIsCokernel.isColimitBiproductToPushout f g)
    obtain ⟨d, hd⟩ := KernelFork.IsLimit.lift' this u hu
    dsimp at d
    dsimp at hd
    have : d ≫ (-g) = 0;
    calc
      d ≫ (-g) = d ≫ biprod.lift f (-g) ≫ biprod.snd := by rw [biprod.lift_snd]
      _ = biprod.lift e (0 : R ⟶ Z) ≫ biprod.snd := by rw [← Category.assoc, hd]
      _ = 0 := biprod.lift_snd _ _
    have : d = 0 := (cancel_mono (-g)).1 (by simpa)
    calc
      e = biprod.lift e (0 : R ⟶ Z) ≫ biprod.fst := by rw [biprod.lift_fst]
      _ = (d ≫ biprod.lift f (-g)) ≫ biprod.fst := by rw [← hd]
      _ = (0 ≫ biprod.lift f (-g)) ≫ biprod.fst := by 

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono g
R : C
e : R ⟶ Y
h : e ≫ pushout.inl = 0
u : R ⟶ Y ⊞ Z := biprod.lift e 0
hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0
this✝¹ :
  IsLimit
    (KernelFork.ofι (biprod.lift f (-g))
      (_ : biprod.lift f (-g) ≫ Cofork.π (BiproductToPushoutIsCokernel.biproductToPushoutCofork f g) = 0))
d : R ⟶ X
hd : d ≫ biprod.lift f (-g) = biprod.lift e 0
this✝ : d ≫ (-g) = 0
this : d = 0
⊢ (d ≫ biprod.lift f (-g)) ≫ biprod.fst = (0 ≫ biprod.lift f (-g)) ≫ biprod.fst

Next tactic:
rw [this]
instance mono_pushout_of_mono_g [Mono g] : Mono (pushout.inl : Y ⟶ pushout f g) :=
  mono_of_cancel_zero _ fun {R} e h => by
    let u := biprod.lift e (0 : R ⟶ Z)
    have hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0 := by simpa
    have :=
      monoIsKernelOfCokernel _
        (BiproductToPushoutIsCokernel.isColimitBiproductToPushout f g)
    obtain ⟨d, hd⟩ := KernelFork.IsLimit.lift' this u hu
    dsimp at d
    dsimp at hd
    have : d ≫ (-g) = 0;
    calc
      d ≫ (-g) = d ≫ biprod.lift f (-g) ≫ biprod.snd := by rw [biprod.lift_snd]
      _ = biprod.lift e (0 : R ⟶ Z) ≫ biprod.snd := by rw [← Category.assoc, hd]
      _ = 0 := biprod.lift_snd _ _
    have : d = 0 := (cancel_mono (-g)).1 (by simpa)
    calc
      e = biprod.lift e (0 : R ⟶ Z) ≫ biprod.fst := by rw [biprod.lift_fst]
      _ = (d ≫ biprod.lift f (-g)) ≫ biprod.fst := by rw [← hd]
      _ = (0 ≫ biprod.lift f (-g)) ≫ biprod.fst := by rw [this]
      _ = 0 ≫ biprod.lift f (-g) ≫ biprod.fst := by 

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono g
R : C
e : R ⟶ Y
h : e ≫ pushout.inl = 0
u : R ⟶ Y ⊞ Z := biprod.lift e 0
hu : u ≫ BiproductToPushoutIsCokernel.biproductToPushout f g = 0
this✝¹ :
  IsLimit
    (KernelFork.ofι (biprod.lift f (-g))
      (_ : biprod.lift f (-g) ≫ Cofork.π (BiproductToPushoutIsCokernel.biproductToPushoutCofork f g) = 0))
d : R ⟶ X
hd : d ≫ biprod.lift f (-g) = biprod.lift e 0
this✝ : d ≫ (-g) = 0
this : d = 0
⊢ (0 ≫ biprod.lift f (-g)) ≫ biprod.fst = 0 ≫ biprod.lift f (-g) ≫ biprod.fst

Next tactic:
rw [Category.assoc]
theorem mono_inr_of_isColimit [Mono f] {s : PushoutCocone f g} (hs : IsColimit s) : Mono s.inr := by
  

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono f
s : PushoutCocone f g
hs : IsColimit s
⊢ Mono (PushoutCocone.inr s)

Next tactic:
haveI : Mono (NatTrans.app (colimit.cocone (span f g)).ι WalkingCospan.right) :=
    Abelian.mono_pushout_of_mono_f f g
theorem mono_inr_of_isColimit [Mono f] {s : PushoutCocone f g} (hs : IsColimit s) : Mono s.inr := by
  haveI : Mono (NatTrans.app (colimit.cocone (span f g)).ι WalkingCospan.right) :=
    Abelian.mono_pushout_of_mono_f f g
  

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono f
s : PushoutCocone f g
hs : IsColimit s
this : Mono ((colimit.cocone (span f g)).ι.app WalkingCospan.right)
⊢ Mono (PushoutCocone.inr s)

Next tactic:
apply
    mono_of_mono_fac (IsColimit.comp_coconePointUniqueUpToIso_hom hs (colimit.isColimit _) _)
theorem mono_inl_of_isColimit [Mono g] {s : PushoutCocone f g} (hs : IsColimit s) : Mono s.inl := by
  

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono g
s : PushoutCocone f g
hs : IsColimit s
⊢ Mono (PushoutCocone.inl s)

Next tactic:
haveI : Mono (NatTrans.app (colimit.cocone (span f g)).ι WalkingCospan.left) :=
    Abelian.mono_pushout_of_mono_g f g
theorem mono_inl_of_isColimit [Mono g] {s : PushoutCocone f g} (hs : IsColimit s) : Mono s.inl := by
  haveI : Mono (NatTrans.app (colimit.cocone (span f g)).ι WalkingCospan.left) :=
    Abelian.mono_pushout_of_mono_g f g
  

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
inst✝² : Abelian C
inst✝¹ : HasPushouts C
W X Y Z : C
f : X ⟶ Y
g : X ⟶ Z
inst✝ : Mono g
s : PushoutCocone f g
hs : IsColimit s
this : Mono ((colimit.cocone (span f g)).ι.app WalkingCospan.left)
⊢ Mono (PushoutCocone.inl s)

Next tactic:
apply
    mono_of_mono_fac (IsColimit.comp_coconePointUniqueUpToIso_hom hs (colimit.isColimit _) _)
/-- Suppose `f` and `g` are two morphisms with a common domain and suppose we have written `g` as
    an epimorphism followed by a monomorphism. If `f` factors through the epi part of this
    factorization, then any pushout of `g` along `f` is a monomorphism. -/
theorem mono_inl_of_factor_thru_epi_mono_factorization (f : X ⟶ Y) (g : X ⟶ Z) (g₁ : X ⟶ W) [Epi g₁]
    (g₂ : W ⟶ Z) [Mono g₂] (hg : g₁ ≫ g₂ = g) (f' : W ⟶ Y) (hf : g₁ ≫ f' = f)
    (t : PushoutCocone f g) (ht : IsColimit t) : Mono t.inl := by
  

Proof state:
C : Type u
inst✝⁴ : Category.{v, u} C
inst✝³ : Abelian C
inst✝² : HasPushouts C
W X Y Z : C
f✝ : X ⟶ Y
g✝ : X ⟶ Z
f : X ⟶ Y
g : X ⟶ Z
g₁ : X ⟶ W
inst✝¹ : Epi g₁
g₂ : W ⟶ Z
inst✝ : Mono g₂
hg : g₁ ≫ g₂ = g
f' : W ⟶ Y
hf : g₁ ≫ f' = f
t : PushoutCocone f g
ht : IsColimit t
⊢ Mono (PushoutCocone.inl t)

Next tactic:
apply mono_inl_of_isColimit _ _ (PushoutCocone.isColimitOfFactors _ _ _ _ _ hf hg t ht)
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by convert (by infer_instance : Limits.HasCokernels C)
    normalMonoOfMono := by
      

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ {X Y : C} → (f : X ⟶ Y) → [inst : Mono f] → NormalMono f

Next tactic:
intro _ _ f _
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by convert (by infer_instance : Limits.HasCokernels C)
    normalMonoOfMono := by
      intro _ _ f _
      

Proof state:
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
X✝ Y✝ : C
f : X✝ ⟶ Y✝
inst✝ : Mono f
⊢ NormalMono f

Next tactic:
convert normalMonoOfMono f
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by convert (by infer_instance : Limits.HasCokernels C)
    normalMonoOfMono := by
      intro _ _ f _
      convert normalMonoOfMono f
    normalEpiOfEpi := by
      

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ {X Y : C} → (f : X ⟶ Y) → [inst : Epi f] → NormalEpi f

Next tactic:
intro _ _ f _
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by convert (by infer_instance : Limits.HasCokernels C)
    normalMonoOfMono := by
      intro _ _ f _
      convert normalMonoOfMono f
    normalEpiOfEpi := by
      intro _ _ f _
      

Proof state:
C : Type u
inst✝² : Category.{v, u} C
inst✝¹ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
X✝ Y✝ : C
f : X✝ ⟶ Y✝
inst✝ : Epi f
⊢ NormalEpi f

Next tactic:
convert normalEpiOfEpi f
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ HasFiniteProducts C

Next tactic:
infer_instance
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ HasKernels C

Next tactic:
convert (by infer_instance : Limits.HasKernels C)
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ HasKernels C

Next tactic:
infer_instance
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ HasCokernels C

Next tactic:
convert (by infer_instance : Limits.HasCokernels C)
/-- Every NonPreadditiveAbelian category can be promoted to an abelian category. -/
def abelian : Abelian C :=
  {/- We need the `convert`s here because the instances we have are slightly different from the
       instances we need: `HasKernels` depends on an instance of `HasZeroMorphisms`. In the
       case of `NonPreadditiveAbelian`, this instance is an explicit argument. However, in the case
       of `abelian`, the `HasZeroMorphisms` instance is derived from `Preadditive`. So we need to
       transform an instance of "has kernels with NonPreadditiveAbelian.HasZeroMorphisms" to an
       instance of "has kernels with NonPreadditiveAbelian.Preadditive.HasZeroMorphisms". Luckily,
       we have a `subsingleton` instance for `HasZeroMorphisms`, so `convert` can immediately close
       the goal it creates for the two instances of `HasZeroMorphisms`, and the proof is complete.-/
    NonPreadditiveAbelian.preadditive with
    has_finite_products := by infer_instance
    has_kernels := by convert (by infer_instance : Limits.HasKernels C)
    has_cokernels := by convert (by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : NonPreadditiveAbelian C
src✝ : Preadditive C := preadditive
⊢ HasCokernels C

Next tactic:
infer_instance
theorem sbtw_iff_not_btw {a b c : α} : sbtw a b c ↔ ¬btw c b a := by
  

Proof state:
α : Type u_1
inst✝ : CircularOrder α
a b c : α
⊢ sbtw a b c ↔ ¬btw c b a

Next tactic:
rw [sbtw_iff_btw_not_btw]
theorem sbtw_iff_not_btw {a b c : α} : sbtw a b c ↔ ¬btw c b a := by
  rw [sbtw_iff_btw_not_btw]
  

Proof state:
α : Type u_1
inst✝ : CircularOrder α
a b c : α
⊢ btw a b c ∧ ¬btw c b a ↔ ¬btw c b a

Next tactic:
exact and_iff_right_of_imp (btw_total _ _ _).resolve_left
theorem compl_cIcc {a b : α} : (cIcc a b)ᶜ = cIoo b a := by
  

Proof state:
α : Type u_1
inst✝ : CircularOrder α
a b : α
⊢ (cIcc a b)ᶜ = cIoo b a

Next tactic:
ext
theorem compl_cIcc {a b : α} : (cIcc a b)ᶜ = cIoo b a := by
  ext
  

Proof state:
case h
α : Type u_1
inst✝ : CircularOrder α
a b x✝ : α
⊢ x✝ ∈ (cIcc a b)ᶜ ↔ x✝ ∈ cIoo b a

Next tactic:
rw [Set.mem_cIoo, sbtw_iff_not_btw, cIcc, mem_compl_iff, mem_setOf]
theorem compl_cIoo {a b : α} : (cIoo a b)ᶜ = cIcc b a := by
  

Proof state:
α : Type u_1
inst✝ : CircularOrder α
a b : α
⊢ (cIoo a b)ᶜ = cIcc b a

Next tactic:
ext
theorem compl_cIoo {a b : α} : (cIoo a b)ᶜ = cIcc b a := by
  ext
  

Proof state:
case h
α : Type u_1
inst✝ : CircularOrder α
a b x✝ : α
⊢ x✝ ∈ (cIoo a b)ᶜ ↔ x✝ ∈ cIcc b a

Next tactic:
rw [Set.mem_cIcc, btw_iff_not_sbtw, cIoo, mem_compl_iff, mem_setOf]
/-- The circular preorder obtained from "looping around" a preorder.
See note [reducible non-instances]. -/
@[reducible]
def Preorder.toCircularPreorder (α : Type*) [Preorder α] : CircularPreorder α where
  btw a b c := a ≤ b ∧ b ≤ c ∨ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b
  sbtw a b c := a < b ∧ b < c ∨ b < c ∧ c < a ∨ c < a ∧ a < b
  btw_refl a := Or.inl ⟨le_rfl, le_rfl⟩
  btw_cyclic_left {a b c} h := by
    

Proof state:
α : Type u_1
inst✝ : Preorder α
a b c : α
h : btw a b c
⊢ btw b c a

Next tactic:
dsimp
/-- The circular preorder obtained from "looping around" a preorder.
See note [reducible non-instances]. -/
@[reducible]
def Preorder.toCircularPreorder (α : Type*) [Preorder α] : CircularPreorder α where
  btw a b c := a ≤ b ∧ b ≤ c ∨ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b
  sbtw a b c := a < b ∧ b < c ∨ b < c ∧ c < a ∨ c < a ∧ a < b
  btw_refl a := Or.inl ⟨le_rfl, le_rfl⟩
  btw_cyclic_left {a b c} h := by
    dsimp
    

Proof state:
α : Type u_1
inst✝ : Preorder α
a b c : α
h : btw a b c
⊢ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b ∨ a ≤ b ∧ b ≤ c

Next tactic:
rwa [← or_assoc, or_comm]
/-- The circular preorder obtained from "looping around" a preorder.
See note [reducible non-instances]. -/
@[reducible]
def Preorder.toCircularPreorder (α : Type*) [Preorder α] : CircularPreorder α where
  btw a b c := a ≤ b ∧ b ≤ c ∨ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b
  sbtw a b c := a < b ∧ b < c ∨ b < c ∧ c < a ∨ c < a ∧ a < b
  btw_refl a := Or.inl ⟨le_rfl, le_rfl⟩
  btw_cyclic_left {a b c} h := by
    dsimp
    rwa [← or_assoc, or_comm]
  sbtw_trans_left {a b c d} := by
    rintro (⟨hab, hbc⟩ | ⟨hbc, hca⟩ | ⟨hca, hab⟩) (⟨hbd, hdc⟩ | ⟨hdc, hcb⟩ | ⟨hcb, hbd⟩)
    · exact Or.inl ⟨hab.trans hbd, hdc⟩
    · exact (hbc.not_lt hcb).elim
    · exact (hbc.not_lt hcb).elim
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact (hbc.not_lt hcb).elim
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inr ⟨hca, hab.trans hbd⟩)
  sbtw_iff_btw_not_btw {a b c} := by
    

Proof state:
α : Type u_1
inst✝ : Preorder α
a b c : α
⊢ sbtw a b c ↔ btw a b c ∧ ¬btw c b a

Next tactic:
simp_rw [lt_iff_le_not_le]
/-- The circular preorder obtained from "looping around" a preorder.
See note [reducible non-instances]. -/
@[reducible]
def Preorder.toCircularPreorder (α : Type*) [Preorder α] : CircularPreorder α where
  btw a b c := a ≤ b ∧ b ≤ c ∨ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b
  sbtw a b c := a < b ∧ b < c ∨ b < c ∧ c < a ∨ c < a ∧ a < b
  btw_refl a := Or.inl ⟨le_rfl, le_rfl⟩
  btw_cyclic_left {a b c} h := by
    dsimp
    rwa [← or_assoc, or_comm]
  sbtw_trans_left {a b c d} := by
    rintro (⟨hab, hbc⟩ | ⟨hbc, hca⟩ | ⟨hca, hab⟩) (⟨hbd, hdc⟩ | ⟨hdc, hcb⟩ | ⟨hcb, hbd⟩)
    · exact Or.inl ⟨hab.trans hbd, hdc⟩
    · exact (hbc.not_lt hcb).elim
    · exact (hbc.not_lt hcb).elim
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact (hbc.not_lt hcb).elim
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inl ⟨hdc, hca⟩)
    · exact Or.inr (Or.inr ⟨hca, hab.trans hbd⟩)
  sbtw_iff_btw_not_btw {a b c} := by
    simp_rw [lt_iff_le_not_le]
    

Proof state:
α : Type u_1
inst✝ : Preorder α
a b c : α
⊢ (a ≤ b ∧ ¬b ≤ a) ∧ b ≤ c ∧ ¬c ≤ b ∨ (b ≤ c ∧ ¬c ≤ b) ∧ c ≤ a ∧ ¬a ≤ c ∨ (c ≤ a ∧ ¬a ≤ c) ∧ a ≤ b ∧ ¬b ≤ a ↔
    (a ≤ b ∧ b ≤ c ∨ b ≤ c ∧ c ≤ a ∨ c ≤ a ∧ a ≤ b) ∧ ¬(c ≤ b ∧ b ≤ a ∨ b ≤ a ∧ a ≤ c ∨ a ≤ c ∧ c ≤ b)

Next tactic:
have h1 := le_trans a b c