reserve X for non empty set;
reserve x for Element of X;
reserve d1,d2 for Element of X;
reserve A for BinOp of X;
reserve M for Function of [:X,X:],X;
reserve V for Ring;
reserve V1 for Subset of V;
reserve V for Algebra;
reserve V1 for Subset of V;
reserve MR for Function of [:REAL,X:],X;
reserve a for Real;

theorem Th3:
  V1 = X & d1 = 0.V & d2 = 1.V & A = (the addF of V)||V1 & M = (the
  multF of V)||V1 & MR = (the Mult of V) | [:REAL,V1:] & V1 is having-inverse
  implies AlgebraStr(# X,M,A,MR,d2,d1 #) is Subalgebra of V
proof
  assume that
A1: V1 = X and
A2: d1 = 0.V and
A3: d2 = 1.V and
A4: A = (the addF of V)||V1 and
A5: M = (the multF of V)||V1 and
A6: MR = (the Mult of V) | [:REAL,V1:] and
A7: for v be Element of V st v in V1 holds -v in V1;
  reconsider W = AlgebraStr(# X,M,A,MR,d2,d1 #) as non empty AlgebraStr;
A8: now
    let x,y be Element of W;
    x + y = (the addF of V).[x,y] by A1,A4,FUNCT_1:49;
    hence x + y = (the addF of V).(x,y);
  end;
A9: now
    let a,x be VECTOR of W;
    a * x = (the multF of V).([a,x]) by A1,A5,FUNCT_1:49;
    hence a * x = (the multF of V).(a,x);
  end;
A10: now
    let a;
    let x be VECTOR of W;
     reconsider aa=a as Element of REAL by XREAL_0:def 1;
    aa * x = (the Mult of V).([aa,x]) by A1,A6,FUNCT_1:49;
    hence a * x = (the Mult of V).(a,x);
  end;
A11: W is Abelian add-associative right_zeroed right_complementable
  commutative associative right_unital right-distributive vector-distributive
  scalar-distributive scalar-associative vector-associative
  proof
    set Mv = the multF of V;
    set Av = the addF of V;
    hereby
      let x,y be VECTOR of W;
      reconsider x1 = x, y1 = y as VECTOR of V by A1,TARSKI:def 3;
      x + y = x1 + y1 & y + x = y1 + x1 by A8;
      hence x + y = y + x;
    end;
    hereby
      let x,y,z be VECTOR of W;
      reconsider x1 = x, y1 = y, z1 = z as VECTOR of V by A1,TARSKI:def 3;
      x + (y + z) = Av.(x1,y + z) by A8;
      then
A12:  x + (y + z) = x1 + (y1 + z1) by A8;
      (x + y) + z = Av.(x + y,z1) by A8;
      then (x + y) + z = (x1 + y1) + z1 by A8;
      hence (x + y) + z = x + (y + z) by A12,RLVECT_1:def 3;
    end;
    hereby
      let x be VECTOR of W;
      reconsider y = x as VECTOR of V by A1,TARSKI:def 3;
      thus x + 0.W = y + 0.V by A2,A8
        .= x;
    end;
    thus W is right_complementable
    proof
      let x be Element of W;
      reconsider x1 = x as Element of V by A1,TARSKI:def 3;
      consider v be Element of V such that
A13:  x1 + v = 0.V by ALGSTR_0:def 11;
      v = - x1 by A13,VECTSP_1:16;
      then reconsider y = v as Element of W by A1,A7;
      take y;
      thus thesis by A2,A8,A13;
    end;
    hereby
      let v,w being Element of W;
      reconsider v1 = v, w1=w as Element of V by A1,TARSKI:def 3;
      v * w = v1 * w1 & w * v = w1 * v1 by A9;
      hence v * w = w * v;
    end;
    hereby
      let a,b,x be Element of W;
      reconsider y=x, a1=a, b1=b as Element of V by A1,TARSKI:def 3;
      a * (b * x) = Mv.(a,b * x) by A9;
      then
A14:  a * (b * x) = a1 * (b1 * y) by A9;
      a * b = a1 * b1 by A9;
      then (a * b) * x = (a1 * b1) * y by A9;
      hence (a * b) * x = a * (b * x) by A14,GROUP_1:def 3;
    end;
    hereby
      let v being Element of W;
      reconsider v1 = v as Element of V by A1,TARSKI:def 3;
      v * 1.W =v1*1.V by A3,A9;
      hence v * 1.W = v;
    end;
    hereby
      let x,y,z being Element of W;
      reconsider x1=x, y1=y, z1=z as Element of V by A1,TARSKI:def 3;
      y+z = y1+z1 by A8;
      then x*(y+z) = x1*(y1+z1) by A9;
      then
A15:  x*(y+z) = x1*y1 + x1*z1 by VECTSP_1:def 2;
      x*y = x1*y1 & x*z = x1*z1 by A9;
      hence x*(y+z) = x*y + x*z by A8,A15;
    end;
    thus W is vector-distributive
    proof
      let a be Real;
      let x,y being Element of W;
      reconsider x1=x, y1=y as Element of V by A1,TARSKI:def 3;
      reconsider aa=a as Real;
A16:  aa*x = aa*x1 by A10;
      x+y = x1+y1 by A8;
      then aa*(x+y) =aa*(x1+y1) by A10;
      then
A17:  a*(x+y) =a*x1 + a*y1 by RLVECT_1:def 5;
      aa*y = aa*y1 by A10;
      hence a*(x+y) = a*x + a*y by A8,A16,A17;
    end;
    thus W is scalar-distributive
    proof
      let a,b be Real;
       reconsider aa=a, bb=b as Real;
      let x being Element of W;
      reconsider x1=x as Element of V by A1,TARSKI:def 3;
A18:  aa*x = aa*x1 by A10;
A19:  bb*x = bb*x1 by A10;
      (aa+bb)*x = (a+b)*x1 by A10;
      then (a+b)*x = a*x1 + b*x1 by RLVECT_1:def 6;
      hence (a+b)*x =a*x + b*x by A8,A18,A19;
    end;
    thus W is scalar-associative
    proof
      let a,b be Real;
      let x being Element of W;
      reconsider x1=x as Element of V by A1,TARSKI:def 3;
       reconsider aa=a, bb=b as Real;
A20:  bb*x = bb*x1 by A10;
      (aa*bb)*x = (a*b)*x1 by A10;
      then (aa*bb)*x = a*(bb*x1) by RLVECT_1:def 7;
      hence (a*b)*x = a*(b*x) by A10,A20;
    end;
    thus W is vector-associative
    proof
      let x,y being Element of W;
      reconsider x1=x, y1=y as Element of V by A1,TARSKI:def 3;
      let a be Real;
A21:  a*x = a*x1 by A10;
      x*y = x1*y1 by A9;
      then a*(x*y) =a*(x1*y1) by A10;
      then a*(x*y) = (a*x1)*y1 by FUNCSDOM:def 9;
      hence a*(x*y) = (a*x)*y by A9,A21;
    end;
  end;
  0.W = 0.V & 1.W= 1.V by A2,A3;
  hence thesis by A1,A4,A5,A6,A11,Def9;
end;
