 reserve x, y, y1, y2 for set;
 reserve V for Z_Module;
 reserve u, v, w for Vector of V;
 reserve F, G, H, I for FinSequence of V;
 reserve W, W1, W2, W3 for Submodule of V;
 reserve KL1, KL2 for Linear_Combination of V;
 reserve X for Subset of V;

theorem Th23:
  for p being prime Element of INT.Ring, V being Z_Module,
  I being Subset of V,
  lq being Linear_Combination of Z_MQ_VectSp(V,p)
  holds ex l being Linear_Combination of I
  st for v being Vector of V st v in I holds
  ex w be Vector of V st w in I & w in ZMtoMQV(V,p,v)
  & l.w = lq.(ZMtoMQV(V,p,v))
  proof
    let p be prime Element of INT.Ring, V be Z_Module, I be Subset of V,
    lq be Linear_Combination of Z_MQ_VectSp(V,p);
    set ZQ = Z_MQ_VectSp(V,p);
    per cases;
    suppose A1: I is empty;
      set l = the Linear_Combination of I;
      take l;
      thus thesis by A1;
    end;
    suppose A2: I is non empty;
      set X = { ZMtoMQV(V,p,v) where v is Vector of V:v in I};
      now let x be object;
        assume x in X;
        then consider v be Vector of V such that
        A3: x = ZMtoMQV(V,p,v) & v in I;
        thus x in the carrier of ZQ by A3;
      end;
      then
      reconsider X as Subset of ZQ by TARSKI:def 3;
      consider v0 be object such that A4: v0 in I by A2,XBOOLE_0:def 1;
      reconsider v0 as Vector of V by A4;
      ZMtoMQV(V,p,v0) in X by A4;
      then reconsider X as non empty Subset of ZQ;
      defpred F0[Element of X, Element of V] means
      $2 in $1 & $2 in I;
      A5: for x being Element of X holds
      ex v being Element of V st F0[x,v]
      proof
        let x be Element of X;
        x in X;
        then consider v be Vector of V such that
        A6: x = ZMtoMQV(V,p,v) & v in I;
        thus ex v be Element of V st F0[x,v] by A6,ZMODUL01:58;
      end;
      consider F being Function of X, the carrier of V such that
 A7:  for x being Element of X holds F0[x,F.x] from FUNCT_2:sch 3(A5);
 A8:  now let y be object;
        assume y in rng F;
        then consider x be object such that
        A9: x in X & F.x = y by FUNCT_2:11;
        reconsider x as Element of X by A9;
        thus y in I by A9,A7;
      end;
      then
      A10: rng F c= I;
      defpred P[Element of V, Element of GF(p)] means
      ($1 in rng F implies $2 = lq.(ZMtoMQV(V,p,$1))) &
      (not $1 in rng F implies $2 = 0);
      A11: for v being Element of V holds
      ex y being Element of GF(p) st P[v,y]
      proof
        let v be Element of V;
        per cases;
        suppose A12: v in rng F;
          reconsider y = lq.(ZMtoMQV(V,p,v)) as Element of GF(p);
          take y;
          thus thesis by A12;
        end;
        suppose A13: not v in rng F;
          0.GF(p) is Element of GF(p);
          then reconsider F0 = 0 as Element of GF(p) by EC_PF_1:11;
          take F0;
          thus thesis by A13;
        end;
      end;
      A14: Segm(p) c= INT by NUMBERS:17;
      consider f being Function of the carrier of V, GF(p) such that
      A15:  for v being Element of V holds P[v,f.v] from FUNCT_2:sch 3(A11);
      A16: for v being Vector of V st v in I holds
      ex w be Vector of V st w in I & w in ZMtoMQV(V,p,v) &
      f.w = lq.(ZMtoMQV(V,p,v))
      proof
        let v be Vector of V;
        assume v in I; then
        A17: ZMtoMQV(V,p,v) in X; then
        A18: F.(ZMtoMQV(V,p,v)) in rng F by FUNCT_2:4;
        reconsider w = F.(ZMtoMQV(V,p,v)) as Element of V by A17,FUNCT_2:5;
        take w;
        A19: f.w = lq.(ZMtoMQV(V,p,w)) by A15,A17,FUNCT_2:4;
        thus w in I by A18,A8;
        thus w in ZMtoMQV(V,p,v) by A7,A17;
        thus f.w = lq.(ZMtoMQV(V,p,v)) by A17,A19,A7,ZMODUL01:67;
      end;
      reconsider l = f as Function of the carrier of V, INT by A14,FUNCT_2:7;
      reconsider l as Element of Funcs(the carrier of V, INT) by FUNCT_2:8;
      set T = {v where v is Element of V : l.v <> 0};
      A20:
      now let v be object;
        assume v in T;
        then ex v1 being Element of V st v1 = v & l.v1 <> 0;
        hence v in the carrier of V;
      end;
      A21:
      now let x be object;
        assume x in T;
        then consider v be Element of V such that
        A22: x = v & l.v <> 0;
        thus x in rng F by A15,A22;
      end;
      then
      A23: T c= rng F;
      now let x be object;
        assume A24: x in F"T;
        then A25: x in X & F.x in T by FUNCT_2:38;
        then consider v be Element of V such that
        A26: F.x=v & l.v <> 0;
        A27: P[v,f.v] by A15;
        lq.(ZMtoMQV(V,p,v)) <> 0.GF(p) by A26,A27,EC_PF_1:11;
        then
        A28: ZMtoMQV(V,p,v) in Carrier(lq);
        reconsider w=x as Element of X by A24;
        A29: F.w in w & F.w in I by A7;
        consider v1 be Vector of V such that
        A30: w = ZMtoMQV(V,p,v1) & v1 in I by A25;
        v in ZMtoMQV(V,p,v) by ZMODUL01:58;
        then ZMtoMQV(V,p,v) /\ ZMtoMQV(V,p,v1) <> {}
        by A26,A29,A30,XBOOLE_0:def 4;
        hence x in Carrier(lq) by A28,A30,Lm2;
      end;
      then F"T c= Carrier(lq);
      then reconsider T as finite Subset of V
      by A20,A21,FINSET_1:9,TARSKI:def 3;
      for v being Element of V st not v in T holds l.v = 0.INT.Ring;
      then reconsider l as Linear_Combination of V by VECTSP_6:def 1;
      T = Carrier(l);
      then reconsider l as Linear_Combination of I
      by A23,A10,XBOOLE_1:1,VECTSP_6:def 4;
      take l;
      now let v be Vector of V;
        assume v in I;
        then ex w be Vector of V  st w in I & w in ZMtoMQV(V,p,v) &
        f.w = lq.(ZMtoMQV(V,p,v)) by A16;
        hence ex w be Vector of V  st w in I & w in ZMtoMQV(V,p,v) &
        l.w = lq.(ZMtoMQV(V,p,v));
      end;
      hence thesis;
    end;
  end;
