@MickLH not with all algorithms and all sets of functions, you can't. All primitive recursive functions are total, but that doesn't describe the set of all computational algorithms modelled by (say) a Turing machine.
Following that train of thought far enough leads to the Halting problem.
not to mention everything happening outside of your code - okay you're not using a higher level language / compiler / framework / libraries, but you still have the OS to deal with.
@MickLH My favorite thing to do is this: create code without writing comments at all. Make sure everything is named appropriately. After that, go back and write comments and justify what you're doing... more often than not, you might find a mistake in your approach, or a bug... and you can fix it easier. It also helps justify what you're trying to do. Sometimes, you may even find that your design approach is incorrect... if you're programming without designing first, that is. I'm weird.
In theoretical computer science, correctness of an algorithm is asserted when it is said that the algorithm is correct with respect to a specification. Functional correctness refers to the input-output behaviour of the algorithm (i.e., for each input it produces the expected output).
A distinction is made between total correctness, which additionally requires that the algorithm terminates, and partial correctness, which simply requires that if an answer is returned it will be correct. Since there is no general solution to the halting problem, a total correctness assertion may lie much deeper. A...
not the best page but it has links to better ones and it gives a broad overview
I NEED A HELP
I WANT TO Design intrusion detection system FOR PROTECT NETWORK I USED SNORT WITH IDS AND FIREWALL TO DETECTS ATTACKS BUT I NEED INTELLIGENT ALGORITHMS TO USED IN SNORT PLEAS ANYONE CAN HELP ME ?? :(