On 29/09/2017 21:47, agapito wrote: > Assume 's' is in set of numbers S, and consider the algorithm which, for input 'n', effectively tests whether 'n' is in S. If it is, algorithm gets a 'yes' and ouputs 'n', otherwise outputs 's'. My problem understanding this is that obviously if 'n' is not in S, then the algorithm will churn forever, so it's not clear under what circumstance it would ouput s. Does every such algorithm contain an internal limit on how long it can continue, as it would require under actual computation? Or in theoretical treatment it can, indeed run forever? > > All clarifications appreciated, am >
An effective test of whether n is in S must terminate and indicate whether OR NOT n is in S. In your example, if n is in S we "get a yes", so I guess if n is not in S we "get a no". (I.e. there must be two halting states, one for 'yes' and another for 'no'.)
You are right concerning the output from the algorithm - for the output to be defined, the algorithm must halt.
If a set S has the weaker property that the algorithm will "get a yes" for input n if and only if n is in S, (and otherwise may "get something else" or never terminate) then the set S is generally called (effectively) semi-decidable, rather than decidable.