l3lab/ntp-mathlib huggingface dataset:
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          

Proof state:
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p : Fq[X]
h : ¬p = 0 → ↑(Fintype.card Fq) ^ natDegree p = 0
⊢ p = 0

Next tactic:
contrapose! h
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          

Proof state:
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p : Fq[X]
h : p ≠ 0
⊢ p ≠ 0 ∧ ↑(Fintype.card Fq) ^ natDegree p ≠ 0

Next tactic:
exact ⟨h, (pow_pos _).ne'⟩
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      

Proof state:
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
by_cases hp : p = 0
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · 

Proof state:
case pos
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : p = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
simp [hp]
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      

Proof state:
case neg
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
by_cases hq : q = 0
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · 

Proof state:
case pos
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : q = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
simp [hq]
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      

Proof state:
case neg
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
by_cases hpq : p + q = 0
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      by_cases hpq : p + q = 0
      · 

Proof state:
case pos
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
hpq : p + q = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
simp only [hpq, hp, hq, eq_self_iff_true, if_true, if_false]
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      by_cases hpq : p + q = 0
      · simp only [hpq, hp, hq, eq_self_iff_true, if_true, if_false]
        

Proof state:
case pos
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
hpq : p + q = 0
⊢ 0 ≤ ↑(Fintype.card Fq) ^ natDegree p + ↑(Fintype.card Fq) ^ natDegree q

Next tactic:
exact add_nonneg (pow_pos _).le (pow_pos _).le
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      by_cases hpq : p + q = 0
      · simp only [hpq, hp, hq, eq_self_iff_true, if_true, if_false]
        exact add_nonneg (pow_pos _).le (pow_pos _).le
      

Proof state:
case neg
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
hpq : ¬p + q = 0
⊢ MulHom.toFun
      { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
        map_mul' :=
          (_ :
            ∀ (p q : Fq[X]),
              (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
      (p + q) ≤
    MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        p +
      MulHom.toFun
        { toFun := fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p,
          map_mul' :=
            (_ :
              ∀ (p q : Fq[X]),
                (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) (p * q) =
                  (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) p *
                    (fun p => if p = 0 then 0 else ↑(Fintype.card Fq) ^ natDegree p) q) }
        q

Next tactic:
simp only [hpq, hp, hq, if_false]
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      by_cases hpq : p + q = 0
      · simp only [hpq, hp, hq, eq_self_iff_true, if_true, if_false]
        exact add_nonneg (pow_pos _).le (pow_pos _).le
      simp only [hpq, hp, hq, if_false]
      

Proof state:
case neg
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
hpq : ¬p + q = 0
⊢ ↑(Fintype.card Fq) ^ natDegree (p + q) ≤ ↑(Fintype.card Fq) ^ natDegree p + ↑(Fintype.card Fq) ^ natDegree q

Next tactic:
refine' le_trans (pow_le_pow_right (by linarith) (Polynomial.natDegree_add_le _ _)) _
/-- `cardPowDegree` is the absolute value on `𝔽_q[t]` sending `f` to `q ^ degree f`.

`cardPowDegree 0` is defined to be `0`. -/
noncomputable def cardPowDegree : AbsoluteValue Fq[X] ℤ :=
  have card_pos : 0 < Fintype.card Fq := Fintype.card_pos_iff.mpr inferInstance
  have pow_pos : ∀ n, 0 < (Fintype.card Fq : ℤ) ^ n := fun n =>
    pow_pos (Int.coe_nat_pos.mpr card_pos) n
  letI := Classical.decEq Fq;
  { toFun := fun p => if p = 0 then 0 else (Fintype.card Fq : ℤ) ^ p.natDegree
    nonneg' := fun p => by
      dsimp
      split_ifs
      · rfl
      exact pow_nonneg (Int.ofNat_zero_le _) _
    eq_zero' := fun p =>
      ite_eq_left_iff.trans <|
        ⟨fun h => by
          contrapose! h
          exact ⟨h, (pow_pos _).ne'⟩, absurd⟩
    add_le' := fun p q => by
      by_cases hp : p = 0; · simp [hp]
      by_cases hq : q = 0; · simp [hq]
      by_cases hpq : p + q = 0
      · simp only [hpq, hp, hq, eq_self_iff_true, if_true, if_false]
        exact add_nonneg (pow_pos _).le (pow_pos _).le
      simp only [hpq, hp, hq, if_false]
      refine' le_trans (pow_le_pow_right (by 

Proof state:
Fq : Type u_1
inst✝¹ : Field Fq
inst✝ : Fintype Fq
card_pos : 0 < Fintype.card Fq
pow_pos : ∀ (n : ℕ), 0 < ↑(Fintype.card Fq) ^ n
this : DecidableEq Fq := Classical.decEq Fq
p q : Fq[X]
hp : ¬p = 0
hq : ¬q = 0
hpq : ¬p + q = 0
⊢ 1 ≤ ↑(Fintype.card Fq)

Next tactic:
linarith