S = {$<A, B, k>$ : there are less than k natural numbers n for which A(x), B(x) both halt}
I have the following proof that S is undecidable.
Suppose D($<A, B, k>$) is a decider for S. Define the following:
halts(P, i) {
$\quad$define A(x) {
$\quad \quad$P(i)
$\quad \quad$if x in (1, 2) then return else loop
$\quad$}
$\quad$define B(x) {
$\quad \quad$P(i)
$\quad \quad$if x in (1, 2) then return else loop
$\quad$}
$\quad$ if $\;D(<A,B,3>)\;\;$accepts then
$\quad \quad$ halts
$\quad$ else
$\quad \quad$ loops
}
If D exists then we would be able to decide if P halts on i. Since the Halting Problem is undecidable, D cannot exist and hence S is undecidable.
I believe that the same argument can be used to show that S is unrecognizable with D being a recognizer instead of a decider. Am I correct?
Or is there a better way to show that S is unrecognizable?
If the $n$ and $x$ in your definition of $S$ are supposed to be the same, and if I'm interpreting your program correctly, then your halts(P,i) will halt if and only if $P(i)$ doesn't. So you seem to be building into your construction part of the proof of the undecidability of the halting problem.
In my opinion, it would be simpler (and would provide a complete proof) to observe that one standard version of the halting problem is Turing reducible to $S$ (in fact, many-one reducible to the complement of $S$) as follows. A Turing machine $A$ (with no input, or, if you prefer, with a dummy input $x$) halts if and only if there are not less than $1$ numbers $x$ for which $A$ and $A$ both halt.