tnx bro

but i asked how to check it if i bought 1 from srilanka
Best way to check that I know of is to restore and set up as new. Then see if it works with any SIM card you put in it. If it does work with any SIM card then it is definitely factory unlocked, if not then well you got scammed.
Nonetheless, it will still work with any carrier the only difference being is when Apple updates the OS it is very possible that your iPhone would be locked to 1 carrier again.
It doesn't matter of how it has been unlocked, just so long as it is. However, when Apple updates the firmware (currently at 3.1.2), it may reorder the carrier baseband back to it's original or update the baseband to carrier specific information.
Currently, I know of no way to check the validity of factory unlocks. What I do know is that AT&T has a very lengthy contract with Apple to propietize the iPhone with AT&T. The length of the contract is termed "propietary information" and has not been disclosed. Otherwise, your would see the iPhone being sold with other cellular providers.