reserve A for QC-alphabet;
reserve i,j,k for Nat;
reserve f for Substitution of A;

theorem Th5:
  for l being QC-variable_list of k, A holds l is CQC-variable_list
of k,A iff { l.i : 1 <= i & i <= len l & l.i in free_QC-variables(A) }
           = {} & { l.j
  : 1 <= j & j <= len l & l.j in fixed_QC-variables(A) } = {}
proof
  let l be QC-variable_list of k, A;
  set FR = { l.i : 1 <= i & i <= len l & l.i in free_QC-variables(A) };
  set FI = { l.j : 1 <= j & j <= len l & l.j in fixed_QC-variables(A) };
  thus l is CQC-variable_list of k, A implies FR = {} & FI = {}
  proof
    assume l is CQC-variable_list of k, A;
    then reconsider l as CQC-variable_list of k, A;
    now
      set x =the  Element of FR;
      assume FR <> {};
      then x in FR;
      then consider i such that
      x = l.i and
A1:   1 <= i & i <= len l and
A2:   l.i in free_QC-variables(A);
      i in dom l by A1,FINSEQ_3:25;
      then rng l c= bound_QC-variables(A) & l.i in rng l by FUNCT_1:def 3
,RELAT_1:def 19;
      hence contradiction by A2,QC_LANG3:34;
    end;
    hence FR = {};
    now
      set x =the  Element of FI;
      assume FI <> {};
      then x in FI;
      then consider i such that
      x = l.i and
A3:   1 <= i & i <= len l and
A4:   l.i in fixed_QC-variables(A);
      i in dom l by A3,FINSEQ_3:25;
      then rng l c= bound_QC-variables(A) & l.i in rng l by FUNCT_1:def 3
,RELAT_1:def 19;
      hence contradiction by A4,QC_LANG3:33;
    end;
    hence thesis;
  end;
  assume that
A5: FR = {} and
A6: FI = {};
  l is bound_QC-variables(A)-valued
  proof
    let x be object;
A7: rng l c= QC-variables(A) by FINSEQ_1:def 4;
    assume x in rng l;
    then consider i being object such that
A8: i in dom l and
A9: l.i = x by FUNCT_1:def 3;
    reconsider i as Nat by A8;
A10: 1 <= i & i <= len l by A8,FINSEQ_3:25;
A11: now
      assume x in fixed_QC-variables(A);
      then x in FI by A9,A10;
      hence contradiction by A6;
    end;
A12: now
      assume x in free_QC-variables(A);
      then x in FR by A9,A10;
      hence contradiction by A5;
    end;
    l.i in rng l by A8,FUNCT_1:def 3;
    hence thesis by A9,A7,A11,A12,Th1;
  end;
  hence thesis;
end;
