reserve i, j, k, c, m, n for Nat,
  a, x, y, z, X, Y for set,
  D, E for non empty set,
  R for Relation,
  f, g for Function,
  p, q for FinSequence;
reserve f1, f2 for non empty homogeneous to-naturals NAT*-defined Function,
  e1, e2 for homogeneous to-naturals NAT*-defined Function,
  p for Element of (arity f1+1)-tuples_on NAT;

theorem Th48:
  for i being Nat
  for p, q being FinSequence of NAT st q in dom primrec(e1,e2,i,p)
  ex k being Element of NAT st q = p+*(i,k)
proof let i be Nat;
  set f1 = e1, f2 = e2;
  let p, q being FinSequence of NAT such that
A1: q in dom primrec(f1,f2,i,p);
  consider F being sequence of  HFuncs NAT such that
A2: primrec(f1,f2,i,p) = F.(p/.i) and
A3: i in dom p & Del(p,i) in dom f1 implies F.0 = p+*(i,0) .--> (f1.Del(
  p,i)) and
A4: not i in dom p or not Del(p,i) in dom f1 implies F.0 = {} and
A5: for m being Nat holds Q[m, F.m qua Element of HFuncs NAT,
  F.(m+1)qua Element of HFuncs NAT, p, i, f2] by Def10;
  defpred p[Nat] means q in dom (F.$1) implies ex k being Element
  of NAT st q = p+*(i,k);
A6: for m be Nat st p[m] holds p[m+1]
  proof
    let m be Nat such that
A7: p[m] and
A8: q in dom (F.(m+1));
    per cases;
    suppose
      i in dom p & p+*(i,m) in dom (F.m) & (p+*(i,m))^<*(F.m).(p+*(i,
      m))*> in dom f2;
      then F.(m+1) = (F.m)+*(p+*(i,m+1).--> f2.((p+*(i,m))^<*(F.m).(p+*(i,m))
      *>)) by A5;
      then
      dom (F.(m+1)) = dom (F.m) \/ dom (p+*(i,m+1).--> f2.((p+*(i,m))^<*(
      F.m).(p+*(i,m))*>)) by FUNCT_4:def 1;
      then
A9:   dom (F.(m+1)) = dom (F.m) \/ {p+*(i,m+1)};
      thus ex k being Element of NAT st q = p+*(i,k)
      proof
        per cases by A8,A9,XBOOLE_0:def 3;
        suppose
          q in dom (F.m);
          hence thesis by A7;
        end;
        suppose
          q in {p+*(i,m+1)};
          then q = p+*(i,m+1) by TARSKI:def 1;
          hence thesis;
        end;
      end;
    end;
    suppose
      not i in dom p or not p+*(i,m) in dom (F.m) or not (p+*(i,m))^
      <*(F.m).(p+*(i,m))*> in dom f2;
      hence thesis by A5,A7,A8;
    end;
  end;
A10: p[0]
  proof
    assume
A11: q in dom (F.0);
    per cases;
    suppose
      i in dom p & Del(p,i) in dom f1;
      then dom (F.0) = {p+*(i,0)} by A3;
      then p+*(i,0) = q by A11,TARSKI:def 1;
      hence thesis;
    end;
    suppose
      not i in dom p or not Del(p,i) in dom f1;
      hence thesis by A4,A11;
    end;
  end;
  for n being Nat holds p[n] from NAT_1:sch 2(A10,A6);
  hence thesis by A1,A2;
end;
