Theorem: Nat.Linear.PolyCnstr.denote_mul
File: src/lean/Init/Data/Nat/Linear.lean

tactic: cases c
state_before: ctx : Context
k : Nat
c : PolyCnstr
⊢ denote ctx (mul (k + 1) c) = denote ctx c

tactic: rename_i eq lhs rhs
state_before: case mk
ctx : Context
k : Nat
eq✝ : Bool
lhs✝ rhs✝ : Poly
⊢ denote ctx (mul (k + 1) { eq := eq✝, lhs := lhs✝, rhs := rhs✝ }) = denote ctx { eq := eq✝, lhs := lhs✝, rhs := rhs✝ }

tactic: have : k ≠ 0 → k + 1 ≠ 1 := by intro h; match k with | 0 => contradiction | k+1 => simp; apply Nat.succ_ne_zero
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: have : ¬ (k == 0) → (k + 1 == 1) = false := fun h => beq_false_of_ne (this (ne_of_beq_false (Bool.of_not_eq_true h)))
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this : k ≠ 0 → k + 1 ≠ 1
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: have : ¬ ((k + 1 == 0) = true)  := fun h => absurd (eq_of_beq h) (Nat.succ_ne_zero k)
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝ : k ≠ 0 → k + 1 ≠ 1
this : ¬(k == 0) = true → (k + 1 == 1) = false
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: have : (1 == (0 : Nat)) = false := rfl
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝¹ : k ≠ 0 → k + 1 ≠ 1
this✝ : ¬(k == 0) = true → (k + 1 == 1) = false
this : ¬(k + 1 == 0) = true
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: have : (1 == (1 : Nat)) = true  := rfl
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝² : k ≠ 0 → k + 1 ≠ 1
this✝¹ : ¬(k == 0) = true → (k + 1 == 1) = false
this✝ : ¬(k + 1 == 0) = true
this : (1 == 0) = false
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: by_cases he : eq = true <;> simp [he, PolyCnstr.mul, PolyCnstr.denote, Poly.denote_le, Poly.denote_eq]
   <;> by_cases hk : k == 0 <;> (try simp [eq_of_beq hk]) <;> simp [*] <;> apply propext <;> apply Iff.intro <;> intro h
state_before: case mk
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
⊢ denote ctx (mul (k + 1) { eq := eq, lhs := lhs, rhs := rhs }) = denote ctx { eq := eq, lhs := lhs, rhs := rhs }

tactic: intro h
state_before: ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
⊢ k ≠ 0 → k + 1 ≠ 1

tactic: match k with | 0 => contradiction | k+1 => simp; apply Nat.succ_ne_zero
state_before: ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
h : k ≠ 0
⊢ k + 1 ≠ 1

tactic: contradiction
state_before: ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
h : 0 ≠ 0
⊢ 0 + 1 ≠ 1

tactic: simp
state_before: ctx : Context
k✝ : Nat
eq : Bool
lhs rhs : Poly
k : Nat
h : k + 1 ≠ 0
⊢ k + 1 + 1 ≠ 1

tactic: apply Nat.succ_ne_zero
state_before: ctx : Context
k✝ : Nat
eq : Bool
lhs rhs : Poly
k : Nat
h : k + 1 ≠ 0
⊢ ¬k + 1 = 0

tactic: try simp [eq_of_beq hk]
state_before: case mk.inr.inr
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : ¬eq = true
hk : ¬(k == 0) = true
⊢ (Poly.denote ctx (bif k + 1 == 0 then [] else bif k + 1 == 1 then lhs else Poly.mul.go (k + 1) lhs) ≤
      Poly.denote ctx (bif k + 1 == 0 then [] else bif k + 1 == 1 then rhs else Poly.mul.go (k + 1) rhs)) =
    (Poly.denote ctx lhs ≤ Poly.denote ctx rhs)

tactic: simp [eq_of_beq hk]
state_before: case mk.inr.inr
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : ¬eq = true
hk : ¬(k == 0) = true
⊢ (Poly.denote ctx (bif k + 1 == 0 then [] else bif k + 1 == 1 then lhs else Poly.mul.go (k + 1) lhs) ≤
      Poly.denote ctx (bif k + 1 == 0 then [] else bif k + 1 == 1 then rhs else Poly.mul.go (k + 1) rhs)) =
    (Poly.denote ctx lhs ≤ Poly.denote ctx rhs)

tactic: exact Nat.eq_of_mul_eq_mul_left (Nat.zero_lt_succ _) h
state_before: case mk.inl.inr.a.mp
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : eq = true
hk : ¬(k == 0) = true
h : (k + 1) * Poly.denote ctx lhs = (k + 1) * Poly.denote ctx rhs
⊢ Poly.denote ctx lhs = Poly.denote ctx rhs

tactic: rw [h]
state_before: case mk.inl.inr.a.mpr
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : eq = true
hk : ¬(k == 0) = true
h : Poly.denote ctx lhs = Poly.denote ctx rhs
⊢ (k + 1) * Poly.denote ctx lhs = (k + 1) * Poly.denote ctx rhs

tactic: exact Nat.le_of_mul_le_mul_left h (Nat.zero_lt_succ _)
state_before: case mk.inr.inr.a.mp
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : ¬eq = true
hk : ¬(k == 0) = true
h : (k + 1) * Poly.denote ctx lhs ≤ (k + 1) * Poly.denote ctx rhs
⊢ Poly.denote ctx lhs ≤ Poly.denote ctx rhs

tactic: apply Nat.mul_le_mul_left _ h
state_before: case mk.inr.inr.a.mpr
ctx : Context
k : Nat
eq : Bool
lhs rhs : Poly
this✝³ : k ≠ 0 → k + 1 ≠ 1
this✝² : ¬(k == 0) = true → (k + 1 == 1) = false
this✝¹ : ¬(k + 1 == 0) = true
this✝ : (1 == 0) = false
this : (1 == 1) = true
he : ¬eq = true
hk : ¬(k == 0) = true
h : Poly.denote ctx lhs ≤ Poly.denote ctx rhs
⊢ (k + 1) * Poly.denote ctx lhs ≤ (k + 1) * Poly.denote ctx rhs