!set methtit=Add two inequalities
!set methenv=ZZ QQ RR
!set methparmtype=parm inequality >,parm inequality >
!set methhelp=This method applies the following property on two existing\
inequalities, to deduce a third one:\
 <div class="wimscenter">\
 If \(a > b) and \(c > b), then \(a+c > b+d) .\
</div>\
 The last inequality will be put into the hypotheses.

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

!exit
:form
 Add 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=Add \($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 $left1 + ($left2)\
	$right1 + ($right2)
!distribute lines $out into newleft, newright
!if $newleft=$empty or $newright=$empty
  error=bad_data
  !exit
!endif

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

contextlist=$ct_Always,\
	$ct_Onlywhen the two inequalities are positive,\
	$ct_Onlywhen one of the two inequalities is positive,\
	$ct_Onlywhen one of the two inequalities is of the same sign

!exit
