reserve
  a,b for object, I,J for set, f for Function, R for Relation,
  i,j,n for Nat, m for (Element of NAT),
  S for non empty non void ManySortedSign,
  s,s1,s2 for SortSymbol of S,
  o for OperSymbol of S,
  X for non-empty ManySortedSet of the carrier of S,
  x,x1,x2 for (Element of X.s), x11 for (Element of X.s1),
  T for all_vars_including inheriting_operations free_in_itself
  (X,S)-terms MSAlgebra over S,
  g for Translation of Free(S,X),s1,s2,
  h for Endomorphism of Free(S,X);
reserve
  r,r1,r2 for (Element of T),
  t,t1,t2 for (Element of Free(S,X));
reserve
  Y for infinite-yielding ManySortedSet of the carrier of S,
  y,y1 for (Element of Y.s), y11 for (Element of Y.s1),
  Q for all_vars_including inheriting_operations free_in_itself
  (Y,S)-terms MSAlgebra over S,
  q,q1 for (Element of Args(o,Free(S,Y))),
  u,u1,u2 for (Element of Q),
  v,v1,v2 for (Element of Free(S,Y)),
  Z for non-trivial ManySortedSet of the carrier of S,
  z,z1 for (Element of Z.s),
  l,l1 for (Element of Free(S,Z)),
  R for all_vars_including inheriting_operations free_in_itself
  (Z,S)-terms MSAlgebra over S,
  k,k1 for Element of Args(o,Free(S,Z));
reserve c,c1,c2 for set, d,d1 for DecoratedTree;
reserve
  w for (Element of Args(o,T)),
  p,p1 for Element of Args(o,Free(S,X));
reserve C for (context of x), C1 for (context of y), C9 for (context of z),
  C11 for (context of x11), C12 for (context of y11), D for context of s,X;
reserve
  S9 for sufficiently_rich non empty non void ManySortedSign,
  s9 for SortSymbol of S9,
  o9 for s9-dependent OperSymbol of S9,
  X9 for non-trivial ManySortedSet of the carrier of S9,
  x9 for (Element of X9.s9);

theorem Th94:
  the_sort_of C9 = s1 implies
  for z1 being z-different Element of Z.s1
  for C1 being z-omitting context of z1 holds C1-sub(C9) is context of z
  proof
    assume
A1: the_sort_of C9 = s1;
    let z1 be z-different Element of Z.s1;
    defpred P[Element of Free(S,Z)] means
    $1 is z-omitting implies ($1,[z1,s1])<-C9 is context of z;
A2: P[z1-term];
A3: for o for k st k is z1-context_including
    holds P[z1-context_in k] implies
    for C being context of z1 st C = o-term k holds P[C]
    proof let o; let k; set p = k; assume that
A2:   k is z1-context_including and
A3:   P[z1-context_in k];
      let C be context of z1;
      assume
AA:   C=o-term k;
      assume c: C is z-omitting;
      set t = C9;
      deffunc F(Nat) = (p/.$1,[z1,s1])<-t;
      consider q being FinSequence such that
A4:   len q = len p & for i st i in dom q holds q.i = F(i) from FINSEQ_1:sch 2;
A5:   dom q = dom p <> {} by A2,A4,FINSEQ_3:29;
      then
A6:   p is non empty & q is non empty;
A8:   dom p = dom the_arity_of o by MSUALG_6:2;
      then
A9:   len q = len the_arity_of o by A5,FINSEQ_3:29;
      now let i;
        assume
B1:     i in dom q;
        then
B2:     p/.i = p.i by A5,PARTFUN1:def 6;
        per cases;
        suppose z1-context_pos_in p = i;
          then
B3:       z1-context_in p = p.i & q.i = F(i) & p/.i is z-omitting
          by c,AA,A5,A4,A2,Th71,Th54;
          p.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i)
          by B1,A5,A8,MSUALG_6:2;
          then the_sort_of (z1-context_in p) = (the_arity_of o)/.i by B3,SORT;
          hence q.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i)
          by A1,B2,B3,aaa1;
        end;
        suppose z1-context_pos_in p <> i;
          then p/.i is z1-omitting by A2,A5,B1,Th72;
          then q.i = F(i) = p.i by A4,B1,B2,Th23;
          hence q.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i)
          by B1,A5,A8,MSUALG_6:2;
        end;
      end;
      then reconsider q as Element of Args(o,Free(S,Z)) by A9,MSAFREE2:5;
      now let i,d1; assume i in dom p & d1 = p.i;
        then q.i = F(i) & p/.i = d1 by A4,A5,PARTFUN1:def 6;
        hence q.i = (d1,[z1,s1])<-t;
      end;
      then
A7:   (o-term p,[z1,s1])<-t = [o,the carrier of S]-tree q by A5,A6,ThL8
      .= o-term q;
      q is z-context_including
      proof
        take i = z1-context_pos_in p;
        thus i in dom q by A2,A5,Th71;
        then
B2:     p/.i = p.i by A5,PARTFUN1:def 6;
        z1-context_in p = p.i & q.i = F(i) & p/.i is z-omitting
        by c,AA,A5,A4,A2,Th71,Th54;
        hence q.i is context of z by B2,A3;
        let j; let q1 be Element of Free(S,Z);
        assume
B4:     j in dom q & j <> i & q1 = q.j;
        then
B5:     p/.j = p.j by A5,PARTFUN1:def 6;
        p/.j is z1-omitting by A2,B4,A5,Th72;
        then q1 = F(j) = p.j by B4,A4,B5,Th23;
        hence q1 is z-omitting by c,B5,B4,A5,AA,Th54;
      end;
      hence thesis by AA,A7,Th53;
    end;
    let C1 be z-omitting context of z1;
    P[C1] from ContextInd(A2,A3);
    hence thesis by A1,SUB;
  end;
