Theorem: interval_shift₂ (Fl.lean)

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hty : t ≤ y := ht ▸ round_sub_le npos hfaithful₀ hfaithful₁ _ hfy
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hyx : y ≤ x := Nat.le_trans hyw hwx
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have htx : t ≤ x := Nat.le_trans hty hyx
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hs : s = round (x - round (x - t)) := hs₂ htx
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hfs : trunc n s = s := hs.symm ▸ trunc_round npos hfaithful₁ _
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hft : trunc n t = t := ht.symm ▸ trunc_round npos hfaithful₁ _
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
have hsy' : s ≤ round (x - round (x - y)) := by
  have hfy' : round (x - round (x - y)) = x - round (x - y) := by
    apply round_eq_of_trunc_eq npos hfaithful₀
    exact s₂ npos hfaithful₀ hfaithful₁ hfx hfy hyx
  have hft' : round (x - round (x - t)) = x - round (x - t) := by
    apply round_eq_of_trunc_eq npos hfaithful₀
    exact s₂ npos hfaithful₀ hfaithful₁ hfx hft htx
  rewrite [hs, hft', hfy']
  apply tsub_le_tsub_left
  exact hml hft hfy hfx hty
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
obtain hsw | ⟨hws, hys⟩ : s ≤ w ∨ (w ≤ s ∧ y < s) := by
  cases Nat.le_total s w with
  | inl hsw => exact Or.inl hsw
  | inr hws =>
    cases Nat.lt_or_ge y s with
    | inl hys => exact Or.inr ⟨hws, hys⟩
    | inr hsy => exact Or.inl (Nat.le_trans hsy hyw)
State after:
case inl
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

case inr.intro
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
case inl
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

case inr.intro
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
. constructor
  . have hfr : trunc n (round (x - t)) = round (x - t) := trunc_round npos hfaithful₁ (x - t)
    have hrx : round (x - t) ≤ x := round_sub_le npos hfaithful₀ hfaithful₁ t hfx
    apply s₁ npos hsw hwx hfs hfx hfw
    rewrite [hs]
    exact s₂ npos hfaithful₀ hfaithful₁ hfx hfr hrx
  . rw [tsub_eq_zero_of_le hsw, trunc_zero]
State after:
case inr.intro
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w

State before:
case inr.intro
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
. constructor
  . rw [tsub_eq_zero_of_le hws, trunc_zero]
  . have hyy' : y < round (x - round (x - y)) := Nat.lt_of_lt_of_le hys hsy'
    have hwy' : w ≤ round (x - round (x - y)) := Nat.le_trans hws hsy'
    apply s₁ npos hws hsy' hfw (trunc_round npos hfaithful₁ _) hfs
    exact s₃ npos hfaithful₀ hfaithful₁ hfx hfy hfw hyx hyw hxyulp hyy' hwy'
State after:
no goals

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ s ≤ round (x - round (x - y))
Tactic:
have hfy' : round (x - round (x - y)) = x - round (x - y) := by
  apply round_eq_of_trunc_eq npos hfaithful₀
  exact s₂ npos hfaithful₀ hfaithful₁ hfx hfy hyx
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
⊢ s ≤ round (x - round (x - y))

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
⊢ s ≤ round (x - round (x - y))
Tactic:
have hft' : round (x - round (x - t)) = x - round (x - t) := by
  apply round_eq_of_trunc_eq npos hfaithful₀
  exact s₂ npos hfaithful₀ hfaithful₁ hfx hft htx
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ s ≤ round (x - round (x - y))

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ s ≤ round (x - round (x - y))
Tactic:
rewrite [hs, hft', hfy']
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ x - round (x - t) ≤ x - round (x - y)

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ x - round (x - t) ≤ x - round (x - y)
Tactic:
apply tsub_le_tsub_left
State after:
case h
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ round (x - y) ≤ round (x - t)

State before:
case h
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
hft' : round (x - round (x - t)) = x - round (x - t)
⊢ round (x - y) ≤ round (x - t)
Tactic:
exact hml hft hfy hfx hty
State after:
no goals

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ round (x - round (x - y)) = x - round (x - y)
Tactic:
apply round_eq_of_trunc_eq npos hfaithful₀
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ trunc n (x - round (x - y)) = x - round (x - y)

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
⊢ trunc n (x - round (x - y)) = x - round (x - y)
Tactic:
exact s₂ npos hfaithful₀ hfaithful₁ hfx hfy hyx
State after:
no goals

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
⊢ round (x - round (x - t)) = x - round (x - t)
Tactic:
apply round_eq_of_trunc_eq npos hfaithful₀
State after:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
⊢ trunc n (x - round (x - t)) = x - round (x - t)

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hfy' : round (x - round (x - y)) = x - round (x - y)
⊢ trunc n (x - round (x - t)) = x - round (x - t)
Tactic:
exact s₂ npos hfaithful₀ hfaithful₁ hfx hft htx
State after:
no goals

State before:
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
⊢ s ≤ w ∨ w ≤ s ∧ y < s
Tactic:
cases Nat.le_total s w with
| inl hsw => exact Or.inl hsw
| inr hws =>
  cases Nat.lt_or_ge y s with
  | inl hys => exact Or.inr ⟨hws, hys⟩
  | inr hsy => exact Or.inl (Nat.le_trans hsy hyw)
State after:
no goals

State before:
case inl
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ s ≤ w ∨ w ≤ s ∧ y < s
Tactic:
exact Or.inl hsw
State after:
no goals

State before:
case inr
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
⊢ s ≤ w ∨ w ≤ s ∧ y < s
Tactic:
cases Nat.lt_or_ge y s with
| inl hys => exact Or.inr ⟨hws, hys⟩
| inr hsy => exact Or.inl (Nat.le_trans hsy hyw)
State after:
no goals

State before:
case inr.inl
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ s ≤ w ∨ w ≤ s ∧ y < s
Tactic:
exact Or.inr ⟨hws, hys⟩
State after:
no goals

State before:
case inr.inr
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hsy : y ≥ s
⊢ s ≤ w ∨ w ≤ s ∧ y < s
Tactic:
exact Or.inl (Nat.le_trans hsy hyw)
State after:
no goals

State before:
case inl
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
constructor
State after:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s

case inl.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (s - w) = s - w

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s

case inl.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (s - w) = s - w
Tactic:
. have hfr : trunc n (round (x - t)) = round (x - t) := trunc_round npos hfaithful₁ (x - t)
  have hrx : round (x - t) ≤ x := round_sub_le npos hfaithful₀ hfaithful₁ t hfx
  apply s₁ npos hsw hwx hfs hfx hfw
  rewrite [hs]
  exact s₂ npos hfaithful₀ hfaithful₁ hfx hfr hrx
State after:
case inl.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (s - w) = s - w

State before:
case inl.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (s - w) = s - w
Tactic:
. rw [tsub_eq_zero_of_le hsw, trunc_zero]
State after:
no goals

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (w - s) = w - s
Tactic:
have hfr : trunc n (round (x - t)) = round (x - t) := trunc_round npos hfaithful₁ (x - t)
State after:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
⊢ trunc n (w - s) = w - s

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
⊢ trunc n (w - s) = w - s
Tactic:
have hrx : round (x - t) ≤ x := round_sub_le npos hfaithful₀ hfaithful₁ t hfx
State after:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (w - s) = w - s

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (w - s) = w - s
Tactic:
apply s₁ npos hsw hwx hfs hfx hfw
State after:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (x - s) = x - s

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (x - s) = x - s
Tactic:
rewrite [hs]
State after:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (x - round (x - round (x - t))) = x - round (x - round (x - t))

State before:
case inl.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
hfr : trunc n (round (x - t)) = round (x - t)
hrx : round (x - t) ≤ x
⊢ trunc n (x - round (x - round (x - t))) = x - round (x - round (x - t))
Tactic:
exact s₂ npos hfaithful₀ hfaithful₁ hfx hfr hrx
State after:
no goals

State before:
case inl.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hsw : s ≤ w
⊢ trunc n (s - w) = s - w
Tactic:
rw [tsub_eq_zero_of_le hsw, trunc_zero]
State after:
no goals

State before:
case inr.intro
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s ∧ trunc n (s - w) = s - w
Tactic:
constructor
State after:
case inr.intro.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s

case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (s - w) = s - w

State before:
case inr.intro.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s

case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (s - w) = s - w
Tactic:
. rw [tsub_eq_zero_of_le hws, trunc_zero]
State after:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (s - w) = s - w

State before:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (s - w) = s - w
Tactic:
. have hyy' : y < round (x - round (x - y)) := Nat.lt_of_lt_of_le hys hsy'
  have hwy' : w ≤ round (x - round (x - y)) := Nat.le_trans hws hsy'
  apply s₁ npos hws hsy' hfw (trunc_round npos hfaithful₁ _) hfs
  exact s₃ npos hfaithful₀ hfaithful₁ hfx hfy hfw hyx hyw hxyulp hyy' hwy'
State after:
no goals

State before:
case inr.intro.left
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (w - s) = w - s
Tactic:
rw [tsub_eq_zero_of_le hws, trunc_zero]
State after:
no goals

State before:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
⊢ trunc n (s - w) = s - w
Tactic:
have hyy' : y < round (x - round (x - y)) := Nat.lt_of_lt_of_le hys hsy'
State after:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
⊢ trunc n (s - w) = s - w

State before:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
⊢ trunc n (s - w) = s - w
Tactic:
have hwy' : w ≤ round (x - round (x - y)) := Nat.le_trans hws hsy'
State after:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
hwy' : w ≤ round (x - round (x - y))
⊢ trunc n (s - w) = s - w

State before:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
hwy' : w ≤ round (x - round (x - y))
⊢ trunc n (s - w) = s - w
Tactic:
apply s₁ npos hws hsy' hfw (trunc_round npos hfaithful₁ _) hfs
State after:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
hwy' : w ≤ round (x - round (x - y))
⊢ trunc n (round (x - round (x - y)) - w) = round (x - round (x - y)) - w

State before:
case inr.intro.right
round : ℕ → ℕ
x y z w s t n : ℕ
npos : 0 < n
hfaithful₀ : faithful₀ n round
hfaithful₁ : faithful₁ n round
hml : sub_left_monotonic n round
hfx : trunc n x = x
hfy : trunc n y = y
hfw : trunc n w = w
hxyulp : ulp n x ≤ 2 * y
ht : t = round (y - round (y - z))
hs₂ : t ≤ x → s = round (x - round (x - t))
hyw : y ≤ w
hwx : w ≤ x
hty : t ≤ y
hyx : y ≤ x
htx : t ≤ x
hs : s = round (x - round (x - t))
hfs : trunc n s = s
hft : trunc n t = t
hsy' : s ≤ round (x - round (x - y))
hws : w ≤ s
hys : y < s
hyy' : y < round (x - round (x - y))
hwy' : w ≤ round (x - round (x - y))
⊢ trunc n (round (x - round (x - y)) - w) = round (x - round (x - y)) - w
Tactic:
exact s₃ npos hfaithful₀ hfaithful₁ hfx hfy hfw hyx hyw hxyulp hyy' hwy'
State after:
no goals