Metamath Proof Explorer


Theorem bezout

Description: Bézout's identity: For any integers A and B , there are integers x , y such that ( A gcd B ) = A x. x + B x. y . This is Metamath 100 proof #60. (Contributed by Mario Carneiro, 22-Feb-2014)

Ref Expression
Assertion bezout ABxyAgcdB=Ax+By

Proof

Step Hyp Ref Expression
1 eqeq1 z=tz=Ax+Byt=Ax+By
2 1 2rexbidv z=txyz=Ax+Byxyt=Ax+By
3 oveq2 x=uAx=Au
4 3 oveq1d x=uAx+By=Au+By
5 4 eqeq2d x=ut=Ax+Byt=Au+By
6 oveq2 y=vBy=Bv
7 6 oveq2d y=vAu+By=Au+Bv
8 7 eqeq2d y=vt=Au+Byt=Au+Bv
9 5 8 cbvrex2vw xyt=Ax+Byuvt=Au+Bv
10 2 9 bitrdi z=txyz=Ax+Byuvt=Au+Bv
11 10 cbvrabv z|xyz=Ax+By=t|uvt=Au+Bv
12 simpll AB¬A=0B=0A
13 simplr AB¬A=0B=0B
14 eqid supz|xyz=Ax+By<=supz|xyz=Ax+By<
15 simpr AB¬A=0B=0¬A=0B=0
16 11 12 13 14 15 bezoutlem4 AB¬A=0B=0AgcdBz|xyz=Ax+By
17 eqeq1 z=AgcdBz=Ax+ByAgcdB=Ax+By
18 17 2rexbidv z=AgcdBxyz=Ax+ByxyAgcdB=Ax+By
19 18 elrab AgcdBz|xyz=Ax+ByAgcdBxyAgcdB=Ax+By
20 19 simprbi AgcdBz|xyz=Ax+ByxyAgcdB=Ax+By
21 16 20 syl AB¬A=0B=0xyAgcdB=Ax+By
22 21 ex AB¬A=0B=0xyAgcdB=Ax+By
23 0z 0
24 00id 0+0=0
25 0cn 0
26 25 mul01i 00=0
27 26 26 oveq12i 00+00=0+0
28 gcd0val 0gcd0=0
29 24 27 28 3eqtr4ri 0gcd0=00+00
30 oveq2 x=00x=00
31 30 oveq1d x=00x+0y=00+0y
32 31 eqeq2d x=00gcd0=0x+0y0gcd0=00+0y
33 oveq2 y=00y=00
34 33 oveq2d y=000+0y=00+00
35 34 eqeq2d y=00gcd0=00+0y0gcd0=00+00
36 32 35 rspc2ev 000gcd0=00+00xy0gcd0=0x+0y
37 23 23 29 36 mp3an xy0gcd0=0x+0y
38 oveq12 A=0B=0AgcdB=0gcd0
39 oveq1 A=0Ax=0x
40 oveq1 B=0By=0y
41 39 40 oveqan12d A=0B=0Ax+By=0x+0y
42 38 41 eqeq12d A=0B=0AgcdB=Ax+By0gcd0=0x+0y
43 42 2rexbidv A=0B=0xyAgcdB=Ax+Byxy0gcd0=0x+0y
44 37 43 mpbiri A=0B=0xyAgcdB=Ax+By
45 22 44 pm2.61d2 ABxyAgcdB=Ax+By