Edit-This answer was provided before Mikhail Katz finally agreed to edit his 'question' to explain how he modifies Thomson's lamp scenario with the help of nonstandard integers to get a 'last (nonstandard) switching' of the Thomson--Katz lamp. It appears that Katz allows for 'someone' to decide to stop switching the lamp after a nonstandard integer H of switchings. I'll let everyone decides for oneself whether this condition (namely, to decide to stop switching the lamp sometime before the mark t=2, be it infinitesimally before) is logically an extra assumption or even a self-evident assumption with regard to Thomson's plausible intent. In any case, the current answer was provided without this assumption, the conclusion being that if one does not decide to stop the lamp at an infinitesimal time before t=2, then the transfer principle implies that the lamp should continue to switch, and the paradox remains.
This is an interesting thread! Whether or not Thomson successfully argued to the effect that "super-tasks are not possible of performance" [Thomson's 'Tasks and Super-Tasks', p.5], the variety of answers in this thread shows that Thomson's paradox acts as a useful (meta)philosophical tool.
I shall share here some thoughts about the mathematical aspects raised in the original question to this thread, especially the relation of Thomson's paradox (and other super-tasks paradoxes) to non-standard mathematics. Most of what I'll say has already been said (at least implicitly) by other commentators on this thread, but I'd like to round up a few different points in this answer.
The physical aspect of Thomson's paradox. There is a sense by which Thomson's paradox is not a mere mathematical question, and that it has a (meta)physical aspect to it. Indeed, I doubt that anyone would argue against the possibility of "mathematically performing", i.e. of defining, the function f(t) defined over 0 ≤ t < 2 as 'f(t)=1 if 2 - 2^{-2n} ≤ t < 2 - 2^{-(2n+1)} for some nonnegative integer n, and f(t)=0 otherwise'.
Granted that Thomson's problem involves some implicit physical aspects, I don't think that the physical irrealizability of Thomson's lamp scenario offers a satisfactory solution to the paradox, for Thomson's argument aims at disproving the possibility of (some) super-tasks at a deeper, more general level.
I can conceive of other physical scenarios that share the same 'functional aspects' as those of Thomson's lamp, and whose performance does not require the use of an infinite amount of energy. Those scenarios are physically irrealizable for other reasons--because of differents aspects of the currently known physics of our world, and because of the limits of my own ingenuity--but they would make sense in a perfectly 'classical physics' world (and perhaps also in a 'future physics' world). I feel that a more satisfactory and robust solution to the paradox would cover these counterfactual worlds.
The mathematical formulation of Thomson's problem and the assumption of determinism. Notwithstanding the importance of some physical aspect to Thomson's problem, much as in the case of Zeno's paradox, I think it is the mathematical abstract formulation of Thomson's scenario (more than the physical irrealizability of Thomson's scenario) that helps best to pinpoint a difficulty with Thomson's paradox: for on what grounds should we suppose that the 'behavior' of the function f(t) over 0 ≤ t < 2 determines an extension of f over 2 ≤ t?
From a mathematical perspective, it is clear that several functions extend the given function f; in other words, the extension is not (uniquely) determined. Note that the same can be said about Zeno's paradox (it is only defined over a bounded open set, and not at the endpoints), but in this case a continuity requirement can be evoked to select a unique 'preferred extension'. In comparison, the above function f in Thomson's scenario admits no continuous extension.
Thomson (implicitly, as far as I can tell) assumes that (A) its lamp have a well-defined state at each instant (either 'on' or 'off') and, most importantly, that (B) the lamp's state at any time t is (uniquely) determined by its past. These are the 'physical aspects' that Thomson considers. Combined with assumption (C) this switching super-task can be performed, one reaches a paradox, as one is unable to tell the state of the lamp for 2 ≤ t.
The importance that Thomson attributes to assumption (A) and (B) transpires in the following quote [p.6]:
What is the sum of the infinite divergent sequence +1, -1, +1, ...? Now mathematicians do say that this sequence has a sum; they
say that its sum is 1/2. And this answer does not help us, since we
attach no sense here to saying that the lamp is half-on. I take
this to mean that there is no established method for deciding what
is done when a super-task is done. And this at least shows that
the concept of a super-task has not been explained. We cannot be
expected to pick up this idea, just because we have the idea of a
task or tasks having been performed and because we are
acquainted with transfinite numbers.
Thomson only attaches sense to a lamp being in state +1 or -1 (assumption (A)). And without assumption (B), one could certainly not decide (or rather predict) what is done when a super-task is done.
However, assumption (B) is a nontrivial one: even in the realm of Newtonian physics, there are 'simple-tasks' that are not uniquely determined. (For instance, read this Wikipedia section (in French) around the Cauchy--Peano--Arzelà theorem.) Such 'simple-tasks' might also be difficult to realize physically, but they do not strike the mind as utterly impossible or artificial.
Hence an important ingredient for Thomson's paradox appears to be assumption (B). (This point seems to have been raised by Paul Benacerraf.)
Relation to non-standard mathematics. I am no expert in non-standard mathematics (NSM), but I fail to see how it could solves Thomson's paradox.
(1) My first point is merely a heuristic one. NSM is a 'conservative extension' of standard mathematics (SM): roughly put, this means that NSM proves exactly the same results 'about' SM than what SM (+ the axiom of choice) can prove 'about' SM. To me, this suggests that NSM behaves in many respects like SM, and thus that one should spontaneously be at least somewhat skeptical when first encountering claims that NSM can solve things that SM cannot solve.
Of course, a (vague) proposition such as 'f admits no preferred extension to t=2' is not a purely SM statement, because of the word 'preferred': the greater richness of NSM over SM might provide some further criteria that allow to single out a preferred type of extension for f. However, considering that within SM there is no distinguished extension of the aforementioned function f to the interval 2 ≤ t, I still spontaneously feel that NSM cannot do much differently.
(2) What I can imagine NSM to allow, via the transfer principle (which is a mathematical implementation of Leibniz's suggestively named 'law of continuity'), is to have 'non-standard' or 'ghost' switchings of the lamp: for instants t = 2 - s where s is any (positive) infinitesimal, the lamp could continue to switch.
Let's delve a little more into the details of this. Although I won't use exactly the same vocabulary, I'll phrase things essentially in the enriched language described in this reference of Mikhail Katz (where ringinals are defined as the 'unlimited nonstandard integers').
The statement that the above function f switches at times t_n = 2 - 2^{-n} where n is a natural integer can be expressed as follows: for all nonnegative integer n, for all real number t such that 0 < t < 2^{-(n+1)}, we have |f(2 - 2^{-n} - t)|=|f(2-2^{-n}+t)| = 1 and f(2 - 2^{-n} - t)=-f(2 - 2^{-n} + t).
By the transfer principle, f extends to a function F defined on (some) nonstandard real numbers and this extension satisfies: for all nonnegative nonstandard integer n, for all nonstandard real number t such that 0 < t < 2^{-(n+1)}, we have |F(2 - 2^{-n} - t)|=|F(2-2^{-n}+t)| = 1 and F(2 - 2^{-n} - t)= - F(2 - 2^{-n} + t). We take this statement to mean that F switches at every nonnegative nonstandard integer. Of course, for n a ringinal, 2^{-n} ± t are infinitesimals, so F extends f to nonstandard reals that are arbitrarily close to the left to t=2.
(3) At this point F(2) is still undefined, but all we need is that F admits a 'distinguished' extension to t=2. Unfortunately, I can't see any such extension.
Mikhail Katz commented to this answer: "Once the lamp is turned on at the last nonstandard integer, it stays on in particular at t=2, contrary to Thomson's claim that the state of the lamp at t=2 cannot be specified. Similarly for the case of the opposite parity." I take this to mean that (i) there exists a last nonstandard integer N, and (ii) for t≥ 2-2^{-N}, simply set F(t) = F(2-2^{-N}). I agree that granted (i), prescription (ii) would yield a preferred extension of F.
However, it seems to me that (i) is false. Indeed, we have the standard proposition: for all integers n, there exists an integer n' > n of a different parity than that of n. Via the transfer principle, one deduces that there is no greatest (even or odd) ringinal.
Besides, one can formalize the infinite number of switchings of f as: for all 0 < t < 2, there exist t < t_1, t_2 < 2 such that f(t_1)≠f(t_2). By the transfer principle, we obtain: for all 0<t<2 [infinitesimally close to 2], there exist t < t_1, t_2 < 2 such that F(t_1)≠F(t_2). So there seems to be no stabilization of F near t=2 that would allow us to pick a 'preferred' value for f(2).
(4) That said, evoking NSM in the context of super-tasks paradoxes remains an interesting idea, especially in relation to Benardete's paradox and the Grim Reapers' paradox. Indeed, in the scenarios of thoses paradoxes, one should perhaps deduce the presence of 'non-standard' or 'ghost' gods/grim reapers to explain the 'spontaneous' obstruction/death of the traveler. In other words, explicitly specifying the 'dynamics' of the system at all standard times implicitly determines the 'dynamics' at infinitesimal times too.