reserve n for non zero Nat,
  j,k,l,m for Nat,
  g,h,i for Integer;

theorem Th14:
  for n be non zero Nat st l + m <= 2 to_power (n-'1) - 1 holds
  Intval(n-BinarySequence(l) + n-BinarySequence(m)) = l + m
proof
  let n be non zero Nat such that
A1: l + m <= 2 to_power (n-'1) - 1;
A2: l < 2 to_power (n-'1) by A1,Th8;
  set L = n-BinarySequence(l), M = n-BinarySequence(m), F = FALSE, T = TRUE;
  n >= 1 by NAT_1:14;
  then n-1 >= 1-1 by XREAL_1:9;
  then n-'1 = n - 1 by XREAL_0:def 2;
  then 2 to_power (n-'1) < 2 to_power n by POWER:39,XREAL_1:146;
  then
A3: 2 to_power (n-'1) - 1 < 2 to_power n - 1 by XREAL_1:14;
A4: m < 2 to_power (n-'1) by A1,Th8;
  1 <= n by NAT_1:14;
  then
A5: n in Seg n by FINSEQ_1:1;
  then
A6: M/.n = IFEQ((m div 2 to_power (n-'1)) mod 2,0,F,T) by BINARI_3:def 1
    .= IFEQ(0 mod 2,0,F,T) by A4,NAT_D:27
    .= IFEQ(0,0,F,T) by NAT_D:26
    .= F by FUNCOP_1:def 8;
  L/.n = IFEQ((l div 2 to_power (n-'1)) mod 2,0,F,T) by A5,BINARI_3:def 1
    .= IFEQ(0 mod 2,0,F,T) by A2,NAT_D:27
    .= IFEQ(0,0,F,T) by NAT_D:26
    .= F by FUNCOP_1:def 8;
  then (L+M)/.n = F 'xor' F 'xor' (carry(L,M)/.n) by A5,A6,BINARITH:def 5
    .= F by A1,Th13;
  then Intval(L+M) = Absval(L+M) by BINARI_2:def 3;
  hence thesis by A1,A3,Th11,XXREAL_0:2;
end;
