reserve i for Nat,
  j for Element of NAT,
  X,Y,x,y,z for set;
reserve C for initialized ConstructorSignature,
  s for SortSymbol of C,
  o for OperSymbol of C,
  c for constructor OperSymbol of C;
reserve a,b for expression of C, an_Adj C;
reserve t, t1,t2 for expression of C, a_Type C;
reserve p for FinSequence of QuasiTerms C;
reserve e for expression of C;
reserve a,a9 for expression of C, an_Adj C;
reserve q for pure expression of C, a_Type C,
  A for finite Subset of QuasiAdjs C;
reserve T for quasi-type of C;
reserve f for valuation of C;
reserve x for variable;

theorem
  for f being irrelevant one-to-one valuation of C
  ex g being irrelevant one-to-one valuation of C
  st for x,y being variable holds
  x in dom f & f.x = y-term C iff y in dom g & g.y = x-term C
proof
  let f be irrelevant one-to-one valuation of C;
  set Y = {x where x is variable: x-term C in rng f};
  defpred P[object,object] means
  ex x being set st x in dom f & f.x = root-tree [ $1, a_Term] &
  $2 = root-tree [x, a_Term];
A1: for x being object st x in Y ex y being object st P[x,y]
  proof
    let x be object;
    assume x in Y;
    then
A2: ex z being variable st x = z & z-term C in rng f;
    then reconsider z = x as variable;
    consider y being object such that
A3: y in dom f and
A4: z-term C = f.y by A2,FUNCT_1:def 3;
    reconsider y as variable by A3;
    take y-term C;
    thus thesis by A3,A4;
  end;
  consider g being Function such that
A5: dom g = Y and
A6: for y being object st y in Y holds P[y,g.y]
       from CLASSES1:sch 1(A1);
A7: Y c= Vars
  proof
    let x be object;
    assume x in Y;
    then ex z being variable st x = z & z-term C in rng f;
    hence thesis;
  end;
  rng g c= QuasiTerms C
  proof
    let y be object;
    assume y in rng g;
    then consider x being object such that
A8: x in dom g and
A9: y = g.x by FUNCT_1:def 3;
    reconsider x as variable by A5,A7,A8;
    consider z being set such that
A10: z in dom f and f.z = x-term C and
A11: g.x = root-tree [z,a_Term] by A5,A6,A8;
    reconsider z as variable by A10;
    y = z-term C by A9,A11;
    hence thesis by Def28;
  end;
  then reconsider g as valuation of C by A5,A7,RELSET_1:4;
A12: g is irrelevant
  proof
    let x be variable;
    assume x in dom g;
    then consider y being set such that
A13: y in dom f and f.y = x-term C and
A14: g.x = root-tree [y,a_Term] by A5,A6;
    reconsider y as variable by A13;
    take y;
    thus thesis by A14;
  end;
  g is one-to-one
  proof
    let z1,z2 be object;
    assume that
A15: z1 in dom g and
A16: z2 in dom g and
A17: g.z1 = g.z2;
    reconsider z1,z2 as variable by A15,A16;
    consider x1 being set such that
A18: x1 in dom f and
A19: f.x1 = z1-term C and
A20: g.z1 = root-tree[x1,a_Term] by A5,A6,A15;
    consider x2 being set such that
A21: x2 in dom f and
A22: f.x2 = z2-term C and
A23: g.z1 = root-tree[x2,a_Term] by A5,A6,A16,A17;
    reconsider x1,x2 as variable by A18,A21;
    x1-term C = x2-term C by A20,A23;
    then x1 = x2 by Th50;
    hence thesis by A19,A22,Th50;
  end;
  then reconsider g as irrelevant one-to-one valuation of C by A12;
  take g;
  let x,y be variable;
  hereby
    assume that
A24: x in dom f and
A25: f.x = y-term C;
    f.x in rng f by A24,FUNCT_1:def 3;
    hence y in dom g by A5,A25;
    then P[y,g.y] by A5,A6;
    hence g.y = x-term C by A24,A25,FUNCT_1:def 4;
  end;
  assume that
A26: y in dom g and
A27: g.y = x-term C;
  consider z being set such that
A28: z in dom f and
A29: f.z = root-tree [y, a_Term] and
A30: x-term C = root-tree [z, a_Term] by A5,A6,A26,A27;
  reconsider z as variable by A28;
  x-term C = z-term C by A30;
  hence thesis by A28,A29,Th50;
end;
