reserve f for Function;
reserve p,q for FinSequence;
reserve A,B,C for set,x,x1,x2,y,z for object;
reserve k,l,m,n for Nat;
reserve a for Nat;
reserve D for non empty set;
reserve d,d1,d2,d3 for Element of D;
reserve L,M for Element of NAT;

theorem Th45:
  p just_once_values x iff x in rng p & not x in rng(p |-- x)
proof
  thus p just_once_values x implies x in rng p & not x in rng(p |-- x)
  proof
    assume
A1: p just_once_values x;
    hence
A2: x in rng p by Th5;
    assume x in rng(p |-- x);
    then consider z being object such that
A3: z in dom(p |-- x) and
A4: (p |-- x).z = x by FUNCT_1:def 3;
    reconsider z as Element of NAT by A3;
    (p |-- x).z = p.(z + x..p) & z + x..p in dom p by A2,A3,Def6,Th43;
    then z + x..p = 0 + x..p by A1,A4,Th26;
    hence thesis by A3,FINSEQ_3:24;
  end;
  assume that
A5: x in rng p and
A6: not x in rng(p |-- x);
  now
    let k;
    assume that
A7: k in dom p and
A8: k <> x..p and
A9: p.k = x;
    now
      per cases by A8,XXREAL_0:1;
      suppose
        k < x..p;
        then k + 1 <= x..p by NAT_1:13;
        then k <= x..p - 1 by XREAL_1:19;
        then
A10:    k <= len(p -| x) by A5,Th34;
        1 <= k by A7,FINSEQ_3:25;
        then
A11:    k in dom(p -| x) by A10,FINSEQ_3:25;
        then x = (p -| x).k by A5,A9,Th36;
        then x in rng(p -| x) by A11,FUNCT_1:def 3;
        hence contradiction by A5,Th37;
      end;
      suppose
A12:    x..p < k;
        then consider m be Nat such that
A13:    k = x..p + m by NAT_1:10;
        x..p + 0 < x..p + m by A12,A13;
        then 0 < m;
        then
A14:    0 + 1 <= m by NAT_1:13;
        m + x..p <= len p by A7,A13,FINSEQ_3:25;
        then m <= len p - x..p by XREAL_1:19;
        then m <= len(p |-- x) by A5,Def6;
        then
A15:    m in dom(p |-- x) by A14,FINSEQ_3:25;
        then (p |-- x).m = p.k by A5,A13,Def6;
        hence contradiction by A6,A9,A15,FUNCT_1:def 3;
      end;
    end;
    hence contradiction;
  end;
  hence thesis by A5,Th27;
end;
