
theorem
  for u,v being Integer, m being CR_Sequence st 0 <= u - v & u - v <
  Product(m) holds to_int(mod(u,m) - mod(v,m), m) = u - v
proof
  let u, v be Integer, m be CR_Sequence;
  assume that
A1: 0 <= u - v and
A2: u - v < Product(m);
  set z = to_int(mod(u,m) - mod(v,m), m);
A3: for i being Nat st i in dom m holds u - v, mod(u-v,m).i
  are_congruent_mod m.i by Th32;
A4: len mod(u-v,m) = len m by Def3;
A5: for i being Nat st i in dom m holds z,mod(u-v,m).i
  are_congruent_mod m.i
  proof
    let i be Nat;
    assume
A6: i in dom m;
    then z,u - v are_congruent_mod m.i by Th36;
    then
A7: z mod m.i = (u-v) mod m.i by NAT_D:64;
    dom(mod(u-v,m)) = Seg(len m) by A4,FINSEQ_1:def 3
      .= dom m by FINSEQ_1:def 3;
    then
A8: mod(u-v,m).i = (u - v) mod m.i by A6,Def3;
    m.i in rng m by A6,FUNCT_1:3;
    then
A9: m.i > 0 by PARTFUN3:def 1;
    then m.i is Element of NAT by INT_1:3;
    then (u-v) mod m.i = ((u-v) mod m.i) mod m.i by NAT_D:65;
    hence thesis by A8,A7,A9,NAT_D:64;
  end;
A10: len mod(u,m) = len m by Def3;
  len mod(v,m) = len m by Def3;
  then
A11: len(mod(u,m) - mod(v,m)) = len m by A10,Lm3;
  then
A12: z < Product(m) by Th31;
  0 <= z by A11,Th31;
  hence thesis by A1,A2,A3,A12,A5,Lm9;
end;
