!set methtit2=Apply the transitivity of inequalities
!set methtit=Transitivity of inequalities
!set methenv=ZZ QQ RR
!set methparmtype=parm inequality >,parm inequality >
!set methhelp=This method applies the transitity of inequalities:\
  <div class="wimscenter">\
  \(A > B) and \(B > C) implies \(A > C).\
 </div>\
 The first two inequalities must already exist in the hypotheses, and the\
 third will be added into the hypotheses. You can also give the two\
 original inequalities under the form \(A > B) and \(C < B) for example.

!if $wims_read_parm iswordof form check
  !goto $wims_read_parm
!endif

!exit
:form
Apply the transitivity on the inequalities
!read deduc/methparm.phtml 1
 and
!read deduc/methparm.phtml 2

!exit
:check
!distribute items $methparmobj1 into data,left1,sign1,right1
!distribute items $methparmobj2 into data,left2,sign2,right2
methexp=Transitivity on \($left1 $sign1 $right1) and \($left2 $sign2 $right2)

gt=>
lt=<
!if ($gt isin $sign1 and $lt isin $sign2) or\
	($lt isin $sign1 and $gt isin $sign2)
  !exchange left2,right2
!endif
!read deduc/sub/simplify ($right1) - ($left2)\
	($right2) - ($left1)
!distribute lines $out into test1,test2
!if $test1!=0
  !if $test2!=0
    error=The transitivity does not apply on your inequalities.
    !advance penalty
    !exit
  !else
    !exchange right1,right2
    !exchange left1,left2
  !endif
!endif

!if $gt isin $sign1
  s_=>
!else
  s_=<
!endif
eq=$empty=
!if $eq isin $sign1 and $eq isin $sign2
  s_=$s_=
!endif
newobject0=$left1 $s_ $right2
oldobject=0

!exit
