Termination of term rewiting using strict partial order on subterms

Are there any good books, research reports, surveys, theses, or papers that display proof techniques, with clear proofs of termination of term rewriting problems that have the following form…?

Terms are represented by directed acyclic graphs where the terms are vertices with arcs labelled $ arg_{1}…arg_{n}$ pointing to the immediate sub-terms. There would be additional equality arcs between vertices. Thinking of the transitive closure of the equality arcs as representing equivalence classes of vertices that are "merged", the $ arg$ arcs in the graph form a lattice (because or the strict order on sub-terms, and some sub-terms might be shared). A rewrite rule would add extra arcs, such that existing partial order would be preserved and added to, so the rewrite rules would be constructing a series of partial orders (represented in the graph state at each step) $ p_{0} \subset … \subset p_{m}$ more and more "constraining" the partial order relation between vertices until either the re-write rules find nothing to re-write or a rewrite would introduce a cycle (immediately detectable by a depth first search). I think this kind of termination proof is correct because we can say every step was a reduction under the partial order $ p_{m}$ but I’d like a formal justification because I have worries about my not knowing $ p_{m}$ before hand, only when it is constructed. And if the rewrite finds a cycle then that cycle was implicit from the beginning. Again I think that’s OK because my re-write rules are prove-ably LHS iff RHS so they transform the problem to an equivalent problem. I call this "construct a partial order or die trying." Is there a more formal name for this kind of proof?

Ideally the proof examples would be constructive and mathematically thorough. I see some papers that assume a lot of prior knowledge, probably because of brevity requirement, and not wanting to bore an expert audience. And others with "wordy" explanations, which are great to give intuitive understanding, but proofs should not depend on them.

Are NP problems lower bounded by exponential order of growth?

My understanding of P. vs NP is quite limited. I can understand P refers to an algorithm with an upper bound (big O) with order of growth $ n^c$ for some constant c and variable n. My question is, do NP problems have a hypothesized lower bound order of growth (big Omega) of $ c^n$ for deterministic machines? I can’t find this stated anywhere and I’m trying to understand if this is something that is assumed or not.

Thanks.

How do you generate random row order in a subquery?

I know other answers here (and here) say to order by newid(). However if I am selecting top 1 in a subquery – so as to generate a random selection per row in the outer query – using newid() yields the same result each time.

That is:

select *,     (select top 1 [value] from lookupTable where [code] = 'TEST') order by newid()) from myTable 

… yields the same lookupTable.value value on each row returned from myTable.

Problem using ‘Regular expression’ in order to split characters of a column when there is no delimiter between them

I have a table with below structure:

create table TBL_TEST (   col_id   NUMBER,   col_name VARCHAR2(500) ) 

Some example data :

col_id | col_name    -----------------   1    | aetnap           2    | elppa          3    | ananab        

What I need to do is to split characters of column col_name for each col_id for example for col_id=1 we must have :

col_id | col_name    -----------------   1    | a   1    | e   1    | t   1    | n   1    | a   1    | p 

this query is fine when there is only one record in the table :

SELECT col_id, REGEXP_SUBSTR(col_name, '[a-z]{1}', 1, LEVEL) AS VAL   FROM tbl_test t CONNECT BY REGEXP_SUBSTR(col_name, '[a-z]{1}', 1, LEVEL) is not null 

but as soon as I insert another record in the table (say col_id=2 and col_id=3) I can not have the desired result. I want to know two things:

  1. Why is this query works fine for one record and it does not for more ?
  2. what is the best way to split the characters when there is no delimiter between them?

Thanks in advance

What is the order in which published D&D 5e adventures should be played?

The current list of published D&D 5e adventures is:

  • Starter Set – Lost Mines of Phandelver | 1-4 | July 15, 2014
  • Tyranny of Dragons – Hoard of the Dragon Queen | 1-7 | August 19, 2014
  • Tyranny of Dragons – The Rise of Tiamat | 8-15 | November 4, 2014
  • Elemental Evil – Princes of the Apocalypse | 1-15 | April 7, 2015
  • Rage of Demons – Out of the Abyss | 1-14 | September 15, 2015
  • Curse of Strahd – Curse of Strahd | 1-10 | March 15, 2016
  • Storm King’s Thunder – Storm King’s Thunder | 1-11 | September 6, 2016
  • Tales from the Yawning Portal – Tales from the Yawning Portal | Anthology/Varies | March 24, 2017

I know that both Tyranny of Dragons campaigns are related. Are there any other relations between adventures? Is there a particular order in which they should be played, or are the adventures independent from one another?

Minimum number of given operations in order to group letters in a string


Description

Suppose we have a string containing letters ‘A’,’B’,’C’,’D’, and the characters are placed in a stack.We also have an empty stack.Ultimately,we want all letters grouped in the 2nd stack,using only 3 operations:

  • push("p"): Removes an items from the bottom of the 1st stack and place it to the top of the 2nd
  • complement("c"): Replace every all letters of the 1st stack with they "complements".The pairs are A – B and C – D
  • reverse("r"): Reverse the content of the 2nd stack.The top becomes bottom and bottom->top.

Example of moves

| Move | First Stack | Second Stack | +------+-------------+--------------+ |      | DBACA       |              | +------+-------------+--------------+ | p    | DBAC        | A            | +------+-------------+--------------+ | p    | DBA         | CA           | +------+-------------+--------------+ | r    | DBA         | AC           | +------+-------------+--------------+ | p    | DB          | AAC          | +------+-------------+--------------+ | c    | CA          | AAC          | +------+-------------+--------------+ | p    | C           | AAAC         | +------+-------------+--------------+ | r    | C           | CAAA         | +------+-------------+--------------+ | p    |             | CCAAA        | +------+-------------+--------------+ 

Note that the example above finds a solution,but not the minimum solution.The correct answer would be "ppr ppp"

Correct examples

Spaces in the sequence have no meaning and are added for readability purposes.

+------------------------+-------------------------------------+ | First Stack (input)    | Moves (output)                      | +------------------------+-------------------------------------+ | DD                     | pp                                  | +------------------------+-------------------------------------+ | BADA                   | ppr pp                              | +------------------------+-------------------------------------+ | DADA                   | ppc pp                              | +------------------------+-------------------------------------+ | DBACA                  | pprppp                              | +------------------------+-------------------------------------+ | BDA CACA               | ppr prp rppp                        | +------------------------+-------------------------------------+ | CAC DCDC               | pcp cpc pcp cpp                     | +------------------------+-------------------------------------+ | ADA DBD BCB DBCB       | ppr pcr pcr prp rpr prp rpr prp rp  | +------------------------+-------------------------------------+ | DAB BCC DCC BDC ACD CC | ppc pcp cpp rpp rpp cpc ppr ppc prp | +------------------------+-------------------------------------+ 

Brute force approach

We could just use brute force approach,calculating all possible moves until the first stack is empty.This could be done using BFS or A* algorithms.

For example,we could initialize an empty queue,start from a parent node and create 3 new nodes for every possible move.Then add these nodes to the queue.Every time remove a node from the queue and apply the operations.Save the sequence of moves while nodes are created.If the last move was a "c",then skip "c" operation for this node.The same is true about "r" operation (no repetitive c’s or r’s).If stack1 = empty for a node,then finish the program and return the sequence of moves.

Questions

Is there a better way to solve this problem? Can we apply some heuristics as improvement in the brute force approach? Thank you in advance.

Does the Iron Flask let you Order the Creature Back in Without a Save?

So I have an Iron Flask in my current campaign, and we happened to find out that it contains Tiamat. We released her to have a conversation, where she threatened to eat me at the end of the hour. Since it didn’t directly lead to her death, I ordered her back in the Flask, but am not sure if that’s okay? If you order the creature in, do they still get to make the save?