 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;

theorem
  for f1,f2 being Function of X,Y holds
    E 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.(E.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.(E.x)]))
      implies f1 = f2
    proof
    let f1,f2 be Function of X,Y;
    assume
A0: E 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.(E.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.(E.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.(E.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;
        reconsider x1 = E.x as Element of X;
        reconsider x as Element of X;
        l.x1 + 1 <= l.x by NAT_1:13,A1,C0;
        then c2: l.x1 + 1 <= k + 1 by B1,XXREAL_0:2;
        f1.x = J.[x,f1.x1] by A0,C0
            .= J.[x,f2.x1] by c2,B0,XREAL_1:8
            .= f2.x by 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;
