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?

Reducing 3-CNFSAT to a particular satisfiability (PA-SAT) problem

The PA-SAT Problem:

PA-SAT is a satisfiability problem where the input is a boolean formula consisting of:

  • a conjunction of clauses, where each clause is either:
    • a disjunction of three boolean variables (without negations)
    • an equivalence between a boolean variable and a negated boolean variable.

Is it possible to satisfy the formula?.
An example of input to the problem is:

(x1 ∨ x2 ∨ x3) ∧ (x1 ∨ x3 ∨ x4) ∧ (x3 ∨ x4 ∨ x5) ∧ (x1 ∨ x5 ∨ x6) ∧ (x1 ≡ x̄5) ∧ (x5 ≡ x̄6)


I need to show that:

  • PA-SAT is NP-complete by showing that:
    • PA-SAT it is part of NP (PA-SAT ∈ NP)
    • PA-SAT is NP-Hard by showing that:
      • it is possible to design a polynomial karp-reduction of the NP-complete problem 3-CNFSAT to PA-SAT (3CNFSAT ≤ PA-SAT).

So my question is: How do I show that PA-SAT is NP-complete?

Calculate the number of combinations of a sequence of numbers in a particular order

I have a problem solving coding challenge when I have to calculate the number of combinations, numbers from 0 to 9, with the length n, with 2 rules –

The first number cannot be 0

Every other number can be 0 or must be divisible by the previous number (number 1 can not be used as divisor), for example [5.0], [1,0] or [2,8], [4,8], [3,6]

For example, if the length n were 2, number of combinations would be 21 – [1,0]…[9,0] + [2,4], [2,6], [2,8], [3,6], [3,9], [4,8] + [2,2]…[9,9]

The resulting response can be code in some programming language or a formula to calculate answer

Generalization of code is slower than particular case

I wrote the following Mathematica module:

QNlalternative[NN_, l_, f_] := Module[{s, wz, w, z, j, lvec},    s = 0;    Do[       wz = Table[weightsNodesQ1l@lvec@i, {i, NN}];       w = Table[wz[[i]][[1, All]], {i, NN}];       z = Table[wz[[i]][[2, All]], {i, NN}];       s = s + Function[Sum[(f @@ (Table[z[[i]][[j[i]]], {i, NN}]))*(Times @@ (Table[                 w[[i]][[j[i]]], {i, NN}])), ##]] @@                  Table[{j[k], 2^lvec[k] + 1}, {k, NN}],       ##       ] & @@ Table[{lvec[i], l + NN - 1 - Total@Table[lvec[k], {k, i - 1}]}, {i, NN}];    Return[s]    ]; 

This module calls another module:

sumPrime[v_List] := First[v]/2 + Total[Delete[v, 1]]  weightsNodes[NN_] := Module[{w, z},    w = Table[4/NN*sumPrime[Table[1/(1 - n^2)*Cos[n*k*Pi/NN], {n, 0., NN, 2}]], {k, 0., NN}];    z = Table[Cos[k*Pi/NN], {k, 0., NN}];    Return[{w, z}]    ];  weightsNodesQ1l[l_] := weightsNodes[2^l] 

This code is related to a mathematical problem I am solving (it is a modification). When I first was thinking about how to write the module QNlalternative, I wrote the particular case of NN=5 in a sloppy manner, using repeated statements, as follows:

Q5l[l_, f_] :=    Module[{s, wzl1, wzl2, wzl3, wzl4, wzl5, wl1, zl1, wl2, zl2, wl3,      zl3, wl4, zl4, wl5, zl5},    s = 0;    Do[     wzl1 = weightsNodesQ1l[l1];     wzl2 = weightsNodesQ1l[l2];     wzl3 = weightsNodesQ1l[l3];     wzl4 = weightsNodesQ1l[l4];     wzl5 = weightsNodesQ1l[l5];     wl1 = wzl1[[1, All]]; zl1 = wzl1[[2, All]];     wl2 = wzl2[[1, All]]; zl2 = wzl2[[2, All]];     wl3 = wzl3[[1, All]]; zl3 = wzl3[[2, All]];     wl4 = wzl4[[1, All]]; zl4 = wzl4[[2, All]];     wl5 = wzl5[[1, All]]; zl5 = wzl5[[2, All]];     s = s +  Sum[f[zl1[[i1]], zl2[[i2]], zl3[[i3]], zl4[[i4]], zl5[[i5]]]*         wl1[[i1]]*wl2[[i2]]*wl3[[i3]]*wl4[[i4]]*wl5[[i5]], {i1, 1,          2^l1 + 1}, {i2, 1, 2^l2 + 1}, {i3, 1, 2^l3 + 1}, {i4, 1,          2^l4 + 1}, {i5, 1, 2^l5 + 1}],     {l1, 1, l + 5 - 1}, {l2, 1, l + 5 - 1 - l1}, {l3, 1,       l + 5 - 1 - l1 - l2}, {l4, 1, l + 5 - 1 - l1 - l2 - l3}, {l5, 1,       l + 5 - 1 - l1 - l2 - l3 - l4}     ];    Return[s]    ]; 

The module Q5l is much faster than QNlalternative:

AbsoluteTiming[QNlalternative3[5, 6, Sin[Plus[##]]^2 &]] (* {19.4634, 6213.02} *)  AbsoluteTiming[Q5l[6, Sin[Plus[##]]^2 &]] (* {6.64357, 6213.02} *) 

Why is QNlalternative slower? Which step of the generalization of Q5l to an arbitrary NN is too slow?

Proving the decidability of whether a CFG generates a particular string or not

Let $ G$ be a context-free grammar and $ w$ be a string of length $ |w| = n$ .

Consider the language $ A_{CFG}$ = { <$ G$ , $ w$ > | $ G$ is CFG that generates $ w$ }, where <$ G$ , $ w$ > is a string encoding of $ G$ and $ w$ .

Now we have to show that $ A_{CFG}$ is decidable, or in other words, there exists an algorithm that determines whether $ w$ is generated by $ G$ or not.

Now, the proof given in my book converts $ G$ into an equivalent CFG $ G’$ in Chomsky Normal Form and one-by-one checks all derivations in $ G’$ that take $ 2n – 1$ steps, since a grammar in CNF takes exactly $ 2n – 1$ steps to generate a string of length $ n$ .

Now, I have an alternate algorithm in mind. I want you guys to tell me if there is something wrong with it or not because this one seems to be much simpler than the one given in my book.

So, since every CFG has a pushdown automaton which recognizes the same language, we convert the CFG into an equivalent PDA. Now we simulate the PDA on our Turing machine on the string $ w$ . This process must end in a finite number of steps since our string is finite in length.

Is this an alternate algorithm that illustrates the decidability of $ A_{CFG}$ or is there something wrong with it?

Is structural induction a particular case of (co)induction rule for an inductive predicate?

What is the relation between the principle of induction on terms:

If, for ech term s,   given P(r) for all immediate subterms r of s  we can show P(s), then P(t) holds for all t 

and the inductive or coinductive induction principles? For instance, if I write:

inductive evn where "evn 0" | "evn x ⟹ evn (x+2)"  thm evn.induct 

in Isabelle I get the principle:

evn ?x ⟹ ?P 0 ⟹ (⋀x. evn x ⟹ ?P x ⟹ ?P (x + 2)) ⟹ ?P ?x 

Before, I thouth that these were two different styles of proof. But know I believe they should be related in some way since after all a term grammar can be given as an inductive predicate.

Are Snap and Flatpack apps safe to install? Are they “official”, approved or tested for a particular distro version?

I don’t like installing apps outside my distro’s official repositories.

Linux security relies a lot on having a repository meticulosly curated and tested for library compatibility with current distro version, stability and security.

Once I installed, from outside repos, a fancy terminal emulator that mimicked retro green/amber phosphor monitors. This app wreaked havoc in my system and I had to reinstall Ubuntu.

I hesitate a lot about using ppas as well.

I only trust very few external sources, ppas or packages downloaded from websites.

But now Snap and Flatpack seems to be all the rage in Ubuntu-specialized sites.

  • Is it safe to install Snap apps or Flatpack apps?
  • Are there official repos for such?
  • Am I missing something here?
  • How is safety and stability taken cared of with this non apt stuff.

Particular WiFi network not detected

I installed yesterday Ubuntu 18.04 in dual boot on a computer usually used with Windows 7.

Everything went fine, except that I am unable to connect to my WiFi network. The weirdest thing being that my Network card seems to work perfectly: Ubuntu’s Network Manager detects all the surrounding WiFi networks, except for mine, which is called “WiFi-2.4-68B7”.

I already tried different solutions, none worked:

  1. I configured “WiFi-2.4-68B7” in the “known networks” and tried to access it through the “Connect to hidden network tool”.
  2. I checked whether Ubuntu was detecting my Network chipset correctly, which appears to be the case:

dd@dd:~$ sudo lspci

Network controller: Broadcom Inc. and subsidiaries BCM4313 802.11bgn Wireless Network Adapter (rev 01)

  1. I tried reinstalling the Broadcom driver for my BCM4313

dd@dd:~$ sudo apt-get –reinstall install bcmwl-kernel-source

  1. I also tried the solution proposed here, but with no result.

I am out of ideas to solve the problem. It should be noted I can connect just fine to my WiFi network when I boot from Windows 7, the problem is thus not from the hardware.

Does anyone have an idea? Thank you!