reserve k,n for Nat,
  x,y,z,y1,y2 for object,X,Y for set,
  f,g for Function;
reserve p,q,r,s,t for XFinSequence;
reserve D for set;
reserve i for Nat;
reserve m for Nat,
        D for non empty set;
reserve l for Nat;
reserve M for Nat;

theorem Th74:
 p^q = p +* Shift(q, card p)
proof
A1: dom Shift(q, card p) = { M+card p:M in dom q } by VALUED_1:def 12;
   for x being object
holds x in dom(p^q) iff x in dom p or x in dom Shift(q, card p)
    proof let x be object;
     thus x in dom(p^q) implies x in dom p or x in dom Shift(q, card p)
      proof assume
A2:     x in dom(p^q);
        then reconsider k = x as Nat;
       per cases by A2,Th18;
       suppose k in dom p;
       hence x in dom p or x in dom Shift(q, card p);
       end;
       suppose ex n st n in dom q & k=len p + n;
       hence x in dom p or x in dom Shift(q, card p) by A1;
       end;
      end;
     assume
A3:    x in dom p or x in dom Shift(q, card p);
     per cases by A3;
     suppose
A4:    x in dom p;
      dom p c= dom(p^q) by Th19;
     hence x in dom(p^q) by A4;
     end;
     suppose x in dom Shift(q, card p);
      then ex M st x = M+card p & M in dom q by A1;
     hence x in dom(p^q) by Th21;
     end;
    end;
   then
A5: dom(p^q) = dom p \/ dom Shift(q, card p) by XBOOLE_0:def 3;
  for x being object st x in dom p \/ dom Shift(q, card p)
   holds (x in dom Shift(q, card p) implies (p^q).x = Shift(q, card p).x) &
    (not x in dom Shift(q, card p) implies (p^q).x = p.x)
  proof let x be object such that
A6:   x in dom p \/ dom Shift(q, card p);
   hereby assume
A7:  x in dom Shift(q, card p);
     then reconsider k = x as Nat;
     consider M such that
A8:   x = M+card p and
A9:   M in dom q by A7,A1;
     set m = k -' len p;
A10: len p + m = k by A8,NAT_D:34;
    hence (p^q).x = q.m by A8,A9,Def3
       .= Shift(q, card p).x by A8,A9,A10,VALUED_1:def 12;
   end;
   assume not x in dom Shift(q, card p);
    then x in dom p by A6,XBOOLE_0:def 3;
   hence (p^q).x = p.x by Def3;
  end;
 hence p^q = p +* Shift(q, card p) by A5,FUNCT_4:def 1;
end;
