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 Th31:
  len fp>=2 & (for b,c st b in dom fp & c in dom fp & b<>c holds (
fp.b gcd fp.c)=1) implies for b st b in dom fp holds (Product Del(fp,b)) gcd (
  fp.b) = 1
proof
  defpred CC[FinSequence of NAT] means for b st b in dom $1 holds Product Del(
  $1,b) gcd $1.b = 1;
  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;
  defpred TH[set] means ex f being FinSequence of NAT st f = $1 &
  (len f>=2 & RP[f] implies CC[f]);
A1: now
    let fp,d such that
A2: TH[fp];
    set k=len fp;
    set fp1=fp^<*d*>;
    now
      assume that
A3:   len fp1>=2 and
A4:   RP[fp1];
A5:   len fp1 = k+1 by FINSEQ_2:16;
      now
        per cases by A3,XXREAL_0:1;
        suppose
A6:       len fp1 = 2;
          then 1 in dom fp1 & 2 in dom fp1 by FINSEQ_3:25;
          then
A7:       fp1.2 gcd fp1.1 = 1 by A4;
A8:       fp1=<*fp1.1,fp1.2*> by A6,FINSEQ_1:44;
          for b st b in dom fp1 holds Product Del(fp1,b) gcd fp1.b = 1
          proof
            let b;
            assume b in dom fp1;
            then
A9:         b in Seg len fp1 by FINSEQ_1:def 3;
            per cases by A6,A9,FINSEQ_1:2,TARSKI:def 2;
            suppose
              b=1;
              hence Product Del(fp1,b) gcd fp1.b = Product <*fp1.2*> gcd fp1.1
              by A8,WSIERP_1:19
                .= 1 by A7,RVSUM_1:95;
            end;
            suppose
              b=2;
              hence Product Del(fp1,b) gcd fp1.b = Product <*fp1.1*> gcd fp1.2
              by A8,WSIERP_1:19
                .= 1 by A7,RVSUM_1:95;
            end;
          end;
          hence CC[fp1];
        end;
        suppose
          len fp1 > 2;
          then
A10:      k+1 > 1+1 by FINSEQ_2:16;
          then k >= 1+1 by NAT_1:13;
          then consider n being Nat such that
A11:      k=n+1 by NAT_1:6;
A12:      RP[fp]
          proof
A13:        dom fp c= dom fp1 by FINSEQ_1:26;
            let b,c such that
A14:        b in dom fp & c in dom fp and
A15:        b<>c;
            fp1.b=fp.b & (fp1.c)=fp.c by A14,FINSEQ_1:def 7;
            hence thesis by A4,A14,A15,A13;
          end;
A16:      a in dom fp implies fp.a gcd d=1
          proof
A17:        (len fp+1) in dom fp1 by A5,FINSEQ_5:6;
A18:        dom fp c= dom fp1 & fp1.(len fp+1)=d by FINSEQ_1:26,42;
            assume
A19:        a in dom fp;
            len fp+1>len fp by NAT_1:13;
            then
A20:        len fp+1 <> a by A19,FINSEQ_3:25;
            fp1.a=fp.a by A19,FINSEQ_1:def 7;
            hence thesis by A4,A19,A18,A20,A17;
          end;
          reconsider n as Element of NAT by ORDINAL1:def 12;
A21:      k=n+1 by A11;
          for b st b in dom fp1 holds Product Del(fp1,b) gcd fp1.b = 1
          proof
            let b such that
A22:        b in dom fp1;
A23:        b>=1 by A22,FINSEQ_3:25;
A24:        b<=k+1 by A5,A22,FINSEQ_3:25;
            per cases by A24,NAT_1:8;
            suppose
              b<=k;
              then
A25:          b in dom fp by A23,FINSEQ_3:25;
              then
              Product Del(fp,b) gcd fp.b = 1 & fp.b gcd d=1 by A2,A10,A12,A16,
NAT_1:13;
              then (Product Del(fp,b))*d gcd fp.b = 1 by WSIERP_1:7;
              then
A26:          (Product (Del(fp,b)^<*d*>)) gcd fp.b = 1 by RVSUM_1:96;
              Del(fp1,b) = Del(fp,b)^<*d*> by A21,A25,Th30;
              hence thesis by A25,A26,FINSEQ_1:def 7;
            end;
            suppose
              b=k+1;
              hence Product Del(fp1,b) gcd fp1.b = Product Del(fp1,k+1) gcd d
              by FINSEQ_1:42
                .= Product(fp) gcd d by WSIERP_1:40
                .= 1 by A16,WSIERP_1:36;
            end;
          end;
          hence CC[fp1];
        end;
      end;
      hence CC[fp1];
    end;
    hence TH[fp1];
  end;
A27: TH[<*>NAT]
  proof
    take <*>NAT;
    thus thesis;
  end;
  for fp holds TH[fp] from FINSEQ_2:sch 2(A27,A1);
  then ex f being FinSequence of NAT st f = fp &
  (len f>=2 & RP[f] implies CC[f]);
  hence thesis;
end;
