algorithms – $ A subseteq mathbb{N} $ is infinite set, Show existence of strictly monotonic increasing sequence…

Problem: If $ A subseteq mathbb{N} $ is an infinite set then there exists a strictly monotonic increasing sequence $ (n_k)_{k=1}^infty $ s.t. $ A = { n_k | k in mathbb{N} } $
My attempt of proof:
Perform the following algorithm,
step 1: Define $ n_1 = minA $
step 2: $ n_2 = min( Asetminus { n_1 }) $
step 3: $ n_3 = min(Asetminus { n_1 , n_2 }) $
$ vdots$
step j: $ n_j = min(Asetminus { n_1 , n_2, …,n_{j-1} }) $

We’ll perform $ |A| $ steps and define each time $ n_i $ for all $ 1 leq i leq |A| $.
Noticing that $ n_1 < n_2 < … < n_{ |A| } $ ( we have a strictly monotonic sequence ) and that $ n_i in A $ for all $ 1 leq i leq |A| $ so we’re finished.
More compact attempt of proof:
Define $ n_1 = minA $ . For all $ n_i in A $ s.t. $ 2 leq i leq |A| $, we’ll define $ n_i = min(Asetminus { n_1 , n_2, …,n_{i-1} }) $
Noticing that $ n_1 < n_2 < … < n_{ |A| } $ and that $ n_i in A $ for all $ 1 leq i leq |A| $ so we’re finished.

I don’t know if I’m correct since $ A $ is an infinite set and I haven’t seen proof by algorithms in which the iteration is continuing infinitely ( there are $ |A| $ iterations in the algorithm above ), neither I have seen the usage of indexing on an infinite set ( for example, I have wrote: ” for all $ 1 leq i leq |A| $ , but $ |A| $ is not a finite number since $ A $ is infinite set ” ). Are my proofs correct? if not, what is the problem with them?

real analysis – Dense sequence definition

A subset $A$ of a space $X$ is called dense if every point $x$ in $X$ either belongs to $A$ or is a limit point of $A$ ; that is, the closure of $A$ constitutes the whole set $X$.

That the definition of a dense set, what about sequences? what is the meaning of dense sequence?

r – Speed up a function that checks for a sequence

I created a function yes.seq that takes two arguments, a pattern pat and data dat, the function looks for the presence of a pattern in the data and in the same sequence

for example

dat <- letters(1:10)
(1) "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
pat <- c('a',"c","g")
 yes.seq(pat = pat,dat = dat)
(1) TRUE

because this sequence is in the pattern and in the same order

"a" “b” "c" “d” “e” “f” "g" “h” “i” “j”

if, for example, expand the date, then we get FALSE

yes.seq(pat = pat,dat =  **rev(dat)**   )

Here is my function

yes.seq <- function(pat , dat){  
  lv <- rep(F,length(pat))
  k <- 1     
  for(i in 1:length(dat)){        
            if(dat(i) == pat(k)) 
              lv(k) <- TRUE
              k <- k+1 
    if(k==length(pat)+1) break
  return(  all(lv)   )

The problem is that I am not satisfied with the speed of this function, can you help me with that?

software – How to return an new Object as Value ?[Sequence Diagram]

within the sequence diagram it is possible to return a value, with return of a method edge, however this is usually done with a simple numeric or string value. Is it possible to return a whole object? For example, I have the task to create a coffee and put 3 sugars in it.

Classes: initiator-Customer, Coffee and Sugar.

Two scenarios for completion:


  1. Customer calls new Coffee() which, generates a new coffee object
  2. From coffe object, call the add sugar from Sugar class, three times(loop) with addSugar(this).
  3. Return coffee object with 3 sugars to the Customer


  1. Customer calls new Coffee() which, generates a new coffee object
  2. Return coffee object to customer class.
  3. Call three times(loop) from customer the Sugar class with coffee object as parmeter.

Which one is better ?

real analysis – True and False Sequence convergence criterions


Show or find a counter example. Let $(a_{n})_{n in N} subseteq R$ be a sequence such that for all

(i) If there exits an $N in N$ and $q in R$, $q < 1$, such that:
$$left|frac{a_{n+1}}{a_{n}}right| leq q hspace{1cm} n in N, n geq N$$
then $displaystyle{lim_{n to infty}{a_{n}} = 0}$

(ii) If there exits an $N in N$ and $q in R$, $q leq 1$, such that:
$$left|frac{a_{n+1}}{a_{n}}right| < q hspace{1cm} n in N, n geq N$$
then $displaystyle{lim_{n to infty}{a_{n}} = 0}$

turing machines – When can a deterministic finite-state-automata along with its input sequence be said to be a part of another FSM?

There is a Finite State Automata / Finite State Machine (FSM) $F$. This FSM has an input alphabet, a set of possible states, an initial state, a set of possible final states and a state transition function.

For this FSM a finite input sequence $S$ is given, such that at the end of this sequence the FSM enters a final state and stays in that state.

Can this FSM $F$ along with the input sequence $S$ be considered a separate FSM $F’$?

Analogous to this, can a Turing machine $T$ along with the tape $P$ be considered a separate Turing machine $T’$?

What are the conditions, if any, for this to be true assuming it is true?

Note: I expect a formal proof, or a reference/outline to a formal proof that proves that either of this can or cannot be done. Some theory related to this is also welcome.

My research:

Related topic:

R. T. G. TAN (1979) Hardware and software equivalence, International Journal of Electronics, 47:6, 621-622, DOI: 10.1080/00207217908938690

I am aware of the principle of hardware and software equivalence, which states that a given task can be performed using hardware or software, i.e. digital hardware and software are equivalent models of computation. But I think that my question is different from this one.


  • From this question (
    Is there code below microcode? ) I think we can consider an FSM with its input sequence (microcode) to be a part of another FSM (the digital computer), but of course much more circuitry like Arithmetic and Logical Unit (ALU) and datapath is needed to make a computer. Microcode is used only for the control circuit.

  • This answer explains how the data in the RAM of a computer along with the CPU can be considered to be a part of a bigger circuit.

exact sequence – Extension problem in linear algebra

If I understand correctly, the extension problem applied to linear algebra is something like

Given two (finite) vector spaces $A$ and $C$, find all vector spaces $B$ such that $B/A$ isomorphic to $C$.

If we consider vector spaces equal up to an isomorphism, then there is only $mathbb{F}^n$ with $n=operatorname{dim}(A)+operatorname{dim}(B)$, as long $A$, $B$ and $C$ are over $mathbb{F}$.

In terms of exact sequences, we are looking at the $B$ that makes the following short sequence exact (the two central linear maps can be freely chosen):
0to Ato Bto Cto 0.

Is my reasoning correct? What would be a clean formulation of the “Extension problem in linear algebra“?

graphs – Can one reconstruct a sequence of given pieces

You can chose the vertices of the graph to be the sequences, and if a vertex is a sequence $alpha u$ (where $alpha$ is a letter and $u$ a word), then there is an edge from $alpha u$ to any vertex $ubeta$ (where $beta$ is a letter). It is convenient to label such edge with the letter $beta$.

In your exemple, the vertex $AGA$ would have an edge to $GAT$ (and, if they exist, $GAA$, $GAC$ and $GAG$).

If you know the sequence $s = s_1s_2…s_k$ in advance, you want to know if there exists a path from $s_1s_2s_3$ to $s_{k-2}s_{k-1}s_k$ reading the sequence $s_4…s_k$ on the edges.

probability theory – Weak stationary white noise sequence that are identically distributed but not independent

Let ${Z_t}$ be a sequence of random variables that are weakly stationary, i.e., $mathbb{E}(Z_t)=0$ and $Var(Z_t)=sigma^2$ and $Z_t$‘s are uncorrelated, i.e., $cov(Z_s,Z_t)=0$ for all $tneq s$. Can we create such a sequence of $Z_t$ that are not independent? Also, can we have the other way around, that is, $Z_t$‘s are independent but not identically distributed?

My try:
For the first question, I am thinking of $Z_t = (-1)^tX_t$ where $X_t sim N(0,1)$ but do not know how to show they are dependent.

unity – Behaviour Trees: How to clean up when a sequence is interrupted?

I’ll try to show my problem on a minimal example, in reality it’s more complex:
Behaviour Tree example

It’s a simple behaviour, that repeats “an action” that has a certain animation. If a player gets close, this sequence gets interrupted and the AI executes the “Flee” action.

The interruption happens because the top level selector is “dynamic” which in Unity/NodeCanvas means, that its higher priority nodes get executed every frame and if they succeed they interrupt the lower priority ones.

My problem is shown via the red arrow – if the “action” gets interrupted, the clean up (in this case “stop animation”) doesn’t execute.

What is the best practice to handle the clean up? Is my setup flawed? Or should I just be using a different interrupting mechanism?

Thanks for any help!