Metamath Proof Explorer


Theorem hashfz

Description: Value of the numeric cardinality of a nonempty integer range. (Contributed by Stefan O'Rear, 12-Sep-2014) (Proof shortened by Mario Carneiro, 15-Apr-2015)

Ref Expression
Assertion hashfz B A A B = B - A + 1

Proof

Step Hyp Ref Expression
1 eluzel2 B A A
2 eluzelz B A B
3 1z 1
4 zsubcl 1 A 1 A
5 3 1 4 sylancr B A 1 A
6 fzen A B 1 A A B A + 1 - A B + 1 - A
7 1 2 5 6 syl3anc B A A B A + 1 - A B + 1 - A
8 1 zcnd B A A
9 ax-1cn 1
10 pncan3 A 1 A + 1 - A = 1
11 8 9 10 sylancl B A A + 1 - A = 1
12 1cnd B A 1
13 2 zcnd B A B
14 13 8 subcld B A B A
15 13 12 8 addsub12d B A B + 1 - A = 1 + B - A
16 12 14 15 comraddd B A B + 1 - A = B - A + 1
17 11 16 oveq12d B A A + 1 - A B + 1 - A = 1 B - A + 1
18 7 17 breqtrd B A A B 1 B - A + 1
19 hasheni A B 1 B - A + 1 A B = 1 B - A + 1
20 18 19 syl B A A B = 1 B - A + 1
21 uznn0sub B A B A 0
22 peano2nn0 B A 0 B - A + 1 0
23 hashfz1 B - A + 1 0 1 B - A + 1 = B - A + 1
24 21 22 23 3syl B A 1 B - A + 1 = B - A + 1
25 20 24 eqtrd B A A B = B - A + 1