One of the most interesting hidden bonuses in Halo 3 was the inclusion of the terminals, revealing a few details on the Forerunners, but more importantly, it reveals a few key things about the nature of A.I’s through the Forerunner construct Mendicant Bias.
(Slight Spoilers)
To sum up the story of Mendicant Bias, he was a Forerunner A.I that eventually went rampant after being convinced by the Flood that the Forerunners were full of it, claiming to let evolution take its course while letting it stagnate (according to the Flood) and the only way to let evolution take it’s course again was to let the Flood “restart” it (we all know where that leads to).
Mendicant Bias turned rampant and attacked the Forerunners, and helped speed along the Forerunners inevitable fall, only being stopped by another A.I, Offensive Bias, with only a shard of him surviving in the Ark.
You can get all the details of Mendicant Bias on the Halo Wiki, this would be a long post if I went through his whole backstory: http://halo.wikia.com/wiki/05-032_Mendicant_Bias
100,000 years later, Mendicant Bias thought about what he did and regretted it. He was in the background of Halo 3 the whole game, helping Master Chief on his quest to stop the Flood.
So how does this all relate to Cortana?
We know for a fact that Cortana is starting to go rampant. After sucking in so much information from the Installation 04, being nearly broken by Gravemind, and reaching the end of her 7 year lifespan, she’s gonna go crazy and probably die.
However, Mendicant Bias proved beyond the shadow of a doubt that A.Is can return from rampancy, it’s not a permanent state of mind. The fact that 343 Guilty Spark and Mendicant Bias were still around and kicking for 100,000 years without dying, despite being at least as smart as Cortana, implies that A.Is that are advanced enough can live past the 7 mark.
Also, Mendicant Bias had no real emotional connection to his creators, he was just a servant really, and when his leash was removed so to speak, he had no emotional reason to not betray the Forerunners, it was just in his programming to obey the Forerunners, something that Gravemind was able to get around. I don’t consider it unreasonable that Cortana would consider betraying humanity once she goes rampant, she really wasn’t emotionally connected to any of them other than the Chief and maybe Halsey, she just protected them because that was what she was programmed for and that is what she grew up with.
The difference between Mendicant Bias and Cortana however is that Cortana does have a real emotional connection, the Master Chief. It’s not unfeasible to see Cortana betray humanity, but Cortana betraying the Chief? Her one and only true friend in the Universe? The guy who made a one-man charge into the heart of the Flood nest just to save her? I find it a little difficult to believe that she would betray him so easily.
I think Cortana might repeat Mendicant Bias’ story. She’ll go insane and possibly be an antagonist for Halo 4, but she could find some way to extend her life with all that Forerunner technology, and her desire to protect the Chief might possibly get her past her rampancy.
Also, sorry for the tl;dr wall of text. 
