reserve D for non empty set,
  i,j,k for Nat,
  n,m for Nat,
  r for Real,
  e for real-valued FinSequence;

theorem Th2:
  for a,b being Element of D holds ex g be FinSequence of D st len
g = n & for i be Nat st i in Seg n holds (i in Seg k implies g.i = a) & (not i
  in Seg k implies g.i = b)
proof
  let a,b be Element of D;
  defpred c[object] means $1 in Seg k;
  deffunc f(object) = a;
  deffunc g(object) = b;
::   (Seg n --> b) +* (Seg k --> a)   !!! ??? obcieta do Seg n ?
  ex f being Function st dom f = Seg n &
for x being object st x in Seg n
holds (c[x] implies f.x=f(x)) & (not c[x] implies f.x=g(x)) from PARTFUN1:sch 1
  ;
  then consider f being Function such that
A1: dom f = Seg n and
A2: for x being object st x in Seg n holds (x in Seg k implies f.x=a) & (
  not x in Seg k implies f.x=b);
  reconsider p = f as FinSequence by A1,FINSEQ_1:def 2;
  rng p c= D
  proof
    let y be object;
    assume y in rng p;
    then consider j be object such that
A3: j in dom p and
A4: y = p.j by FUNCT_1:def 3;
A5: not j in Seg k implies p.j=b by A1,A2,A3;
    j in Seg k implies p.j=a by A1,A2,A3;
    hence thesis by A4,A5;
  end;
  then reconsider p as FinSequence of D by FINSEQ_1:def 4;
  take p;
  n in NAT by ORDINAL1:def 12;
  hence thesis by A1,A2,FINSEQ_1:def 3;
end;
