I wanted to prove group properties over integer. I found the setoid representation of integer makes proof easy.
ℤ
is defined as (ℕ , ℕ)
such that (a , b)
represents a - b
zero : ℤ
zero = 0 , 0
I have already proven
leftIdZ : (a : ℤ) → zero + a ≡ a
rightIdZ : (a : ℤ) → a + zero ≡ a
zpre
and zsuc
is defined as
zsuc : ℤ → ℤ
zsuc (m , n) = suc m , n
zpre : ℤ → ℤ
zpre (m , n) = m , suc n
I would like to prove the commutativity of addition:
commZ-+ : (a b : ℤ) → a + b ≡ b + a
commZ-+ (ℕ.zero , ℕ.zero) b = sym (trans (rightIdZ b) (sym (leftIdZ b)))
commZ-+ (ℕ.zero , suc x₁) (ℕ.zero , ℕ.zero) = rightIdZ (ℕ.zero , suc x₁)
commZ-+ (ℕ.zero , suc x₁) (ℕ.zero , suc x₃) = cong zpre {!!}
commZ-+ (ℕ.zero , suc x₁) (suc x₂ , x₃) = cong zsuc {!!}
commZ-+ (suc x , x₁) (x₂ , x₃) = {!!}
I found somewhere they are proving this by using agda library. But i tried in that way (above).
The problem reduced to proof 0 , (x₁ ℕ.+ suc x₃) ≡ 0 , (x₃ ℕ.+ suc x₁)
I had proof of this lemma : lemma-+succ : ∀ a b → suc a + b ≡ a + suc b
I know some how this lemma will be used to prove above reduced goal but it return type is Set
whereas above that is expecting integer.
Is there any efficient way of doing this?? or How should i do this?? Please help.