reserve i,i1,i2,i3,i4,i5,j,r,a,b,x,y for Integer,
  d,e,k,n for Nat,
  fp,fk for FinSequence of INT,
  f,f1,f2 for FinSequence of REAL,
  p for Prime;
reserve fr for FinSequence of REAL;
reserve fr,f for FinSequence of INT;
reserve b,m for Nat;
reserve b for Integer;

theorem Th31:
  (for d st d in dom fr holds fr.d = 1 or fr.d = 0 or fr.d = -1) implies
  Product fr = 1 or Product fr = 0 or Product fr = -1
proof
  defpred P[FinSequence of INT] means (for d st d in dom $1 holds $1.d = 1 or
  $1.d = 0 or $1.d = -1) implies Product $1 = 1 or Product $1 = 0 or
    Product $1 = -1;
A1: for p being FinSequence of INT, n being Element of INT st P[p] holds P[p
  ^<*n*>]
  proof
    let p be FinSequence of INT,i be Element of INT;
    set p1 = p^<*i*>;
    assume
A2: P[p];
    P[p1]
    proof
      assume
A3:   for d st d in dom p1 holds p1.d = 1 or p1.d = 0 or p1.d = -1;
A4:   for d st d in dom p holds p.d = 1 or p.d = 0 or p.d = -1
      proof
        let d;
        assume
A5:     d in dom p;
        then p1.d = 1 or p1.d = 0 or p1.d = -1 by A3,FINSEQ_2:15;
        hence thesis by A5,FINSEQ_1:def 7;
      end;
A6:   len p1 in dom p1 by FINSEQ_5:6;
A7:   Product p1 = (Product p)*i by RVSUM_1:96;
      len p1 =len p +1 by FINSEQ_2:16;
      then
A8:   p1.(len p + 1) = 1 or p1.(len p + 1) = 0 or
        p1.(len p + 1) = -1 by A3,A6;
      per cases by A2,A4,A8,FINSEQ_1:42;
      suppose
        Product p = 1 & i =1;
        hence thesis by A7;
      end;
      suppose
        Product p = 1 & i =0;
        hence thesis by A7;
      end;
      suppose
        Product p = 1 & i = -1;
        hence thesis by A7;
      end;
      suppose
        Product p = -1 & i = 1;
        hence thesis by A7;
      end;
      suppose
        Product p = -1 & i = 0;
        hence thesis by A7;
      end;
      suppose
        Product p = -1 & i = -1;
        hence thesis by A7;
      end;
      suppose
        Product p = 0 & i = 1;
        hence thesis by A7;
      end;
      suppose
        Product p = 0 & i = 0;
        hence thesis by A7;
      end;
      suppose
        Product p = 0 & i = -1;
        hence thesis by A7;
      end;
    end;
    hence thesis;
  end;
A9: P[<*>INT] by RVSUM_1:94;
  for p being FinSequence of INT holds P[p] from FINSEQ_2:sch 2(A9,A1 );
  hence thesis;
end;
