1, testing Wei Yan's loyalty.
Zhuge Liang was able to know that Wei Yan would rebel after his death mainly because of this test. In fact, Zhuge Liang had suspected that Wei Yan might rebel after his death, but he was not sure, so he took this opportunity to test Wei Yan. If Wei Yan didn't interrupt this ceremony, it means that Wei Yan won't rebel, but it turns out that Zhuge Liang is right.
2. Pray for God to extend his life
In this regard, I consulted some ancient books and found a method similar to the seven-star lamp, but the conditions for meeting this array are very harsh. One of the most important conditions is to have a very grand vision, and this vision is positive. Zhuge Liang pleaded for the people and spared no effort to rehabilitate the great man, so he met the requirements, but in the end he was really interrupted by Wei Yan. Of course, we all know that this is a superstition.
You can only accept your fate.
In ancient times, when the scientific level was not very developed, many people believed this fate statement, even princes and princes were no exception. Zhuge Liang may have known that his life was not far away, so he would rather believe it or not, but after being interrupted by Wei Yan, he could only helplessly believe his fate.