[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
h : sel s = none
⊢ enumerate sel s 0 = none
[PROOFSTEP]
simp [h, enumerate]
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
h : sel s = none
n : ℕ
⊢ enumerate sel s (n + 1) = none
[PROOFSTEP]
simp [h, enumerate]
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
h : sel s = none
n : ℕ
⊢ (do
      let a ← none
      enumerate sel (s \ {a}) n) =
    none
[PROOFSTEP]
rfl
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n m : ℕ
h : enumerate sel s (n + 1) = none
hm : n + 1 ≤ m
⊢ enumerate sel s m = none
[PROOFSTEP]
cases hs : sel s
[GOAL]
case none
α : Type u_1
sel : Set α → Option α
s : Set α
n m : ℕ
h : enumerate sel s (n + 1) = none
hm : n + 1 ≤ m
hs : sel s = none
⊢ enumerate sel s m = none
[PROOFSTEP]
exact enumerate_eq_none_of_sel sel hs
[GOAL]
case some
α : Type u_1
sel : Set α → Option α
s : Set α
n m : ℕ
h : enumerate sel s (n + 1) = none
hm : n + 1 ≤ m
val✝ : α
hs : sel s = some val✝
⊢ enumerate sel s m = none
[PROOFSTEP]
cases m
[GOAL]
case some.zero
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
hm : n + 1 ≤ Nat.zero
⊢ enumerate sel s Nat.zero = none
case some.succ
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
n✝ : ℕ
hm : n + 1 ≤ Nat.succ n✝
⊢ enumerate sel s (Nat.succ n✝) = none
[PROOFSTEP]
case zero => contradiction
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
hm : n + 1 ≤ Nat.zero
⊢ enumerate sel s Nat.zero = none
[PROOFSTEP]
case zero => contradiction
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
hm : n + 1 ≤ Nat.zero
⊢ enumerate sel s Nat.zero = none
[PROOFSTEP]
contradiction
[GOAL]
case some.succ
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
n✝ : ℕ
hm : n + 1 ≤ Nat.succ n✝
⊢ enumerate sel s (Nat.succ n✝) = none
[PROOFSTEP]
case succ m' =>
  simp [hs, enumerate] at h ⊢
  have hm : n ≤ m' := Nat.le_of_succ_le_succ hm
  exact enumerate_eq_none h hm
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
m' : ℕ
hm : n + 1 ≤ Nat.succ m'
⊢ enumerate sel s (Nat.succ m') = none
[PROOFSTEP]
case succ m' =>
  simp [hs, enumerate] at h ⊢
  have hm : n ≤ m' := Nat.le_of_succ_le_succ hm
  exact enumerate_eq_none h hm
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
h : enumerate sel s (n + 1) = none
val✝ : α
hs : sel s = some val✝
m' : ℕ
hm : n + 1 ≤ Nat.succ m'
⊢ enumerate sel s (Nat.succ m') = none
[PROOFSTEP]
simp [hs, enumerate] at h ⊢
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
val✝ : α
hs : sel s = some val✝
m' : ℕ
hm : n + 1 ≤ Nat.succ m'
h :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) n) =
    none
⊢ (do
      let a ← some val✝
      enumerate sel (s \ {a}) m') =
    none
[PROOFSTEP]
have hm : n ≤ m' := Nat.le_of_succ_le_succ hm
[GOAL]
α : Type u_1
sel : Set α → Option α
s : Set α
n : ℕ
val✝ : α
hs : sel s = some val✝
m' : ℕ
hm✝ : n + 1 ≤ Nat.succ m'
h :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) n) =
    none
hm : n ≤ m'
⊢ (do
      let a ← some val✝
      enumerate sel (s \ {a}) m') =
    none
[PROOFSTEP]
exact enumerate_eq_none h hm
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a : α
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
cases h : sel s
[GOAL]
case none
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a : α
h : sel s = none
⊢ enumerate sel s (n + 1) = some a → a ∈ s
case some
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a val✝ : α
h : sel s = some val✝
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
case none => simp [enumerate_eq_none_of_sel, h]
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a : α
h : sel s = none
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
case none => simp [enumerate_eq_none_of_sel, h]
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a : α
h : sel s = none
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
simp [enumerate_eq_none_of_sel, h]
[GOAL]
case some
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a val✝ : α
h : sel s = some val✝
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
case some a' =>
  simp [enumerate, h]
  exact fun h' : enumerate sel (s \ { a' }) n = some a ↦
    have : a ∈ s \ { a' } := enumerate_mem h_sel h'
    this.left
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a a' : α
h : sel s = some a'
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
case some a' =>
  simp [enumerate, h]
  exact fun h' : enumerate sel (s \ { a' }) n = some a ↦
    have : a ∈ s \ { a' } := enumerate_mem h_sel h'
    this.left
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a a' : α
h : sel s = some a'
⊢ enumerate sel s (n + 1) = some a → a ∈ s
[PROOFSTEP]
simp [enumerate, h]
[GOAL]
α : Type u_1
sel : Set α → Option α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
n : ℕ
a a' : α
h : sel s = some a'
⊢ (do
        let a ← some a'
        enumerate sel (s \ {a}) n) =
      some a →
    a ∈ s
[PROOFSTEP]
exact fun h' : enumerate sel (s \ { a' }) n = some a ↦
  have : a ∈ s \ { a' } := enumerate_mem h_sel h'
  this.left
[GOAL]
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
⊢ n₁ = n₂
[PROOFSTEP]
rcases le_total n₁ n₂ with (hn | hn)
[GOAL]
case inl
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₁ ≤ n₂
⊢ n₁ = n₂
case inr
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₂ ≤ n₁
⊢ n₁ = n₂
[PROOFSTEP]
on_goal 2 => swap_var n₁ ↔ n₂, h₁ ↔ h₂
[GOAL]
case inl
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₁ ≤ n₂
⊢ n₁ = n₂
case inr
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₂ ≤ n₁
⊢ n₁ = n₂
[PROOFSTEP]
on_goal 2 => swap_var n₁ ↔ n₂, h₁ ↔ h₂
[GOAL]
case inr
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₂ ≤ n₁
⊢ n₁ = n₂
[PROOFSTEP]
swap_var n₁ ↔ n₂, h₁ ↔ h₂
[GOAL]
case inl
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₁ ≤ n₂
⊢ n₁ = n₂
case inr
α : Type u_1
sel : Set α → Option α
n₂ n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₂ : enumerate sel s n₂ = some a
h₁ : enumerate sel s n₁ = some a
hn : n₁ ≤ n₂
⊢ n₂ = n₁
[PROOFSTEP]
all_goals
  rcases Nat.le.dest hn with ⟨m, rfl⟩
  clear hn
  induction n₁ generalizing s
  case zero =>
    cases m
    case zero => rfl
    case succ
      m =>
      have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
        exact h₂
      have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
      simp_all [Set.mem_diff_singleton]
  case succ k ih =>
    cases h : sel s
    case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
    case some
      _ =>
      simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
        Nat.succ.injEq]
      exact ih h₁ h₂
[GOAL]
case inl
α : Type u_1
sel : Set α → Option α
n₁ n₂ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
h₂ : enumerate sel s n₂ = some a
hn : n₁ ≤ n₂
⊢ n₁ = n₂
[PROOFSTEP]
rcases Nat.le.dest hn with ⟨m, rfl⟩
[GOAL]
case inl.intro
α : Type u_1
sel : Set α → Option α
n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
m : ℕ
h₂ : enumerate sel s (n₁ + m) = some a
hn : n₁ ≤ n₁ + m
⊢ n₁ = n₁ + m
[PROOFSTEP]
clear hn
[GOAL]
case inl.intro
α : Type u_1
sel : Set α → Option α
n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
m : ℕ
h₂ : enumerate sel s (n₁ + m) = some a
⊢ n₁ = n₁ + m
[PROOFSTEP]
induction n₁ generalizing s
[GOAL]
case inl.intro.zero
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero = Nat.zero + m
case inl.intro.succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m n✝ : ℕ
n_ih✝ : ∀ {s : Set α}, enumerate sel s n✝ = some a → enumerate sel s (n✝ + m) = some a → n✝ = n✝ + m
s : Set α
h₁ : enumerate sel s (Nat.succ n✝) = some a
h₂ : enumerate sel s (Nat.succ n✝ + m) = some a
⊢ Nat.succ n✝ = Nat.succ n✝ + m
[PROOFSTEP]
case zero =>
  cases m
  case zero => rfl
  case succ
    m =>
    have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
      exact h₂
    have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
    simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero = Nat.zero + m
[PROOFSTEP]
case zero =>
  cases m
  case zero => rfl
  case succ
    m =>
    have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
      exact h₂
    have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
    simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero = Nat.zero + m
[PROOFSTEP]
cases m
[GOAL]
case zero
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero = Nat.zero + Nat.zero
case succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
n✝ : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ n✝) = some a
⊢ Nat.zero = Nat.zero + Nat.succ n✝
[PROOFSTEP]
case zero => rfl
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero = Nat.zero + Nat.zero
[PROOFSTEP]
case zero => rfl
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero = Nat.zero + Nat.zero
[PROOFSTEP]
rfl
[GOAL]
case succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
n✝ : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ n✝) = some a
⊢ Nat.zero = Nat.zero + Nat.succ n✝
[PROOFSTEP]
case succ
  m =>
  have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
    exact h₂
  have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
  simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ Nat.zero = Nat.zero + Nat.succ m
[PROOFSTEP]
case succ
  m =>
  have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
    exact h₂
  have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
  simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ Nat.zero = Nat.zero + Nat.succ m
[PROOFSTEP]
have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
  exact h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ enumerate sel (s \ {a}) m = some a
[PROOFSTEP]
simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
m : ℕ
h₁ : sel s = some a
h₂ :
  (do
      let a ← some a
      enumerate sel (s \ {a}) m) =
    some a
⊢ enumerate sel (s \ {a}) m = some a
[PROOFSTEP]
exact h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
h' : enumerate sel (s \ {a}) m = some a
⊢ Nat.zero = Nat.zero + Nat.succ m
[PROOFSTEP]
have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
h' : enumerate sel (s \ {a}) m = some a
this : a ∈ s \ {a}
⊢ Nat.zero = Nat.zero + Nat.succ m
[PROOFSTEP]
simp_all [Set.mem_diff_singleton]
[GOAL]
case inl.intro.succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m n✝ : ℕ
n_ih✝ : ∀ {s : Set α}, enumerate sel s n✝ = some a → enumerate sel s (n✝ + m) = some a → n✝ = n✝ + m
s : Set α
h₁ : enumerate sel s (Nat.succ n✝) = some a
h₂ : enumerate sel s (Nat.succ n✝ + m) = some a
⊢ Nat.succ n✝ = Nat.succ n✝ + m
[PROOFSTEP]
case succ k ih =>
  cases h : sel s
  case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
  case some
    _ =>
    simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
      Nat.succ.injEq]
    exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
case succ k ih =>
  cases h : sel s
  case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
  case some
    _ =>
    simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
      Nat.succ.injEq]
    exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
cases h : sel s
[GOAL]
case none
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k = Nat.succ k + m
case some
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
case some
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
case some
  _ =>
  simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
    Nat.succ.injEq]
  exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
case some
  _ =>
  simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
    Nat.succ.injEq]
  exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k = k + m
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k = Nat.succ k + m
[PROOFSTEP]
simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2, Nat.succ.injEq]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
s : Set α
val✝ : α
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (m + k) = some a → m = 0
h₁ :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) k) =
    some a
h₂ :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) (m + k)) =
    some a
h : sel s = some val✝
⊢ m = 0
[PROOFSTEP]
exact ih h₁ h₂
[GOAL]
case inr
α : Type u_1
sel : Set α → Option α
n₂ n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₂ : enumerate sel s n₂ = some a
h₁ : enumerate sel s n₁ = some a
hn : n₁ ≤ n₂
⊢ n₂ = n₁
[PROOFSTEP]
rcases Nat.le.dest hn with ⟨m, rfl⟩
[GOAL]
case inr.intro
α : Type u_1
sel : Set α → Option α
n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
m : ℕ
h₂ : enumerate sel s (n₁ + m) = some a
hn : n₁ ≤ n₁ + m
⊢ n₁ + m = n₁
[PROOFSTEP]
clear hn
[GOAL]
case inr.intro
α : Type u_1
sel : Set α → Option α
n₁ : ℕ
a : α
s : Set α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
h₁ : enumerate sel s n₁ = some a
m : ℕ
h₂ : enumerate sel s (n₁ + m) = some a
⊢ n₁ + m = n₁
[PROOFSTEP]
induction n₁ generalizing s
[GOAL]
case inr.intro.zero
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero + m = Nat.zero
case inr.intro.succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m n✝ : ℕ
n_ih✝ : ∀ {s : Set α}, enumerate sel s n✝ = some a → enumerate sel s (n✝ + m) = some a → n✝ + m = n✝
s : Set α
h₁ : enumerate sel s (Nat.succ n✝) = some a
h₂ : enumerate sel s (Nat.succ n✝ + m) = some a
⊢ Nat.succ n✝ + m = Nat.succ n✝
[PROOFSTEP]
case zero =>
  cases m
  case zero => rfl
  case succ
    m =>
    have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
      exact h₂
    have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
    simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero + m = Nat.zero
[PROOFSTEP]
case zero =>
  cases m
  case zero => rfl
  case succ
    m =>
    have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
      exact h₂
    have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
    simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m : ℕ
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + m) = some a
⊢ Nat.zero + m = Nat.zero
[PROOFSTEP]
cases m
[GOAL]
case zero
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero + Nat.zero = Nat.zero
case succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
n✝ : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ n✝) = some a
⊢ Nat.zero + Nat.succ n✝ = Nat.zero
[PROOFSTEP]
case zero => rfl
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero + Nat.zero = Nat.zero
[PROOFSTEP]
case zero => rfl
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
h₂ : enumerate sel s (Nat.zero + Nat.zero) = some a
⊢ Nat.zero + Nat.zero = Nat.zero
[PROOFSTEP]
rfl
[GOAL]
case succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
n✝ : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ n✝) = some a
⊢ Nat.zero + Nat.succ n✝ = Nat.zero
[PROOFSTEP]
case succ
  m =>
  have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
    exact h₂
  have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
  simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ Nat.zero + Nat.succ m = Nat.zero
[PROOFSTEP]
case succ
  m =>
  have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
    exact h₂
  have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
  simp_all [Set.mem_diff_singleton]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ Nat.zero + Nat.succ m = Nat.zero
[PROOFSTEP]
have h' : enumerate sel (s \ { a }) m = some a := by simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add];
  exact h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
⊢ enumerate sel (s \ {a}) m = some a
[PROOFSTEP]
simp_all only [enumerate, Nat.zero_eq, Nat.add_eq, zero_add]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
m : ℕ
h₁ : sel s = some a
h₂ :
  (do
      let a ← some a
      enumerate sel (s \ {a}) m) =
    some a
⊢ enumerate sel (s \ {a}) m = some a
[PROOFSTEP]
exact h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
h' : enumerate sel (s \ {a}) m = some a
⊢ Nat.zero + Nat.succ m = Nat.zero
[PROOFSTEP]
have : a ∈ s \ { a } := enumerate_mem sel h_sel h'
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
s : Set α
h₁ : enumerate sel s Nat.zero = some a
m : ℕ
h₂ : enumerate sel s (Nat.zero + Nat.succ m) = some a
h' : enumerate sel (s \ {a}) m = some a
this : a ∈ s \ {a}
⊢ Nat.zero + Nat.succ m = Nat.zero
[PROOFSTEP]
simp_all [Set.mem_diff_singleton]
[GOAL]
case inr.intro.succ
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m n✝ : ℕ
n_ih✝ : ∀ {s : Set α}, enumerate sel s n✝ = some a → enumerate sel s (n✝ + m) = some a → n✝ + m = n✝
s : Set α
h₁ : enumerate sel s (Nat.succ n✝) = some a
h₂ : enumerate sel s (Nat.succ n✝ + m) = some a
⊢ Nat.succ n✝ + m = Nat.succ n✝
[PROOFSTEP]
case succ k ih =>
  cases h : sel s
  case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
  case some
    _ =>
    simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
      Nat.succ.injEq]
    exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
case succ k ih =>
  cases h : sel s
  case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
  case some
    _ =>
    simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
      Nat.succ.injEq]
    exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
cases h : sel s
[GOAL]
case none
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k + m = Nat.succ k
case some
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
case none => simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
h : sel s = none
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
simp_all only [add_comm, self_eq_add_left, Nat.add_succ, enumerate_eq_none_of_sel _ h]
[GOAL]
case some
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
case some
  _ =>
  simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
    Nat.succ.injEq]
  exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
case some
  _ =>
  simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2,
    Nat.succ.injEq]
  exact ih h₁ h₂
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (k + m) = some a → k + m = k
s : Set α
h₁ : enumerate sel s (Nat.succ k) = some a
h₂ : enumerate sel s (Nat.succ k + m) = some a
val✝ : α
h : sel s = some val✝
⊢ Nat.succ k + m = Nat.succ k
[PROOFSTEP]
simp_all only [add_comm, self_eq_add_left, enumerate, Option.some.injEq, Nat.add_succ, enumerate._eq_2, Nat.succ.injEq]
[GOAL]
α : Type u_1
sel : Set α → Option α
a : α
h_sel : ∀ (s : Set α) (a : α), sel s = some a → a ∈ s
m k : ℕ
s : Set α
val✝ : α
ih : ∀ {s : Set α}, enumerate sel s k = some a → enumerate sel s (m + k) = some a → m + k = k
h₁ :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) k) =
    some a
h₂ :
  (do
      let a ← some val✝
      enumerate sel (s \ {a}) (m + k)) =
    some a
h : sel s = some val✝
⊢ m + k = k
[PROOFSTEP]
exact ih h₁ h₂


[GOAL]
P : PartENat → Prop
⊢ ∀ (a : PartENat), P ⊤ → (∀ (n : ℕ), P ↑n) → P a
[PROOFSTEP]
exact PartENat.casesOn'
[GOAL]
x : PartENat
⊢ x + ⊤ = ⊤
[PROOFSTEP]
rw [add_comm, top_add]
[GOAL]
x : PartENat
h : x.Dom
⊢ ↑(Part.get x h) = x
[PROOFSTEP]
exact Part.ext' (iff_of_true trivial h) fun _ _ => rfl
[GOAL]
x : ℕ
h : (↑x).Dom
⊢ Part.get (↑x) h = x
[PROOFSTEP]
rw [← natCast_inj, natCast_get]
[GOAL]
x : ℕ
y : PartENat
h : (↑x + y).Dom
⊢ Part.get (↑x + y) h = x + Part.get y (_ : y.Dom)
[PROOFSTEP]
rfl
[GOAL]
a : PartENat
ha : a.Dom
b : ℕ
⊢ Part.get a ha = b ↔ a = ↑b
[PROOFSTEP]
rw [get_eq_iff_eq_some]
[GOAL]
a : PartENat
ha : a.Dom
b : ℕ
⊢ a = ↑b ↔ a = ↑b
[PROOFSTEP]
rfl
[GOAL]
x : PartENat
y : ℕ
h : x ≤ ↑y
⊢ x.Dom
[PROOFSTEP]
exact dom_of_le_some h
[GOAL]
x y : PartENat
inst✝¹ : Decidable x.Dom
inst✝ : Decidable y.Dom
hx : x.Dom
⊢ ?m.35650 x y hx ↔ x ≤ y
[PROOFSTEP]
rw [le_def]
[GOAL]
x y : PartENat
⊢ x < y ↔ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
rw [lt_iff_le_not_le, le_def, le_def, not_exists]
[GOAL]
x y : PartENat
⊢ ((∃ h, ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
      ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy) ↔
    ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
constructor
[GOAL]
case mp
x y : PartENat
⊢ ((∃ h, ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
      ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy) →
    ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
rintro ⟨⟨hyx, H⟩, h⟩
[GOAL]
case mp.intro.intro
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
by_cases hx : x.Dom
[GOAL]
case pos
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : x.Dom
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
use hx
[GOAL]
case h
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : x.Dom
⊢ ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
intro hy
[GOAL]
case h
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : x.Dom
hy : y.Dom
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
specialize H hy
[GOAL]
case h
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
specialize h fun _ => hy
[GOAL]
case h
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
h : ¬∀ (hy_1 : x.Dom), Part.get y hy ≤ Part.get x hy_1
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
rw [not_forall] at h
[GOAL]
case h
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
h : ∃ x_1, ¬Part.get y hy ≤ Part.get x x_1
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
cases' h with hx' h
[GOAL]
case h.intro
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
hx' : x.Dom
h : ¬Part.get y hy ≤ Part.get x hx'
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
rw [not_le] at h
[GOAL]
case h.intro
x y : PartENat
hyx : y.Dom → x.Dom
hx : x.Dom
hy : y.Dom
H : Part.get x (_ : x.Dom) ≤ Part.get y hy
hx' : x.Dom
h : Part.get x hx' < Part.get y hy
⊢ Part.get x hx < Part.get y hy
[PROOFSTEP]
exact h
[GOAL]
case neg
x y : PartENat
h : ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
specialize h fun hx' => (hx hx').elim
[GOAL]
case neg
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
h : ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
rw [not_forall] at h
[GOAL]
case neg
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
h : ∃ x_1, ¬Part.get y (_ : y.Dom) ≤ Part.get x x_1
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
cases' h with hx' h
[GOAL]
case neg.intro
x y : PartENat
hyx : y.Dom → x.Dom
H : ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy
hx : ¬x.Dom
hx' : x.Dom
h : ¬Part.get y (_ : y.Dom) ≤ Part.get x hx'
⊢ ∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
[PROOFSTEP]
exact (hx hx').elim
[GOAL]
case mpr
x y : PartENat
⊢ (∃ hx, ∀ (hy : y.Dom), Part.get x hx < Part.get y hy) →
    (∃ h, ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
      ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
[PROOFSTEP]
rintro ⟨hx, H⟩
[GOAL]
case mpr.intro
x y : PartENat
hx : x.Dom
H : ∀ (hy : y.Dom), Part.get x hx < Part.get y hy
⊢ (∃ h, ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy) ∧
    ∀ (x_1 : x.Dom → y.Dom), ¬∀ (hy : x.Dom), Part.get y (_ : y.Dom) ≤ Part.get x hy
[PROOFSTEP]
exact ⟨⟨fun _ => hx, fun hy => (H hy).le⟩, fun hxy h => not_lt_of_le (h _) (H _)⟩
[GOAL]
x y : ℕ
⊢ ↑x ≤ ↑y ↔ x ≤ y
[PROOFSTEP]
exact ⟨fun ⟨_, h⟩ => h trivial, fun h => ⟨fun _ => trivial, fun _ => h⟩⟩
[GOAL]
x y : ℕ
⊢ ↑x < ↑y ↔ x < y
[PROOFSTEP]
rw [lt_iff_le_not_le, lt_iff_le_not_le, coe_le_coe, coe_le_coe]
[GOAL]
x y : PartENat
hx : x.Dom
hy : y.Dom
⊢ Part.get x hx ≤ Part.get y hy ↔ x ≤ y
[PROOFSTEP]
conv =>
  lhs
  rw [← coe_le_coe, natCast_get, natCast_get]
[GOAL]
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy ↔ x ≤ y
[PROOFSTEP]
  lhs
  rw [← coe_le_coe, natCast_get, natCast_get]
[GOAL]
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy ↔ x ≤ y
[PROOFSTEP]
  lhs
  rw [← coe_le_coe, natCast_get, natCast_get]
[GOAL]
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy ↔ x ≤ y
[PROOFSTEP]
lhs
[GOAL]
x y : PartENat
hx : x.Dom
hy : y.Dom
| Part.get x hx ≤ Part.get y hy
[PROOFSTEP]
rw [← coe_le_coe, natCast_get, natCast_get]
[GOAL]
x : PartENat
n : ℕ
⊢ x ≤ ↑n ↔ ∃ h, Part.get x h ≤ n
[PROOFSTEP]
show (∃ h : True → x.Dom, _) ↔ ∃ h : x.Dom, x.get h ≤ n
[GOAL]
x : PartENat
n : ℕ
⊢ (∃ h, ∀ (hy : (↑n).Dom), Part.get x (_ : x.Dom) ≤ Part.get (↑n) hy) ↔ ∃ h, Part.get x h ≤ n
[PROOFSTEP]
simp only [forall_prop_of_true, dom_natCast, get_natCast']
[GOAL]
x : PartENat
n : ℕ
⊢ x < ↑n ↔ ∃ h, Part.get x h < n
[PROOFSTEP]
simp only [lt_def, forall_prop_of_true, get_natCast', dom_natCast]
[GOAL]
n : ℕ
x : PartENat
⊢ ↑n ≤ x ↔ ∀ (h : x.Dom), n ≤ Part.get x h
[PROOFSTEP]
rw [← some_eq_natCast]
[GOAL]
n : ℕ
x : PartENat
⊢ ↑n ≤ x ↔ ∀ (h : x.Dom), n ≤ Part.get x h
[PROOFSTEP]
simp only [le_def, exists_prop_of_true, dom_some, forall_true_iff]
[GOAL]
n : ℕ
x : PartENat
⊢ (∀ (hy : x.Dom), Part.get ↑n (_ : (↑n).Dom) ≤ Part.get x hy) ↔ ∀ (h : x.Dom), n ≤ Part.get x h
[PROOFSTEP]
rfl
[GOAL]
n : ℕ
x : PartENat
⊢ ↑n < x ↔ ∀ (h : x.Dom), n < Part.get x h
[PROOFSTEP]
rw [← some_eq_natCast]
[GOAL]
n : ℕ
x : PartENat
⊢ ↑n < x ↔ ∀ (h : x.Dom), n < Part.get x h
[PROOFSTEP]
simp only [lt_def, exists_prop_of_true, dom_some, forall_true_iff]
[GOAL]
n : ℕ
x : PartENat
⊢ (∀ (hy : x.Dom), Part.get ↑n (_ : (↑n).Dom) < Part.get x hy) ↔ ∀ (h : x.Dom), n < Part.get x h
[PROOFSTEP]
rfl
[GOAL]
⊢ ¬1 = 0
[PROOFSTEP]
decide
[GOAL]
x : ℕ
h : ↑x = ⊤
⊢ ¬(↑x).Dom = ⊤.Dom
[PROOFSTEP]
simp only [dom_natCast]
[GOAL]
x : ℕ
h : ↑x = ⊤
⊢ ¬True = ⊤.Dom
[PROOFSTEP]
exact true_ne_false
[GOAL]
x : PartENat
⊢ x ≠ ⊤ ↔ ∃ n, x = ↑n
[PROOFSTEP]
simpa only [← some_eq_natCast] using Part.ne_none_iff
[GOAL]
x : PartENat
⊢ x ≠ ⊤ ↔ x.Dom
[PROOFSTEP]
classical exact not_iff_comm.1 Part.eq_none_iff'.symm
[GOAL]
x : PartENat
⊢ x ≠ ⊤ ↔ x.Dom
[PROOFSTEP]
exact not_iff_comm.1 Part.eq_none_iff'.symm
[GOAL]
x : PartENat
⊢ x = ⊤ ↔ ∀ (n : ℕ), ↑n < x
[PROOFSTEP]
constructor
[GOAL]
case mp
x : PartENat
⊢ x = ⊤ → ∀ (n : ℕ), ↑n < x
[PROOFSTEP]
rintro rfl n
[GOAL]
case mp
n : ℕ
⊢ ↑n < ⊤
[PROOFSTEP]
exact natCast_lt_top _
[GOAL]
case mpr
x : PartENat
⊢ (∀ (n : ℕ), ↑n < x) → x = ⊤
[PROOFSTEP]
contrapose!
[GOAL]
case mpr
x : PartENat
⊢ x ≠ ⊤ → ∃ n, ¬↑n < x
[PROOFSTEP]
rw [ne_top_iff]
[GOAL]
case mpr
x : PartENat
⊢ (∃ n, x = ↑n) → ∃ n, ¬↑n < x
[PROOFSTEP]
rintro ⟨n, rfl⟩
[GOAL]
case mpr.intro
n : ℕ
⊢ ∃ n_1, ¬↑n_1 < ↑n
[PROOFSTEP]
exact ⟨n, irrefl _⟩
[GOAL]
x : PartENat
⊢ 0 < ⊤ ↔ 1 ≤ ⊤
[PROOFSTEP]
simp only [iff_true_iff, le_top, natCast_lt_top, ← @Nat.cast_zero PartENat]
[GOAL]
x : PartENat
n : ℕ
⊢ 0 < ↑n ↔ 1 ≤ ↑n
[PROOFSTEP]
rw [← Nat.cast_zero, ← Nat.cast_one, PartENat.coe_lt_coe, PartENat.coe_le_coe]
[GOAL]
x : PartENat
n : ℕ
⊢ 0 < n ↔ 1 ≤ n
[PROOFSTEP]
rfl
[GOAL]
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ max a b = if a ≤ b then b else a
[PROOFSTEP]
change (fun a b => a ⊔ b) a b = _
[GOAL]
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ (fun a b => a ⊔ b) a b = if a ≤ b then b else a
[PROOFSTEP]
rw [@sup_eq_maxDefault PartENat _ (id _) _]
[GOAL]
src✝ : PartialOrder PartENat := partialOrder
a b : PartENat
⊢ maxDefault a b = if a ≤ b then b else a
src✝ : PartialOrder PartENat := partialOrder a b : PartENat ⊢ DecidableRel fun x x_1 => x ≤ x_1
[PROOFSTEP]
rfl
[GOAL]
src✝¹ : LinearOrder PartENat := linearOrder
src✝ : AddCommMonoid PartENat := addCommMonoid
a b : PartENat
x✝ : a ≤ b
c : PartENat
h₁ : b.Dom → a.Dom
h₂ : ∀ (hy : b.Dom), Part.get a (_ : a.Dom) ≤ Part.get b hy
⊢ ⊤ + a ≤ ⊤ + b
[PROOFSTEP]
simp
[GOAL]
src✝¹ : LinearOrder PartENat := linearOrder
src✝ : AddCommMonoid PartENat := addCommMonoid
a b : PartENat
x✝ : a ≤ b
c✝ : PartENat
h₁ : b.Dom → a.Dom
h₂ : ∀ (hy : b.Dom), Part.get a (_ : a.Dom) ≤ Part.get b hy
c : ℕ
h : (↑c + b).Dom
⊢ Part.get (↑c + a) (_ : (↑c).Dom ∧ a.Dom) ≤ Part.get (↑c + b) h
[PROOFSTEP]
simpa only [coe_add_get] using add_le_add_left (h₂ _) c
[GOAL]
src✝² : SemilatticeSup PartENat := semilatticeSup
src✝¹ : OrderBot PartENat := orderBot
src✝ : OrderedAddCommMonoid PartENat := orderedAddCommMonoid
a✝ b✝ : PartENat
b a : ℕ
h : ↑a ≤ ↑b
⊢ ↑b = ↑a + ↑(b - a)
[PROOFSTEP]
rw [← Nat.cast_add, natCast_inj, add_comm, tsub_add_cancel_of_le (coe_le_coe.1 h)]
[GOAL]
x y : PartENat
n : ℕ
h : x + y = ↑n
⊢ x = ↑(n - Part.get y (_ : y.Dom))
[PROOFSTEP]
lift x to ℕ using dom_of_le_natCast ((le_add_right le_rfl).trans_eq h)
[GOAL]
case intro
y : PartENat
n x : ℕ
h : ↑x + y = ↑n
⊢ ↑x = ↑(n - Part.get y (_ : y.Dom))
[PROOFSTEP]
lift y to ℕ using dom_of_le_natCast ((le_add_left le_rfl).trans_eq h)
[GOAL]
case intro.intro
n x y : ℕ
h : ↑x + ↑y = ↑n
⊢ ↑x = ↑(n - Part.get ↑y (_ : (↑y).Dom))
[PROOFSTEP]
rw [← Nat.cast_add, natCast_inj] at h
[GOAL]
case intro.intro
n x y : ℕ
h✝ : ↑x + ↑y = ↑n
h : x + y = n
⊢ ↑x = ↑(n - Part.get ↑y (_ : (↑y).Dom))
[PROOFSTEP]
rw [get_natCast, natCast_inj, eq_tsub_of_add_eq h]
[GOAL]
x y z : PartENat
h : x < y
hz : z ≠ ⊤
⊢ x + z < y + z
[PROOFSTEP]
rcases ne_top_iff.mp (ne_top_of_lt h) with ⟨m, rfl⟩
[GOAL]
case intro
y z : PartENat
hz : z ≠ ⊤
m : ℕ
h : ↑m < y
⊢ ↑m + z < y + z
[PROOFSTEP]
rcases ne_top_iff.mp hz with ⟨k, rfl⟩
[GOAL]
case intro.intro
y : PartENat
m : ℕ
h : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
⊢ ↑m + ↑k < y + ↑k
[PROOFSTEP]
induction' y using PartENat.casesOn with n
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑m + ↑k < ⊤ + ↑k
[PROOFSTEP]
rw [top_add]
  -- Porting note: was apply_mod_cast natCast_lt_top
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑m + ↑k < ⊤
[PROOFSTEP]
norm_cast
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
h : ↑m < ⊤
⊢ ↑(m + k) < ⊤
[PROOFSTEP]
apply natCast_lt_top
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : ↑m < ↑n
⊢ ↑m + ↑k < ↑n + ↑k
[PROOFSTEP]
norm_cast at h
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : m < n
⊢ ↑m + ↑k < ↑n + ↑k
[PROOFSTEP]
norm_cast
[GOAL]
case intro.intro.a
y : PartENat
m : ℕ
h✝ : ↑m < y
k : ℕ
hz : ↑k ≠ ⊤
n : ℕ
h : m < n
⊢ m + k < n + k
[PROOFSTEP]
apply add_lt_add_right h
[GOAL]
x y z : PartENat
hz : z ≠ ⊤
⊢ z + x < z + y ↔ x < y
[PROOFSTEP]
rw [add_comm z, add_comm z, PartENat.add_lt_add_iff_right hz]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
⊢ x < x + y ↔ 0 < y
[PROOFSTEP]
conv_rhs => rw [← PartENat.add_lt_add_iff_left hx]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
| 0 < y
[PROOFSTEP]
rw [← PartENat.add_lt_add_iff_left hx]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
| 0 < y
[PROOFSTEP]
rw [← PartENat.add_lt_add_iff_left hx]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
| 0 < y
[PROOFSTEP]
rw [← PartENat.add_lt_add_iff_left hx]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
⊢ x < x + y ↔ x + 0 < x + y
[PROOFSTEP]
rw [add_zero]
[GOAL]
x : PartENat
hx : x ≠ ⊤
⊢ x < x + 1
[PROOFSTEP]
rw [PartENat.lt_add_iff_pos_right hx]
[GOAL]
x : PartENat
hx : x ≠ ⊤
⊢ 0 < 1
[PROOFSTEP]
norm_cast
[GOAL]
x y : PartENat
h : x < y + 1
⊢ x ≤ y
[PROOFSTEP]
induction' y using PartENat.casesOn with n
[GOAL]
case a
x y : PartENat
h✝ : x < y + 1
h : x < ⊤ + 1
⊢ x ≤ ⊤
[PROOFSTEP]
apply le_top
[GOAL]
case a
x y : PartENat
h✝ : x < y + 1
n : ℕ
h : x < ↑n + 1
⊢ x ≤ ↑n
[PROOFSTEP]
rcases ne_top_iff.mp (ne_top_of_lt h) with
  ⟨m, rfl⟩
    -- Porting note: was `apply_mod_cast Nat.le_of_lt_succ; apply_mod_cast h`
[GOAL]
case a.intro
y : PartENat
n m : ℕ
h✝ : ↑m < y + 1
h : ↑m < ↑n + 1
⊢ ↑m ≤ ↑n
[PROOFSTEP]
norm_cast
[GOAL]
case a.intro
y : PartENat
n m : ℕ
h✝ : ↑m < y + 1
h : ↑m < ↑n + 1
⊢ m ≤ n
[PROOFSTEP]
apply Nat.le_of_lt_succ
[GOAL]
case a.intro.a
y : PartENat
n m : ℕ
h✝ : ↑m < y + 1
h : ↑m < ↑n + 1
⊢ m < Nat.succ n
[PROOFSTEP]
norm_cast at h
[GOAL]
x y : PartENat
h : x < y
⊢ x + 1 ≤ y
[PROOFSTEP]
induction' y using PartENat.casesOn with n
[GOAL]
case a
x y : PartENat
h✝ : x < y
h : x < ⊤
⊢ x + 1 ≤ ⊤
[PROOFSTEP]
apply le_top
[GOAL]
case a
x y : PartENat
h✝ : x < y
n : ℕ
h : x < ↑n
⊢ x + 1 ≤ ↑n
[PROOFSTEP]
rcases ne_top_iff.mp (ne_top_of_lt h) with
  ⟨m, rfl⟩
    -- Porting note: was `apply_mod_cast Nat.succ_le_of_lt; apply_mod_cast h`
[GOAL]
case a.intro
y : PartENat
n m : ℕ
h✝ : ↑m < y
h : ↑m < ↑n
⊢ ↑m + 1 ≤ ↑n
[PROOFSTEP]
norm_cast
[GOAL]
case a.intro
y : PartENat
n m : ℕ
h✝ : ↑m < y
h : ↑m < ↑n
⊢ m + 1 ≤ n
[PROOFSTEP]
apply Nat.succ_le_of_lt
[GOAL]
case a.intro.h
y : PartENat
n m : ℕ
h✝ : ↑m < y
h : ↑m < ↑n
⊢ m < n
[PROOFSTEP]
norm_cast at h
[GOAL]
x y : PartENat
hx : x ≠ ⊤
⊢ x + 1 ≤ y ↔ x < y
[PROOFSTEP]
refine ⟨fun h => ?_, add_one_le_of_lt⟩
[GOAL]
x y : PartENat
hx : x ≠ ⊤
h : x + 1 ≤ y
⊢ x < y
[PROOFSTEP]
rcases ne_top_iff.mp hx with ⟨m, rfl⟩
[GOAL]
case intro
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m + 1 ≤ y
⊢ ↑m < y
[PROOFSTEP]
induction' y using PartENat.casesOn with n
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m + 1 ≤ y
h : ↑m + 1 ≤ ⊤
⊢ ↑m < ⊤
[PROOFSTEP]
apply natCast_lt_top
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m + 1 ≤ y
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ ↑m < ↑n
[PROOFSTEP]
norm_cast
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m + 1 ≤ y
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ m < n
[PROOFSTEP]
apply Nat.lt_of_succ_le
[GOAL]
case intro.a.h
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m + 1 ≤ y
n : ℕ
h : ↑m + 1 ≤ ↑n
⊢ Nat.succ m ≤ n
[PROOFSTEP]
norm_cast at h
[GOAL]
n : ℕ
e : PartENat
⊢ ↑(Nat.succ n) ≤ e ↔ ↑n < e
[PROOFSTEP]
rw [Nat.succ_eq_add_one n, Nat.cast_add, Nat.cast_one, add_one_le_iff_lt (natCast_ne_top n)]
[GOAL]
x y : PartENat
hx : x ≠ ⊤
⊢ x < y + 1 ↔ x ≤ y
[PROOFSTEP]
refine ⟨le_of_lt_add_one, fun h => ?_⟩
[GOAL]
x y : PartENat
hx : x ≠ ⊤
h : x ≤ y
⊢ x < y + 1
[PROOFSTEP]
rcases ne_top_iff.mp hx with ⟨m, rfl⟩
[GOAL]
case intro
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h : ↑m ≤ y
⊢ ↑m < y + 1
[PROOFSTEP]
induction' y using PartENat.casesOn with n
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m ≤ y
h : ↑m ≤ ⊤
⊢ ↑m < ⊤ + 1
[PROOFSTEP]
rw [top_add]
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m ≤ y
h : ↑m ≤ ⊤
⊢ ↑m < ⊤
[PROOFSTEP]
apply natCast_lt_top
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m ≤ y
n : ℕ
h : ↑m ≤ ↑n
⊢ ↑m < ↑n + 1
[PROOFSTEP]
norm_cast
[GOAL]
case intro.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m ≤ y
n : ℕ
h : ↑m ≤ ↑n
⊢ m < n + 1
[PROOFSTEP]
apply Nat.lt_succ_of_le
[GOAL]
case intro.a.a
y : PartENat
m : ℕ
hx : ↑m ≠ ⊤
h✝ : ↑m ≤ y
n : ℕ
h : ↑m ≤ ↑n
⊢ m ≤ n
[PROOFSTEP]
norm_cast at h
[GOAL]
x : PartENat
n : ℕ
hx : x ≠ ⊤
⊢ x < ↑(Nat.succ n) ↔ x ≤ ↑n
[PROOFSTEP]
rw [Nat.succ_eq_add_one n, Nat.cast_add, Nat.cast_one, lt_add_one_iff_lt hx]
[GOAL]
a b : PartENat
⊢ a + b = ⊤ ↔ a = ⊤ ∨ b = ⊤
[PROOFSTEP]
refine PartENat.casesOn a ?_ ?_
[GOAL]
case refine_1
a b : PartENat
⊢ ⊤ + b = ⊤ ↔ ⊤ = ⊤ ∨ b = ⊤
[PROOFSTEP]
refine PartENat.casesOn b ?_ ?_
[GOAL]
case refine_2
a b : PartENat
⊢ ∀ (n : ℕ), ↑n + b = ⊤ ↔ ↑n = ⊤ ∨ b = ⊤
[PROOFSTEP]
refine PartENat.casesOn b ?_ ?_
[GOAL]
case refine_1.refine_1
a b : PartENat
⊢ ⊤ + ⊤ = ⊤ ↔ ⊤ = ⊤ ∨ ⊤ = ⊤
[PROOFSTEP]
simp
[GOAL]
case refine_1.refine_2
a b : PartENat
⊢ ∀ (n : ℕ), ⊤ + ↑n = ⊤ ↔ ⊤ = ⊤ ∨ ↑n = ⊤
[PROOFSTEP]
simp
[GOAL]
case refine_2.refine_1
a b : PartENat
⊢ ∀ (n : ℕ), ↑n + ⊤ = ⊤ ↔ ↑n = ⊤ ∨ ⊤ = ⊤
[PROOFSTEP]
simp
[GOAL]
case refine_2.refine_2
a b : PartENat
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑n = ⊤ ↔ ↑n_1 = ⊤ ∨ ↑n = ⊤
[PROOFSTEP]
simp
[GOAL]
case refine_2.refine_2
a b : PartENat
⊢ ∀ (n n_1 : ℕ), ¬↑n_1 + ↑n = ⊤
[PROOFSTEP]
simp only [← Nat.cast_add, PartENat.natCast_ne_top, forall_const]
[GOAL]
a b c : PartENat
hc : c ≠ ⊤
⊢ a + c = b + c ↔ a = b
[PROOFSTEP]
rcases ne_top_iff.1 hc with ⟨c, rfl⟩
[GOAL]
case intro
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ a + ↑c = b + ↑c ↔ a = b
[PROOFSTEP]
refine PartENat.casesOn a ?_ ?_
[GOAL]
case intro.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ⊤ + ↑c = b + ↑c ↔ ⊤ = b
[PROOFSTEP]
refine PartENat.casesOn b ?_ ?_
[GOAL]
case intro.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ↑n + ↑c = b + ↑c ↔ ↑n = b
[PROOFSTEP]
refine PartENat.casesOn b ?_ ?_
[GOAL]
case intro.refine_1.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ⊤ + ↑c = ⊤ + ↑c ↔ ⊤ = ⊤
[PROOFSTEP]
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat)]
[GOAL]
case intro.refine_1.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ⊤ + ↑c = ↑n + ↑c ↔ ⊤ = ↑n
[PROOFSTEP]
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat)]
[GOAL]
case intro.refine_2.refine_1
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n : ℕ), ↑n + ↑c = ⊤ + ↑c ↔ ↑n = ⊤
[PROOFSTEP]
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat)]
[GOAL]
case intro.refine_2.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑c = ↑n + ↑c ↔ ↑n_1 = ↑n
[PROOFSTEP]
simp [add_eq_top_iff, natCast_ne_top, @eq_comm _ (⊤ : PartENat)]
[GOAL]
case intro.refine_2.refine_2
a b : PartENat
c : ℕ
hc : ↑c ≠ ⊤
⊢ ∀ (n n_1 : ℕ), ↑n_1 + ↑c = ↑n + ↑c ↔ n_1 = n
[PROOFSTEP]
simp only [← Nat.cast_add, add_left_cancel_iff, PartENat.natCast_inj, add_comm, forall_const]
[GOAL]
a b c : PartENat
ha : a ≠ ⊤
⊢ a + b = a + c ↔ b = c
[PROOFSTEP]
rw [add_comm a, add_comm a, PartENat.add_right_cancel_iff ha]
[GOAL]
h : Decidable ⊤.Dom
⊢ toWithTop ⊤ = ⊤
[PROOFSTEP]
convert toWithTop_top
[GOAL]
h : Decidable 0.Dom
⊢ toWithTop 0 = 0
[PROOFSTEP]
convert toWithTop_zero
[GOAL]
n : ℕ
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = ↑n
[PROOFSTEP]
simp only [← toWithTop_some]
[GOAL]
n : ℕ
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = toWithTop ↑n
[PROOFSTEP]
congr
[GOAL]
n : ℕ
h : Decidable (↑n).Dom
⊢ toWithTop ↑n = ↑n
[PROOFSTEP]
rw [toWithTop_natCast n]
[GOAL]
x y : PartENat
hx : Decidable x.Dom
hy : Decidable y.Dom
⊢ toWithTop x ≤ toWithTop y ↔ x ≤ y
[PROOFSTEP]
induction y using PartENat.casesOn generalizing hy
[GOAL]
case a
x : PartENat
hx : Decidable x.Dom
hy : Decidable ⊤.Dom
⊢ toWithTop x ≤ toWithTop ⊤ ↔ x ≤ ⊤
[PROOFSTEP]
simp
[GOAL]
case a
x : PartENat
hx : Decidable x.Dom
n✝ : ℕ
hy : Decidable (↑n✝).Dom
⊢ toWithTop x ≤ toWithTop ↑n✝ ↔ x ≤ ↑n✝
[PROOFSTEP]
induction x using PartENat.casesOn generalizing hx
[GOAL]
case a.a
n✝ : ℕ
hy : Decidable (↑n✝).Dom
hx : Decidable ⊤.Dom
⊢ toWithTop ⊤ ≤ toWithTop ↑n✝ ↔ ⊤ ≤ ↑n✝
[PROOFSTEP]
simp
[GOAL]
case a.a
n✝¹ : ℕ
hy : Decidable (↑n✝¹).Dom
n✝ : ℕ
hx : Decidable (↑n✝).Dom
⊢ toWithTop ↑n✝ ≤ toWithTop ↑n✝¹ ↔ ↑n✝ ≤ ↑n✝¹
[PROOFSTEP]
simp
  -- Porting note: this takes too long.
[GOAL]
⊢ ↑Option.none = ⊤
[PROOFSTEP]
rfl
  -- Porting note : new
[GOAL]
n : ℕ
⊢ ↑(Option.some n) = ↑n
[PROOFSTEP]
rfl
  -- Porting note : new
[GOAL]
n : ℕ∞
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = n
[PROOFSTEP]
induction n with
| none => simp
| some n =>
  simp only [toWithTop_natCast', ofENat_some]
  rfl
[GOAL]
n : ℕ∞
x✝ : Decidable (↑n).Dom
⊢ toWithTop ↑n = n
[PROOFSTEP]
induction n with
| none => simp
| some n =>
  simp only [toWithTop_natCast', ofENat_some]
  rfl
[GOAL]
case none
x✝ : Decidable (↑Option.none).Dom
⊢ toWithTop ↑Option.none = Option.none
[PROOFSTEP]

| none => simp
[GOAL]
case none
x✝ : Decidable (↑Option.none).Dom
⊢ toWithTop ↑Option.none = Option.none
[PROOFSTEP]
simp
[GOAL]
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ toWithTop ↑(Option.some n) = Option.some n
[PROOFSTEP]

| some n =>
  simp only [toWithTop_natCast', ofENat_some]
  rfl
[GOAL]
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ toWithTop ↑(Option.some n) = Option.some n
[PROOFSTEP]
simp only [toWithTop_natCast', ofENat_some]
[GOAL]
case some
n : ℕ
x✝ : Decidable (↑(Option.some n)).Dom
⊢ ↑n = Option.some n
[PROOFSTEP]
rfl
[GOAL]
x y : PartENat
⊢ toWithTop (x + y) = toWithTop x + toWithTop y
[PROOFSTEP]
refine PartENat.casesOn y ?_ ?_
[GOAL]
case refine_1
x y : PartENat
⊢ toWithTop (x + ⊤) = toWithTop x + toWithTop ⊤
[PROOFSTEP]
refine
  PartENat.casesOn x ?_
    ?_
      --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
[GOAL]
case refine_2
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (x + ↑n) = toWithTop x + toWithTop ↑n
[PROOFSTEP]
refine
  PartENat.casesOn x ?_
    ?_
      --Porting note: was `simp [← Nat.cast_add, ← ENat.coe_add]`
[GOAL]
case refine_1.refine_1
x y : PartENat
⊢ toWithTop (⊤ + ⊤) = toWithTop ⊤ + toWithTop ⊤
[PROOFSTEP]
simp only [add_top, toWithTop_top', _root_.add_top]
[GOAL]
case refine_1.refine_2
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (↑n + ⊤) = toWithTop ↑n + toWithTop ⊤
[PROOFSTEP]
simp only [add_top, toWithTop_top', toWithTop_natCast', _root_.add_top, forall_const]
[GOAL]
case refine_2.refine_1
x y : PartENat
⊢ ∀ (n : ℕ), toWithTop (⊤ + ↑n) = toWithTop ⊤ + toWithTop ↑n
[PROOFSTEP]
simp only [top_add, toWithTop_top', toWithTop_natCast', _root_.top_add, forall_const]
[GOAL]
case refine_2.refine_2
x y : PartENat
⊢ ∀ (n n_1 : ℕ), toWithTop (↑n + ↑n_1) = toWithTop ↑n + toWithTop ↑n_1
[PROOFSTEP]
simp_rw [toWithTop_natCast', ← Nat.cast_add, toWithTop_natCast', forall_const]
[GOAL]
x : PartENat
⊢ (fun x => ↑x) ((fun x => toWithTop x) x) = x
[PROOFSTEP]
induction x using PartENat.casesOn
[GOAL]
case a
⊢ (fun x => ↑x) ((fun x => toWithTop x) ⊤) = ⊤
[PROOFSTEP]
intros
[GOAL]
case a
n✝ : ℕ
⊢ (fun x => ↑x) ((fun x => toWithTop x) ↑n✝) = ↑n✝
[PROOFSTEP]
intros
[GOAL]
case a
⊢ (fun x => ↑x) ((fun x => toWithTop x) ⊤) = ⊤
[PROOFSTEP]
simp
[GOAL]
case a
n✝ : ℕ
⊢ (fun x => ↑x) ((fun x => toWithTop x) ↑n✝) = ↑n✝
[PROOFSTEP]
simp
[GOAL]
case a
⊢ ↑⊤ = ⊤
[PROOFSTEP]
rfl
[GOAL]
case a
n✝ : ℕ
⊢ ↑↑n✝ = ↑n✝
[PROOFSTEP]
rfl
[GOAL]
x : ℕ∞
⊢ (fun x => toWithTop x) ((fun x => ↑x) x) = x
[PROOFSTEP]
simp [toWithTop_ofENat]
[GOAL]
⊢ ↑withTopEquiv 0 = 0
[PROOFSTEP]
simpa only [Nat.cast_zero] using withTopEquiv_natCast 0
[GOAL]
x y : ℕ∞
⊢ ↑withTopEquiv.symm x ≤ ↑withTopEquiv.symm y ↔ x ≤ y
[PROOFSTEP]
rw [← withTopEquiv_le]
[GOAL]
x y : ℕ∞
⊢ ↑withTopEquiv (↑withTopEquiv.symm x) ≤ ↑withTopEquiv (↑withTopEquiv.symm y) ↔ x ≤ y
[PROOFSTEP]
simp
[GOAL]
x y : ℕ∞
⊢ ↑withTopEquiv.symm x < ↑withTopEquiv.symm y ↔ x < y
[PROOFSTEP]
rw [← withTopEquiv_lt]
[GOAL]
x y : ℕ∞
⊢ ↑withTopEquiv (↑withTopEquiv.symm x) < ↑withTopEquiv (↑withTopEquiv.symm y) ↔ x < y
[PROOFSTEP]
simp
[GOAL]
src✝ : PartENat ≃ ℕ∞ := withTopEquiv
x y : PartENat
⊢ Equiv.toFun
      { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
        right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
      (x + y) =
    Equiv.toFun
        { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        x +
      Equiv.toFun
        { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        y
[PROOFSTEP]
simp only [withTopEquiv]
[GOAL]
src✝ : PartENat ≃ ℕ∞ := withTopEquiv
x y : PartENat
⊢ toWithTop (x + y) = toWithTop x + toWithTop y
[PROOFSTEP]
exact toWithTop_add
[GOAL]
⊢ WellFounded fun x x_1 => x < x_1
[PROOFSTEP]
classical
change WellFounded fun a b : PartENat => a < b
simp_rw [← withTopEquiv_lt]
exact InvImage.wf _ (WithTop.wellFounded_lt Nat.lt_wfRel.wf)
[GOAL]
⊢ WellFounded fun x x_1 => x < x_1
[PROOFSTEP]
change WellFounded fun a b : PartENat => a < b
[GOAL]
⊢ WellFounded fun a b => a < b
[PROOFSTEP]
simp_rw [← withTopEquiv_lt]
[GOAL]
⊢ WellFounded fun a b => ↑withTopEquiv a < ↑withTopEquiv b
[PROOFSTEP]
exact InvImage.wf _ (WithTop.wellFounded_lt Nat.lt_wfRel.wf)
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
⊢ ↑n < find P
[PROOFSTEP]
rw [coe_lt_iff]
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
⊢ ∀ (h : (find P).Dom), n < Part.get (find P) h
[PROOFSTEP]
intro h₁
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
h₁ : (find P).Dom
⊢ n < Part.get (find P) h₁
[PROOFSTEP]
rw [find_get]
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
h₁ : (find P).Dom
⊢ n < Nat.find h₁
[PROOFSTEP]
have h₂ := @Nat.find_spec P _ h₁
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
h₁ : (find P).Dom
h₂ : P (Nat.find h₁)
⊢ n < Nat.find h₁
[PROOFSTEP]
revert h₂
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
h₁ : (find P).Dom
⊢ P (Nat.find h₁) → n < Nat.find h₁
[PROOFSTEP]
contrapose!
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (m : ℕ), m ≤ n → ¬P m
h₁ : (find P).Dom
⊢ Nat.find h₁ ≤ n → ¬P (Nat.find h₁)
[PROOFSTEP]
exact h _
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
⊢ ↑n < find P ↔ ∀ (m : ℕ), m ≤ n → ¬P m
[PROOFSTEP]
refine' ⟨_, lt_find P n⟩
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
⊢ ↑n < find P → ∀ (m : ℕ), m ≤ n → ¬P m
[PROOFSTEP]
intro h m hm
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ↑n < find P
m : ℕ
hm : m ≤ n
⊢ ¬P m
[PROOFSTEP]
by_cases H : (find P).Dom
[GOAL]
case pos
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ↑n < find P
m : ℕ
hm : m ≤ n
H : (find P).Dom
⊢ ¬P m
[PROOFSTEP]
apply Nat.find_min H
[GOAL]
case pos
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ↑n < find P
m : ℕ
hm : m ≤ n
H : (find P).Dom
⊢ m < Nat.find H
[PROOFSTEP]
rw [coe_lt_iff] at h
[GOAL]
case pos
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ∀ (h : (find P).Dom), n < Part.get (find P) h
m : ℕ
hm : m ≤ n
H : (find P).Dom
⊢ m < Nat.find H
[PROOFSTEP]
specialize h H
[GOAL]
case pos
P : ℕ → Prop
inst✝ : DecidablePred P
n m : ℕ
hm : m ≤ n
H : (find P).Dom
h : n < Part.get (find P) H
⊢ m < Nat.find H
[PROOFSTEP]
exact lt_of_le_of_lt hm h
[GOAL]
case neg
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : ↑n < find P
m : ℕ
hm : m ≤ n
H : ¬(find P).Dom
⊢ ¬P m
[PROOFSTEP]
exact not_exists.mp H m
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : P n
⊢ find P ≤ ↑n
[PROOFSTEP]
rw [le_coe_iff]
[GOAL]
P : ℕ → Prop
inst✝ : DecidablePred P
n : ℕ
h : P n
⊢ ∃ h, Part.get (find P) h ≤ n
[PROOFSTEP]
refine' ⟨⟨_, h⟩, @Nat.find_min' P _ _ _ h⟩


[GOAL]
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
⊢ Compatibility.τ₀ =
    Compatibility.τ₁
      (eqToIso (_ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁))
      (eqToIso
        (_ :
          (toKaroubiEquivalence (ChainComplex C ℕ)).functor ⋙ Preadditive.DoldKan.equivalence.inverse =
            Γ ⋙ (toKaroubiEquivalence (SimplicialObject C)).functor))
      N₁Γ₀
[PROOFSTEP]
ext K : 3
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
K : ChainComplex C ℕ
⊢ NatTrans.app Compatibility.τ₀.hom K =
    NatTrans.app
      (Compatibility.τ₁
          (eqToIso
            (_ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁))
          (eqToIso
            (_ :
              (toKaroubiEquivalence (ChainComplex C ℕ)).functor ⋙ Preadditive.DoldKan.equivalence.inverse =
                Γ ⋙ (toKaroubiEquivalence (SimplicialObject C)).functor))
          N₁Γ₀).hom
      K
[PROOFSTEP]
simp only [Compatibility.τ₀_hom_app, Compatibility.τ₁_hom_app, eqToIso.hom]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
K : ChainComplex C ℕ
⊢ NatTrans.app Preadditive.DoldKan.equivalence.counitIso.hom ((toKaroubiEquivalence (ChainComplex C ℕ)).functor.obj K) =
    Preadditive.DoldKan.equivalence.functor.map
        (NatTrans.app
          (eqToHom
            (_ :
              (toKaroubiEquivalence (ChainComplex C ℕ)).functor ⋙ Preadditive.DoldKan.equivalence.inverse =
                Γ ⋙ (toKaroubiEquivalence (SimplicialObject C)).functor))
          K) ≫
      NatTrans.app
          (eqToHom
            (_ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁))
          (Γ.obj K) ≫
        NatTrans.app N₁Γ₀.hom K
[PROOFSTEP]
refine' (N₂Γ₂_compatible_with_N₁Γ₀ K).trans _
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
K : ChainComplex C ℕ
⊢ NatTrans.app N₂Γ₂ToKaroubiIso.hom K ≫ NatTrans.app N₁Γ₀.hom K =
    Preadditive.DoldKan.equivalence.functor.map
        (NatTrans.app
          (eqToHom
            (_ :
              (toKaroubiEquivalence (ChainComplex C ℕ)).functor ⋙ Preadditive.DoldKan.equivalence.inverse =
                Γ ⋙ (toKaroubiEquivalence (SimplicialObject C)).functor))
          K) ≫
      NatTrans.app
          (eqToHom
            (_ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁))
          (Γ.obj K) ≫
        NatTrans.app N₁Γ₀.hom K
[PROOFSTEP]
simp only [N₂Γ₂ToKaroubiIso_hom, eqToHom_map, eqToHom_app, eqToHom_trans_assoc]
[GOAL]
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
⊢ Compatibility.υ
      (eqToIso
        (_ : (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁)) =
    Γ₂N₁
[PROOFSTEP]
ext1
[GOAL]
case w
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
⊢ (Compatibility.υ
        (eqToIso
          (_ :
            (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor = N₁))).hom =
    Γ₂N₁.hom
[PROOFSTEP]
rw [← cancel_epi Γ₂N₁.inv, Iso.inv_hom_id]
[GOAL]
case w
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
⊢ Γ₂N₁.inv ≫
      (Compatibility.υ
          (eqToIso
            (_ :
              (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                N₁))).hom =
    𝟙 (N₁ ⋙ Γ₂)
[PROOFSTEP]
ext X : 2
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ NatTrans.app
      (Γ₂N₁.inv ≫
        (Compatibility.υ
            (eqToIso
              (_ :
                (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                  N₁))).hom)
      X =
    NatTrans.app (𝟙 (N₁ ⋙ Γ₂)) X
[PROOFSTEP]
rw [NatTrans.comp_app]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ NatTrans.app Γ₂N₁.inv X ≫
      NatTrans.app
        (Compatibility.υ
            (eqToIso
              (_ :
                (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                  N₁))).hom
        X =
    NatTrans.app (𝟙 (N₁ ⋙ Γ₂)) X
[PROOFSTEP]
erw [compatibility_Γ₂N₁_Γ₂N₂_natTrans X]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ ((compatibility_Γ₂N₁_Γ₂N₂.app X).inv ≫ NatTrans.app Γ₂N₂.natTrans ((toKaroubi (SimplicialObject C)).obj X)) ≫
      NatTrans.app
        (Compatibility.υ
            (eqToIso
              (_ :
                (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                  N₁))).hom
        X =
    NatTrans.app (𝟙 (N₁ ⋙ Γ₂)) X
[PROOFSTEP]
rw [Compatibility.υ_hom_app, Preadditive.DoldKan.equivalence_unitIso, Iso.app_inv, assoc]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ NatTrans.app compatibility_Γ₂N₁_Γ₂N₂.inv X ≫
      NatTrans.app Γ₂N₂.natTrans ((toKaroubi (SimplicialObject C)).obj X) ≫
        NatTrans.app Γ₂N₂.hom ((toKaroubiEquivalence (SimplicialObject C)).functor.obj X) ≫
          Preadditive.DoldKan.equivalence.inverse.map
            (NatTrans.app
              (eqToIso
                  (_ :
                    (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                      N₁)).hom
              X) =
    NatTrans.app (𝟙 (N₁ ⋙ Γ₂)) X
[PROOFSTEP]
erw [← NatTrans.comp_app_assoc, IsIso.hom_inv_id]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ NatTrans.app compatibility_Γ₂N₁_Γ₂N₂.inv X ≫
      NatTrans.app (𝟙 (N₂ ⋙ Γ₂)) ((toKaroubi (SimplicialObject C)).obj X) ≫
        Preadditive.DoldKan.equivalence.inverse.map
          (NatTrans.app
            (eqToIso
                (_ :
                  (toKaroubiEquivalence (SimplicialObject C)).functor ⋙ Preadditive.DoldKan.equivalence.functor =
                    N₁)).hom
            X) =
    NatTrans.app (𝟙 (N₁ ⋙ Γ₂)) X
[PROOFSTEP]
rw [NatTrans.id_app, id_comp, NatTrans.id_app, eqToIso.hom, eqToHom_app, eqToHom_map]
[GOAL]
case w.w.h
C : Type u_1
inst✝³ : Category.{u_2, u_1} C
inst✝² : Preadditive C
inst✝¹ : IsIdempotentComplete C
inst✝ : HasFiniteCoproducts C
X : SimplicialObject C
⊢ NatTrans.app compatibility_Γ₂N₁_Γ₂N₂.inv X ≫
      eqToHom
        (_ :
          Preadditive.DoldKan.equivalence.inverse.obj
              (Preadditive.DoldKan.equivalence.functor.obj
                ((toKaroubiEquivalence (SimplicialObject C)).functor.obj X)) =
            Preadditive.DoldKan.equivalence.inverse.obj (N₁.obj X)) =
    𝟙 ((N₁ ⋙ Γ₂).obj X)
[PROOFSTEP]
rw [compatibility_Γ₂N₁_Γ₂N₂_inv_app, eqToHom_trans, eqToHom_refl]


[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
h : L ⊣ F
A : C
inst✝² : PreservesLimitsOfShape (Discrete WalkingPair) L
inst✝¹ : Full F
inst✝ : Faithful F
B : D
⊢ IsIso (NatTrans.app (frobeniusMorphism F h A) B)
[PROOFSTEP]
dsimp [frobeniusMorphism]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
h : L ⊣ F
A : C
inst✝² : PreservesLimitsOfShape (Discrete WalkingPair) L
inst✝¹ : Full F
inst✝ : Faithful F
B : D
⊢ IsIso (prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)))
[PROOFSTEP]
infer_instance
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
⊢ prod.map (𝟙 (F.obj A)) (NatTrans.app (expComparison F A) B) ≫ NatTrans.app (exp.ev (F.obj A)) (F.obj B) =
    inv (prodComparison F A (A ⟹ B)) ≫ F.map (NatTrans.app (exp.ev A) B)
[PROOFSTEP]
convert transferNatTrans_counit _ _ (prodComparisonNatIso F A).inv B using 2
[GOAL]
case h.e'_3.h.h.e'_6.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
e_1✝ :
  (F.obj A ⨯ (exp A ⋙ F).obj B ⟶ (𝟭 D).obj (F.obj B)) =
    ((prod.functor.obj (F.obj A)).obj ((exp A ⋙ F).obj B) ⟶ (𝟭 D).obj (F.obj B))
e_3✝ : (F.obj A ⨯ F.obj (A ⟹ B)) = (F ⋙ prod.functor.obj (F.obj A)).obj (A ⟹ B)
e_4✝ : F.obj (A ⨯ A ⟹ B) = (prod.functor.obj A ⋙ F).obj (A ⟹ B)
⊢ inv (prodComparison F A (A ⟹ B)) = NatTrans.app (prodComparisonNatIso F A).inv (A ⟹ B)
[PROOFSTEP]
apply IsIso.inv_eq_of_hom_inv_id
[GOAL]
case h.e'_3.h.h.e'_6.h.hom_inv_id
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
e_1✝ :
  (F.obj A ⨯ (exp A ⋙ F).obj B ⟶ (𝟭 D).obj (F.obj B)) =
    ((prod.functor.obj (F.obj A)).obj ((exp A ⋙ F).obj B) ⟶ (𝟭 D).obj (F.obj B))
e_3✝ : (F.obj A ⨯ F.obj (A ⟹ B)) = (F ⋙ prod.functor.obj (F.obj A)).obj (A ⟹ B)
e_4✝ : F.obj (A ⨯ A ⟹ B) = (prod.functor.obj A ⋙ F).obj (A ⟹ B)
⊢ prodComparison F A (A ⟹ B) ≫ NatTrans.app (prodComparisonNatIso F A).inv (A ⟹ B) = 𝟙 (F.obj (A ⨯ A ⟹ B))
[PROOFSTEP]
simp only [Limits.prodComparisonNatIso_inv, asIso_inv, NatIso.isIso_inv_app, IsIso.hom_inv_id]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
⊢ F.map (NatTrans.app (exp.coev A) B) ≫ NatTrans.app (expComparison F A) (A ⨯ B) =
    NatTrans.app (exp.coev (F.obj A)) (F.obj B) ≫ (exp (F.obj A)).map (inv (prodComparison F A B))
[PROOFSTEP]
convert unit_transferNatTrans _ _ (prodComparisonNatIso F A).inv B using 3
[GOAL]
case h.e'_3.h.h.e'_7.h.h.e'_8.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
e_1✝ :
  (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj (A ⨯ B)) =
    (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj ((prod.functor.obj A).obj B))
e_4✝ :
  (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj B) =
    (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_5✝ : (F.obj A ⟹ F.obj (A ⨯ B)) = (F.obj A ⟹ (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B))
e_6✝ : (prod.functor.obj (F.obj A)).obj (F.obj B) = (prod.functor.obj (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_7✝ : F.obj (A ⨯ B) = (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B)
⊢ inv (prodComparison F A B) = NatTrans.app (prodComparisonNatIso F A).inv ((𝟭 C).obj B)
[PROOFSTEP]
apply IsIso.inv_eq_of_hom_inv_id
[GOAL]
case h.e'_3.h.h.e'_7.h.h.e'_8.h.hom_inv_id
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
e_1✝ :
  (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj (A ⨯ B)) =
    (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj ((prod.functor.obj A).obj B))
e_4✝ :
  (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj B) =
    (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_5✝ : (F.obj A ⟹ F.obj (A ⨯ B)) = (F.obj A ⟹ (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B))
e_6✝ : (prod.functor.obj (F.obj A)).obj (F.obj B) = (prod.functor.obj (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_7✝ : F.obj (A ⨯ B) = (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B)
⊢ prodComparison F A B ≫ NatTrans.app (prodComparisonNatIso F A).inv ((𝟭 C).obj B) = 𝟙 (F.obj (A ⨯ B))
[PROOFSTEP]
dsimp
[GOAL]
case h.e'_3.h.h.e'_7.h.h.e'_8.h.hom_inv_id
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
e_1✝ :
  (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj (A ⨯ B)) =
    (F.obj ((𝟭 C).obj B) ⟶ (F ⋙ exp (F.obj A)).obj ((prod.functor.obj A).obj B))
e_4✝ :
  (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj B) =
    (prod.functor.obj (F.obj A) ⋙ exp (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_5✝ : (F.obj A ⟹ F.obj (A ⨯ B)) = (F.obj A ⟹ (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B))
e_6✝ : (prod.functor.obj (F.obj A)).obj (F.obj B) = (prod.functor.obj (F.obj A)).obj (F.obj ((𝟭 C).obj B))
e_7✝ : F.obj (A ⨯ B) = (prod.functor.obj A ⋙ F).obj ((𝟭 C).obj B)
⊢ prodComparison F A B ≫ NatTrans.app (inv (NatTrans.mk fun B => prodComparison F A B)) B = 𝟙 (F.obj (A ⨯ B))
[PROOFSTEP]
simp
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A B : C
⊢ CartesianClosed.uncurry (NatTrans.app (expComparison F A) B) =
    inv (prodComparison F A (A ⟹ B)) ≫ F.map (NatTrans.app (exp.ev A) B)
[PROOFSTEP]
rw [uncurry_eq, expComparison_ev]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A A' : C
f : A' ⟶ A
⊢ expComparison F A ≫ whiskerLeft F (pre (F.map f)) = whiskerRight (pre f) F ≫ expComparison F A'
[PROOFSTEP]
ext B
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A A' : C
f : A' ⟶ A
B : C
⊢ NatTrans.app (expComparison F A ≫ whiskerLeft F (pre (F.map f))) B =
    NatTrans.app (whiskerRight (pre f) F ≫ expComparison F A') B
[PROOFSTEP]
dsimp
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A A' : C
f : A' ⟶ A
B : C
⊢ NatTrans.app (expComparison F A) B ≫ NatTrans.app (pre (F.map f)) (F.obj B) =
    F.map (NatTrans.app (pre f) B) ≫ NatTrans.app (expComparison F A') B
[PROOFSTEP]
apply uncurry_injective
[GOAL]
case w.h.a
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
A A' : C
f : A' ⟶ A
B : C
⊢ CartesianClosed.uncurry (NatTrans.app (expComparison F A) B ≫ NatTrans.app (pre (F.map f)) (F.obj B)) =
    CartesianClosed.uncurry (F.map (NatTrans.app (pre f) B) ≫ NatTrans.app (expComparison F A') B)
[PROOFSTEP]
rw [uncurry_natural_left, uncurry_natural_left, uncurry_expComparison, uncurry_pre, prod.map_swap_assoc, ← F.map_id,
  expComparison_ev, ← F.map_id, ← prodComparison_inv_natural_assoc, ← prodComparison_inv_natural_assoc, ← F.map_comp, ←
  F.map_comp, prod_map_pre_app_comp_ev]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
⊢ ↑(transferNatTransSelf (Adjunction.comp h (exp.adjunction A)) (Adjunction.comp (exp.adjunction (F.obj A)) h))
      (frobeniusMorphism F h A) =
    expComparison F A
[PROOFSTEP]
rw [← Equiv.eq_symm_apply]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
⊢ frobeniusMorphism F h A =
    ↑(transferNatTransSelf (Adjunction.comp h (exp.adjunction A)) (Adjunction.comp (exp.adjunction (F.obj A)) h)).symm
      (expComparison F A)
[PROOFSTEP]
ext B : 2
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ NatTrans.app (frobeniusMorphism F h A) B =
    NatTrans.app
      (↑(transferNatTransSelf (Adjunction.comp h (exp.adjunction A))
              (Adjunction.comp (exp.adjunction (F.obj A)) h)).symm
        (expComparison F A))
      B
[PROOFSTEP]
dsimp [frobeniusMorphism, transferNatTransSelf, transferNatTrans, Adjunction.comp]
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    𝟙 (L.obj (F.obj A ⨯ B)) ≫
      (L.map
            (prod.map (𝟙 (F.obj A))
              ((NatTrans.app h.unit B ≫
                  F.map (NatTrans.app (exp.adjunction A).unit (L.obj B)) ≫ 𝟙 (F.obj (A ⟹ A ⨯ L.obj B))) ≫
                𝟙 (F.obj (A ⟹ A ⨯ L.obj B)) ≫
                  NatTrans.app (expComparison F A) (A ⨯ L.obj B) ≫ 𝟙 (F.obj A ⟹ F.obj (A ⨯ L.obj B)))) ≫
          𝟙 (L.obj (F.obj A ⨯ F.obj A ⟹ F.obj (A ⨯ L.obj B))) ≫
            L.map (NatTrans.app (exp.adjunction (F.obj A)).counit (F.obj (A ⨯ L.obj B))) ≫
              NatTrans.app h.counit (A ⨯ L.obj B)) ≫
        𝟙 (A ⨯ L.obj B)
[PROOFSTEP]
simp only [id_comp, comp_id]
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map
        (prod.map (𝟙 (F.obj A))
          ((NatTrans.app h.unit B ≫ F.map (NatTrans.app (exp.adjunction A).unit (L.obj B))) ≫
            NatTrans.app (expComparison F A) (A ⨯ L.obj B))) ≫
      L.map (NatTrans.app (exp.adjunction (F.obj A)).counit (F.obj (A ⨯ L.obj B))) ≫ NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
rw [← L.map_comp_assoc, prod.map_id_comp, assoc]
  -- Porting note: need to use `erw` here.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map
        (prod.map (𝟙 (F.obj A)) (NatTrans.app h.unit B ≫ F.map (NatTrans.app (exp.adjunction A).unit (L.obj B))) ≫
          prod.map (𝟙 (F.obj A)) (NatTrans.app (expComparison F A) (A ⨯ L.obj B)) ≫
            NatTrans.app (exp.adjunction (F.obj A)).counit (F.obj (A ⨯ L.obj B))) ≫
      NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
erw [expComparison_ev]
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map
        (prod.map (𝟙 (F.obj A)) (NatTrans.app h.unit B ≫ F.map (NatTrans.app (exp.adjunction A).unit (L.obj B))) ≫
          inv (prodComparison F A (A ⟹ A ⨯ L.obj B)) ≫ F.map (NatTrans.app (exp.ev A) (A ⨯ L.obj B))) ≫
      NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
rw [prod.map_id_comp, assoc, ← F.map_id, ← prodComparison_inv_natural_assoc, ← F.map_comp]
  -- Porting note: need to use `erw` here.
    -- https://github.com/leanprover-community/mathlib4/issues/5164
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map
        (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫
          inv (prodComparison F A (L.obj B)) ≫
            F.map
              (prod.map (𝟙 A) (NatTrans.app (exp.adjunction A).unit (L.obj B)) ≫
                NatTrans.app (exp.ev A) (A ⨯ L.obj B))) ≫
      NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
erw [exp.ev_coev]
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map
        (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫
          inv (prodComparison F A (L.obj B)) ≫ F.map (𝟙 (A ⨯ L.obj B))) ≫
      NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
rw [F.map_id (A ⨯ L.obj B), comp_id]
[GOAL]
case w.h
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) =
    L.map (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫ inv (prodComparison F A (L.obj B))) ≫
      NatTrans.app h.counit (A ⨯ L.obj B)
[PROOFSTEP]
ext
[GOAL]
case w.h.h₁
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ (prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B))) ≫ prod.fst =
    (L.map (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫ inv (prodComparison F A (L.obj B))) ≫
        NatTrans.app h.counit (A ⨯ L.obj B)) ≫
      prod.fst
[PROOFSTEP]
rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_fst]
[GOAL]
case w.h.h₁
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) ≫ prod.fst =
    L.map (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫ prod.fst) ≫ NatTrans.app h.counit A
[PROOFSTEP]
simp
[GOAL]
case w.h.h₂
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ (prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B))) ≫ prod.snd =
    (L.map (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫ inv (prodComparison F A (L.obj B))) ≫
        NatTrans.app h.counit (A ⨯ L.obj B)) ≫
      prod.snd
[PROOFSTEP]
rw [assoc, assoc, ← h.counit_naturality, ← L.map_comp_assoc, assoc, inv_prodComparison_map_snd]
[GOAL]
case w.h.h₂
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
B : D
⊢ prodComparison L (F.obj A) B ≫ prod.map (NatTrans.app h.counit A) (𝟙 (L.obj B)) ≫ prod.snd =
    L.map (prod.map (F.map (𝟙 A)) (NatTrans.app h.unit B) ≫ prod.snd) ≫ NatTrans.app h.counit (L.obj B)
[PROOFSTEP]
simp
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
i : IsIso (expComparison F A)
⊢ IsIso (frobeniusMorphism F h A)
[PROOFSTEP]
rw [← frobeniusMorphism_mate F h] at i
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
i :
  IsIso
    (↑(transferNatTransSelf (Adjunction.comp h (exp.adjunction A)) (Adjunction.comp (exp.adjunction (F.obj A)) h))
      (frobeniusMorphism F h A))
⊢ IsIso (frobeniusMorphism F h A)
[PROOFSTEP]
exact @transferNatTransSelf_of_iso _ _ _ _ _ _ _ _ _ _ _ i
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
i : IsIso (frobeniusMorphism F h A)
⊢ IsIso (expComparison F A)
[PROOFSTEP]
rw [← frobeniusMorphism_mate F h]
[GOAL]
C : Type u
inst✝⁶ : Category.{v, u} C
D : Type u'
inst✝⁵ : Category.{v, u'} D
inst✝⁴ : HasFiniteProducts C
inst✝³ : HasFiniteProducts D
F : C ⥤ D
L : D ⥤ C
inst✝² : CartesianClosed C
inst✝¹ : CartesianClosed D
inst✝ : PreservesLimitsOfShape (Discrete WalkingPair) F
h : L ⊣ F
A : C
i : IsIso (frobeniusMorphism F h A)
⊢ IsIso
    (↑(transferNatTransSelf (Adjunction.comp h (exp.adjunction A)) (Adjunction.comp (exp.adjunction (F.obj A)) h))
      (frobeniusMorphism F h A))
[PROOFSTEP]
infer_instance