
theorem Th57: :: lemma 5.26, p. 202
  for n being Ordinal, T being connected TermOrder of n, L being
  Abelian add-associative right_complementable right_zeroed commutative
  associative well-unital distributive almost_left_invertible non trivial
  doubleLoopStr, P being Subset of Polynom-Ring(n,L), f,g being Element of
  Polynom-Ring(n,L) holds f,g are_convertible_wrt PolyRedRel(P,T) implies f,g
  are_congruent_mod P-Ideal
proof
  let n be Ordinal, T be connected TermOrder of n, L be Abelian
  add-associative right_complementable right_zeroed commutative associative
well-unital distributive almost_left_invertible non trivial doubleLoopStr, P
  be Subset of Polynom-Ring(n,L), f,g be Element of Polynom-Ring(n,L);
  set R = PolyRedRel(P,T), PR = Polynom-Ring(n,L);
  defpred P[Nat] means for f,g being Element of Polynom-Ring(n,L) st R \/ R~
reduces f,g for p being RedSequence of R \/ R~ st p.1 = f & p.len p = g & len p
  = $1 holds f,g are_congruent_mod P-Ideal;
  assume f,g are_convertible_wrt PolyRedRel(P,T);
  then
A1: R \/ R~ reduces f,g by REWRITE1:def 4;
  then consider p being RedSequence of R \/ R~ such that
A2: p.1 = f & p.len p = g by REWRITE1:def 3;
A3: 0_(n,L) = 0.Polynom-Ring(n,L) by POLYNOM1:def 11;
A4: now
    let k be Nat;
    assume
A5: 1 <= k;
    thus P[k] implies P[k+1]
    proof
      assume
A6:   P[k];
      now
        let f,g be Element of Polynom-Ring(n,L);
        assume R \/ R~ reduces f,g;
        let p be RedSequence of R \/ R~;
        assume that
A7:     p.1 = f and
A8:     p.len p = g and
A9:     len p = k+1;
A10:    dom p = Seg(k+1) by A9,FINSEQ_1:def 3;
        then
A11:    k+1 in dom p by FINSEQ_1:4;
        set q = p|(Seg k);
        reconsider q as FinSequence by FINSEQ_1:15;
A12:    k <= k+1 by NAT_1:11;
        then
A13:    dom q = Seg k by A9,FINSEQ_1:17;
        then
A14:    k in dom q by A5,FINSEQ_1:1;
        set h = q.len q;
A15:    len q = k by A9,A12,FINSEQ_1:17;
        k in dom p by A5,A10,A12,FINSEQ_1:1;
        then [p.k,p.(k+1)] in R \/ R~ by A11,REWRITE1:def 2;
        then [h,g] in R \/ R~ by A8,A9,A15,A14,FUNCT_1:47;
        then
A16:    [h,g] in R or [h,g] in R~ by XBOOLE_0:def 3;
A17:    now
          per cases by A16,RELAT_1:def 7;
          case
            [h,g] in R;
            then consider h9,g9 being object such that
A18:        [h,g] = [h9,g9] and
A19:        h9 in NonZero Polynom-Ring(n,L) and
            g9 in (the carrier of Polynom-Ring(n,L)) by RELSET_1:2;
            h = h9 by A18,XTUPLE_0:1;
            hence h in (the carrier of Polynom-Ring(n,L)) \ {0_(n,L)} & h in (
the carrier of Polynom-Ring(n,L)) & g in (the carrier of Polynom-Ring(n,L)) by
A19,POLYNOM1:def 11;
          end;
          case
            [g,h] in R;
            then consider h9,g9 being object such that
A20:        [g,h] = [h9,g9] and
A21:        h9 in NonZero Polynom-Ring(n,L) & g9 in (the carrier of
            Polynom-Ring(n,L)) by RELSET_1:2;
A22:        h = g9 by A20,XTUPLE_0:1;
            g = h9 by A20,XTUPLE_0:1;
            hence g in (the carrier of Polynom-Ring(n,L)) \ {0_(n,L)} & g in (
the carrier of Polynom-Ring(n,L)) & h in (the carrier of Polynom-Ring(n,L)) by
A21,A22,POLYNOM1:def 11;
          end;
        end;
        now
          let i be Nat;
          assume that
A23:      i in dom q and
A24:      i+1 in dom q;
          i+1 <= k by A13,A24,FINSEQ_1:1;
          then
A25:      i+1 <= k+1 by A12,XXREAL_0:2;
          i <= k by A13,A23,FINSEQ_1:1;
          then
A26:      i <= k+1 by A12,XXREAL_0:2;
          1 <= i+1 by A13,A24,FINSEQ_1:1;
          then
A27:      i+1 in dom p by A10,A25,FINSEQ_1:1;
          1 <= i by A13,A23,FINSEQ_1:1;
          then i in dom p by A10,A26,FINSEQ_1:1;
          then
A28:      [p.i, p.(i+1)] in R \/ R~ by A27,REWRITE1:def 2;
          p.i = q.i by A23,FUNCT_1:47;
          hence [q.i, q.(i+1)] in R \/ R~ by A24,A28,FUNCT_1:47;
        end;
        then reconsider q as RedSequence of R \/ R~ by A5,A15,REWRITE1:def 2;
        reconsider h as Polynomial of n,L by A17,POLYNOM1:def 11;
        reconsider h9 = h as Element of Polynom-Ring(n,L) by POLYNOM1:def 11;
        reconsider h9 as Element of Polynom-Ring(n,L);
        1 in dom q by A5,A13,FINSEQ_1:1;
        then
A29:    q.1 = f by A7,FUNCT_1:47;
        then R \/ R~ reduces f,h by REWRITE1:def 3;
        then
A30:    f,h9 are_congruent_mod P-Ideal by A6,A9,A12,A29,FINSEQ_1:17;
        now
          per cases by A16,RELAT_1:def 7;
          case
A31:        [h,g] in R;
            then consider h9,g9 being object such that
A32:        [h,g] = [h9,g9] and
A33:        h9 in NonZero Polynom-Ring(n,L) and
A34:        g9 in (the carrier of Polynom-Ring(n,L)) by RELSET_1:2;
A35:        h = h9 by A32,XTUPLE_0:1;
            not h9 in {0_(n,L)} by A3,A33,XBOOLE_0:def 5;
            then h9 <> 0_(n,L) by TARSKI:def 1;
            then reconsider h as non-zero Polynomial of n,L by A35,
POLYNOM7:def 1;
A36:        g = g9 by A32,XTUPLE_0:1;
            reconsider g9 as Polynomial of n,L by A34,POLYNOM1:def 11;
            reconsider h9 = h as Element of Polynom-Ring(n,L) by
POLYNOM1:def 11;
            reconsider h9 as Element of Polynom-Ring(n,L);
            h reduces_to g9,P,T by A31,A36,Def13;
            then h9,g are_congruent_mod P-Ideal by A36,Lm19;
            then f,g are_congruent_mod P-Ideal by A30,Th54;
            hence f-g in P-Ideal;
          end;
          case
A37:        [g,h] in R;
            then consider g9,h9 being object such that
A38:        [g,h] = [g9,h9] and
A39:        g9 in NonZero Polynom-Ring(n,L) and
A40:        h9 in (the carrier of Polynom-Ring(n,L)) by RELSET_1:2;
A41:        g = g9 by A38,XTUPLE_0:1;
            not g9 in {0_(n,L)} by A3,A39,XBOOLE_0:def 5;
            then
A42:        g9 <> 0_(n,L) by TARSKI:def 1;
A43:        h = h9 by A38,XTUPLE_0:1;
            then reconsider h as Element of Polynom-Ring(n,L) by A40;
            reconsider h9 as Polynomial of n,L by A43;
            reconsider g9 = g as non-zero Polynomial of n,L by A41,A42,
POLYNOM1:def 11,POLYNOM7:def 1;
            reconsider gg = g9 as Element of Polynom-Ring(n,L);
            reconsider gg as Element of Polynom-Ring(n,L);
            reconsider h as Element of Polynom-Ring(n,L);
            g9 reduces_to h9,P,T by A37,A43,Def13;
            then h,gg are_congruent_mod P-Ideal by A43,Lm19,Th53;
            then f,gg are_congruent_mod P-Ideal by A30,Th54;
            hence f-g in P-Ideal;
          end;
        end;
        hence f,g are_congruent_mod P-Ideal;
      end;
      hence thesis;
    end;
  end;
A44: P[1]
  proof
    let f,g be Element of Polynom-Ring(n,L);
    assume R \/ R~ reduces f,g;
    let p be RedSequence of R \/ R~;
    assume p.1 = f & p.len p = g & len p = 1;
    then
A45: f - g = 0.PR by RLVECT_1:15;
    0.PR in P-Ideal by IDEAL_1:3;
    hence thesis by A45;
  end;
A46: for k being Nat st 1 <= k holds P[k] from NAT_1:sch 8(A44,A4);
  consider k being Nat such that
A47: len p = k;
  1 <= k by A47,NAT_1:14;
  hence thesis by A46,A1,A2,A47;
end;
