svf-lib 1.0.1713 → 1.0.1715
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-linux/svf/include/AbstractExecution/IntervalValue.h +74 -26
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/AbstractExecution/IntervalValue.h +74 -26
- package/package.json +1 -1
|
Binary file
|
|
@@ -577,74 +577,100 @@ inline IntervalValue operator%(const IntervalValue &lhs,
|
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
-
|
|
580
|
+
// Compare two IntervalValues for greater than
|
|
581
581
|
inline IntervalValue operator>(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
582
582
|
{
|
|
583
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
583
584
|
if (lhs.isBottom() || rhs.isBottom())
|
|
584
585
|
{
|
|
585
586
|
return IntervalValue::bottom();
|
|
586
587
|
}
|
|
587
|
-
|
|
588
|
+
// If either lhs or rhs is top, the result is top
|
|
589
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
588
590
|
{
|
|
589
591
|
return IntervalValue::top();
|
|
590
592
|
}
|
|
591
593
|
else
|
|
592
594
|
{
|
|
595
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
593
596
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
594
597
|
{
|
|
598
|
+
// It means lhs.lb() > rhs.lb()? true: false
|
|
595
599
|
return lhs.lb().leq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
|
|
596
600
|
}
|
|
597
601
|
else
|
|
598
602
|
{
|
|
599
|
-
//
|
|
603
|
+
// Return [1,1] means lhs is totally greater than rhs
|
|
604
|
+
// When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
|
|
605
|
+
// lhs.lb(3) > rhs.ub(2)
|
|
606
|
+
// It means lhs.lb() > rhs.ub()
|
|
600
607
|
if (!lhs.lb().leq(rhs.ub()))
|
|
601
608
|
{
|
|
602
609
|
return IntervalValue(1, 1);
|
|
603
|
-
// lhs[1,2] rhs[3,4]
|
|
604
610
|
}
|
|
605
|
-
|
|
611
|
+
// Return [0,0] means lhs is totally impossible to be greater than rhs
|
|
612
|
+
// i.e., lhs is totally less than or equal to rhs
|
|
613
|
+
// When lhs.ub <= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
|
|
614
|
+
// lhs.ub(4) <= rhs.lb(4)
|
|
615
|
+
else if (lhs.ub().leq(rhs.lb()))
|
|
606
616
|
{
|
|
607
617
|
return IntervalValue(0, 0);
|
|
608
618
|
}
|
|
619
|
+
// For other cases, lhs can be greater than or not, depending on the values
|
|
620
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
621
|
+
// lhs can be greater than rhs if lhs is 4 and rhs is 1.
|
|
622
|
+
// lhs can also not be greater than rhs if lhs is 2 and rhs is 3
|
|
609
623
|
else
|
|
610
624
|
{
|
|
611
|
-
// lhs[1,3] rhs[2,4]
|
|
612
625
|
return IntervalValue(0, 1);
|
|
613
626
|
}
|
|
614
627
|
}
|
|
615
628
|
}
|
|
616
629
|
}
|
|
617
630
|
|
|
618
|
-
|
|
631
|
+
// Compare two IntervalValues for less than
|
|
619
632
|
inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
620
633
|
{
|
|
634
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
621
635
|
if (lhs.isBottom() || rhs.isBottom())
|
|
622
636
|
{
|
|
623
637
|
return IntervalValue::bottom();
|
|
624
638
|
}
|
|
625
|
-
|
|
639
|
+
// If either lhs or rhs is top, the result is top
|
|
640
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
626
641
|
{
|
|
627
642
|
return IntervalValue::top();
|
|
628
643
|
}
|
|
629
644
|
else
|
|
630
645
|
{
|
|
646
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
631
647
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
632
648
|
{
|
|
649
|
+
// It means lhs.lb() < rhs.lb()? true: false
|
|
633
650
|
return lhs.lb().geq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
|
|
634
651
|
}
|
|
635
652
|
else
|
|
636
653
|
{
|
|
637
|
-
//
|
|
654
|
+
// Return [1,1] means lhs is totally less than rhs
|
|
655
|
+
// When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
|
|
656
|
+
// lhs.ub(2) < rhs.lb(3)
|
|
657
|
+
// It means lhs.ub() < rhs.lb()
|
|
638
658
|
if (!lhs.ub().geq(rhs.lb()))
|
|
639
659
|
{
|
|
640
660
|
return IntervalValue(1, 1);
|
|
641
|
-
// lhs [3,4] rhs [1,2]
|
|
642
661
|
}
|
|
643
|
-
|
|
662
|
+
// Return [0,0] means lhs is totally impossible to be less than rhs
|
|
663
|
+
// i.e., lhs is totally greater than or equal to rhs
|
|
664
|
+
// When lhs.ub >= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
|
|
665
|
+
// lhs.ub(4) >= rhs.lb(4)
|
|
666
|
+
else if (rhs.ub().geq(lhs.lb()))
|
|
644
667
|
{
|
|
645
668
|
return IntervalValue(0, 0);
|
|
646
|
-
// lhs [1,3] rhs [2,4]
|
|
647
669
|
}
|
|
670
|
+
// For other cases, lhs can be less than rhs or not, depending on the values
|
|
671
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
672
|
+
// lhs can be less than rhs if lhs is 2, rhs is 3.
|
|
673
|
+
// lhs can also not be less than rhs if lhs is 4 and rhs is 1
|
|
648
674
|
else
|
|
649
675
|
{
|
|
650
676
|
return IntervalValue(0, 1);
|
|
@@ -654,79 +680,101 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
|
|
|
654
680
|
}
|
|
655
681
|
|
|
656
682
|
|
|
657
|
-
|
|
683
|
+
// Compare two IntervalValues for greater than or equal to
|
|
658
684
|
inline IntervalValue operator>=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
659
685
|
{
|
|
686
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
660
687
|
if (lhs.isBottom() || rhs.isBottom())
|
|
661
688
|
{
|
|
662
689
|
return IntervalValue::bottom();
|
|
663
690
|
}
|
|
664
|
-
|
|
691
|
+
// If either lhs or rhs is top, the result is top
|
|
692
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
665
693
|
{
|
|
666
694
|
return IntervalValue::top();
|
|
667
695
|
}
|
|
668
696
|
else
|
|
669
697
|
{
|
|
698
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
670
699
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
671
700
|
{
|
|
672
701
|
return lhs.lb().geq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
|
|
673
702
|
}
|
|
674
703
|
else
|
|
675
704
|
{
|
|
676
|
-
//
|
|
705
|
+
// Return [1,1] means lhs is totally greater than or equal to rhs
|
|
706
|
+
// When lhs.lb >= rhs.ub, e.g., lhs:[2, 3] rhs:[1, 2]
|
|
707
|
+
// lhs.lb(2) >= rhs.ub(2)
|
|
677
708
|
if (lhs.lb().geq(rhs.ub()))
|
|
678
709
|
{
|
|
679
710
|
return IntervalValue(1, 1);
|
|
680
|
-
// lhs [1,2] rhs[3,4]
|
|
681
711
|
}
|
|
712
|
+
// Return [0,0] means lhs is totally impossible to be greater than or equal to rhs
|
|
713
|
+
// i.e., lhs is totally less than rhs
|
|
714
|
+
// When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
|
|
715
|
+
// lhs.ub(2) < rhs.lb(3)
|
|
716
|
+
// It means lhs.ub() < rhs.lb()
|
|
682
717
|
else if (!lhs.ub().geq(rhs.lb()))
|
|
683
718
|
{
|
|
684
719
|
return IntervalValue(0, 0);
|
|
685
|
-
// lhs [1,3] rhs [2,4]
|
|
686
720
|
}
|
|
721
|
+
// For other cases, lhs can be greater than or equal to rhs or not, depending on the values
|
|
722
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
723
|
+
// lhs can be greater than or equal to rhs if lhs is 3, rhs is 2.
|
|
724
|
+
// lhs can also not be greater than or equal to rhs if lhs is 2 and rhs is 3
|
|
687
725
|
else
|
|
688
726
|
{
|
|
689
|
-
|
|
690
|
-
else return IntervalValue(0, 1);
|
|
727
|
+
return IntervalValue(0, 1);
|
|
691
728
|
}
|
|
692
729
|
}
|
|
693
730
|
}
|
|
694
731
|
}
|
|
695
732
|
|
|
696
|
-
|
|
733
|
+
// Compare two IntervalValues for less than or equal to
|
|
697
734
|
inline IntervalValue operator<=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
698
735
|
{
|
|
736
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
699
737
|
if (lhs.isBottom() || rhs.isBottom())
|
|
700
738
|
{
|
|
701
739
|
return IntervalValue::bottom();
|
|
702
740
|
}
|
|
703
|
-
|
|
741
|
+
// If either lhs or rhs is top, the result is top
|
|
742
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
704
743
|
{
|
|
705
744
|
return IntervalValue::top();
|
|
706
745
|
}
|
|
707
746
|
else
|
|
708
747
|
{
|
|
748
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
709
749
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
710
750
|
{
|
|
711
751
|
return lhs.lb().leq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
|
|
712
752
|
}
|
|
713
753
|
else
|
|
714
754
|
{
|
|
715
|
-
//
|
|
755
|
+
// Return [1,1] means lhs is totally less than or equal to rhs
|
|
756
|
+
// When lhs.ub <= rhs.lb, e.g., lhs:[1, 2] rhs:[2, 3]
|
|
757
|
+
// lhs.ub(2) <= rhs.lb(2)
|
|
716
758
|
if (lhs.ub().leq(rhs.lb()))
|
|
717
759
|
{
|
|
718
760
|
return IntervalValue(1, 1);
|
|
719
|
-
// lhs [3,4] rhs[1,2]
|
|
720
761
|
}
|
|
762
|
+
// Return [0,0] means lhs is totally impossible to be less than or equal to rhs
|
|
763
|
+
// i.e., lhs is totally greater than rhs
|
|
764
|
+
// When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
|
|
765
|
+
// lhs.lb(3) > rhs.ub(2)
|
|
766
|
+
// It means lhs.lb() > rhs.ub()
|
|
721
767
|
else if (!lhs.lb().leq(rhs.ub()))
|
|
722
768
|
{
|
|
723
769
|
return IntervalValue(0, 0);
|
|
724
|
-
// lhs [1,3] rhs [2,4]
|
|
725
770
|
}
|
|
771
|
+
// For other cases, lhs can be less than or equal to rhs or not, depending on the values
|
|
772
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
773
|
+
// lhs can be less than or equal to rhs if lhs is 3, rhs is 3.
|
|
774
|
+
// lhs can also not be less than or equal to rhs if lhs is 3 and rhs is 2
|
|
726
775
|
else
|
|
727
776
|
{
|
|
728
|
-
|
|
729
|
-
else return IntervalValue(0, 1);
|
|
777
|
+
return IntervalValue(0, 1);
|
|
730
778
|
}
|
|
731
779
|
}
|
|
732
780
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -575,74 +575,100 @@ inline IntervalValue operator%(const IntervalValue &lhs,
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
|
|
578
|
+
// Compare two IntervalValues for greater than
|
|
579
579
|
inline IntervalValue operator>(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
580
580
|
{
|
|
581
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
581
582
|
if (lhs.isBottom() || rhs.isBottom())
|
|
582
583
|
{
|
|
583
584
|
return IntervalValue::bottom();
|
|
584
585
|
}
|
|
585
|
-
|
|
586
|
+
// If either lhs or rhs is top, the result is top
|
|
587
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
586
588
|
{
|
|
587
589
|
return IntervalValue::top();
|
|
588
590
|
}
|
|
589
591
|
else
|
|
590
592
|
{
|
|
593
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
591
594
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
592
595
|
{
|
|
596
|
+
// It means lhs.lb() > rhs.lb()? true: false
|
|
593
597
|
return lhs.lb().leq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
|
|
594
598
|
}
|
|
595
599
|
else
|
|
596
600
|
{
|
|
597
|
-
//
|
|
601
|
+
// Return [1,1] means lhs is totally greater than rhs
|
|
602
|
+
// When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
|
|
603
|
+
// lhs.lb(3) > rhs.ub(2)
|
|
604
|
+
// It means lhs.lb() > rhs.ub()
|
|
598
605
|
if (!lhs.lb().leq(rhs.ub()))
|
|
599
606
|
{
|
|
600
607
|
return IntervalValue(1, 1);
|
|
601
|
-
// lhs[1,2] rhs[3,4]
|
|
602
608
|
}
|
|
603
|
-
|
|
609
|
+
// Return [0,0] means lhs is totally impossible to be greater than rhs
|
|
610
|
+
// i.e., lhs is totally less than or equal to rhs
|
|
611
|
+
// When lhs.ub <= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
|
|
612
|
+
// lhs.ub(4) <= rhs.lb(4)
|
|
613
|
+
else if (lhs.ub().leq(rhs.lb()))
|
|
604
614
|
{
|
|
605
615
|
return IntervalValue(0, 0);
|
|
606
616
|
}
|
|
617
|
+
// For other cases, lhs can be greater than or not, depending on the values
|
|
618
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
619
|
+
// lhs can be greater than rhs if lhs is 4 and rhs is 1.
|
|
620
|
+
// lhs can also not be greater than rhs if lhs is 2 and rhs is 3
|
|
607
621
|
else
|
|
608
622
|
{
|
|
609
|
-
// lhs[1,3] rhs[2,4]
|
|
610
623
|
return IntervalValue(0, 1);
|
|
611
624
|
}
|
|
612
625
|
}
|
|
613
626
|
}
|
|
614
627
|
}
|
|
615
628
|
|
|
616
|
-
|
|
629
|
+
// Compare two IntervalValues for less than
|
|
617
630
|
inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
618
631
|
{
|
|
632
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
619
633
|
if (lhs.isBottom() || rhs.isBottom())
|
|
620
634
|
{
|
|
621
635
|
return IntervalValue::bottom();
|
|
622
636
|
}
|
|
623
|
-
|
|
637
|
+
// If either lhs or rhs is top, the result is top
|
|
638
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
624
639
|
{
|
|
625
640
|
return IntervalValue::top();
|
|
626
641
|
}
|
|
627
642
|
else
|
|
628
643
|
{
|
|
644
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
629
645
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
630
646
|
{
|
|
647
|
+
// It means lhs.lb() < rhs.lb()? true: false
|
|
631
648
|
return lhs.lb().geq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
|
|
632
649
|
}
|
|
633
650
|
else
|
|
634
651
|
{
|
|
635
|
-
//
|
|
652
|
+
// Return [1,1] means lhs is totally less than rhs
|
|
653
|
+
// When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
|
|
654
|
+
// lhs.ub(2) < rhs.lb(3)
|
|
655
|
+
// It means lhs.ub() < rhs.lb()
|
|
636
656
|
if (!lhs.ub().geq(rhs.lb()))
|
|
637
657
|
{
|
|
638
658
|
return IntervalValue(1, 1);
|
|
639
|
-
// lhs [3,4] rhs [1,2]
|
|
640
659
|
}
|
|
641
|
-
|
|
660
|
+
// Return [0,0] means lhs is totally impossible to be less than rhs
|
|
661
|
+
// i.e., lhs is totally greater than or equal to rhs
|
|
662
|
+
// When lhs.ub >= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
|
|
663
|
+
// lhs.ub(4) >= rhs.lb(4)
|
|
664
|
+
else if (rhs.ub().geq(lhs.lb()))
|
|
642
665
|
{
|
|
643
666
|
return IntervalValue(0, 0);
|
|
644
|
-
// lhs [1,3] rhs [2,4]
|
|
645
667
|
}
|
|
668
|
+
// For other cases, lhs can be less than rhs or not, depending on the values
|
|
669
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
670
|
+
// lhs can be less than rhs if lhs is 2, rhs is 3.
|
|
671
|
+
// lhs can also not be less than rhs if lhs is 4 and rhs is 1
|
|
646
672
|
else
|
|
647
673
|
{
|
|
648
674
|
return IntervalValue(0, 1);
|
|
@@ -651,79 +677,101 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
|
|
|
651
677
|
}
|
|
652
678
|
}
|
|
653
679
|
|
|
654
|
-
|
|
680
|
+
// Compare two IntervalValues for greater than or equal to
|
|
655
681
|
inline IntervalValue operator>=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
656
682
|
{
|
|
683
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
657
684
|
if (lhs.isBottom() || rhs.isBottom())
|
|
658
685
|
{
|
|
659
686
|
return IntervalValue::bottom();
|
|
660
687
|
}
|
|
661
|
-
|
|
688
|
+
// If either lhs or rhs is top, the result is top
|
|
689
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
662
690
|
{
|
|
663
691
|
return IntervalValue::top();
|
|
664
692
|
}
|
|
665
693
|
else
|
|
666
694
|
{
|
|
695
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
667
696
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
668
697
|
{
|
|
669
698
|
return lhs.lb().geq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
|
|
670
699
|
}
|
|
671
700
|
else
|
|
672
701
|
{
|
|
673
|
-
//
|
|
702
|
+
// Return [1,1] means lhs is totally greater than or equal to rhs
|
|
703
|
+
// When lhs.lb >= rhs.ub, e.g., lhs:[2, 3] rhs:[1, 2]
|
|
704
|
+
// lhs.lb(2) >= rhs.ub(2)
|
|
674
705
|
if (lhs.lb().geq(rhs.ub()))
|
|
675
706
|
{
|
|
676
707
|
return IntervalValue(1, 1);
|
|
677
|
-
// lhs [1,2] rhs[3,4]
|
|
678
708
|
}
|
|
709
|
+
// Return [0,0] means lhs is totally impossible to be greater than or equal to rhs
|
|
710
|
+
// i.e., lhs is totally less than rhs
|
|
711
|
+
// When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
|
|
712
|
+
// lhs.ub(2) < rhs.lb(3)
|
|
713
|
+
// It means lhs.ub() < rhs.lb()
|
|
679
714
|
else if (!lhs.ub().geq(rhs.lb()))
|
|
680
715
|
{
|
|
681
716
|
return IntervalValue(0, 0);
|
|
682
|
-
// lhs [1,3] rhs [2,4]
|
|
683
717
|
}
|
|
718
|
+
// For other cases, lhs can be greater than or equal to rhs or not, depending on the values
|
|
719
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
720
|
+
// lhs can be greater than or equal to rhs if lhs is 3, rhs is 2.
|
|
721
|
+
// lhs can also not be greater than or equal to rhs if lhs is 2 and rhs is 3
|
|
684
722
|
else
|
|
685
723
|
{
|
|
686
|
-
|
|
687
|
-
else return IntervalValue(0, 1);
|
|
724
|
+
return IntervalValue(0, 1);
|
|
688
725
|
}
|
|
689
726
|
}
|
|
690
727
|
}
|
|
691
728
|
}
|
|
692
729
|
|
|
693
|
-
|
|
730
|
+
// Compare two IntervalValues for less than or equal to
|
|
694
731
|
inline IntervalValue operator<=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
695
732
|
{
|
|
733
|
+
// If either lhs or rhs is bottom, the result is bottom
|
|
696
734
|
if (lhs.isBottom() || rhs.isBottom())
|
|
697
735
|
{
|
|
698
736
|
return IntervalValue::bottom();
|
|
699
737
|
}
|
|
700
|
-
|
|
738
|
+
// If either lhs or rhs is top, the result is top
|
|
739
|
+
else if (lhs.isTop() || rhs.isTop())
|
|
701
740
|
{
|
|
702
741
|
return IntervalValue::top();
|
|
703
742
|
}
|
|
704
743
|
else
|
|
705
744
|
{
|
|
745
|
+
// If both lhs and rhs are numerals (lb = ub), directly compare their values
|
|
706
746
|
if (lhs.is_numeral() && rhs.is_numeral())
|
|
707
747
|
{
|
|
708
748
|
return lhs.lb().leq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
|
|
709
749
|
}
|
|
710
750
|
else
|
|
711
751
|
{
|
|
712
|
-
//
|
|
752
|
+
// Return [1,1] means lhs is totally less than or equal to rhs
|
|
753
|
+
// When lhs.ub <= rhs.lb, e.g., lhs:[1, 2] rhs:[2, 3]
|
|
754
|
+
// lhs.ub(2) <= rhs.lb(2)
|
|
713
755
|
if (lhs.ub().leq(rhs.lb()))
|
|
714
756
|
{
|
|
715
757
|
return IntervalValue(1, 1);
|
|
716
|
-
// lhs [3,4] rhs[1,2]
|
|
717
758
|
}
|
|
759
|
+
// Return [0,0] means lhs is totally impossible to be less than or equal to rhs
|
|
760
|
+
// i.e., lhs is totally greater than rhs
|
|
761
|
+
// When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
|
|
762
|
+
// lhs.lb(3) > rhs.ub(2)
|
|
763
|
+
// It means lhs.lb() > rhs.ub()
|
|
718
764
|
else if (!lhs.lb().leq(rhs.ub()))
|
|
719
765
|
{
|
|
720
766
|
return IntervalValue(0, 0);
|
|
721
|
-
// lhs [1,3] rhs [2,4]
|
|
722
767
|
}
|
|
768
|
+
// For other cases, lhs can be less than or equal to rhs or not, depending on the values
|
|
769
|
+
// e.g., lhs: [2,4], rhs: [1,3],
|
|
770
|
+
// lhs can be less than or equal to rhs if lhs is 3, rhs is 3.
|
|
771
|
+
// lhs can also not be less than or equal to rhs if lhs is 3 and rhs is 2
|
|
723
772
|
else
|
|
724
773
|
{
|
|
725
|
-
|
|
726
|
-
else return IntervalValue(0, 1);
|
|
774
|
+
return IntervalValue(0, 1);
|
|
727
775
|
}
|
|
728
776
|
}
|
|
729
777
|
}
|