reserve X for set;
reserve n,i for Element of NAT;
reserve a,b,c,d,e,r,x0 for Real;
reserve A for non empty closed_interval Subset of REAL;
reserve f,g,h for PartFunc of REAL,REAL n;
reserve E for Element of REAL n;

theorem Th22:
  for n be non zero Element of NAT, f be PartFunc of REAL,REAL n
  st a <= b & f is_integrable_on ['a,b'] & |. f .| is_integrable_on ['a,b']
    & f| ['a,b'] is bounded & ['a,b'] c= dom f & c in ['a,b'] & d in ['a,b']
  holds |. f .| is_integrable_on ['min(c,d),max(c,d)'] &
    (|. f .|) | ['min(c,d),max(c,d)'] is bounded &
    |. integral(f,c,d) .| <= integral((|. f .|),min(c,d),max(c,d))
  proof
    let n be non zero Element of NAT, f be PartFunc of REAL,REAL n;
    assume A1: a <= b & f is_integrable_on ['a,b']
    & |. f .| is_integrable_on ['a,b'] & f| ['a,b'] is bounded &
    ['a,b'] c= dom f & c in ['a,b'] & d in ['a,b'];
    per cases;
    suppose
A2:   not c <= d; then
A3:   ['d,c'] = [.d,c.] by INTEGRA5:def 3; then
      integral(f,c,d) = -integral(f,['d,c']) by INTEGR15:20; then
      integral(f,c,d) = -integral(f,d,c) by A3,INTEGR15:19; then
A4:   |. integral(f,c,d) .| = |.integral(f,d,c).| by EUCLID:10;
      d = min(c,d) & c = max(c,d) by A2,XXREAL_0:def 9,def 10;
      hence thesis by A1,A2,A4,Lm10;
    end;
    suppose
A5:   c <= d; then
      c = min(c,d) & d = max(c,d) by XXREAL_0:def 9,def 10;
      hence thesis by A1,A5,Lm10;
    end;
  end;
