reserve x, x1, x2, y, X, D for set,
  i, j, k, l, m, n, N for Nat,
  p, q for XFinSequence of NAT,
  q9 for XFinSequence,
  pd, qd for XFinSequence of D;

theorem Th7:
  p is dominated_by_0 & q is dominated_by_0 implies p^q is dominated_by_0
proof
  assume that
A1: p is dominated_by_0 and
A2: q is dominated_by_0;
  rng p c= {0,1} & rng q c= {0,1} by A1,A2;
  then rng p \/rng q c= {0,1} by XBOOLE_1:8;
  hence rng (p^q) c= {0,1} by AFINSQ_1:26;
  let k such that
  k <= dom (p^q);
  now
    per cases;
    suppose
A3:   k <= dom p;
      then (p^q)|k=p|k by AFINSQ_1:58;
      hence thesis by A1,A3;
    end;
    suppose
      k>dom p;
      then reconsider kd=k-dom p as Nat by NAT_1:21;
      k=kd+dom p;
      then (p^q)|k=p^(q|kd) by AFINSQ_1:59;
      then
A4:   Sum((p^q)|k)=Sum p+Sum(q|kd) by AFINSQ_2:55;
      2 * Sum (p|(len p)) <= len p & 2 * Sum (q|kd)<= kd by A1,A2,Th2;
      then 2* Sum p + 2 * Sum (q|kd)<=dom p+kd by XREAL_1:7;
      hence thesis by A4;
    end;
  end;
  hence thesis;
end;
