[STATEMENT]
lemma val_prod:
  assumes "prime p"
  assumes "f \<in> (padic_set p)"
  assumes "g \<in> (padic_set p)"
  assumes "f \<noteq> padic_zero p"
  assumes "g \<noteq> padic_zero p"
  shows "padic_val p (padic_mult p f g) = padic_val p f + padic_val p g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?vp = "padic_val p (padic_mult p f g)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?vf = "padic_val p f"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?vg = "padic_val p g"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 0: "f (nat ?vf + 1) \<noteq>  \<zero>\<^bsub>residue_ring (p^(nat ?vf + 1))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + 1))\<^esub>
[PROOF STEP]
using assms(2) assms(4) val_of_nonzero  assms(1)
[PROOF STATE]
proof (prove)
using this:
f \<in> padic_set p
f \<noteq> padic_zero p
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ (nat (padic_val ?p ?f) + 1))\<^esub>
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = \<zero>\<^bsub>residue_ring (?p ^ nat (padic_val ?p ?f))\<^esub>
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f) + 1) \<noteq> 0
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = 0
prime p

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + 1))\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + 1))\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 1: "g (nat ?vg + 1) \<noteq>  \<zero>\<^bsub>residue_ring (p^(nat ?vg + 1))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p g) + 1))\<^esub>
[PROOF STEP]
using assms(3) assms(5) val_of_nonzero assms(1)
[PROOF STATE]
proof (prove)
using this:
g \<in> padic_set p
g \<noteq> padic_zero p
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ (nat (padic_val ?p ?f) + 1))\<^esub>
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = \<zero>\<^bsub>residue_ring (?p ^ nat (padic_val ?p ?f))\<^esub>
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f) + 1) \<noteq> 0
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = 0
prime p

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p g) + 1))\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p g) + 1))\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 2: "f (nat ?vf) =  \<zero>\<^bsub>residue_ring (p^(nat ?vf))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p f))\<^esub>
[PROOF STEP]
using assms(1) assms(2) assms(4) val_of_nonzero(2)
[PROOF STATE]
proof (prove)
using this:
prime p
f \<in> padic_set p
f \<noteq> padic_zero p
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = \<zero>\<^bsub>residue_ring (?p ^ nat (padic_val ?p ?f))\<^esub>

goal (1 subgoal):
 1. f (nat (padic_val p f)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p f))\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p f))\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 3: "g (nat ?vg) =  \<zero>\<^bsub>residue_ring (p^(nat ?vg))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p g))\<^esub>
[PROOF STEP]
using assms(1) assms(3) assms(5) val_of_nonzero(2)
[PROOF STATE]
proof (prove)
using this:
prime p
g \<in> padic_set p
g \<noteq> padic_zero p
\<lbrakk>?f \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; prime ?p\<rbrakk> \<Longrightarrow> ?f (nat (padic_val ?p ?f)) = \<zero>\<^bsub>residue_ring (?p ^ nat (padic_val ?p ?f))\<^esub>

goal (1 subgoal):
 1. g (nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p g))\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ nat (padic_val p g))\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?nm = "((padic_mult p f g) (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?n = "(f (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?m = "(g (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have A: "?nm = ?n \<otimes>\<^bsub>residue_ring (p^((Suc (nat (?vf + ?vg))))) \<^esub> ?m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
using padic_mult_def
[PROOF STATE]
proof (prove)
using this:
padic_mult ?p ?f ?g \<equiv> \<lambda>n. ?f n \<otimes>\<^bsub>residue_ring (?p ^ n)\<^esub> ?g n

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 5: "f (nat ?vf + 1) = residue (p^(nat ?vf + 1)) ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "(Suc (nat (?vf + ?vg))) \<ge> (nat ?vf + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p f) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: assms(5) padic_val_def)
[PROOF STATE]
proof (state)
this:
nat (padic_val p f) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat (padic_val p f) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have "f (nat ?vf + 1) =  residue (p^(nat ?vf + 1)) (f (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(1) assms(2) padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
prime p
f \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 6: "f (nat ?vf) = residue (p^(nat ?vf)) ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f)) = residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using add.commute assms(1) assms(2) assms(5) int_nat_eq nat_int
        nat_le_iff not_less_eq_eq padic_set_res_coherent padic_val_def plus_1_eq_Suc
[PROOF STATE]
proof (prove)
using this:
?a + ?b = ?b + ?a
prime p
f \<in> padic_set p
g \<noteq> padic_zero p
int (nat ?z) = (if 0 \<le> ?z then ?z else 0)
nat (int ?n) = ?n
(nat ?x \<le> ?n) = (?x \<le> int ?n)
(\<not> ?m \<le> ?n) = (Suc ?n \<le> ?m)
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)
(+) 1 = Suc

goal (1 subgoal):
 1. f (nat (padic_val p f)) = residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f)) = residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 7: "g (nat ?vg + 1) = residue (p^(nat ?vg + 1)) ?m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "(Suc (nat (?vf + ?vg))) \<ge> (nat ?vg + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p g) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: assms(4) padic_val_def)
[PROOF STATE]
proof (state)
this:
nat (padic_val p g) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat (padic_val p g) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have "g (nat ?vg + 1) =  residue (p^(nat ?vg + 1)) (g (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p g) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(1) assms(3) padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p g) + 1 \<le> Suc (nat (padic_val p f + padic_val p g))
prime p
g \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 8: "g (nat ?vg) = residue (p^(nat ?vg)) ?m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "(Suc (nat (?vf + ?vg))) \<ge> (nat ?vg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p g) \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: assms(4) padic_val_def)
[PROOF STATE]
proof (state)
this:
nat (padic_val p g) \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat (padic_val p g) \<le> Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have "g (nat ?vg) =  residue (p^(nat ?vg)) (g (Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p g) \<le> Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(1) assms(3) padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p g) \<le> Suc (nat (padic_val p f + padic_val p g))
prime p
g \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g)) = residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 9: "f (nat ?vf) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f)) = 0
[PROOF STEP]
by (simp add: "2" residue_ring_def)
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f)) = 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 10: "g (nat ?vg) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g)) = 0
[PROOF STEP]
by (simp add: "3" residue_ring_def)
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g)) = 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 11: "f (nat ?vf + 1) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) \<noteq> 0
[PROOF STEP]
using "0" residue_ring_def
[PROOF STATE]
proof (prove)
using this:
f (nat (padic_val p f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + 1))\<^esub>
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>

goal (1 subgoal):
 1. f (nat (padic_val p f) + 1) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (nat (padic_val p f) + 1) \<noteq> 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 12: "g (nat ?vg + 1) \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) \<noteq> 0
[PROOF STEP]
using "1" residue_ring_def
[PROOF STATE]
proof (prove)
using this:
g (nat (padic_val p g) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p g) + 1))\<^esub>
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>

goal (1 subgoal):
 1. g (nat (padic_val p g) + 1) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (nat (padic_val p g) + 1) \<noteq> 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 13:"\<exists>i. ?n = i*p^(nat ?vf) \<and> \<not> p dvd (nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have  "residue (p^(nat ?vf)) (?n) = f (nat ?vf)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f))
[PROOF STEP]
by (simp add: "6")
[PROOF STATE]
proof (state)
this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f))

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f))
[PROOF STEP]
have P0: "residue (p^(nat ?vf)) (?n) = 0"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f))

goal (1 subgoal):
 1. residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = 0
[PROOF STEP]
using "9"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f))
f (nat (padic_val p f)) = 0

goal (1 subgoal):
 1. residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = 0

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "residue (p^(nat ?vf + 1)) (?n) = f (nat ?vf + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)
[PROOF STEP]
using "5"
[PROOF STATE]
proof (prove)
using this:
f (nat (padic_val p f) + 1) = residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)
[PROOF STEP]
have P1: "residue (p^(nat ?vf + 1)) (?n) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
[PROOF STEP]
using "11"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) = f (nat (padic_val p f) + 1)
f (nat (padic_val p f) + 1) \<noteq> 0

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have P2: "?n mod (p^(nat ?vf)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p f) = 0
[PROOF STEP]
using P0 residue_def
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p f)) (f (Suc (nat (padic_val p f + padic_val p g)))) = 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p f) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p f) = 0

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have P3: "?n mod (p^(nat ?vf + 1)) \<noteq>  0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + 1) \<noteq> 0
[PROOF STEP]
using P1 residue_def
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p f) + 1)) (f (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + 1) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + 1) \<noteq> 0

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "p^(nat ?vf) dvd ?n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ nat (padic_val p f) dvd f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
using P2
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p f) = 0

goal (1 subgoal):
 1. p ^ nat (padic_val p f) dvd f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p ^ nat (padic_val p f) dvd f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p ^ nat (padic_val p f) dvd f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
obtain i where A0:"?n = i*(p^(nat ?vf))"
[PROOF STATE]
proof (prove)
using this:
p ^ nat (padic_val p f) dvd f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. (\<And>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f)

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "?n \<in> carrier (residue_ring (p^(Suc (nat (?vf + ?vg)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(2) padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
f \<in> padic_set p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "?n \<ge>0"
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by (simp add: residue_ring_def)
[PROOF STATE]
proof (state)
this:
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
have NN:"i \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g))) \<Longrightarrow> 0 \<le> i
[PROOF STEP]
have S0:"?n \<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
using \<open>0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g))) \<Longrightarrow> 0 \<le> i
[PROOF STEP]
have S1:"(p^(nat ?vf)) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ nat (padic_val p f)
[PROOF STEP]
using assms(1) prime_gt_0_int zero_less_power
[PROOF STATE]
proof (prove)
using this:
prime p
prime ?p \<Longrightarrow> 0 < ?p
(0::?'a) < ?a \<Longrightarrow> (0::?'a) < ?a ^ ?n

goal (1 subgoal):
 1. 0 < p ^ nat (padic_val p f)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < p ^ nat (padic_val p f)

goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g))) \<Longrightarrow> 0 \<le> i
[PROOF STEP]
have "\<not> i<0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> i < 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < 0 \<Longrightarrow> False
[PROOF STEP]
assume "i < 0"
[PROOF STATE]
proof (state)
this:
i < 0

goal (1 subgoal):
 1. i < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < 0
[PROOF STEP]
have "?n < 0"
[PROOF STATE]
proof (prove)
using this:
i < 0

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) < 0
[PROOF STEP]
using S1 A0
[PROOF STATE]
proof (prove)
using this:
i < 0
0 < p ^ nat (padic_val p f)
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f)

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) < 0
[PROOF STEP]
by (metis mult.commute times_int_code(1) zmult_zless_mono2)
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) < 0

goal (1 subgoal):
 1. i < 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (Suc (nat (padic_val p f + padic_val p g))) < 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) < 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using S0
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) < 0
0 \<le> f (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. False
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> i < 0

goal (1 subgoal):
 1. 0 \<le> f (Suc (nat (padic_val p f + padic_val p g))) \<Longrightarrow> 0 \<le> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> i < 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> i < 0

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> i

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have A1: "\<not> p dvd (nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p dvd int (nat i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
assume "p dvd nat i"
[PROOF STATE]
proof (state)
this:
p dvd int (nat i)

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd int (nat i)
[PROOF STEP]
obtain j where "nat i = j*p"
[PROOF STATE]
proof (prove)
using this:
p dvd int (nat i)

goal (1 subgoal):
 1. (\<And>j. int (nat i) = j * p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
int (nat i) = j * p

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int (nat i) = j * p
[PROOF STEP]
have "?n = j*p*(p^(nat ?vf))"
[PROOF STATE]
proof (prove)
using this:
int (nat i) = j * p

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)
[PROOF STEP]
using A0 NN
[PROOF STATE]
proof (prove)
using this:
int (nat i) = j * p
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f)
0 \<le> i

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)

goal (1 subgoal):
 1. False
[PROOF STEP]
using P3
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p f)
f (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + 1) \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> p dvd int (nat i)

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> p dvd int (nat i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd int (nat i)

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
using A0
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd int (nat i)
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f)

goal (1 subgoal):
 1. \<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 14:"\<exists> i. ?m = i*p^(nat ?vg) \<and> \<not> p dvd (nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have  "residue (p^(nat ?vg)) (?m) = g (nat ?vg)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g))
[PROOF STEP]
by (simp add: "8")
[PROOF STATE]
proof (state)
this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g))

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g))
[PROOF STEP]
have P0: "residue (p^(nat ?vg)) (?m) = 0"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g))

goal (1 subgoal):
 1. residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = 0
[PROOF STEP]
using "10"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g))
g (nat (padic_val p g)) = 0

goal (1 subgoal):
 1. residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = 0

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "residue (p^(nat ?vg + 1)) (?m) = g (nat ?vg + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)
[PROOF STEP]
using "7"
[PROOF STATE]
proof (prove)
using this:
g (nat (padic_val p g) + 1) = residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)
[PROOF STEP]
have P1: "residue (p^(nat ?vg + 1)) (?m) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
[PROOF STEP]
using "12"
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) = g (nat (padic_val p g) + 1)
g (nat (padic_val p g) + 1) \<noteq> 0

goal (1 subgoal):
 1. residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have P2: "?m mod (p^(nat ?vg)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p g) = 0
[PROOF STEP]
using P0 residue_def
[PROOF STATE]
proof (prove)
using this:
residue (p ^ nat (padic_val p g)) (g (Suc (nat (padic_val p f + padic_val p g)))) = 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p g) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p g) = 0

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have P3: "?m mod (p^(nat ?vg + 1)) \<noteq>  0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p g) + 1) \<noteq> 0
[PROOF STEP]
using P1 residue_def
[PROOF STATE]
proof (prove)
using this:
residue (p ^ (nat (padic_val p g) + 1)) (g (Suc (nat (padic_val p f + padic_val p g)))) \<noteq> 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p g) + 1) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p g) + 1) \<noteq> 0

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "p^(nat ?vg) dvd ?m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ nat (padic_val p g) dvd g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
using P2
[PROOF STATE]
proof (prove)
using this:
g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ nat (padic_val p g) = 0

goal (1 subgoal):
 1. p ^ nat (padic_val p g) dvd g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p ^ nat (padic_val p g) dvd g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p ^ nat (padic_val p g) dvd g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
obtain i where A0:"?m = i*(p^(nat ?vg))"
[PROOF STATE]
proof (prove)
using this:
p ^ nat (padic_val p g) dvd g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. (\<And>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g)

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have "?m \<in> carrier (residue_ring (p^(Suc (nat (?vf + ?vg)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(3) padic_set_res_closed
[PROOF STATE]
proof (prove)
using this:
g \<in> padic_set p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have S0: "?m \<ge>0"
[PROOF STATE]
proof (prove)
using this:
g (Suc (nat (padic_val p f + padic_val p g))) \<in> carrier (residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. 0 \<le> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by (simp add: residue_ring_def)
[PROOF STATE]
proof (state)
this:
0 \<le> g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
have NN:"i \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
0 \<le> g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
using 0 assms(1) prime_gt_0_int[of p] zero_le_mult_iff zero_less_power[of p]
[PROOF STATE]
proof (prove)
using this:
0 \<le> g (Suc (nat (padic_val p f + padic_val p g)))
f (nat (padic_val p f) + 1) \<noteq> \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + 1))\<^esub>
prime p
prime p \<Longrightarrow> 0 < p
((0::?'a) \<le> ?a * ?b) = ((0::?'a) \<le> ?a \<and> (0::?'a) \<le> ?b \<or> ?a \<le> (0::?'a) \<and> ?b \<le> (0::?'a))
0 < p \<Longrightarrow> 0 < p ^ ?n

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
by (metis A0 linorder_not_less)
[PROOF STATE]
proof (state)
this:
0 \<le> i

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
have A1: "\<not> p dvd (nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p dvd int (nat i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
assume "p dvd nat i"
[PROOF STATE]
proof (state)
this:
p dvd int (nat i)

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd int (nat i)
[PROOF STEP]
obtain j where "nat i = j*p"
[PROOF STATE]
proof (prove)
using this:
p dvd int (nat i)

goal (1 subgoal):
 1. (\<And>j. int (nat i) = j * p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
int (nat i) = j * p

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int (nat i) = j * p
[PROOF STEP]
have "?m = j*p*(p^(nat ?vg))"
[PROOF STATE]
proof (prove)
using this:
int (nat i) = j * p

goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)
[PROOF STEP]
using A0 NN
[PROOF STATE]
proof (prove)
using this:
int (nat i) = j * p
g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g)
0 \<le> i

goal (1 subgoal):
 1. g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)
[PROOF STEP]
by (metis int_nat_eq )
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)

goal (1 subgoal):
 1. p dvd int (nat i) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)

goal (1 subgoal):
 1. False
[PROOF STEP]
using P3
[PROOF STATE]
proof (prove)
using this:
g (Suc (nat (padic_val p f + padic_val p g))) = j * p * p ^ nat (padic_val p g)
g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p g) + 1) \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> p dvd int (nat i)

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> p dvd int (nat i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd int (nat i)

goal (1 subgoal):
 1. \<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
[PROOF STEP]
by (metis (no_types, lifting) A0)
[PROOF STATE]
proof (state)
this:
\<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
obtain i where I:"?n = i*p^(nat ?vf) \<and> \<not> p dvd (nat i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using "13"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. (\<And>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
obtain j where J:"?m = j*p^(nat ?vg) \<and> \<not> p dvd (nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. g (Suc (nat (padic_val p f + padic_val p g))) = j * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using "14"
[PROOF STATE]
proof (prove)
using this:
\<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. (\<And>j. g (Suc (nat (padic_val p f + padic_val p g))) = j * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g (Suc (nat (padic_val p f + padic_val p g))) = j * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat j)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
let ?i = "(p^(Suc (nat (?vf + ?vg))))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have P:"?nm mod ?i = ?n*?m mod ?i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have P1:"?nm = (?n \<otimes>\<^bsub>residue_ring ?i \<^esub> ?m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have P2:"(?n \<otimes>\<^bsub>residue_ring ?i \<^esub> ?m) = (residue ?i (?n)) \<otimes>\<^bsub>residue_ring ?i\<^esub>   (residue ?i (?m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g)))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using assms(1) assms(2) assms(3) padic_set_res_closed prime_ge_0_int residue_id
[PROOF STATE]
proof (prove)
using this:
prime p
f \<in> padic_set p
g \<in> padic_set p
?f \<in> padic_set ?p \<Longrightarrow> ?f ?m \<in> carrier (residue_ring (?p ^ ?m))
prime ?p \<Longrightarrow> 0 \<le> ?p
\<lbrakk>?x \<in> carrier (residue_ring ?n); 0 \<le> ?n\<rbrakk> \<Longrightarrow> residue ?n ?x = ?x

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g)))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g)))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g)))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have P3:"(?n \<otimes>\<^bsub>residue_ring ?i \<^esub> ?m) = (residue ?i (?n*?m))"
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g)))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by (metis monoid.simps(1) residue_def residue_ring_def)
[PROOF STATE]
proof (state)
this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f (Suc (nat (padic_val p f + padic_val p g))) \<otimes>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub> g (Suc (nat (padic_val p f + padic_val p g))) = residue (p ^ Suc (nat (padic_val p f + padic_val p g))) (f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: P1 residue_def)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
have 15: "?nm mod ?i =  i*j*p^((nat ?vf) +(nat ?vg)) mod ?i"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = f (Suc (nat (padic_val p f + padic_val p g))) * g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: I J mult.assoc mult.left_commute power_add)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 16: "\<not> p dvd (i*j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p dvd i * j
[PROOF STEP]
using 13 14
[PROOF STATE]
proof (prove)
using this:
\<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
\<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)

goal (1 subgoal):
 1. \<not> p dvd i * j
[PROOF STEP]
using I J assms(1) prime_dvd_mult_iff
[PROOF STATE]
proof (prove)
using this:
\<exists>i. f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
\<exists>i. g (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat i)
f (Suc (nat (padic_val p f + padic_val p g))) = i * p ^ nat (padic_val p f) \<and> \<not> p dvd int (nat i)
g (Suc (nat (padic_val p f + padic_val p g))) = j * p ^ nat (padic_val p g) \<and> \<not> p dvd int (nat j)
prime p
prime ?p \<Longrightarrow> (?p dvd ?a * ?b) = (?p dvd ?a \<or> ?p dvd ?b)

goal (1 subgoal):
 1. \<not> p dvd i * j
[PROOF STEP]
by (metis dvd_0_right int_nat_eq)
[PROOF STATE]
proof (state)
this:
\<not> p dvd i * j

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 17: "((nat ?vf) +(nat ?vg)) < (Suc (nat (?vf + ?vg)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p f) + nat (padic_val p g) < Suc (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by (simp add: assms(4) assms(5) nat_add_distrib padic_val_def)
[PROOF STATE]
proof (state)
this:
nat (padic_val p f) + nat (padic_val p g) < Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 18:"?nm mod ?i \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
have A0:"\<not>  p^((Suc (nat (?vf + ?vg)))) dvd p^((nat ?vf) +(nat ?vg)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
using 17
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f) + nat (padic_val p g) < Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. \<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
by (metis "16" assms(1) dvd_power_iff dvd_trans less_int_code(1) linorder_not_less one_dvd prime_gt_0_int)
[PROOF STATE]
proof (state)
this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
have A1: "p^((nat ?vf) +(nat ?vg)) mod ?i \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
using dvd_eq_mod_eq_0
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))
(?a dvd ?b) = (?b mod ?a = (0::?'a))

goal (1 subgoal):
 1. p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
have "\<not>  p^((Suc (nat (?vf + ?vg)))) dvd i*j*p^((nat ?vf) +(nat ?vg)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
using 16 A0 assms(1) assms(4) assms(5) nat_int_add padic_val_def
[PROOF STATE]
proof (prove)
using this:
\<not> p dvd i * j
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd p ^ (nat (padic_val p f) + nat (padic_val p g))
prime p
f \<noteq> padic_zero p
g \<noteq> padic_zero p
nat (int ?a + int ?b) = ?a + ?b
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. \<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
using "15"
[PROOF STATE]
proof (prove)
using this:
\<not> p ^ Suc (nat (padic_val p f + padic_val p g)) dvd i * j * p ^ (nat (padic_val p f) + nat (padic_val p g))
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 19: "(?nm mod ?i ) mod (p^(nat ?vf + nat ?vg)) = i*j*p^((nat ?vf) +(nat ?vg)) mod (p^(nat ?vf + nat ?vg))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
using 15
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g))
[PROOF STEP]
by (simp add: assms(4) assms(5) nat_add_distrib padic_val_def)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 20: "?nm mod (p^(nat ?vf + nat ?vg)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
have "(?nm mod ?i ) mod (p^(nat ?vf + nat ?vg)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
using 19
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = i * j * p ^ (nat (padic_val p f) + nat (padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
using "17" assms(1) int_nat_eq mod_mod_cancel[of "p^(nat ?vf + nat ?vg)" ?i]
           mod_pos_pos_trivial
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
nat (padic_val p f) + nat (padic_val p g) < Suc (nat (padic_val p f + padic_val p g))
prime p
int (nat ?z) = (if 0 \<le> ?z then ?z else 0)
p ^ (nat (padic_val p f) + nat (padic_val p g)) dvd p ^ Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> ?a mod p ^ Suc (nat (padic_val p f + padic_val p g)) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = ?a mod p ^ (nat (padic_val p f) + nat (padic_val p g))
\<lbrakk>0 \<le> ?k; ?k < ?l\<rbrakk> \<Longrightarrow> ?k mod ?l = ?k

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
[PROOF STEP]
by (metis le_imp_power_dvd less_imp_le_nat)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 21: "(padic_mult p f g) \<noteq> padic_zero p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g \<noteq> padic_zero p
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g = padic_zero p \<Longrightarrow> False
[PROOF STEP]
assume "(padic_mult p f g) =  padic_zero p"
[PROOF STATE]
proof (state)
this:
padic_mult p f g = padic_zero p

goal (1 subgoal):
 1. padic_mult p f g = padic_zero p \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g = padic_zero p
[PROOF STEP]
have "(padic_mult p f g) (Suc (nat (padic_val p f + padic_val p g))) =  padic_zero p (Suc (nat (padic_val p f + padic_val p g)))"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g = padic_zero p

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g = padic_zero p \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
have "?nm  = (padic_zero p (Suc (nat (padic_val p f + padic_val p g))))"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g = padic_zero p \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))
[PROOF STEP]
have "?nm = 0"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = padic_zero p (Suc (nat (padic_val p f + padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = 0
[PROOF STEP]
by (simp add: padic_zero_def)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = 0

goal (1 subgoal):
 1. padic_mult p f g = padic_zero p \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = 0
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using "18"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) = 0
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g \<noteq> padic_zero p

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 22: "(padic_mult p f g)\<in> (padic_set p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g \<in> padic_set p
[PROOF STEP]
using assms(1) assms(2) assms(3) padic_mult_in_padic_set
[PROOF STATE]
proof (prove)
using this:
prime p
f \<in> padic_set p
g \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?g \<in> padic_set ?p; prime ?p\<rbrakk> \<Longrightarrow> padic_mult ?p ?f ?g \<in> padic_set ?p

goal (1 subgoal):
 1. padic_mult p f g \<in> padic_set p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
padic_mult p f g \<in> padic_set p

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 23: "\<And> j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> (padic_mult p f g) j = \<zero>\<^bsub>residue_ring (p^j)\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g j = \<zero>\<^bsub>residue_ring (p ^ j)\<^esub>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g j = \<zero>\<^bsub>residue_ring (p ^ j)\<^esub>
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g j = \<zero>\<^bsub>residue_ring (p ^ j)\<^esub>
[PROOF STEP]
let ?j = "Suc (nat (padic_val p f + padic_val p g))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g j = \<zero>\<^bsub>residue_ring (p ^ j)\<^esub>
[PROOF STEP]
assume P: "k < ?j"
[PROOF STATE]
proof (state)
this:
k < Suc (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. \<And>j. j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g j = \<zero>\<^bsub>residue_ring (p ^ j)\<^esub>
[PROOF STEP]
show "(padic_mult p f g) k = \<zero>\<^bsub>residue_ring (p^k)\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
have P0: "(padic_mult p f g) (nat ?vf + nat ?vg) = \<zero>\<^bsub>residue_ring (p^(nat ?vf + nat ?vg))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
let ?k = "(nat ?vf + nat ?vg)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
have "((padic_mult p f g) ?k) = residue (p^?k) ((padic_mult p f g) ?k) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
using P 22 padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
k < Suc (nat (padic_val p f + padic_val p g))
padic_mult p f g \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
by (simp add: assms(1) prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
have "((padic_mult p f g) ?k) = residue (p^?k) ?nm"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
using "17" "22" assms(1) padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
nat (padic_val p f) + nat (padic_val p g) < Suc (nat (padic_val p f + padic_val p g))
padic_mult p f g \<in> padic_set p
prime p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "((padic_mult p f g) ?k) = residue (p^?k) ?nm"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
by (simp add: residue_def)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
[PROOF STEP]
have "((padic_mult p f g) ?k) = residue (p^?k) 0"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) 0
[PROOF STEP]
using "20" residue_def
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) (padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))))
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ (nat (padic_val p f) + nat (padic_val p g)) = 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) 0

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = residue (p ^ (nat (padic_val p f) + nat (padic_val p g))) 0

goal (1 subgoal):
 1. padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
by (simp add: residue_def residue_ring_def)
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
proof(cases "k = (nat ?vf + nat ?vg)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k = nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
 2. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k \<noteq> nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k = nat (padic_val p f) + nat (padic_val p g)

goal (2 subgoals):
 1. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k = nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
 2. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k \<noteq> nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = nat (padic_val p f) + nat (padic_val p g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = nat (padic_val p f) + nat (padic_val p g)

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
using P0
[PROOF STATE]
proof (prove)
using this:
k = nat (padic_val p f) + nat (padic_val p g)
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal (1 subgoal):
 1. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k \<noteq> nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k \<noteq> nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
case B: False
[PROOF STATE]
proof (state)
this:
k \<noteq> nat (padic_val p f) + nat (padic_val p g)

goal (1 subgoal):
 1. \<lbrakk>padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>; k \<noteq> nat (padic_val p f) + nat (padic_val p g)\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> nat (padic_val p f) + nat (padic_val p g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<noteq> nat (padic_val p f) + nat (padic_val p g)

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
proof(cases "k=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k = 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
 2. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k = 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
 2. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
using "22" assms(1) padic_set_zero_res residue_ring_def
[PROOF STATE]
proof (prove)
using this:
k = 0
padic_mult p f g \<in> padic_set p
prime p
\<lbrakk>prime ?p; ?f \<in> padic_set ?p\<rbrakk> \<Longrightarrow> ?f 0 = 0
residue_ring ?m = \<lparr>carrier = {0..?m - 1}, monoid.mult = \<lambda>x y. x * y mod ?m, one = 1, zero = 0, add = \<lambda>x y. (x + y) mod ?m\<rparr>

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
case C: False
[PROOF STATE]
proof (state)
this:
k \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k \<noteq> 0
[PROOF STEP]
have "((padic_mult p f g) k) = residue (p^k) ((padic_mult p f g) (nat ?vf + nat ?vg)) "
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0

goal (1 subgoal):
 1. padic_mult p f g k = residue (p ^ k) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
using B P 22 padic_set_res_coherent
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0
k \<noteq> nat (padic_val p f) + nat (padic_val p g)
k < Suc (nat (padic_val p f + padic_val p g))
padic_mult p f g \<in> padic_set p
\<lbrakk>?f \<in> padic_set ?p; ?m \<le> ?n; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) (?f ?n) = ?f ?m

goal (1 subgoal):
 1. padic_mult p f g k = residue (p ^ k) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
by (simp add: assms(1) assms(4) assms(5) padic_val_def prime_gt_0_nat)
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = residue (p ^ k) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_mult p f g k = residue (p ^ k) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))
[PROOF STEP]
have S: "((padic_mult p f g) k) = residue (p^k) \<zero>\<^bsub>residue_ring (p^((nat ?vf + nat ?vg)))\<^esub>"
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g k = residue (p ^ k) (padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)))

goal (1 subgoal):
 1. padic_mult p f g k = residue (p ^ k) \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
[PROOF STEP]
by (simp add: P0)
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = residue (p ^ k) \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
have "residue (p^k) \<in> ring_hom (residue_ring (p^((nat ?vf + nat ?vg)))) (residue_ring (p^k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
[PROOF STEP]
using B P C residue_hom_p
[PROOF STATE]
proof (prove)
using this:
k \<noteq> nat (padic_val p f) + nat (padic_val p g)
k < Suc (nat (padic_val p f + padic_val p g))
k \<noteq> 0
\<lbrakk>?m \<le> ?n; 0 < ?m; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) \<in> ring_hom (residue_ring (?p ^ ?n)) (residue_ring (?p ^ ?m))

goal (1 subgoal):
 1. residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
[PROOF STEP]
using assms(1) assms(4) assms(5) less_Suc0 nat_int not_less_eq of_nat_power padic_val_def prime_nat_int_transfer
[PROOF STATE]
proof (prove)
using this:
k \<noteq> nat (padic_val p f) + nat (padic_val p g)
k < Suc (nat (padic_val p f + padic_val p g))
k \<noteq> 0
\<lbrakk>?m \<le> ?n; 0 < ?m; prime ?p\<rbrakk> \<Longrightarrow> residue (?p ^ ?m) \<in> ring_hom (residue_ring (?p ^ ?n)) (residue_ring (?p ^ ?m))
prime p
f \<noteq> padic_zero p
g \<noteq> padic_zero p
(?n < Suc 0) = (?n = 0)
nat (int ?n) = ?n
(\<not> ?m < ?n) = (?n < Suc ?m)
of_nat (?m ^ ?n) = of_nat ?m ^ ?n
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)
prime (int ?n) = prime ?n

goal (1 subgoal):
 1. residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))

goal (1 subgoal):
 1. \<lbrakk>k \<noteq> nat (padic_val p f) + nat (padic_val p g); k \<noteq> 0\<rbrakk> \<Longrightarrow> padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
using S
[PROOF STATE]
proof (prove)
using this:
residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
padic_mult p f g k = residue (p ^ k) \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
using P0 padic_zero_def padic_zero_simp residue_def
[PROOF STATE]
proof (prove)
using this:
residue (p ^ k) \<in> ring_hom (residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))) (residue_ring (p ^ k))
padic_mult p f g k = residue (p ^ k) \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
padic_mult p f g (nat (padic_val p f) + nat (padic_val p g)) = \<zero>\<^bsub>residue_ring (p ^ (nat (padic_val p f) + nat (padic_val p g)))\<^esub>
padic_zero ?p \<equiv> \<lambda>n. 0
padic_zero ?p ?n = \<zero>\<^bsub>residue_ring (?p ^ ?n)\<^esub>
padic_zero ?p ?n = 0
residue ?n ?m = ?m mod ?n

goal (1 subgoal):
 1. padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
padic_mult p f g k = \<zero>\<^bsub>residue_ring (p ^ k)\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?j < Suc (nat (padic_val p f + padic_val p g)) \<Longrightarrow> padic_mult p f g ?j = \<zero>\<^bsub>residue_ring (p ^ ?j)\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 24: "(padic_mult p f g) (Suc (nat ?vf + nat ?vg)) \<noteq> \<zero>\<^bsub>residue_ring ((p ^ Suc (nat (padic_val p f + padic_val p g))))\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p f g (Suc (nat (padic_val p f) + nat (padic_val p g))) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub>
[PROOF STEP]
by (metis (no_types, lifting) "18" A P assms(4) assms(5) monoid.simps(1) nat_int nat_int_add padic_val_def residue_ring_def ring.simps(1))
[PROOF STATE]
proof (state)
this:
padic_mult p f g (Suc (nat (padic_val p f) + nat (padic_val p g))) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub>

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 25: "padic_val p (padic_mult p f g) = int (LEAST k::nat. ((padic_mult p f g) (Suc k)) \<noteq> \<zero>\<^bsub>residue_ring (p^(Suc k))\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = int (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
using padic_val_def 21
[PROOF STATE]
proof (prove)
using this:
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)
padic_mult p f g \<noteq> padic_zero p

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = int (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_val p (padic_mult p f g) = int (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 26:"(nat (padic_val p f + padic_val p g)) \<in> {k::nat. ((padic_mult p f g) (Suc k)) \<noteq> \<zero>\<^bsub>residue_ring (p^(Suc k))\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) \<in> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}
[PROOF STEP]
using 24
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f) + nat (padic_val p g))) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub>

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) \<in> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}
[PROOF STEP]
using "18" assms(1) prime_gt_0_nat
[PROOF STATE]
proof (prove)
using this:
padic_mult p f g (Suc (nat (padic_val p f) + nat (padic_val p g))) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc (nat (padic_val p f + padic_val p g)))\<^esub>
padic_mult p f g (Suc (nat (padic_val p f + padic_val p g))) mod p ^ Suc (nat (padic_val p f + padic_val p g)) \<noteq> 0
prime p
prime ?p \<Longrightarrow> 0 < ?p

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) \<in> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}
[PROOF STEP]
by (metis (mono_tags, lifting) mem_Collect_eq mod_0 residue_ring_def ring.simps(1))
[PROOF STATE]
proof (state)
this:
nat (padic_val p f + padic_val p g) \<in> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have 27: "\<And> j. j < (nat (padic_val p f + padic_val p g)) \<Longrightarrow>
     j \<notin> {k::nat. ((padic_mult p f g) (Suc k)) \<noteq> \<zero>\<^bsub>residue_ring (p^(Suc k))\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < nat (padic_val p f + padic_val p g) \<Longrightarrow> j \<notin> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}
[PROOF STEP]
by (simp add: "23")
[PROOF STATE]
proof (state)
this:
?j < nat (padic_val p f + padic_val p g) \<Longrightarrow> ?j \<notin> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
have "(nat (padic_val p f + padic_val p g)) = (LEAST k::nat. ((padic_mult p f g) (Suc k)) \<noteq> \<zero>\<^bsub>residue_ring (p^(Suc k))\<^esub>) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
obtain P where C0: "P= (\<lambda> k. ((padic_mult p f g) (Suc k)) \<noteq> \<zero>\<^bsub>residue_ring (p^(Suc k))\<^esub>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. P = (\<lambda>k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P = (\<lambda>k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
obtain x where C1: "x = (nat (padic_val p f + padic_val p g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x = nat (padic_val p f + padic_val p g) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = nat (padic_val p f + padic_val p g)

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
have C2: "P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x
[PROOF STEP]
using "26" C0 C1
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f + padic_val p g) \<in> {k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>}
P = (\<lambda>k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
x = nat (padic_val p f + padic_val p g)

goal (1 subgoal):
 1. P x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P x

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
have C3:"\<And> j. j< x \<Longrightarrow> \<not> P j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. j < x \<Longrightarrow> \<not> P j
[PROOF STEP]
using C0 C1
[PROOF STATE]
proof (prove)
using this:
P = (\<lambda>k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
x = nat (padic_val p f + padic_val p g)

goal (1 subgoal):
 1. \<And>j. j < x \<Longrightarrow> \<not> P j
[PROOF STEP]
by (simp add: "23")
[PROOF STATE]
proof (state)
this:
?j < x \<Longrightarrow> \<not> P ?j

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
have C4: "\<And> j. P j \<Longrightarrow> x \<le>j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. P j \<Longrightarrow> x \<le> j
[PROOF STEP]
using C3 le_less_linear
[PROOF STATE]
proof (prove)
using this:
?j < x \<Longrightarrow> \<not> P ?j
?x \<le> ?y \<or> ?y < ?x

goal (1 subgoal):
 1. \<And>j. P j \<Longrightarrow> x \<le> j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P ?j \<Longrightarrow> x \<le> ?j

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
have "x = (LEAST k. P k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (LEAST k. P k)
[PROOF STEP]
using C2 C4 Least_equality
[PROOF STATE]
proof (prove)
using this:
P x
P ?j \<Longrightarrow> x \<le> ?j
\<lbrakk>?P ?x; \<And>y. ?P y \<Longrightarrow> ?x \<le> y\<rbrakk> \<Longrightarrow> Least ?P = ?x

goal (1 subgoal):
 1. x = (LEAST k. P k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = (LEAST k. P k)

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = (LEAST k. P k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = (LEAST k. P k)

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
using C0 C1
[PROOF STATE]
proof (prove)
using this:
x = (LEAST k. P k)
P = (\<lambda>k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
x = nat (padic_val p f + padic_val p g)

goal (1 subgoal):
 1. nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
[PROOF STEP]
have "padic_val p (padic_mult p f g) = (nat (padic_val p f + padic_val p g))"
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = int (nat (padic_val p f + padic_val p g))
[PROOF STEP]
using "25"
[PROOF STATE]
proof (prove)
using this:
nat (padic_val p f + padic_val p g) = (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)
padic_val p (padic_mult p f g) = int (LEAST k. padic_mult p f g (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (p ^ Suc k)\<^esub>)

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = int (nat (padic_val p f + padic_val p g))
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
padic_val p (padic_mult p f g) = int (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_val p (padic_mult p f g) = int (nat (padic_val p f + padic_val p g))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
padic_val p (padic_mult p f g) = int (nat (padic_val p f + padic_val p g))

goal (1 subgoal):
 1. padic_val p (padic_mult p f g) = padic_val p f + padic_val p g
[PROOF STEP]
by (simp add: assms(4) assms(5) padic_val_def)
[PROOF STATE]
proof (state)
this:
padic_val p (padic_mult p f g) = padic_val p f + padic_val p g

goal:
No subgoals!
[PROOF STEP]
qed