Im trying to prove commutativity in Isabelle / HOL for a self-defined function add. I managed to prove associativity, but I was stuck on this.
Definition add:
fun add :: "nat ⇒ nat ⇒ nat" where
"add 0 n = n" |
"add (Suc m) n = Suc(add m n)"
Associative Proof:
lemma add_Associative: "add(add k m) z = add k (add m z)"
apply(induction k)
apply(auto)
done
Proof of commutativity:
theorem add_commutativity: "add k m = add m k"
apply(induction k)
apply(induction m)
apply(auto)
I get the following goals:
goal (3 subgoals):
1. add 0 0 = add 0 0
2. ⋀m. add 0 m = add m 0 ⟹
add 0 (Suc m) = add (Suc m) 0
3. ⋀k. add k m = add m k ⟹
add (Suc k) m = add m (Suc k)
After applying auto, I only have subtitle 3 left:
3. ⋀k. add k m = add m k ⟹
add (Suc k) m = add m (Suc k)
EDIT: I'm not really looking for an answer, like a push in the right direction. These are exercises from a book called Concrete Sementics.
source
share