Artificial intelligent assistant

Proove that Unions and intersections of recursively enumerable sets are also recursively enumerable How do I prove that Unions and intersections of recursively enumerable sets are also recursively enumerable?

Suppose $A, B$ are accepted by Turing machines $M_A, M_B$ respectively.

[$A\cap B$] A TM that implements the following algorithm will accept $A\cap B$:

On input $x$,

1. run $M_A$ on $x$;
2. run $M_B$ on $x$;
3. accept $x$ (halt).



If $M_A$ or $M_B$ doesn't halt on $x$, so be it: in either case, this machine won't halt either, as it will never reach the next step, so it won't accept $x$.

[$A\cup B$] A TM that implements the following algorithm will accept $A\cup B$:

On input $x$,


loop
run $M_A$ for one more step on input $x$;
if $M_A$ has accepted $x$, then accept $x$ (halt, return)

run $M_B$ for one more step on input $x$;
if $M_B$ has accepted $x$, then accept $x$ (halt, return)
end loop


The TM runs the two TMs $M_A$ and $M_B$ on $x$ "in parallel", one step at a time. If either accepts $x$, then it accepts $x$; if neither does, it will run forever.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 85a224e218d4230f89e73948ca664399