How can I apply Rice’s theorem?

I am learning for my computability and complexity exam in which there is always an exercise to decide whether some problem is decidable or not.

In one of the past exams, there was the following problem:

Given Turing Machine M, decide whether there exists a prime number on which M halts.

I am supposed to decide whether the problem is decidable or not. I guess I can rewrite the problem into the language $ L = \{ \langle M \rangle | \exists p \in \mathbb{P} : M(p) \downarrow \}$ . I have been given a hint that I can use Rice’s theorem to prove the language is undecidable. I am actually struggeling, since I have no idea how should I apply Rice’s theorem to (generaly any) problem.

Any help appreciated.

Can you apply metamagic on a Mythic spell?

As per Pathfinder Roleplaying Game Mythic Adventures, a level 19 bard has 2 tiers in his Mythic path.
This bard took the Mythic feat Mythic Spell Lore

Benefit: You can learn a number of mythic spells equal to your tier and can expend mythic power when casting them to enhance the results. To select a mythic spell, you must be able to cast the non-mythic version or have it on your list of spells known. Every time you gain a new tier, you can select an additional mythic spell.

This bard also has has the metamagic feat Empower Spell

Benefit: All variable, numeric effects of an empowered spell are increased by half including bonuses to those dice rolls. Saving throws and opposed rolls are not affected, nor are spells without random variables.

Can he use the feat Empower Spell, on his Mythic Cure Critical Wounds ?


The damage cured increases to 8d8 points of damage + 2 points per caster level (maximum +40). The spell cures up to 4 points of ability damage if the target is a living creature. The target chooses what types of ability damage are cured.

If he can, how would you calculate the damage healed ?

What strategy should I use to sovle this interview problem? May I apply DP on this?

The problem description is as below and it feels like a DP problem but I am not sure, thank you for helping!

You have a certain dose of a drug, say, 200 milliliters, and now some patients need this drug. The doses for each patient may vary from person to person, for example, 2.5 milliliters for A, B, C, 5 milliliters for D, E, and 7 milliliters for F, and so on. The question is, in short, how can you allocate the drugs so that you have the least amount of drugs left? Example input: total drug dose 10 (milliliters). A needs 3, B needs 5, C needs 2, D needs 4, E needs 2. Output: A, B, C or A, B, E (perfect allocation with no drugs left). Note: there may be decimals.

You are welcome to give any hints or mature solutions to the question, or you can ask for more details about it.

Does the leader election problem only apply to process replication/redundancy?

The leader election problem is said to be

In distributed computing, leader election is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task is begun, all network nodes are either unaware which node will serve as the “leader” (or coordinator) of the task, or unable to communicate with the current coordinator. After a leader election algorithm has been run, however, each node throughout the network recognizes a particular, unique node as the task leader.

As far as the leader’s responsibility is concerned, are the candidates identical?

Does the leader election problem apply only to processes which are replicas, i.e. to process redundancy? In other words, does the leader election problem not apply to processes which are not replicas, i.e. processes without redundancy?

My confusions come from:

  • Design Data Intensive Programs by Kleppmann introduces the concept of “leader” in Chapter 5 Replication, while the election problem in Chapter 9: Consistency and Consensus.

  • Distributed Systems by Coulouris introduces the concept of “primary replica manager” and “backup replica manager” in Chapter 18 Replication, while the election problem in Chapter 15: Coordination and Agreement.

So I wonder if the election problem applies only to replication (more specifically, process replication), or also to cases which don’t involve replication?


Does the Adventurers League’s “PHB+1” rule also apply to received magical items?

Yesterday, I was playing an Adventurers League game with a Bugbear character (from Volo’s Guide to Monsters). I am aware of the Adventurers League’s PHB+1 rule, which prevents me from using material from other D&D 5e sourcebooks, like Xanathar’s Guide to Everything.

However, I received a magical item that comes from Xanathar’s Guide to Everything, and I’m wondering if I’m now violating the PHB+1 rule or not.

Does the Adventurers League’s “PHB+1” rule also apply to received magical items?

Review of Formal Verification and How to Apply it to Greenfield Project

Last year I looked heavily into Formal Verification, such as automated theorem proving, model checking, type systems, symbolic evaluation, and many others. I probably spent a few weeks or maybe months looking into it. At the time, I felt like I had a decent grasp of how it could be applied, yet still couldn’t put my finger on exactly what first steps would be. Today, I have forgotten a significant portion of this stuff, or more specifically of implementation details. I get all the different branches of Formal Verification at a high theoretical classroom level, but I don’t get how to apply it to writing real software.

The question here is how I can apply formal verification to a project if it were greenfield and free of constraints (yet at the same time, realistic meaning the problems can be solved within a reasonable amount of time). I’m wondering if one could explain relatively briefly how you would apply any/all Formal Verification techniques to gain that mathematical guarantee that your program matches a specification. How do the hardware people do it? How should it be done in software? Basically…

More specifically, nothing comes to mind other than writing unit/integration tests when it comes to making sure I’m building a super complicated program correctly (like an HTTP server). How could I apply model checking, or typechecking, or other things, to my advantage in terms of proofs / guarantees of program correctness (with regards to the specification)?

Understanding of big-O massively improved when I began thinking of orders as sets. How to apply the same approach to big-Theta?

Today I revisited the topic of runtime complexity orders – big-O and big-$ \Theta$ . I finally fully understood what the formal definition of big-O meant but more importantly I realised that big-O orders can be considered sets.

For example, $ n^3 + 3n + 1$ can be considered an element of set $ O(n^3)$ . Moreover, $ O(1)$ is a subset of $ O(n)$ is a subset of $ O(n^2)$ , etc.

This got me thinking about big-Theta which is also obviously a set. What I found confusing is how each big-Theta order relates to each other. i.e. I believe that $ \Theta(n^3)$ is not a subset of $ \Theta(n^4)$ . I played around with Desmos (graph visualiser) for a while and I failed to find how each big-Theta order relates to other orders. A simple example Big-Theta example graphs shows that although $ f(n) = 2n$ is in $ \Theta(n)$ and $ g(n) = 2n^2$ is in $ \Theta(n^2)$ , the graphs in $ \Theta(n)$ are obviously not in $ \Theta(n^2)$ . I kind of understand this visually, if I think about how different graphs and bounds might look like but I am having a hard time getting a solid explanation of why it is the way it is.

So, my questions are:

  1. Is what I wrote about big-O correct?
  2. How do big-Theta sets relate to each other, if they relate at all?
  3. Why do they relate to each other the way they do? The explanation is probably derivable from the formal definition of big-Theta (might be wrong here) and if someone could relate the explanation back to that definition it would be great.
  4. Is this also the reason why big-O is better for analysing complexity? Because it is easier to compare it to other runtimes?

How to apply command to all elements of a list?

So I generated a list of cities and I want to apply FindGeoLocation to all of them without having to seperate the elements and then applying.

y= CityData[{Large, Last[x]}]  

(x here is dynamically updated from

x = RandomChoice[CountryData[]]]  TextString@y 

Gives me a list of the Cities.

But now I want to take the list and have FindGeoLocation evaluate it at all the given cities in the list.

As far as I know, Map does that with functions. I don’t know what to do next.