 reserve a,Z1,Z2,Z3 for set,
         x,y,z for object,
         k for Nat;
 reserve S for RelStr;
 reserve P,Q for non empty flat Poset;
 reserve p,p1,p2 for Element of P;
 reserve K for non empty Chain of P;
 reserve X,Y for non empty set;
 reserve D for Subset of X;
 reserve I for Function of X,Y;
 reserve J for Function of [:X,Y:], Y;
 reserve E for Function of X,X;
 reserve D for Subset of X;
 reserve I,I1,I2 for Function of X,Y;
 reserve J,J1,J2 for Function of [:X,Y,Y:], Y;
 reserve E1,E2 for Function of X,X;

theorem
  for f1,f2 being Function of X,Y holds
    E1,E2 is_well_founded_with_minimal_set D &
    (for x being Element of X holds
       (x in D implies f1.x = I.x) &
       (not x in D implies f1.x = J.[x,f1.(E1.x),f1.(E2.x)])) &
    (for x being Element of X holds
       (x in D implies f2.x = I.x) &
       (not x in D implies f2.x = J.[x,f2.(E1.x),f2.(E2.x)]))
      implies f1 = f2
    proof
    let f1,f2 be Function of X,Y;
    assume
A0: E1,E2 is_well_founded_with_minimal_set D &
    (for x being Element of X holds
       (x in D implies f1.x = I.x) &
       (not x in D implies f1.x = J.[x,f1.(E1.x),f1.(E2.x)])) &
    (for x being Element of X holds
       (x in D implies f2.x = I.x) &
       (not x in D implies f2.x = J.[x,f2.(E1.x),f2.(E2.x)])); then
    consider l be Function of X,NAT such that
A1:   for x being Element of X holds
     (l.x <= 0 implies x in D) &
     (not x in D implies l.(E1.x) < l.x & l.(E2.x) < l.x);
    defpred P[Nat] means
         for x being Element of X st l.x<=$1 holds f1.x = f2.x;
A2: P[0]
    proof
      let x be Element of X;
      assume b1: l.x <= 0; then
      f1.x = I.x by A0,A1
          .= f2.x by A0,b1,A1;
      hence thesis;
    end;
A3: for k st P[k] holds P[k + 1]
    proof
      let k;
      assume
B0:   P[k];
      let x be Element of X;
      assume
B1:   l.x <= k+1;
      per cases;
        suppose
C0:       x in D;
          f1.x = I.x by A0,C0
              .= f2.x by A0,C0;
          hence thesis;
        end;
        suppose
C0:       not x in D;
          set x1 = E1.x, x2 = E2.x;
          reconsider x as Element of X;
          l.x1 + 1 <= l.x & l.x2 + 1 <= l.x by NAT_1:13,A1,C0;
          then l.x1 + 1 <= k + 1 & l.x2 + 1 <= k + 1 by B1,XXREAL_0:2;
          then
C2:       f1.x1 = f2.x1 & f1.x2 = f2.x2 by B0,XREAL_1:8;
          f1.x = J.[x,f1.x1,f1.x2] by A0,C0
              .= f2.x by C2,A0,C0;
          hence thesis;
        end;
      end;
A4: for k being Nat holds P[k] from NAT_1:sch 2(A2,A3);
    for x being Element of X holds f1.x = f2.x
    proof
      let x be Element of X;
      reconsider k = l.x as Nat;
      l.x <= k;
      hence thesis by A4;
    end;
    hence thesis;
  end;
