
theorem Th3:
for n,b being Nat st n < b & b > 1 holds digits(n,b)=<%n%>
proof
  let n,b be Nat;
  assume A1: n < b & b > 1;
  per cases;
  suppose n=0;
    hence thesis by A1,NUMERAL1:def 2;
  end;
  suppose A2: n>0;
    A3: value(<%n%>,b)=n by Th2;
    len <%n%>=1 by AFINSQ_1:34; then
    <%n%>.(len(<%n%>)-1) = n;
    then A4: <%n%>.(len(<%n%>)-1) <> 0 by A2;
    now
      let i be Nat;
      assume i in dom <%n%>;
      then i in 1 by AFINSQ_1:def 4;
      then i in {0} by CARD_1:49;
      then i = 0 by TARSKI:def 1;
      hence 0 <= <%n%>.i & <%n%>.i < b by A1;
    end;
    hence thesis by A2,A1,A3,A4,NUMERAL1:def 2;
  end;
end;
