reserve A for preIfWhileAlgebra,
  C,I,J for Element of A;
reserve S for non empty set,
  T for Subset of S,
  s for Element of S;

theorem Th77:
  for A being ECIW-strict preIfWhileAlgebra
  for x being set, n being Nat st x in (ElementaryInstructions A)|^(n+1)
  holds x in (ElementaryInstructions A)|^n or x = EmptyIns A or
  (ex I1,I2 being Element of A st x = I1\;I2 &
  I1 in (ElementaryInstructions A)|^n & I2 in (ElementaryInstructions A)|^n) or
  (ex C,I1,I2 being Element of A st x = if-then-else(C,I1,I2) &
  C in (ElementaryInstructions A)|^n &
  I1 in (ElementaryInstructions A)|^n & I2 in (ElementaryInstructions A)|^n) or
  ex C,I being Element of A st x = while(C,I) &
  C in (ElementaryInstructions A)|^n & I in (ElementaryInstructions A)|^n
proof
  let A be ECIW-strict preIfWhileAlgebra;
  set B = ElementaryInstructions A;
  let x be set;
  let n be Nat;
  assume
A1: x in B|^(n+1);
  then reconsider I = x as Element of A;
  assume
A2: x nin B|^n;
  assume
A3: x <> EmptyIns A;
  assume
A4: not ex I1,I2 being Element of A st x = I1\;I2 & I1 in B|^n & I2 in B|^n;
  assume
A5: not ex C,I1,I2 being Element of A st x = if-then-else(C,I1,I2) &
  C in B|^n & I1 in B|^n & I2 in B|^n;
  B|^(n+1) = B|^n\/{Den(o,A).p where o is (Element of dom the charact of A),
  p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
  by Th19;
  then x in {Den(o,A).p where o is (Element of dom the charact of A),
  p is Element of (the carrier of A)*: p in dom Den(o,A) & rng p c= B|^n}
  by A1,A2,XBOOLE_0:def 3;
  then consider o being (Element of dom the charact of A),
  p being Element of (the carrier of A)* such that
A6: I = Den(o,A).p and
A7: p in dom Den(o,A) and
A8: rng p c= B|^n;
  reconsider no = o as Element of NAT;
  reconsider oo = Den(o,A) as Element of Operations A;
  len signature A = len the charact of A by UNIALG_1:def 4;
  then
A9: dom signature A = dom the charact of A by FINSEQ_3:29;
A10: len p = arity oo by A7,MARGREL1:def 25
    .= (signature A).no by A9,UNIALG_1:def 4
    .= ECIW-signature.o by Def27;
A11: 1 in Seg 2;
A12: 2 in Seg 2;
A13: 1 in Seg 3;
A14: 2 in Seg 3;
A15: 3 in Seg 3;
  per cases by Th55;
  suppose
A16: o = 1;
    then p = {} by A10,Th54;
    hence thesis by A3,A6,A16;
  end;
  suppose
A17: o = 2;
    then
A18: p = <*p.1,p.2*> by A10,Th54,FINSEQ_1:44;
A19: dom p = Seg 2 by A10,A17,Th54,FINSEQ_1:def 3;
    then
A20: p.1 in rng p by A11,FUNCT_1:def 3;
A21: p.2 in rng p by A12,A19,FUNCT_1:def 3;
    then reconsider I1 = p.1, I2 = p.2 as Element of A by A20;
    I = I1\;I2 by A6,A17,A18;
    hence thesis by A4,A8,A20,A21;
  end;
  suppose
A22: o = 3;
    then
A23: p = <*p.1,p.2,p.3*> by A10,Th54,FINSEQ_1:45;
A24: dom p = Seg 3 by A10,A22,Th54,FINSEQ_1:def 3;
    then
A25: p.1 in rng p by A13,FUNCT_1:def 3;
A26: p.2 in rng p by A14,A24,FUNCT_1:def 3;
A27: p.3 in rng p by A15,A24,FUNCT_1:def 3;
    then reconsider C = p.1, I1 = p.2, I2 = p.3 as Element of A by A25,A26;
    I = if-then-else(C,I1,I2) by A6,A22,A23;
    hence thesis by A5,A8,A25,A26,A27;
  end;
  suppose
A28: o = 4;
    then
A29: p = <*p.1,p.2*> by A10,Th54,FINSEQ_1:44;
A30: dom p = Seg 2 by A10,A28,Th54,FINSEQ_1:def 3;
    then
A31: p.1 in rng p by A11,FUNCT_1:def 3;
A32: p.2 in rng p by A12,A30,FUNCT_1:def 3;
    then reconsider I1 = p.1, I2 = p.2 as Element of A by A31;
    I = while(I1,I2) by A6,A28,A29;
    hence thesis by A8,A31,A32;
  end;
end;
