reserve a,b,m,x,y,i1,i2,i3,i for Integer,
  k,p,q,n for Nat,
  c,c1,c2 for Element of NAT,
  z for set;
reserve fp,fp1 for FinSequence of NAT,

  b,c,d, n for Element of NAT,
  a for Nat;

theorem Th38:
  (for b,c st b in dom fp & c in dom fp & b<>c holds (fp.b gcd fp.
c)=1) & (for b st b in dom fp holds fp.b divides a) implies Product fp divides
  a
proof
  defpred RP[FinSequence of NAT] means (for b,c st b in dom $1 & c in dom $1 &
  b<>c holds ($1.b gcd $1.c)=1) & (for b st b in dom $1 holds $1.b divides a);
  defpred CC[FinSequence of NAT] means Product $1 divides a;
  defpred TH[set] means ex f being FinSequence of NAT st f = $1 &
  (RP[f] implies CC[f]);
A1: now
    let fp,d such that
A2: TH[fp];
    set fp1=fp^<*d*>;
    len fp + 1 >= 0 + 1 by XREAL_1:6;
    then
A3: len fp1 >= 1 by FINSEQ_2:16;
    now
      assume
A4:   RP[fp1];
      for a st a in dom fp holds fp.a gcd d=1
      proof
        let a;
A5:     len fp1 in dom fp1 by A3,FINSEQ_3:25;
        assume
A6:     a in dom fp;
        then a <= len fp by FINSEQ_3:25;
        then a < len fp + 1 by XREAL_1:39;
        then
A7:     a < len fp1 by FINSEQ_2:16;
        a in dom fp1 by A6,FINSEQ_2:15;
        then fp1.a gcd fp1.(len fp1)=1 by A4,A7,A5;
        then
A8:     fp1.a gcd fp1.(len fp + 1)=1 by FINSEQ_2:16;
        fp1.a = fp.a by A6,FINSEQ_1:def 7;
        hence thesis by A8,FINSEQ_1:42;
      end;
      then Product(fp) gcd d = 1 by WSIERP_1:36;
      then
A9:   Product(fp),d are_coprime by INT_2:def 3;
A10:  dom fp c= dom fp1 by FINSEQ_1:26;
A11:  for b,c st b in dom fp & c in dom fp & b<>c holds (fp.b gcd fp.c)=1
      proof
        let b,c;
        assume that
A12:    b in dom fp & c in dom fp and
A13:    b<>c;
        fp1.b = fp.b & fp1.c = fp.c by A12,FINSEQ_1:def 7;
        hence thesis by A4,A10,A12,A13;
      end;
A14:  for b st b in dom fp holds fp.b divides a
      proof
        let b;
        assume
A15:    b in dom fp;
        then fp1.b = fp.b by FINSEQ_1:def 7;
        hence thesis by A4,A10,A15;
      end;
      len fp1 in dom fp1 by FINSEQ_5:6;
      then fp1.(len fp1) divides a by A4;
      then fp1.(len fp + 1) divides a by FINSEQ_2:16;
      then d divides a by FINSEQ_1:42;
      then (Product(fp) * d) divides a by A2,A11,A14,A9,PEPIN:4;
      hence CC[fp1] by RVSUM_1:96;
    end;
    hence TH[fp1];
  end;
A16: TH[<*>NAT]
     proof
       take <*>NAT;
       thus thesis by NAT_D:6,RVSUM_1:94;
     end;
  for fp holds TH[fp] from FINSEQ_2:sch 2(A16,A1);
  then ex f being FinSequence of NAT st f = fp & (RP[f] implies CC[f]);
  hence thesis;
end;
