HomeHome Intuitionistic Logic Explorer
Theorem List (p. 120 of 141)
< Previous  Next >
Browser slow? Try the
Unicode version.

Mirrors  >  Metamath Home Page  >  ILE Home Page  >  Theorem List Contents  >  Recent Proofs       This page: Page List

Theorem List for Intuitionistic Logic Explorer - 11901-12000   *Has distinct variable group(s)
TypeLabelDescription
Statement
 
Theoremgcdval 11901* The value of the  gcd operator.  ( M  gcd  N ) is the greatest common divisor of  M and  N. If  M and  N are both  0, the result is defined conventionally as  0. (Contributed by Paul Chapman, 21-Mar-2011.) (Revised by Mario Carneiro, 10-Nov-2013.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  =  if (
 ( M  =  0 
 /\  N  =  0 ) ,  0 , 
 sup ( { n  e.  ZZ  |  ( n 
 ||  M  /\  n  ||  N ) } ,  RR ,  <  ) ) )
 
Theoremgcd0val 11902 The value, by convention, of the 
gcd operator when both operands are 0. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( 0  gcd  0
 )  =  0
 
Theoremgcdn0val 11903* The value of the  gcd operator when at least one operand is nonzero. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  ( M  gcd  N )  =  sup ( { n  e.  ZZ  |  ( n  ||  M  /\  n  ||  N ) } ,  RR ,  <  ) )
 
Theoremgcdn0cl 11904 Closure of the  gcd operator. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( ( M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 ) )  ->  ( M  gcd  N )  e.  NN )
 
Theoremgcddvds 11905 The gcd of two integers divides each of them. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( M 
 gcd  N )  ||  M  /\  ( M  gcd  N )  ||  N ) )
 
Theoremdvdslegcd 11906 An integer which divides both operands of the  gcd operator is bounded by it. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( ( K  e.  ZZ  /\  M  e.  ZZ  /\  N  e.  ZZ )  /\  -.  ( M  =  0  /\  N  =  0 )
 )  ->  ( ( K  ||  M  /\  K  ||  N )  ->  K  <_  ( M  gcd  N ) ) )
 
Theoremnndvdslegcd 11907 A positive integer which divides both positive operands of the  gcd operator is bounded by it. (Contributed by AV, 9-Aug-2020.)
 |-  ( ( K  e.  NN  /\  M  e.  NN  /\  N  e.  NN )  ->  ( ( K  ||  M  /\  K  ||  N )  ->  K  <_  ( M  gcd  N ) ) )
 
Theoremgcdcl 11908 Closure of the  gcd operator. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  e.  NN0 )
 
Theoremgcdnncl 11909 Closure of the  gcd operator. (Contributed by Thierry Arnoux, 2-Feb-2020.)
 |-  ( ( M  e.  NN  /\  N  e.  NN )  ->  ( M  gcd  N )  e.  NN )
 
Theoremgcdcld 11910 Closure of the  gcd operator. (Contributed by Mario Carneiro, 29-May-2016.)
 |-  ( ph  ->  M  e.  ZZ )   &    |-  ( ph  ->  N  e.  ZZ )   =>    |-  ( ph  ->  ( M  gcd  N )  e.  NN0 )
 
Theoremgcd2n0cl 11911 Closure of the  gcd operator if the second operand is not 0. (Contributed by AV, 10-Jul-2021.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ  /\  N  =/=  0 ) 
 ->  ( M  gcd  N )  e.  NN )
 
Theoremzeqzmulgcd 11912* An integer is the product of an integer and the gcd of it and another integer. (Contributed by AV, 11-Jul-2021.)
 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  E. n  e.  ZZ  A  =  ( n  x.  ( A  gcd  B ) ) )
 
Theoremdivgcdz 11913 An integer divided by the gcd of it and a nonzero integer is an integer. (Contributed by AV, 11-Jul-2021.)
 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ  /\  B  =/=  0 ) 
 ->  ( A  /  ( A  gcd  B ) )  e.  ZZ )
 
Theoremgcdf 11914 Domain and codomain of the  gcd operator. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 16-Nov-2013.)
 |- 
 gcd  : ( ZZ  X.  ZZ ) --> NN0
 
Theoremgcdcom 11915 The  gcd operator is commutative. Theorem 1.4(a) in [ApostolNT] p. 16. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  =  ( N 
 gcd  M ) )
 
Theoremgcdcomd 11916 The  gcd operator is commutative, deduction version. (Contributed by SN, 24-Aug-2024.)
 |-  ( ph  ->  M  e.  ZZ )   &    |-  ( ph  ->  N  e.  ZZ )   =>    |-  ( ph  ->  ( M  gcd  N )  =  ( N  gcd  M ) )
 
Theoremdivgcdnn 11917 A positive integer divided by the gcd of it and another integer is a positive integer. (Contributed by AV, 10-Jul-2021.)
 |-  ( ( A  e.  NN  /\  B  e.  ZZ )  ->  ( A  /  ( A  gcd  B ) )  e.  NN )
 
Theoremdivgcdnnr 11918 A positive integer divided by the gcd of it and another integer is a positive integer. (Contributed by AV, 10-Jul-2021.)
 |-  ( ( A  e.  NN  /\  B  e.  ZZ )  ->  ( A  /  ( B  gcd  A ) )  e.  NN )
 
Theoremgcdeq0 11919 The gcd of two integers is zero iff they are both zero. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( M 
 gcd  N )  =  0  <-> 
 ( M  =  0 
 /\  N  =  0 ) ) )
 
Theoremgcdn0gt0 11920 The gcd of two integers is positive (nonzero) iff they are not both zero. (Contributed by Paul Chapman, 22-Jun-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( -.  ( M  =  0  /\  N  =  0 )  <->  0  <  ( M  gcd  N ) ) )
 
Theoremgcd0id 11921 The gcd of 0 and an integer is the integer's absolute value. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( N  e.  ZZ  ->  ( 0  gcd  N )  =  ( abs `  N ) )
 
Theoremgcdid0 11922 The gcd of an integer and 0 is the integer's absolute value. Theorem 1.4(d)2 in [ApostolNT] p. 16. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( N  e.  ZZ  ->  ( N  gcd  0
 )  =  ( abs `  N ) )
 
Theoremnn0gcdid0 11923 The gcd of a nonnegative integer with 0 is itself. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( N  e.  NN0  ->  ( N  gcd  0 )  =  N )
 
Theoremgcdneg 11924 Negating one operand of the  gcd operator does not alter the result. (Contributed by Paul Chapman, 21-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  -u N )  =  ( M  gcd  N ) )
 
Theoremneggcd 11925 Negating one operand of the  gcd operator does not alter the result. (Contributed by Paul Chapman, 22-Jun-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( -u M  gcd  N )  =  ( M  gcd  N ) )
 
Theoremgcdaddm 11926 Adding a multiple of one operand of the  gcd operator to the other does not alter the result. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( ( K  e.  ZZ  /\  M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  =  ( M  gcd  ( N  +  ( K  x.  M ) ) ) )
 
Theoremgcdadd 11927 The GCD of two numbers is the same as the GCD of the left and their sum. (Contributed by Scott Fenton, 20-Apr-2014.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  =  ( M 
 gcd  ( N  +  M ) ) )
 
Theoremgcdid 11928 The gcd of a number and itself is its absolute value. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( N  e.  ZZ  ->  ( N  gcd  N )  =  ( abs `  N ) )
 
Theoremgcd1 11929 The gcd of a number with 1 is 1. Theorem 1.4(d)1 in [ApostolNT] p. 16. (Contributed by Mario Carneiro, 19-Feb-2014.)
 |-  ( M  e.  ZZ  ->  ( M  gcd  1
 )  =  1 )
 
Theoremgcdabs 11930 The gcd of two integers is the same as that of their absolute values. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( abs `  M )  gcd  ( abs `  N ) )  =  ( M  gcd  N ) )
 
Theoremgcdabs1 11931  gcd of the absolute value of the first operator. (Contributed by Scott Fenton, 2-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( N  e.  ZZ  /\  M  e.  ZZ )  ->  ( ( abs `  N )  gcd  M )  =  ( N  gcd  M ) )
 
Theoremgcdabs2 11932  gcd of the absolute value of the second operator. (Contributed by Scott Fenton, 2-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( N  e.  ZZ  /\  M  e.  ZZ )  ->  ( N  gcd  ( abs `  M )
 )  =  ( N 
 gcd  M ) )
 
Theoremmodgcd 11933 The gcd remains unchanged if one operand is replaced with its remainder modulo the other. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( ( M  e.  ZZ  /\  N  e.  NN )  ->  ( ( M 
 mod  N )  gcd  N )  =  ( M  gcd  N ) )
 
Theorem1gcd 11934 The GCD of one and an integer is one. (Contributed by Scott Fenton, 17-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( M  e.  ZZ  ->  ( 1  gcd  M )  =  1 )
 
Theoremgcdmultipled 11935 The greatest common divisor of a nonnegative integer  M and a multiple of it is  M itself. (Contributed by Rohan Ridenour, 3-Aug-2023.)
 |-  ( ph  ->  M  e.  NN0 )   &    |-  ( ph  ->  N  e.  ZZ )   =>    |-  ( ph  ->  ( M  gcd  ( N  x.  M ) )  =  M )
 
Theoremdvdsgcdidd 11936 The greatest common divisor of a positive integer and another integer it divides is itself. (Contributed by Rohan Ridenour, 3-Aug-2023.)
 |-  ( ph  ->  M  e.  NN )   &    |-  ( ph  ->  N  e.  ZZ )   &    |-  ( ph  ->  M  ||  N )   =>    |-  ( ph  ->  ( M  gcd  N )  =  M )
 
Theorem6gcd4e2 11937 The greatest common divisor of six and four is two. To calculate this gcd, a simple form of Euclid's algorithm is used:  ( 6  gcd  4 )  =  ( ( 4  +  2 )  gcd  4 )  =  ( 2  gcd  4 ) and  ( 2  gcd  4 )  =  ( 2  gcd  ( 2  +  2 ) )  =  ( 2  gcd  2 )  =  2. (Contributed by AV, 27-Aug-2020.)
 |-  ( 6  gcd  4
 )  =  2
 
5.1.5  Bézout's identity
 
Theorembezoutlemnewy 11938* Lemma for Bézout's identity. The is-bezout predicate holds for  ( y  mod 
W ). (Contributed by Jim Kingdon, 6-Jan-2022.)
 |-  ( ph  <->  E. s  e.  ZZ  E. t  e.  ZZ  r  =  ( ( A  x.  s )  +  ( B  x.  t ) ) )   &    |-  ( th  ->  A  e.  NN0 )   &    |-  ( th  ->  B  e.  NN0 )   &    |-  ( th  ->  W  e.  NN )   &    |-  ( th  ->  [ y  /  r ] ph )   &    |-  ( th  ->  y  e.  NN0 )   &    |-  ( th  ->  [. W  /  r ]. ph )   =>    |-  ( th  ->  [. ( y  mod  W )  /  r ]. ph )
 
Theorembezoutlemstep 11939* Lemma for Bézout's identity. This is the induction step for the proof by induction. (Contributed by Jim Kingdon, 3-Jan-2022.)
 |-  ( ph  <->  E. s  e.  ZZ  E. t  e.  ZZ  r  =  ( ( A  x.  s )  +  ( B  x.  t ) ) )   &    |-  ( th  ->  A  e.  NN0 )   &    |-  ( th  ->  B  e.  NN0 )   &    |-  ( th  ->  W  e.  NN )   &    |-  ( th  ->  [ y  /  r ] ph )   &    |-  ( th  ->  y  e.  NN0 )   &    |-  ( th  ->  [. W  /  r ]. ph )   &    |-  ( ps 
 <-> 
 A. z  e.  NN0  ( z  ||  r  ->  ( z  ||  x  /\  z  ||  y ) ) )   &    |-  ( ( th  /\  [. ( y  mod  W )  /  r ]. ph )  ->  E. r  e.  NN0  ( [. ( y  mod  W )  /  x ]. [. W  /  y ]. ps  /\  ph ) )   &    |-  F/ x th   &    |-  F/ r th   =>    |-  ( th  ->  E. r  e.  NN0  ( [. W  /  x ].
 ps  /\  ph ) )
 
Theorembezoutlemmain 11940* Lemma for Bézout's identity. This is the main result which we prove by induction and which represents the application of the Extended Euclidean algorithm. (Contributed by Jim Kingdon, 30-Dec-2021.)
 |-  ( ph  <->  E. s  e.  ZZ  E. t  e.  ZZ  r  =  ( ( A  x.  s )  +  ( B  x.  t ) ) )   &    |-  ( ps  <->  A. z  e.  NN0  ( z  ||  r  ->  ( z  ||  x  /\  z  ||  y ) ) )   &    |-  ( th  ->  A  e.  NN0 )   &    |-  ( th  ->  B  e.  NN0 )   =>    |-  ( th  ->  A. x  e.  NN0  ( [ x  /  r ] ph  ->  A. y  e.  NN0  ( [ y  /  r ] ph  ->  E. r  e.  NN0  ( ps  /\  ph ) ) ) )
 
Theorembezoutlema 11941* Lemma for Bézout's identity. The is-bezout condition is satisfied by  A. (Contributed by Jim Kingdon, 30-Dec-2021.)
 |-  ( ph  <->  E. s  e.  ZZ  E. t  e.  ZZ  r  =  ( ( A  x.  s )  +  ( B  x.  t ) ) )   &    |-  ( th  ->  A  e.  NN0 )   &    |-  ( th  ->  B  e.  NN0 )   =>    |-  ( th  ->  [. A  /  r ]. ph )
 
Theorembezoutlemb 11942* Lemma for Bézout's identity. The is-bezout condition is satisfied by  B. (Contributed by Jim Kingdon, 30-Dec-2021.)
 |-  ( ph  <->  E. s  e.  ZZ  E. t  e.  ZZ  r  =  ( ( A  x.  s )  +  ( B  x.  t ) ) )   &    |-  ( th  ->  A  e.  NN0 )   &    |-  ( th  ->  B  e.  NN0 )   =>    |-  ( th  ->  [. B  /  r ]. ph )
 
Theorembezoutlemex 11943* Lemma for Bézout's identity. Existence of a number which we will later show to be the greater common divisor and its decomposition into cofactors. (Contributed by Mario Carneiro and Jim Kingdon, 3-Jan-2022.)
 |-  ( ( A  e.  NN0  /\  B  e.  NN0 )  ->  E. d  e.  NN0  ( A. z  e.  NN0  ( z  ||  d  ->  ( z  ||  A  /\  z  ||  B ) ) 
 /\  E. x  e.  ZZ  E. y  e.  ZZ  d  =  ( ( A  x.  x )  +  ( B  x.  y ) ) ) )
 
Theorembezoutlemzz 11944* Lemma for Bézout's identity. Like bezoutlemex 11943 but where ' z ' is any integer, not just a nonnegative one. (Contributed by Mario Carneiro and Jim Kingdon, 8-Jan-2022.)
 |-  ( ( A  e.  NN0  /\  B  e.  NN0 )  ->  E. d  e.  NN0  ( A. z  e.  ZZ  ( z  ||  d  ->  ( z  ||  A  /\  z  ||  B ) ) 
 /\  E. x  e.  ZZ  E. y  e.  ZZ  d  =  ( ( A  x.  x )  +  ( B  x.  y ) ) ) )
 
Theorembezoutlemaz 11945* Lemma for Bézout's identity. Like bezoutlemzz 11944 but where ' A ' can be any integer, not just a nonnegative one. (Contributed by Mario Carneiro and Jim Kingdon, 8-Jan-2022.)
 |-  ( ( A  e.  ZZ  /\  B  e.  NN0 )  ->  E. d  e.  NN0  ( A. z  e.  ZZ  ( z  ||  d  ->  ( z  ||  A  /\  z  ||  B ) ) 
 /\  E. x  e.  ZZ  E. y  e.  ZZ  d  =  ( ( A  x.  x )  +  ( B  x.  y ) ) ) )
 
Theorembezoutlembz 11946* Lemma for Bézout's identity. Like bezoutlemaz 11945 but where ' B ' can be any integer, not just a nonnegative one. (Contributed by Mario Carneiro and Jim Kingdon, 8-Jan-2022.)
 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  E. d  e.  NN0  ( A. z  e.  ZZ  ( z  ||  d  ->  ( z  ||  A  /\  z  ||  B ) ) 
 /\  E. x  e.  ZZ  E. y  e.  ZZ  d  =  ( ( A  x.  x )  +  ( B  x.  y ) ) ) )
 
Theorembezoutlembi 11947* Lemma for Bézout's identity. Like bezoutlembz 11946 but the greatest common divisor condition is a biconditional, not just an implication. (Contributed by Mario Carneiro and Jim Kingdon, 8-Jan-2022.)
 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  E. d  e.  NN0  ( A. z  e.  ZZ  ( z  ||  d  <->  ( z  ||  A  /\  z  ||  B ) )  /\  E. x  e.  ZZ  E. y  e. 
 ZZ  d  =  ( ( A  x.  x )  +  ( B  x.  y ) ) ) )
 
Theorembezoutlemmo 11948* Lemma for Bézout's identity. There is at most one nonnegative integer meeting the greatest common divisor condition. (Contributed by Mario Carneiro and Jim Kingdon, 9-Jan-2022.)
 |-  ( ph  ->  A  e.  ZZ )   &    |-  ( ph  ->  B  e.  ZZ )   &    |-  ( ph  ->  D  e.  NN0 )   &    |-  ( ph  ->  A. z  e.  ZZ  ( z  ||  D 
 <->  ( z  ||  A  /\  z  ||  B ) ) )   &    |-  ( ph  ->  E  e.  NN0 )   &    |-  ( ph  ->  A. z  e.  ZZ  (
 z  ||  E  <->  ( z  ||  A  /\  z  ||  B ) ) )   =>    |-  ( ph  ->  D  =  E )
 
Theorembezoutlemeu 11949* Lemma for Bézout's identity. There is exactly one nonnegative integer meeting the greatest common divisor condition. (Contributed by Mario Carneiro and Jim Kingdon, 9-Jan-2022.)
 |-  ( ph  ->  A  e.  ZZ )   &    |-  ( ph  ->  B  e.  ZZ )   &    |-  ( ph  ->  D  e.  NN0 )   &    |-  ( ph  ->  A. z  e.  ZZ  ( z  ||  D 
 <->  ( z  ||  A  /\  z  ||  B ) ) )   =>    |-  ( ph  ->  E! d  e.  NN0  A. z  e.  ZZ  ( z  ||  d 
 <->  ( z  ||  A  /\  z  ||  B ) ) )
 
Theorembezoutlemle 11950* Lemma for Bézout's identity. The number satisfying the greatest common divisor condition is the largest number which divides both  A and  B. (Contributed by Mario Carneiro and Jim Kingdon, 9-Jan-2022.)
 |-  ( ph  ->  A  e.  ZZ )   &    |-  ( ph  ->  B  e.  ZZ )   &    |-  ( ph  ->  D  e.  NN0 )   &    |-  ( ph  ->  A. z  e.  ZZ  ( z  ||  D 
 <->  ( z  ||  A  /\  z  ||  B ) ) )   &    |-  ( ph  ->  -.  ( A  =  0 
 /\  B  =  0 ) )   =>    |-  ( ph  ->  A. z  e.  ZZ  ( ( z 
 ||  A  /\  z  ||  B )  ->  z  <_  D ) )
 
Theorembezoutlemsup 11951* Lemma for Bézout's identity. The number satisfying the greatest common divisor condition is the supremum of divisors of both  A and  B. (Contributed by Mario Carneiro and Jim Kingdon, 9-Jan-2022.)
 |-  ( ph  ->  A  e.  ZZ )   &    |-  ( ph  ->  B  e.  ZZ )   &    |-  ( ph  ->  D  e.  NN0 )   &    |-  ( ph  ->  A. z  e.  ZZ  ( z  ||  D 
 <->  ( z  ||  A  /\  z  ||  B ) ) )   &    |-  ( ph  ->  -.  ( A  =  0 
 /\  B  =  0 ) )   =>    |-  ( ph  ->  D  =  sup ( { z  e.  ZZ  |  ( z 
 ||  A  /\  z  ||  B ) } ,  RR ,  <  ) )
 
Theoremdfgcd3 11952* Alternate definition of the  gcd operator. (Contributed by Jim Kingdon, 31-Dec-2021.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  gcd  N )  =  ( iota_ d  e.  NN0  A. z  e. 
 ZZ  ( z  ||  d 
 <->  ( z  ||  M  /\  z  ||  N ) ) ) )
 
Theorembezout 11953* 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.

The proof is constructive, in the sense that it applies the Extended Euclidian Algorithm to constuct a number which can be shown to be  ( A  gcd  B ) and which satisfies the rest of the theorem. In the presence of excluded middle, it is common to prove Bézout's identity by taking the smallest number which satisfies the Bézout condition, and showing it is the greatest common divisor. But we do not have the ability to show that number exists other than by providing a way to determine it. (Contributed by Mario Carneiro, 22-Feb-2014.)

 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ )  ->  E. x  e.  ZZ  E. y  e.  ZZ  ( A  gcd  B )  =  ( ( A  x.  x )  +  ( B  x.  y ) ) )
 
Theoremdvdsgcd 11954 An integer which divides each of two others also divides their gcd. (Contributed by Paul Chapman, 22-Jun-2011.) (Revised by Mario Carneiro, 30-May-2014.)
 |-  ( ( K  e.  ZZ  /\  M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( K  ||  M  /\  K  ||  N )  ->  K  ||  ( M  gcd  N ) ) )
 
Theoremdvdsgcdb 11955 Biconditional form of dvdsgcd 11954. (Contributed by Scott Fenton, 2-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( K  e.  ZZ  /\  M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( K  ||  M  /\  K  ||  N ) 
 <->  K  ||  ( M  gcd  N ) ) )
 
Theoremdfgcd2 11956* Alternate definition of the  gcd operator, see definition in [ApostolNT] p. 15. (Contributed by AV, 8-Aug-2021.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( D  =  ( M  gcd  N )  <-> 
 ( 0  <_  D  /\  ( D  ||  M  /\  D  ||  N )  /\  A. e  e.  ZZ  ( ( e  ||  M  /\  e  ||  N )  ->  e  ||  D ) ) ) )
 
Theoremgcdass 11957 Associative law for  gcd operator. Theorem 1.4(b) in [ApostolNT] p. 16. (Contributed by Scott Fenton, 2-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( N  e.  ZZ  /\  M  e.  ZZ  /\  P  e.  ZZ )  ->  ( ( N  gcd  M )  gcd  P )  =  ( N  gcd  ( M  gcd  P ) ) )
 
Theoremmulgcd 11958 Distribute multiplication by a nonnegative integer over gcd. (Contributed by Paul Chapman, 22-Jun-2011.) (Proof shortened by Mario Carneiro, 30-May-2014.)
 |-  ( ( K  e.  NN0  /\  M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( K  x.  M )  gcd  ( K  x.  N ) )  =  ( K  x.  ( M  gcd  N ) ) )
 
Theoremabsmulgcd 11959 Distribute absolute value of multiplication over gcd. Theorem 1.4(c) in [ApostolNT] p. 16. (Contributed by Paul Chapman, 22-Jun-2011.)
 |-  ( ( K  e.  ZZ  /\  M  e.  ZZ  /\  N  e.  ZZ )  ->  ( ( K  x.  M )  gcd  ( K  x.  N ) )  =  ( abs `  ( K  x.  ( M  gcd  N ) ) ) )
 
Theoremmulgcdr 11960 Reverse distribution law for the 
gcd operator. (Contributed by Scott Fenton, 2-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( A  e.  ZZ  /\  B  e.  ZZ  /\  C  e.  NN0 )  ->  ( ( A  x.  C )  gcd  ( B  x.  C ) )  =  ( ( A 
 gcd  B )  x.  C ) )
 
Theoremgcddiv 11961 Division law for GCD. (Contributed by Scott Fenton, 18-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ  /\  C  e.  NN )  /\  ( C 
 ||  A  /\  C  ||  B ) )  ->  ( ( A  gcd  B )  /  C )  =  ( ( A 
 /  C )  gcd  ( B  /  C ) ) )
 
Theoremgcdmultiple 11962 The GCD of a multiple of a number is the number itself. (Contributed by Scott Fenton, 12-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( M  e.  NN  /\  N  e.  NN )  ->  ( M  gcd  ( M  x.  N ) )  =  M )
 
Theoremgcdmultiplez 11963 Extend gcdmultiple 11962 so  N can be an integer. (Contributed by Scott Fenton, 18-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( M  e.  NN  /\  N  e.  ZZ )  ->  ( M  gcd  ( M  x.  N ) )  =  M )
 
Theoremgcdzeq 11964 A positive integer  A is equal to its gcd with an integer  B if and only if  A divides  B. Generalization of gcdeq 11965. (Contributed by AV, 1-Jul-2020.)
 |-  ( ( A  e.  NN  /\  B  e.  ZZ )  ->  ( ( A 
 gcd  B )  =  A  <->  A 
 ||  B ) )
 
Theoremgcdeq 11965  A is equal to its gcd with  B if and only if  A divides  B. (Contributed by Mario Carneiro, 23-Feb-2014.) (Proof shortened by AV, 8-Aug-2021.)
 |-  ( ( A  e.  NN  /\  B  e.  NN )  ->  ( ( A 
 gcd  B )  =  A  <->  A 
 ||  B ) )
 
Theoremdvdssqim 11966 Unidirectional form of dvdssq 11973. (Contributed by Scott Fenton, 19-Apr-2014.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  ||  N  ->  ( M ^
 2 )  ||  ( N ^ 2 ) ) )
 
Theoremdvdsmulgcd 11967 Relationship between the order of an element and that of a multiple. (a divisibility equivalent). (Contributed by Stefan O'Rear, 6-Sep-2015.)
 |-  ( ( B  e.  ZZ  /\  C  e.  ZZ )  ->  ( A  ||  ( B  x.  C ) 
 <->  A  ||  ( B  x.  ( C  gcd  A ) ) ) )
 
Theoremrpmulgcd 11968 If  K and  M are relatively prime, then the GCD of  K and  M  x.  N is the GCD of  K and  N. (Contributed by Scott Fenton, 12-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( ( K  e.  NN  /\  M  e.  NN  /\  N  e.  NN )  /\  ( K 
 gcd  M )  =  1 )  ->  ( K  gcd  ( M  x.  N ) )  =  ( K  gcd  N ) )
 
Theoremrplpwr 11969 If  A and  B are relatively prime, then so are  A ^ N and  B. (Contributed by Scott Fenton, 12-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( A  e.  NN  /\  B  e.  NN  /\  N  e.  NN )  ->  ( ( A  gcd  B )  =  1  ->  ( ( A ^ N )  gcd  B )  =  1 ) )
 
Theoremrppwr 11970 If  A and  B are relatively prime, then so are  A ^ N and  B ^ N. (Contributed by Scott Fenton, 12-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( A  e.  NN  /\  B  e.  NN  /\  N  e.  NN )  ->  ( ( A  gcd  B )  =  1  ->  ( ( A ^ N )  gcd  ( B ^ N ) )  =  1 ) )
 
Theoremsqgcd 11971 Square distributes over gcd. (Contributed by Scott Fenton, 18-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( M  e.  NN  /\  N  e.  NN )  ->  ( ( M 
 gcd  N ) ^ 2
 )  =  ( ( M ^ 2 ) 
 gcd  ( N ^
 2 ) ) )
 
Theoremdvdssqlem 11972 Lemma for dvdssq 11973. (Contributed by Scott Fenton, 18-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( M  e.  NN  /\  N  e.  NN )  ->  ( M  ||  N 
 <->  ( M ^ 2
 )  ||  ( N ^ 2 ) ) )
 
Theoremdvdssq 11973 Two numbers are divisible iff their squares are. (Contributed by Scott Fenton, 18-Apr-2014.) (Revised by Mario Carneiro, 19-Apr-2014.)
 |-  ( ( M  e.  ZZ  /\  N  e.  ZZ )  ->  ( M  ||  N 
 <->  ( M ^ 2
 )  ||  ( N ^ 2 ) ) )
 
Theorembezoutr 11974 Partial converse to bezout 11953. Existence of a linear combination does not set the GCD, but it does upper bound it. (Contributed by Stefan O'Rear, 23-Sep-2014.)
 |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( X  e.  ZZ  /\  Y  e.  ZZ ) )  ->  ( A  gcd  B ) 
 ||  ( ( A  x.  X )  +  ( B  x.  Y ) ) )
 
Theorembezoutr1 11975 Converse of bezout 11953 for when the greater common divisor is one (sufficient condition for relative primality). (Contributed by Stefan O'Rear, 23-Sep-2014.)
 |-  ( ( ( A  e.  ZZ  /\  B  e.  ZZ )  /\  ( X  e.  ZZ  /\  Y  e.  ZZ ) )  ->  ( ( ( A  x.  X )  +  ( B  x.  Y ) )  =  1  ->  ( A  gcd  B )  =  1 )
 )
 
5.1.6  Decidable sets of integers
 
Theoremnnmindc 11976* An inhabited decidable subset of the natural numbers has a minimum. (Contributed by Jim Kingdon, 23-Sep-2024.)
 |-  ( ( A  C_  NN  /\  A. x  e. 
 NN DECID  x  e.  A  /\  E. y  y  e.  A )  -> inf ( A ,  RR ,  <  )  e.  A )
 
Theoremnnminle 11977* The infimum of a decidable subset of the natural numbers is less than an element of the set. The infimum is also a minimum as shown at nnmindc 11976. (Contributed by Jim Kingdon, 26-Sep-2024.)
 |-  ( ( A  C_  NN  /\  A. x  e. 
 NN DECID  x  e.  A  /\  B  e.  A )  -> inf ( A ,  RR ,  <  )  <_  B )
 
Theoremnnwodc 11978* Well-ordering principle: any inhabited decidable set of positive integers has a least element. Theorem I.37 (well-ordering principle) of [Apostol] p. 34. (Contributed by NM, 17-Aug-2001.) (Revised by Jim Kingdon, 23-Oct-2024.)
 |-  ( ( A  C_  NN  /\  E. w  w  e.  A  /\  A. j  e.  NN DECID  j  e.  A )  ->  E. x  e.  A  A. y  e.  A  x  <_  y )
 
Theoremuzwodc 11979* Well-ordering principle: any inhabited decidable subset of an upper set of integers has a least element. (Contributed by NM, 8-Oct-2005.) (Revised by Jim Kingdon, 22-Oct-2024.)
 |-  ( ( S  C_  ( ZZ>= `  M )  /\  E. x  x  e.  S  /\  A. x  e.  ( ZZ>= `  M )DECID  x  e.  S )  ->  E. j  e.  S  A. k  e.  S  j  <_  k
 )
 
Theoremnnwofdc 11980* Well-ordering principle: any inhabited decidable set of positive integers has a least element. This version allows  x and  y to be present in  A as long as they are effectively not free. (Contributed by NM, 17-Aug-2001.) (Revised by Mario Carneiro, 15-Oct-2016.)
 |-  F/_ x A   &    |-  F/_ y A   =>    |-  ( ( A 
 C_  NN  /\  E. z  z  e.  A  /\  A. j  e.  NN DECID  j  e.  A )  ->  E. x  e.  A  A. y  e.  A  x  <_  y
 )
 
Theoremnnwosdc 11981* Well-ordering principle: any inhabited decidable set of positive integers has a least element (schema form). (Contributed by NM, 17-Aug-2001.) (Revised by Jim Kingdon, 25-Oct-2024.)
 |-  ( x  =  y 
 ->  ( ph  <->  ps ) )   =>    |-  ( ( E. x  e.  NN  ph  /\  A. x  e.  NN DECID  ph )  ->  E. x  e.  NN  ( ph  /\  A. y  e.  NN  ( ps  ->  x  <_  y
 ) ) )
 
5.1.7  Algorithms
 
Theoremnn0seqcvgd 11982* A strictly-decreasing nonnegative integer sequence with initial term  N reaches zero by the  N th term. Deduction version. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( ph  ->  F : NN0 --> NN0 )   &    |-  ( ph  ->  N  =  ( F `  0 ) )   &    |-  (
 ( ph  /\  k  e. 
 NN0 )  ->  (
 ( F `  (
 k  +  1 ) )  =/=  0  ->  ( F `  ( k  +  1 ) )  <  ( F `  k ) ) )   =>    |-  ( ph  ->  ( F `  N )  =  0 )
 
Theoremialgrlem1st 11983 Lemma for ialgr0 11985. Expressing algrflemg 6206 in a form suitable for theorems such as seq3-1 10403 or seqf 10404. (Contributed by Jim Kingdon, 22-Jul-2021.)
 |-  ( ph  ->  F : S --> S )   =>    |-  ( ( ph  /\  ( x  e.  S  /\  y  e.  S ) )  ->  ( x ( F  o.  1st ) y )  e.  S )
 
Theoremialgrlemconst 11984 Lemma for ialgr0 11985. Closure of a constant function, in a form suitable for theorems such as seq3-1 10403 or seqf 10404. (Contributed by Jim Kingdon, 22-Jul-2021.)
 |-  Z  =  ( ZZ>= `  M )   &    |-  ( ph  ->  A  e.  S )   =>    |-  ( ( ph  /\  x  e.  ( ZZ>= `  M ) )  ->  ( ( Z  X.  { A } ) `  x )  e.  S )
 
Theoremialgr0 11985 The value of the algorithm iterator 
R at  0 is the initial state  A. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Jim Kingdon, 12-Mar-2023.)
 |-  Z  =  ( ZZ>= `  M )   &    |-  R  =  seq M ( ( F  o.  1st ) ,  ( Z  X.  { A }
 ) )   &    |-  ( ph  ->  M  e.  ZZ )   &    |-  ( ph  ->  A  e.  S )   &    |-  ( ph  ->  F : S --> S )   =>    |-  ( ph  ->  ( R `  M )  =  A )
 
Theoremalgrf 11986 An algorithm is a step function  F : S --> S on a state space  S. An algorithm acts on an initial state  A  e.  S by iteratively applying  F to give  A,  ( F `  A ),  ( F `  ( F `  A )
) and so on. An algorithm is said to halt if a fixed point of  F is reached after a finite number of iterations.

The algorithm iterator  R : NN0 --> S "runs" the algorithm  F so that  ( R `  k ) is the state after  k iterations of  F on the initial state  A.

Domain and codomain of the algorithm iterator  R. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 28-May-2014.)

 |-  Z  =  ( ZZ>= `  M )   &    |-  R  =  seq M ( ( F  o.  1st ) ,  ( Z  X.  { A }
 ) )   &    |-  ( ph  ->  M  e.  ZZ )   &    |-  ( ph  ->  A  e.  S )   &    |-  ( ph  ->  F : S --> S )   =>    |-  ( ph  ->  R : Z --> S )
 
Theoremalgrp1 11987 The value of the algorithm iterator 
R at  ( K  + 
1 ). (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Jim Kingdon, 12-Mar-2023.)
 |-  Z  =  ( ZZ>= `  M )   &    |-  R  =  seq M ( ( F  o.  1st ) ,  ( Z  X.  { A }
 ) )   &    |-  ( ph  ->  M  e.  ZZ )   &    |-  ( ph  ->  A  e.  S )   &    |-  ( ph  ->  F : S --> S )   =>    |-  ( ( ph  /\  K  e.  Z ) 
 ->  ( R `  ( K  +  1 )
 )  =  ( F `
  ( R `  K ) ) )
 
Theoremalginv 11988* If  I is an invariant of  F, then its value is unchanged after any number of iterations of 
F. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  R  =  seq 0
 ( ( F  o.  1st ) ,  ( NN0  X. 
 { A } )
 )   &    |-  F : S --> S   &    |-  ( x  e.  S  ->  ( I `  ( F `
  x ) )  =  ( I `  x ) )   =>    |-  ( ( A  e.  S  /\  K  e.  NN0 )  ->  ( I `  ( R `  K ) )  =  ( I `  ( R `  0 ) ) )
 
Theoremalgcvg 11989* One way to prove that an algorithm halts is to construct a countdown function  C : S --> NN0 whose value is guaranteed to decrease for each iteration of  F until it reaches  0. That is, if  X  e.  S is not a fixed point of  F, then  ( C `  ( F `  X ) )  <  ( C `
 X ).

If  C is a countdown function for algorithm  F, the sequence  ( C `  ( R `  k ) ) reaches  0 after at most  N steps, where  N is the value of  C for the initial state  A. (Contributed by Paul Chapman, 22-Jun-2011.)

 |-  F : S --> S   &    |-  R  =  seq 0 ( ( F  o.  1st ) ,  ( NN0  X.  { A } ) )   &    |-  C : S --> NN0   &    |-  ( z  e.  S  ->  ( ( C `  ( F `  z ) )  =/=  0  ->  ( C `  ( F `
  z ) )  <  ( C `  z ) ) )   &    |-  N  =  ( C `  A )   =>    |-  ( A  e.  S  ->  ( C `  ( R `  N ) )  =  0 )
 
Theoremalgcvgblem 11990 Lemma for algcvgb 11991. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  ( ( M  e.  NN0  /\  N  e.  NN0 )  ->  ( ( N  =/=  0  ->  N  <  M ) 
 <->  ( ( M  =/=  0  ->  N  <  M )  /\  ( M  =  0  ->  N  =  0 ) ) ) )
 
Theoremalgcvgb 11991 Two ways of expressing that  C is a countdown function for algorithm  F. The first is used in these theorems. The second states the condition more intuitively as a conjunction: if the countdown function's value is currently nonzero, it must decrease at the next step; if it has reached zero, it must remain zero at the next step. (Contributed by Paul Chapman, 31-Mar-2011.)
 |-  F : S --> S   &    |-  C : S --> NN0   =>    |-  ( X  e.  S  ->  ( ( ( C `
  ( F `  X ) )  =/=  0  ->  ( C `  ( F `  X ) )  <  ( C `
  X ) )  <-> 
 ( ( ( C `
  X )  =/=  0  ->  ( C `  ( F `  X ) )  <  ( C `
  X ) ) 
 /\  ( ( C `
  X )  =  0  ->  ( C `  ( F `  X ) )  =  0
 ) ) ) )
 
Theoremalgcvga 11992* The countdown function  C remains  0 after  N steps. (Contributed by Paul Chapman, 22-Jun-2011.)
 |-  F : S --> S   &    |-  R  =  seq 0 ( ( F  o.  1st ) ,  ( NN0  X.  { A } ) )   &    |-  C : S --> NN0   &    |-  ( z  e.  S  ->  ( ( C `  ( F `  z ) )  =/=  0  ->  ( C `  ( F `
  z ) )  <  ( C `  z ) ) )   &    |-  N  =  ( C `  A )   =>    |-  ( A  e.  S  ->  ( K  e.  ( ZZ>=
 `  N )  ->  ( C `  ( R `
  K ) )  =  0 ) )
 
Theoremalgfx 11993* If  F reaches a fixed point when the countdown function 
C reaches  0,  F remains fixed after  N steps. (Contributed by Paul Chapman, 22-Jun-2011.)
 |-  F : S --> S   &    |-  R  =  seq 0 ( ( F  o.  1st ) ,  ( NN0  X.  { A } ) )   &    |-  C : S --> NN0   &    |-  ( z  e.  S  ->  ( ( C `  ( F `  z ) )  =/=  0  ->  ( C `  ( F `
  z ) )  <  ( C `  z ) ) )   &    |-  N  =  ( C `  A )   &    |-  ( z  e.  S  ->  ( ( C `  z )  =  0  ->  ( F `  z )  =  z ) )   =>    |-  ( A  e.  S  ->  ( K  e.  ( ZZ>=
 `  N )  ->  ( R `  K )  =  ( R `  N ) ) )
 
5.1.8  Euclid's Algorithm
 
Theoremeucalgval2 11994* The value of the step function  E for Euclid's Algorithm on an ordered pair. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 28-May-2014.)
 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   =>    |-  ( ( M  e.  NN0  /\  N  e.  NN0 )  ->  ( M E N )  =  if ( N  =  0 ,  <. M ,  N >. ,  <. N ,  ( M  mod  N ) >. ) )
 
Theoremeucalgval 11995* Euclid's Algorithm eucalg 12000 computes the greatest common divisor of two nonnegative integers by repeatedly replacing the larger of them with its remainder modulo the smaller until the remainder is 0.

The value of the step function  E for Euclid's Algorithm. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 28-May-2014.)

 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   =>    |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( E `  X )  =  if (
 ( 2nd `  X )  =  0 ,  X ,  <. ( 2nd `  X ) ,  (  mod  `  X ) >. ) )
 
Theoremeucalgf 11996* Domain and codomain of the step function  E for Euclid's Algorithm. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 28-May-2014.)
 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   =>    |-  E : (
 NN0  X.  NN0 ) --> ( NN0  X. 
 NN0 )
 
Theoremeucalginv 11997* The invariant of the step function 
E for Euclid's Algorithm is the  gcd operator applied to the state. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 29-May-2014.)
 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   =>    |-  ( X  e.  ( NN0  X.  NN0 )  ->  (  gcd  `  ( E `  X ) )  =  (  gcd  `  X ) )
 
Theoremeucalglt 11998* The second member of the state decreases with each iteration of the step function  E for Euclid's Algorithm. (Contributed by Paul Chapman, 31-Mar-2011.) (Revised by Mario Carneiro, 29-May-2014.)
 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   =>    |-  ( X  e.  ( NN0  X.  NN0 )  ->  ( ( 2nd `  ( E `  X ) )  =/=  0  ->  ( 2nd `  ( E `  X ) )  < 
 ( 2nd `  X )
 ) )
 
Theoremeucalgcvga 11999* Once Euclid's Algorithm halts after 
N steps, the second element of the state remains 0 . (Contributed by Paul Chapman, 22-Jun-2011.) (Revised by Mario Carneiro, 29-May-2014.)
 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   &    |-  R  =  seq 0 ( ( E  o.  1st ) ,  ( NN0  X.  { A } ) )   &    |-  N  =  ( 2nd `  A )   =>    |-  ( A  e.  ( NN0  X.  NN0 )  ->  ( K  e.  ( ZZ>= `  N )  ->  ( 2nd `  ( R `  K ) )  =  0
 ) )
 
Theoremeucalg 12000* Euclid's Algorithm computes the greatest common divisor of two nonnegative integers by repeatedly replacing the larger of them with its remainder modulo the smaller until the remainder is 0. Theorem 1.15 in [ApostolNT] p. 20.

Upon halting, the 1st member of the final state  ( R `  N ) is equal to the gcd of the values comprising the input state  <. M ,  N >.. This is Metamath 100 proof #69 (greatest common divisor algorithm). (Contributed by Paul Chapman, 31-Mar-2011.) (Proof shortened by Mario Carneiro, 29-May-2014.)

 |-  E  =  ( x  e.  NN0 ,  y  e. 
 NN0  |->  if ( y  =  0 ,  <. x ,  y >. ,  <. y ,  ( x  mod  y
 ) >. ) )   &    |-  R  =  seq 0 ( ( E  o.  1st ) ,  ( NN0  X.  { A } ) )   &    |-  A  =  <. M ,  N >.   =>    |-  ( ( M  e.  NN0  /\  N  e.  NN0 )  ->  ( 1st `  ( R `  N ) )  =  ( M  gcd  N ) )
    < Previous  Next >

Page List
Jump to page: Contents  1 1-100 2 101-200 3 201-300 4 301-400 5 401-500 6 501-600 7 601-700 8 701-800 9 801-900 10 901-1000 11 1001-1100 12 1101-1200 13 1201-1300 14 1301-1400 15 1401-1500 16 1501-1600 17 1601-1700 18 1701-1800 19 1801-1900 20 1901-2000 21 2001-2100 22 2101-2200 23 2201-2300 24 2301-2400 25 2401-2500 26 2501-2600 27 2601-2700 28 2701-2800 29 2801-2900 30 2901-3000 31 3001-3100 32 3101-3200 33 3201-3300 34 3301-3400 35 3401-3500 36 3501-3600 37 3601-3700 38 3701-3800 39 3801-3900 40 3901-4000 41 4001-4100 42 4101-4200 43 4201-4300 44 4301-4400 45 4401-4500 46 4501-4600 47 4601-4700 48 4701-4800 49 4801-4900 50 4901-5000 51 5001-5100 52 5101-5200 53 5201-5300 54 5301-5400 55 5401-5500 56 5501-5600 57 5601-5700 58 5701-5800 59 5801-5900 60 5901-6000 61 6001-6100 62 6101-6200 63 6201-6300 64 6301-6400 65 6401-6500 66 6501-6600 67 6601-6700 68 6701-6800 69 6801-6900 70 6901-7000 71 7001-7100 72 7101-7200 73 7201-7300 74 7301-7400 75 7401-7500 76 7501-7600 77 7601-7700 78 7701-7800 79 7801-7900 80 7901-8000 81 8001-8100 82 8101-8200 83 8201-8300 84 8301-8400 85 8401-8500 86 8501-8600 87 8601-8700 88 8701-8800 89 8801-8900 90 8901-9000 91 9001-9100 92 9101-9200 93 9201-9300 94 9301-9400 95 9401-9500 96 9501-9600 97 9601-9700 98 9701-9800 99 9801-9900 100 9901-10000 101 10001-10100 102 10101-10200 103 10201-10300 104 10301-10400 105 10401-10500 106 10501-10600 107 10601-10700 108 10701-10800 109 10801-10900 110 10901-11000 111 11001-11100 112 11101-11200 113 11201-11300 114 11301-11400 115 11401-11500 116 11501-11600 117 11601-11700 118 11701-11800 119 11801-11900 120 11901-12000 121 12001-12100 122 12101-12200 123 12201-12300 124 12301-12400 125 12401-12500 126 12501-12600 127 12601-12700 128 12701-12800 129 12801-12900 130 12901-13000 131 13001-13100 132 13101-13200 133 13201-13300 134 13301-13400 135 13401-13500 136 13501-13600 137 13601-13700 138 13701-13800 139 13801-13900 140 13901-14000 141 14001-14035
  Copyright terms: Public domain < Previous  Next >