reserve n   for Nat,
        r,s for Real,
        x,y for Element of REAL n,
        p,q for Point of TOP-REAL n,
        e   for Point of Euclid n;
reserve n for non zero Nat;

theorem Th31:
  for x being object st x in MeasurableRectangle(ProductLeftOpenIntervals(n))
  holds ex y being Subset of REAL n,
           f being n-element FinSequence of [:REAL,REAL:]
        st x = y &
        (for t being Element of REAL n holds t in y
              iff
         for i being Nat st i in Seg n holds t.i in ].(f/.i)`1,(f/.i)`2.])
  proof
    let x be object;
    assume
A1: x in MeasurableRectangle(ProductLeftOpenIntervals(n));
    MeasurableRectangle(ProductLeftOpenIntervals(n)) is
      Subset-Family of REAL n by Th30;
    then reconsider y = x as Subset of REAL n by A1;
    take y;
    reconsider x0 = x as set by TARSKI:1;
    consider g be Function such that
A2: x = product g and
A3: g in product ProductLeftOpenIntervals(n) by A1,SRINGS_4:def 4;
    dom ProductLeftOpenIntervals(n) = Seg n by FUNCOP_1:13; then
A4: dom g = Seg n by A3,CARD_3:9;
A5: now
      let i be Nat;
      assume
A6:   i in Seg n;
      then i in dom ProductLeftOpenIntervals(n) by FUNCOP_1:13;
      then g.i in (ProductLeftOpenIntervals(n)).i by A3,CARD_3:9;
      then g.i in the_set_of_all_left_open_real_bounded_intervals
        by A6,FUNCOP_1:7;
      hence ex a,b be Real st g.i = ].a,b.];
    end;
    defpred P[Nat,set] means ex x be Element of [:REAL,REAL:] st $2 = x &
    g.$1 = ].x`1,x`2.];
A7: for i be Nat st i in Seg n holds ex d be Element of [:REAL,REAL:] st P[i,d]
    proof
      let i be Nat;
      assume i in Seg n;
      then consider a,b be Real such that
A8:   g.i = ].a,b.] by A5;
      set d = [a,b];
      a in REAL & b in REAL by XREAL_0:def 1;
      then reconsider d as Element of [:REAL,REAL:] by ZFMISC_1:def 2;
      take d;
      d is Element of [:REAL,REAL:] & g.i = ].d`1,d`2.] by A8;
      hence thesis;
    end;
    ex f2 being FinSequence of [:REAL,REAL:] st len f2 = n & for i be Nat st
    i in Seg n holds P[i,f2/.i] from FINSEQ_4:sch 1(A7);
    then consider f2 being FinSequence of [:REAL,REAL:] such that
A9: len f2 = n and
A10: for i be Nat st i in Seg n holds
    ex x be Element of [:REAL,REAL:] st f2/.i = x & g.i = ].x`1,x`2.];
    reconsider f2 as n-element FinSequence of [:REAL,REAL:] by A9,CARD_1:def 7;
    take f2;
    thus x = y;
A11: for i be Nat st i in Seg n holds g.i = ].(f2/.i)`1,(f2/.i)`2.]
    proof
      let i be Nat;
      assume i in Seg n;
      then consider x be Element of [:REAL,REAL:] such that
A12:  f2/.i = x and
A13:  g.i = ].x`1,x`2.] by A10;
      thus thesis by A12,A13;
    end;
A14: for t be Element of REAL n st t in y
    holds for i be Nat st i in Seg n holds t.i in ].(f2/.i)`1,(f2/.i)`2.]
    proof
      let t be Element of REAL n;
      assume t in y;
      then consider j0 be Function such that
A15:  t = j0 and dom j0 = Seg n and
A16:  for y be object st y in Seg n holds j0.y in g.y by A2,CARD_3:def 5,A4;
      now
        let i be Nat;
        assume
A17:    i in Seg n;
        then t.i in g.i by A15,A16;
        hence t.i in ].(f2/.i)`1,(f2/.i)`2.] by A17,A11;
      end;
      hence thesis;
    end;
    for t be Element of REAL n st
    for i be Nat st i in Seg n holds t.i in ].(f2/.i)`1,(f2/.i)`2.]
    holds t in y
    proof
      let t be Element of REAL n;
      assume
A18:   for i be Nat st i in Seg n holds t.i in ].(f2/.i)`1,(f2/.i)`2.];
      reconsider j =t as Function;
      t is Element of Funcs(Seg n,REAL) by FINSEQ_2:93; then
A19:  ex j0 be Function st j = j0 & dom j0 = Seg n &
      rng j0 c= REAL by FUNCT_2:def 2;
      for y be object st y in Seg n holds j.y in g.y
      proof
        let y be object;
        assume
A20:    y in Seg n;
        then reconsider y1=y as Nat;
        g.y1 = ].(f2/.y1)`1,(f2/.y1)`2.] by A20,A11;
        hence thesis by A20,A18;
      end;
      hence t in y by A19,A2,CARD_3:def 5,A4;
    end;
    hence thesis by A14;
  end;
