Metamath Proof Explorer


Theorem nnaddcom

Description: Addition is commutative for natural numbers. Uses fewer axioms than addcom . (Contributed by Steven Nguyen, 9-Dec-2022)

Ref Expression
Assertion nnaddcom ( ( 𝐴 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( 𝐴 + 𝐵 ) = ( 𝐵 + 𝐴 ) )

Proof

Step Hyp Ref Expression
1 oveq1 ( 𝑥 = 1 → ( 𝑥 + 𝐵 ) = ( 1 + 𝐵 ) )
2 oveq2 ( 𝑥 = 1 → ( 𝐵 + 𝑥 ) = ( 𝐵 + 1 ) )
3 1 2 eqeq12d ( 𝑥 = 1 → ( ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ↔ ( 1 + 𝐵 ) = ( 𝐵 + 1 ) ) )
4 3 imbi2d ( 𝑥 = 1 → ( ( 𝐵 ∈ ℕ → ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ) ↔ ( 𝐵 ∈ ℕ → ( 1 + 𝐵 ) = ( 𝐵 + 1 ) ) ) )
5 oveq1 ( 𝑥 = 𝑦 → ( 𝑥 + 𝐵 ) = ( 𝑦 + 𝐵 ) )
6 oveq2 ( 𝑥 = 𝑦 → ( 𝐵 + 𝑥 ) = ( 𝐵 + 𝑦 ) )
7 5 6 eqeq12d ( 𝑥 = 𝑦 → ( ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ↔ ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) ) )
8 7 imbi2d ( 𝑥 = 𝑦 → ( ( 𝐵 ∈ ℕ → ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ) ↔ ( 𝐵 ∈ ℕ → ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) ) ) )
9 oveq1 ( 𝑥 = ( 𝑦 + 1 ) → ( 𝑥 + 𝐵 ) = ( ( 𝑦 + 1 ) + 𝐵 ) )
10 oveq2 ( 𝑥 = ( 𝑦 + 1 ) → ( 𝐵 + 𝑥 ) = ( 𝐵 + ( 𝑦 + 1 ) ) )
11 9 10 eqeq12d ( 𝑥 = ( 𝑦 + 1 ) → ( ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ↔ ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) )
12 11 imbi2d ( 𝑥 = ( 𝑦 + 1 ) → ( ( 𝐵 ∈ ℕ → ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ) ↔ ( 𝐵 ∈ ℕ → ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) ) )
13 oveq1 ( 𝑥 = 𝐴 → ( 𝑥 + 𝐵 ) = ( 𝐴 + 𝐵 ) )
14 oveq2 ( 𝑥 = 𝐴 → ( 𝐵 + 𝑥 ) = ( 𝐵 + 𝐴 ) )
15 13 14 eqeq12d ( 𝑥 = 𝐴 → ( ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ↔ ( 𝐴 + 𝐵 ) = ( 𝐵 + 𝐴 ) ) )
16 15 imbi2d ( 𝑥 = 𝐴 → ( ( 𝐵 ∈ ℕ → ( 𝑥 + 𝐵 ) = ( 𝐵 + 𝑥 ) ) ↔ ( 𝐵 ∈ ℕ → ( 𝐴 + 𝐵 ) = ( 𝐵 + 𝐴 ) ) ) )
17 nnadd1com ( 𝐵 ∈ ℕ → ( 𝐵 + 1 ) = ( 1 + 𝐵 ) )
18 17 eqcomd ( 𝐵 ∈ ℕ → ( 1 + 𝐵 ) = ( 𝐵 + 1 ) )
19 oveq1 ( ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) → ( ( 𝑦 + 𝐵 ) + 1 ) = ( ( 𝐵 + 𝑦 ) + 1 ) )
20 17 oveq2d ( 𝐵 ∈ ℕ → ( 𝑦 + ( 𝐵 + 1 ) ) = ( 𝑦 + ( 1 + 𝐵 ) ) )
21 20 adantl ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( 𝑦 + ( 𝐵 + 1 ) ) = ( 𝑦 + ( 1 + 𝐵 ) ) )
22 nncn ( 𝑦 ∈ ℕ → 𝑦 ∈ ℂ )
23 22 adantr ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → 𝑦 ∈ ℂ )
24 nncn ( 𝐵 ∈ ℕ → 𝐵 ∈ ℂ )
25 24 adantl ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → 𝐵 ∈ ℂ )
26 1cnd ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → 1 ∈ ℂ )
27 23 25 26 addassd ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( 𝑦 + 𝐵 ) + 1 ) = ( 𝑦 + ( 𝐵 + 1 ) ) )
28 23 26 25 addassd ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝑦 + ( 1 + 𝐵 ) ) )
29 21 27 28 3eqtr4d ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( 𝑦 + 𝐵 ) + 1 ) = ( ( 𝑦 + 1 ) + 𝐵 ) )
30 25 23 26 addassd ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( 𝐵 + 𝑦 ) + 1 ) = ( 𝐵 + ( 𝑦 + 1 ) ) )
31 29 30 eqeq12d ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( ( 𝑦 + 𝐵 ) + 1 ) = ( ( 𝐵 + 𝑦 ) + 1 ) ↔ ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) )
32 19 31 syl5ib ( ( 𝑦 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) → ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) )
33 32 ex ( 𝑦 ∈ ℕ → ( 𝐵 ∈ ℕ → ( ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) → ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) ) )
34 33 a2d ( 𝑦 ∈ ℕ → ( ( 𝐵 ∈ ℕ → ( 𝑦 + 𝐵 ) = ( 𝐵 + 𝑦 ) ) → ( 𝐵 ∈ ℕ → ( ( 𝑦 + 1 ) + 𝐵 ) = ( 𝐵 + ( 𝑦 + 1 ) ) ) ) )
35 4 8 12 16 18 34 nnind ( 𝐴 ∈ ℕ → ( 𝐵 ∈ ℕ → ( 𝐴 + 𝐵 ) = ( 𝐵 + 𝐴 ) ) )
36 35 imp ( ( 𝐴 ∈ ℕ ∧ 𝐵 ∈ ℕ ) → ( 𝐴 + 𝐵 ) = ( 𝐵 + 𝐴 ) )