I'm trying to learn how to use Isabelle/Isar with HOL, and I decided a good way to do that would be to develop some elementary number theory. I defined my own plus and times operations so that proof methods wouldn't be doing all the work for me as there's already plenty proved about +, * in Main. My versions are defined as:
fun p:: "nat ⇒ nat ⇒ nat" (infix "⊕" 80) where
p_0: "0 ⊕ n =n" |
p_rec: " (Suc m) ⊕ n = Suc (m ⊕ n)"
fun t:: "nat ⇒ nat ⇒ nat" (infix "⊗" 90) where
t_0: "0 ⊗ n= 0" |
t_rec: "Suc m ⊗ n = n + m ⊗ n"
and I've already shown that multiplication and addition are commutative the distributive law holds. Then I tried to show the following:
lemma euclidean_division_existence: "∃q r. n=q⊗m⊕r"
proof (induction n)
case 0
have "0= 0 ⊗ m" by auto
hence "∃q. 0 =q ⊗ m" by auto
but it's telling me it can't finish the proof of the last step. I've tried various things, but I can't figure out how to tell Isabelle I just gave it a witness for the existence statement I'm trying to prove. How can I make Isabelle recognize that?
Edit:
xanonec helped me get past this step, but I immediately got stuck on the next step by a seemingly similar problem. Ultimately I want to show:
"∃ q r. 0 = q ⊗ m⊕r"
but I can't figure out how to simultaneously introduce the two existentially quantified variable from
"0 = 0 ⊗ m ⊕ 0"