## Defining nullable symbols and the first set of a grammar

I’m practicing for an upcoming exam and am being tripped up by a review problem. The problem gives the following grammar:

$$S \rightarrow AB$$ $$A \rightarrow \epsilon | a | (T)$$ $$T \rightarrow T, S | S$$ $$B \rightarrow b$$

As far as I can tell, the only nullable symbol is $$A$$. It is the only non-terminal whose production contains the null symbol $$\epsilon$$. I don’t think $$S$$, which contains $$A$$ in it’s production, is a nullable symbol since the same production also contains $$B$$, which is not a nullable symbol, and both $$A$$ and $$B$$ would need to be nullable for $$S$$ to also be nullable. Is $$A$$ really the only nullable symbol in this grammar, or am I misinformed?

As for the first set, frankly, I’m just having trouble following my professor’s notes for creating the first set. Could anyone help here or point me to a good resource for this?

Thank you all so much.

## Defining an Algorithm for finding all alignments between two sequences

Let S and T be two sequences of length n and m, respectively. When calculating the dynamic programming table to find the optimal global alignments between the two sequences S and T, we can keep pointers to find the optimal alignments by following these pointers from cell (n, m) to cell (0,0). Each of the paths represents a different optimal alignment for the two sequences.

To illustrate, we have an example of a table between the sequences ACGTTA and AACTA. By following the arrows from the cell (6,5) to (0,0) we get a possible optimal alignment. There are many ways to get to (0,0). Each of those ways is a distinct possible optimal alignment.

The challenge is to find a dynamic programming algorithm that will give me the number of the possible paths from this first table probably by looking at pointers.

Because dynamic programming involves having a programming table I’m not sure how it should look like. What would be the appropriate policy that determines which cells to look at to find the result in the next cell.

I notice that each possible alignment is a path from (n,m) to (0,0). This implies that each different path is a divergence from a common path.

You will notice that the red path and the blue path have some parts in common. This seems to justify a dynamic programming solution because we have certain solutions in common that we can use to find the next solution.

My whole problem with this is how do I formalize this thinking into a policy that looks like:

The left part is the intial conditions. It basically tells how to find the solution for the next cells based on previous cells. This is not specific to this problem it’s just an example of what I’m looking for.

## Defining a regular grammar but without $Q \rightarrow \varepsilon$

I defined a regular grammar (FSM), which starts with $$ab$$ and ends with $$ba$$ the following way:

1. $$S \rightarrow aS$$
2. $$S \rightarrow bS$$
3. $$S \rightarrow aT$$
4. $$T \rightarrow bR$$
5. $$R \rightarrow aQ$$
6. $$Q \rightarrow aQ$$
7. $$Q \rightarrow bQ$$
8. $$Q \rightarrow \epsilon$$

, where $$S$$ is the starting element, $$\epsilon$$ is the empty (null) element and the rest are just variables.

The rules 6, 7 and 8 are there, so we can end a word. However, I am trying to rewrite my grammer but without the $$Q \rightarrow \epsilon$$. I can’t use the empty element.

Can it be done? I’m not sure how.

Thanks

## Defining “a particular kind” in the Locate Object spell

In our latest session a question came up. The initial statement [PHB pg 256] says to;

“Describe an object that is familiar to you.”

The spell description goes on to state that known to you (not familiar to you) is defined as seen within 30 feet.

The discrepancy comes up in the phrase;

“Alternatively, the spell can locate the nearest object of a particular kind, such as a certain kind of apparel, jewelry, furniture, tool, or weapon.”

We are trying to decide if an item that we have never seen, but is described to us (it is a gem that does X and has been in X location for a couple of hundred years) is enough to qualify as a “particular kind” of if that is too vague?

## Throttling – difficulty in defining the description

WE have a problem with the spell form the lore of Shadow, named Throttling. (warhammer 2ed).

Spell description: You send ropes of inky darkness to throttle any one target within 12 yards (6 squares), cutting of his ability to breath entirely and forcing him to make a Thoughness Test to resist the effect the spell. You can maintain this spell with half action on each subsequent round, but you may cast no futher spells while doing so. If u maintain the spell, the Thoughness Test is modified a cumulative -10% penalty each round until it is failed, at which point the target begins to take damage. The first round of failure causes a Mamage 1 hit that ignores Armour, and each subsequent round the Damage of the hit increases by 1. No additional Toughness Test are allowed to resist damage after the first has been failed; the damage simply continues to compund until you stop, or are forced to stop, concentrating on the spell. The rules for concentration (see WFRP, Spellcasting Limits, page 144) apply.

And you see. 1. One of my friends is saying that: In first round, after the target make successful Toughness Test, wizard has to cast the spell (if want to maintain it) again and (if successful) target (again) has to pass Toughness Test (-10) if successful, then again wizard has to cast a spell… and the cycle repeats until the test fails

2. When the other is saying that: In first round, after the target make successful Toughness Test, wizard can maintain the spell with half action, and in the next round target (yet again) has to pass Toughness Test (-10) if successful, then again wizard sacrifice half action to maintain the spell… and the cycle repeats until the test fails.

Which one is correct? And if there was any mistakes, then sorry for my bad English

## Defining a function with For loop within For loop

h[n_] := For[i = 1, i <= n, i++,     For[j = 1, j <= n, j++,      g = g + i*j]; f = f + g;]; h[10] 

I want to define a function to calculate the Sum from i to n from the Sum of j to n of i*j

## Defining $a^n b^{n^2}$ with one existential SO binary relation

Is it possible to define the language:

$$L = \{ a^n \; b^{n^2} \}$$

using an existential second order sentence over strings (ordered structures with unary predicates $$U_a(x), U_b(x)$$) using only one binary relation?

( $$\exists M \varphi$$ where $$M$$ is a binary relation, $$\varphi$$ is first order)

If not, how to prove it? (or cite a textbook in which I can find similar exercises)

## Defining $a^n b^{n^2}$ with one existential SO binary relation

Is it possible to define the language:

$$L = \{ a^n \; b^{n^2} \}$$

using an existential second order sentence over strings (ordered structures with unary predicates $$U_a(x), U_b(x)$$) using only one binary relation?

( $$\exists M \varphi$$ where $$M$$ is a binary relation, $$\varphi$$ is first order)

If not, how to prove it? (or cite a textbook in which I can find similar exercises)

## Defining $a^n b^{n^2}$ with one existential SO binary relation

Is it possible to define the language:

$$L = \{ a^n \; b^{n^2} \}$$

using an existential second order sentence over strings (ordered structures with unary predicates $$U_a(x), U_b(x)$$) using only one binary relation?

( $$\exists M \varphi$$ where $$M$$ is a binary relation, $$\varphi$$ is first order)

If not, how to prove it? (or cite a textbook in which I can find similar exercises)

## Defining one variable function on specific interval and taking supremum of it

I got a course in my undergraduate education 4 years ago. So actually I can’t remember the details about mathematica. I’m trying to solve one thing about 1 week. Here is my question:

f is a continuos and bounded function on [a,b]. Define

blank”>{x,t\in[a,b]&space;and&space;|t-x|<\delta}|f(x)-f(t)|” title=”w(f,\delta)=sup_{x,t\in[a,b] and |t-x|<\delta}|f(x)-f(t)|” />

I want to write this function on mathematica and checking while delta going zero, is w will be going with it. I replaced supremum with MaxValue function. But I didn’t write when x,t in [a,b] take f(x)-f(t). Because f is a single variable and I dont know how can I put condition when t-x < delta.

These are my problems. After defining this function I want to see on graph how it changes with different delta’s