reserve x for set;
reserve k, l for Nat;
reserve p, q for FinSequence;
reserve R for Relation;
reserve p, q for RedSequence of R;
reserve E for set;
reserve s, t for XFinSequence;
reserve p, q for XFinSequence-yielding FinSequence;
reserve E for set;
reserve S, T, U for semi-Thue-system of E;
reserve s, t, s1, t1, u, v, u1, v1, w for Element of E^omega;
reserve p for FinSequence of E^omega;

theorem Th58:
  S, T are_equivalent_wrt w & ==>.-relation(S \/ T) reduces w, s
  implies ==>.-relation(S) reduces w, s
proof
  assume that
A1: Lang(w, S) = Lang(w, T) and
A2: ==>.-relation(S \/ T) reduces w, s;
A3: ex p being RedSequence of ==>.-relation(S \/ T) st p.1 = w & p.len p = s
  by A2,REWRITE1:def 3;
  defpred P[Nat] means for p being RedSequence of ==>.-relation(S \/ T), t st
  len p = $1 & p.1 = w & p.len p = t ex q being RedSequence of ==>.-relation(S)
  st q.1 = w & q.len q = t;
A4: now
    let k;
    assume
A5: P[k];
    thus P[k + 1]
    proof
      let p be RedSequence of ==>.-relation(S \/ T), t such that
A6:   len p = k + 1 and
A7:   p.1 = w and
A8:   p.len p = t;
      per cases;
      suppose
        not k in dom p & k + 1 in dom p;
        then k = 0 by Th1;
        then p = <*w*> by A6,A7,FINSEQ_1:40;
        then reconsider p as RedSequence of ==>.-relation(S) by REWRITE1:6;
        take p;
        thus thesis by A7,A8;
      end;
      suppose
        not k + 1 in dom p;
        then 0 + 1 > k + 1 by A6,FINSEQ_3:25;
        hence thesis by XREAL_1:6;
      end;
      suppose
A9:     k in dom p & k + 1 in dom p;
        set u = p.k;
A10:    [p.k, p.(k + 1)] in ==>.-relation(S \/ T) by A9,REWRITE1:def 2;
        then reconsider u as Element of E^omega by ZFMISC_1:87;
A11:    u ==>. t, S \/ T by A6,A8,A10,Def6;
        ex p1 being RedSequence of ==>.-relation(S \/ T) st len p1 = k &
        p1.1 = w & p1.len p1 = u by A7,A9,Th4;
        then ex q being RedSequence of ==>.-relation(S) st q.1 = w & q.len q =
        u by A5;
        then ==>.-relation(S) reduces w, u by REWRITE1:def 3;
        then
A12:    w ==>* u, S;
        per cases by A11,Th21;
        suppose
          u ==>. t, S;
          then u ==>* t, S by Th33;
          then w ==>* t, S by A12,Th35;
          then ==>.-relation(S) reduces w, t;
          hence thesis by REWRITE1:def 3;
        end;
        suppose
A13:      u ==>. t, T;
          u in Lang(w, S) by A12;
          then
A14:      w ==>* u, T by A1,Th46;
          u ==>* t, T by A13,Th33;
          then w ==>* t, T by A14,Th35;
          then t in Lang(w, T);
          then w ==>* t, S by A1,Th46;
          then ==>.-relation(S) reduces w, t;
          hence thesis by REWRITE1:def 3;
        end;
      end;
    end;
  end;
A15: P[0] by REWRITE1:def 2;
  for k holds P[k] from NAT_1:sch 2(A15, A4);
  then ex q being RedSequence of ==>.-relation(S) st q.1 = w & q.len q = s by
A3;
  hence thesis by REWRITE1:def 3;
end;
