Recursive definition character counter

Question Screenshot

This is my definition for part 1 (in latex form)

\begin{alignat*}{2} \text{Base Case }& &&\text{ if } \mathtt{ones}(\varepsilon) = 0 \qquad \mbox{ ($ \varepsilon$ is the empty string)} \ \text{Inductive Step }& &&\text{ if } v \in \Sigma^{\ast} \text{ and } x \in \{1\} \text{ then } \mathtt{ones}(vx) = \mathtt{ones}(v) + 1\ & &&\text{ if } v \in \Sigma^{\ast} \text{ and } x \in \{0\} \text{ then } \mathtt{ones}(vx) = \mathtt{ones}(v) \end{alignat*}

For part 2, I was thinking of :

  1. inducting on $ v$ by taking $ v=v^{\prime} x$

  2. assuming true for $ \mathtt{ones}(w ++ v^{\prime}) = \mathtt{ones}(w) + \mathtt{ones}(v^{\prime})$

  3. proceed to show that $ \mathtt{ones}\left(w ++ (v^{\prime}x)\right)$ holds for both $ x \in \{1\}$ and $ x \in \{0\}$ .

Like so,

For $ x \in 1$

\begin{align*} \mathtt{ones}(w ++ (v^{\prime}x)) &= \mathtt{ones}(w ++ v^{\prime})x) \quad \mbox{Concatenation}\ &= \mathtt{ones}(w ++ v^{\prime}) + 1 \quad \mbox{Definiton of } \mathtt{ones}\ &= \mathtt{ones}(w) + \mathtt{ones}(v^{\prime}) + 1 \quad \mbox{Induction Hypothesis}\ &= \mathtt{ones}(w) + \mathtt{ones}(v^{\prime}x) \ &= \mathtt{ones}(w) + \mathtt{ones}(v) \quad \mbox{ since } v=v^{\prime} x \end{align*}

For $ x \in 0$

\begin{align*} \mathtt{ones}(w ++ (v^{\prime}x)) &= \mathtt{ones}(w ++ v^{\prime})x) \quad \mbox{Concatenation}\ &= \mathtt{ones}(w ++ v^{\prime}) + 0 \quad \mbox{Definiton of } \mathtt{ones}\ &= \mathtt{ones}(w) + \mathtt{ones}(v^{\prime}) + 0 \quad \mbox{Induction Hypothesis}\ &= \mathtt{ones}(w) + \mathtt{ones}(v^{\prime}x) \ &= \mathtt{ones}(w) + \mathtt{ones}(v) \quad \mbox{ since } v=v^{\prime} x \end{align*}

I’m concerned about the following?

  1. Is inducting on $ v$ the correct way to go about it? I chose it because it seems to be how concatenation is defined

  2. I haven’t seen any definition with two branches in lectures. Is splitting the domain of $ x$ in 2 ok, given that I show that both cases follow? Is there a better and/or simpler alternative?

Is there any written RAW definition for ‘Immunity’ in the Source Books?

When reading stat blocks in the Monster Manual there’s once in a while a mention of monsters having immunity to certain damage types.

While the natural language understanding of that is certainly clear, I could never find a written definition akin to those for resistance, vulnerability, etc.

Is there any RAW definition for immunity in the source books?

PhpMyAdmin ALTER TABLE command gets ignored when table definition is imported

I am running PhpMyAdmin v4.8.0.1. I exported a table and thus, have the following structure:

CREATE TABLE `wp_site_settings` (   `settings_id` bigint(20) UNSIGNED NOT NULL,       `usage_limit_per_user` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;  -- -- Indexes for dumped tables -- ALTER TABLE `wp_site_settings`   ADD PRIMARY KEY (`settings_id`); 

As we can see from the above code, the ALTER TABLE part is present after the CREATE TABLE. I want this ADD PRIMARY KEY to be a part of the CREATE TABLE itself, so that it can be exported as:

CREATE TABLE `wp_site_settings` (   `settings_id` bigint(20) UNSIGNED NOT NULL,       `usage_limit_per_user` varchar(255) NOT NULL,    PRIMARY KEY (`settings_id`), ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

I need it in the above way because I am trying to use the above in a custom WordPress plugin. If the ADD PRIMARY KEY is performed using the ALTER TABLE command, the whole command gets ignored and the resultant table does not contain the PRIMARY KEY.

This is just an example of one table. I need the solution to work for other 20+ custom tables as well, so any workaround/fix is appreciated.

NOTE: I am aware that the ALTER TABLE was separated intentionally as per + rfe #1004 Create indexes at the end in SQL export

Why does setting SyntaxInformation add a definition to DefaultValues

Before setting any definitions to the symbol f, the DefaultValues of f is empty:

DefaultValues[f] (*  {}  *) 

Define SyntaxInformation for f:

SyntaxInformation[f] = {"ArgumentsPattern" -> {_, _}}; 

Now, DefaultValues for f is not empty:

DefaultValues[f] (*  {HoldPattern[SyntaxInformation[f]] :> {"ArgumentsPattern" -> {_, _}}}  *) 

Also, DefaultValues of built-ins that do have syntax highlighting such as BesselJ have empty DefaultValues:

DefaultValues[BesselJ] (*  {}  *)  
  1. Why does defining SyntaxInformation for a symbol add definitions to DefaultValues?

  2. Why do built-in symbols with syntax highlighting not have DefaultValues associated with them?

  3. Running DefaultValues[f]={} does not remove the syntax highlighting. But does manually clearing DefaultValues for a symbol cause any problems?

What is the UX definition of a View?

The term “view” is used a lot in UX. In programming it often refers specifically to a user interface element associated with a model (e.g. in MVC or MV* frameworks). But I’ve heard it used in other contexts in UX, e.g. user view vs admin view of a website…where it relates to role rather than a model.

  • Is there a canonical or other well articulated definition for View from a UX perspective.
  • If not, is there any form of consistency around how to use the term as a UX designer?

What definition of the noun “threat” do the rule books for D&D 5E use when it affects gameplay mechanics?

I have recently asked a question about Surprise where the unclear interpretation of the word “threat” in the sentence “Any character or monster that doesn’t notice a threat is surprised at the start of the encounter.” seems to be the root of the problem. In a comment to an answer, I was adviced to look at Wiktionary’s entry for “threat” which defines it as:

  1. An expression of intent to injure or punish another.
  2. An indication of potential or imminent danger.
  3. A person or object that is regarded as a danger; a menace.

While meaning 1 is certainly not the relevant one in the context of the rule for Surprise, the confusions seems to stem from the distinction between meaning 2 and meaning 3.

Are there any instances in an official rule book where it becomes clear in which sense the word threat is used in view of the game mechanics?

PS: I am aware that this problem can be solved by using pdf versions of the books and CTRL+f, but I do not have these files.