reserve X for set,
        n,m,k for Nat,
        K for Field,
        f for n-element real-valued FinSequence,
        M for Matrix of n,m,F_Real;

theorem Th4:
  for x,y be Element of REAL n,
        m be Nat
    st m <= n
  holds (x-y) | m = x|m - y|m
  proof
    let x,y be Element of REAL n,
          m be Nat;
    assume
    A1: m <= n;

    len x = n by CARD_1:def 7;
    then
    A2: len(x|m) = m by A1,FINSEQ_1:59;
    len y = n by CARD_1:def 7;
    then
    A3: len(y|m) = m by A1,FINSEQ_1:59;
    len(x-y) = n by CARD_1:def 7; then
    len((x-y) | m) = m by A1,FINSEQ_1:59; then

    A5: dom((x-y) | m) = Seg m by FINSEQ_1:def 3;
    A6: dom(x|m -y|m)
     = dom(x|m) /\ dom(y|m) by VALUED_1:12
    .= (Seg m) /\ dom (y|m) by FINSEQ_1:def 3,A2
    .= (Seg m) /\ (Seg m) by FINSEQ_1:def 3,A3
    .= Seg m;

    now let i be object;
    assume A7: i in dom((x-y) | m);
    then i in dom(x-y) /\ Seg m by RELAT_1:61;
    then
    A8: i in dom(x-y) & i in Seg m by XBOOLE_0:def 4;

    hence ((x-y) | m).i
     = (x-y).i by FUNCT_1:49
    .= x.i -y.i by A8,VALUED_1:13
    .= (x|m).i -y.i by A8,FUNCT_1:49
    .= (x|m).i -(y|m).i by A8,FUNCT_1:49
    .= ((x|m) - (y|m)).i by A5,A6,A7,VALUED_1:13;
    end;
    hence (x-y) | m = x|m - y|m by A5,A6,FUNCT_1:2;
  end;
