reserve X for non empty set;
reserve e for set;
reserve x for Element of X;
reserve f,g for PartFunc of X,ExtREAL;
reserve S for SigmaField of X;
reserve F for Function of RAT,S;
reserve p,q for Rational;
reserve r for Real;
reserve n,m for Nat;
reserve A,B for Element of S;

theorem
  chi(A,X) is B-measurable
proof
 for r be Real holds B /\ less_eq_dom(chi(A,X), r) in S
  proof
    let r be Real;
    reconsider r as Real;
 now per cases;
      suppose
A1:     r >= 1;
        for x being object st x in X holds x in less_eq_dom(chi(A,X), r)
        proof
          let x be object;
          assume
A2:       x in X;
then A3:       x in dom chi(A,X) by FUNCT_3:def 3;
          reconsider x as Element of X by A2;
       chi(A,X).x <= 1.
          proof
         now per cases;
              suppose
             x in A;
                hence thesis by FUNCT_3:def 3;
              end;
              suppose
            not x in A;
                hence thesis by FUNCT_3:def 3;
              end;
            end;
            hence thesis;
          end;
then       chi(A,X).x <=  r by A1,XXREAL_0:2;
          hence thesis by A3,MESFUNC1:def 12;
        end;
then     X c= less_eq_dom(chi(A,X), r);
then     less_eq_dom(chi(A,X), r) = X;
then     less_eq_dom(chi(A,X), r) in S by PROB_1:5;
        hence thesis by FINSUB_1:def 2;
      end;
      suppose
A4:    0 <= r & r < 1;
            for
 x being object st x in less_eq_dom(chi(A,X), r) holds x in X\A
        proof
          let x be object;
          assume
A5:      x in less_eq_dom(chi(A,X), r);
          then reconsider x as Element of X;
      chi(A,X).x <=  r by A5,MESFUNC1:def 12;
then       not x in A by A4,FUNCT_3:def 3;
          hence thesis by XBOOLE_0:def 5;
        end;
then A6:    less_eq_dom(chi(A,X), r) c= X\A;
            for
 x being object st x in X\A holds x in less_eq_dom(chi(A,X), r)
        proof
          let x be object;
          assume
A7:      x in X\A;
then A8:      x in X;
A9:      not x in A by A7,XBOOLE_0:def 5;
          reconsider x as Element of X by A7;
A10:      chi(A,X).x = 0. by A9,FUNCT_3:def 3;
      x in dom chi(A,X) by A8,FUNCT_3:def 3;
          hence thesis by A4,A10,MESFUNC1:def 12;
        end;
then     X\A c= less_eq_dom(chi(A,X), r);
then A11:    less_eq_dom(chi(A,X), r) = X\A by A6;
    X in S by PROB_1:5;
then     less_eq_dom(chi(A,X), r) in S by A11,MEASURE1:6;
        hence thesis by FINSUB_1:def 2;
      end;
      suppose
A12:    r < 0;
    for x holds not x in less_eq_dom(chi(A,X), r)
        proof
          assume ex x st x in less_eq_dom(chi(A,X), r);
          then consider x such that
A13:      x in less_eq_dom(chi(A,X), r);
      0. <= chi(A,X).x
          proof
        now per cases;
              suppose
            x in A;
                hence thesis by FUNCT_3:def 3;
              end;
              suppose
            not x in A;
                hence thesis by FUNCT_3:def 3;
              end;
            end;
            hence thesis;
          end;
          hence contradiction by A12,A13,MESFUNC1:def 12;
        end;
then     less_eq_dom(chi(A,X), r) = {} by SUBSET_1:4;
        hence thesis by PROB_1:4;
      end;
    end;
    hence thesis;
  end;
  hence thesis by MESFUNC1:28;
end;
