Anyone have idea with this command? - caching

I will be introduced with .csp file by Cache
Can you help elaborate their coding linem what was that initials (w, q, k, d, s etc )
w "<th>Total (RM)</th>"
q
#;=====================================
#;knjlbbk
#;=====================================
xxfindSomthingSomthing(dateFrom,dateTo,Status,currentPage,sessionId,type)
n (dateFrom,dateTo,Status,%request)
d insertAudit^exyz,abcabc(126,43,"",$$getSession^eaa.Audit(sessionId,type),"")
k ^Temp
d paginationInit^eaa.Pagination($g(currentPage))
s dataCount = 0
s list = ""
f
{

s stand for set
w is write
q is quit
that's all you know.

Related

Can I use a GraphQL union for plain strings?

In Graphql, I can create a union such as the following:
union SearchResult = Book | Movie
Is there a way I can do this for plain strings? Something like this:
union AccountRole = "admin" | "consumer"
I am afraid you cannot do that because it is what defined by the specification.
From the union syntax mentioned at specification here , the part that you want to change should follow the Names syntax , which the first character is only allow to be upper case letter, lower case latter or _
(i.e. the characters set as follows)
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m
n o p q r s t u v w x y z _

What are those elements in the method?

This is an extract of a file from this project (full text here):
Method redirects() [ Private, ProcedureBlock = 0 ]
{
/// Mnemonics
APC d APC^%X364 q
BEL d BEL^%X364 q
CBT(%1) d CBT^%X364(%1) q
CCH d CCH^%X364 q
CHA(%1) d CHA^%X364(%1) q
CHT(%1) d CHT^%X364(%1) q
CNL(%1) d CNL^%X364(%1) q
CPL(%1) d CPL^%X364(%1) q
CPR d CPR^%X364 q
CTC(%1,%2,%3,%4,%5,%6,%7,%8,%9) d CTC^%X364(%1,%2,%3,%4,%5,%6,%7,%8,%9) q
CUB(%1) d CUB^%X364(%1) q
CUD(%1) d CUD^%X364(%1) q
CUF(%1) d CUF^%X364(%1) q
CUP(%2,%1) d CUP^%X364(%2,%1) q
CUU(%1) d CUU^%X364(%1) q
CVT(%1) d CVT^%X364(%1) q
DA d DA^%X364 q
DAQ(%1,%2,%3,%4,%5,%6,%7,%8,%9) d DAQ^%X364(%1,%2,%3,%4,%5,%6,%7,%8,%9) q
DCH(%1) d DCH^%X364(%1) q
DCS d DCS^%X364 q
DL(%1) d DL^%X364(%1) q
DMI d DMI^%X364 q
DSR(%1) d DSR^%X364(%1) q
EA(%1) d EA^%X364(%1) q
ECH(%1) d ECH^%X364(%1) q
ED(%1) d ED^%X364(%1) q
EF(%1) d EF^%X364(%1) q
EL(%1) d EL^%X364(%1) q
EMI d EMI^%X364 q
EPA d EPA^%X364 q
ESA d ESA^%X364 q
FNT d DNT^%X364 q
GSM d GSM^%X364 q
GSS d GSS^%X364 q
HPA(%1) d HPA^%X364(%1) q
HPR(%1) d HPR^%X364(%1) q
HTJ d HTJ^%X364 q
HTS d HTS^%X364 q
HVP(%1,%2) d HVP^%X364(%1,%2) q
ICH(%1) d ICH^%X364(%1) q
IL(%1) d IL^%X364(%1) q
IND d IND^%X364 q
// And others, followed by old style MAC routines
}
This is the first time I see that... And I can't find documentation on what those "mnemonics" are.
What are they? Where is the documentation for it?
This is a standard mnemonics implementation for WebTerminal inside WebTerminal itself.
To make WebTerminal work as common terminal do over WebSockets, one of the most important things is a little line of code
use $io:(/NOXY:/BREAK):"^" _ ..InitialZName
which is executed at the beginning of WebSocket server initialization, and which actually set up the name of the mnemonic space, which is equal to WebTerminal's compiled routine name (like WebTerminal.Engine.1.int).
These mnemonics (APC, BEL, etc) are a little macro programs, which user can call from the terminal using the special syntax. For example, mnemonic "CHA" is used to set the caret position:
USER > w "Pos 0", /CHA(14), "Pos 14", /CHA(35), "Pos 35"
Pos 0 Pos 14 Pos 35
In order to make user able to access all of these with this syntax, there were a need to include all standard mnemonics names into terminal routine, which is set as a mnemonic space for each client by default (because setting the default mnemonic space, which include these mnemonics breaks WebTerminal). The only solution left is to declare them inside any method (in this case, the method named "redirects") using ProcedureBlock = 0.
Talking about the syntax, in general, we have
MNEMONICNAME(%ArgByRef) do MNEMONICNAME^%SYSTEMROUTINE(%ArgByRef) quit
This just calls all of the standard mnemonics which can be found in ^%X364 system routine.

Is this CTL formula equivalent and what makes it hold?

I'm wondering if the CTL formulas below are equivalent and if so, can you help me persuade myself that they are?
A(p U ( A(q U r) )) = A(A(p U q) U r)
I can't come up with any models that contradicts it and my guts tells me the formulas are equivalent but I can't find any equivalences that supports that statement. I've tried to rewrite the equivalence
A(p U q) == not(E ((not q) U not(p or q)) or EG (not q))
into something helpful but failed several times.
I've looked through my course material as well as google but I can't find anything. I did however find another question here that has the same equivalence question but with no answer, so I'm trying to make a second try.
Note: this answer might be late.
However, since the question was raised multiple times, I think it's still useful.
Question: Is A[p U A[q U r]] equivalent to A[A[p U q] U r]?
Answer: no.
To prove that the inequality stands, it is sufficient to provide a single Kripke Structure s.t. A[p U A[q U r]] is verified but A[A[p U q] U r] is not (or the converse).
Now, for simplicity, we assume to deal with a Kripke Structure in which every state has only one possible future state. Therefore, we can forget about the A modifier and consider the LTL version of the given problem: is [p U [q U r]] equivalent to [[p U q] U r]?.
Let's break down [p U [q U r]]:
[q U r] is true on paths which match the expression {q}*{r}
[p U [q U r]] is true on paths that mach {p}*{[q U r]} = {p}*{q}*{r}
What about [[p U q] U r]?
[p U q] is true on paths which match the expression {p}*{q}
[[p U q] U r] is true on paths that mach {[p U q]}*{r} = {{p}*{q}}*{r}
Now, {p}*{q}*{r} != {{p}*{q}}*{r}.
In fact, {p}*{q}*{r} matches any path in which a sequence of p is followed by r and there is no q along the way.
However, {{p}*{q}}*{r} does not. If a path contains a sequence of p, then the occurrence of q before r is mandatory.
Thus, the two formulas are not equivalent.
Hands-On Answer:
Let's encode a Kripke structure that provides the same counter-example using NuSMV
MODULE main ()
VAR
p: boolean;
q: boolean;
r: boolean;
INVAR !q;
INIT
!q & p & !r
TRANS
r -> next(r);
TRANS
p & !r -> next(r);
CTLSPEC A[p U A[q U r]];
CTLSPEC A[A[p U q] U r];
and check it:
~$ NuSMV -int
NuSMV > reset; read_model -i test.smv; go; check_property
-- specification A [ p U A [ q U r ] ] is true
-- specification A [ A [ p U q ] U r ] is false
-- as demonstrated by the following execution sequence
Trace Description: CTL Counterexample
Trace Type: Counterexample
-> State: 1.1 <-
p = TRUE
q = FALSE
r = FALSE
Indeed, one property is verified but the other is not.

Reduction from Atm to A (of my choice) , and from A to Atm

Reduction of many one , is not symmetric . I'm trying to prove it but it doesn't work
so well .
Given two languages A and B ,where A is defined as
A={w| |w| is even} , i.e. `w` has an even length
and B=A_TM , where A_TM is undecidable but Turing-recognizable!
Given the following Reduction:
f(w) = { (P(x):{accept;}),epsilon , if |w| is even
f(w) = { (P(x):{reject;}),epsilon , else
(Please forgive me for not using Latex , I have no experience with it)
As I can see, a reduction from A <= B (from A to A_TM) is possible , and works great.
However , I don't understand why B <= A , is not possible .
Can you please clarify and explain ?
Thanks
Ron
Assume for a moment that B <= A. Then there is a function f:Sigma*->Sigma* such that:
f(w) = x in A if w is in B
= x not in A if w is not in B
Therefore, we can describe the following algorithm [turing machine] M on input w:
1. w' <- f(w)
2. if |w'| is even return true
3. return false
It is easy to prove that M accepts w if and only if w is in B [left as an exercise to the reader], thus L(M) = B.
Also, M stops for any input w [from its construction]. Thus - L(M) is decideable.
But we got that L(M) = B is decideable - and that is a contradiction, because B = A_TM is undecideable!

Mathematica Reduce/Solve: Best way to ask for non-repeating values

A few times I found I had a system and I need to specify that all variables get different values (ie non-repeating).
I usually do things like this:
k = {a, b, c, d, e, f, g};
Reduce[
a != 2 && f == a + b && g == c - d && f == (d + e)/2 && f == e + g &&
First[And ### {0 < # < 8 & /# k}] &&
Times#(Sequence ## (Subsets[k, {2}] /. {x_, y_} -> (x - y))) != 0,
k, Integers]
Where the last part of the Reduce equation
Times#(Sequence ## (Subsets[k, {2}] /. {x_, y_} -> (x - y))) != 0
asks for different values.
Are there better ways to do this? (I mean, not the product equal zero, but to specify I need all variables different)
From the speed viewpoint, you are inducing a large overhead with that product condition. If your solutions are always numbers, you can produce all solutions with Reduce and then filter them - it may be faster in some cases. For example, in the case at hand:
k = {a, b, c, d, e, f, g};
sl = Reduce[ a != 2 && f == a + b && g == c - d && f == (d + e)/2 && f == e + g &&
First[And ### {0 < # < 8 & /# k}], k, Integers]
You can do the post-processing, for example like this (perhaps not the best way):
In[21]:= Select[{#, First[k /. Solve[#, k]]} & /# List ## sl,
MatchQ[Tally[#[[2]], Equal][[All, 2]], {1 ..}] &][[All, 1]]
Out[21]= {a == 3 && b == 2 && c == 7 && d == 6 && e == 4 && f == 5 && g == 1}
At least for this particular case, it was much faster.
For smallish problems, post=processing to remove unwanted solutions might be best. For larger problems there are at least two useful approaches.
(1) If the allowed values are say contiguous, or nearly so, could create 0-1 variables for the grid of each original variable and possible value. For example, if your variables are intended to fill out a standard Sudoku array, then x[i,j,k]=1 could be used to indicate that the value in row i, col j, is k. The constraints that e.g. no value in row 1 is repeated would be
Sum[x[1,j,1]==1, {j,9}]
...
Sum[x[1,j,9]==1, {j,9}]
If not all values need to be used in all places (e.g. rows) then these could be made into inequalities instead.
(2) Another approach is to use 0-1 variables for each pair if values that needs to be distinct. We assume there is at least a known upper and lower bound on value ranges. Call it m. So for any pair of variables x and y we know that the difference is between -m and m (could add/subtract ones there, but not essential).
For the pair x[i] and x[j] that need to be distinct, add a new variable 0-1 k[i,j]. The idea is it will need to be 1 if x[i]>x[j] and 0 if x[j]>x[i].*
For this pair we add two equations. I will show them in non-expanded form as that might be slightly easier to understand.
x[i]-x[j] >= k[i,j] + m*(k[i,j]-1)
x[j]-x[i] >= (1-k[i,j]) + m*(-k[i,j])
If x[i]>x[j] then both are satisfied only for k[i,j]==1. Vice versa for x[j]>x[i] and k[i.j]==0.
This might be the preferred method when variables can span a range of values substantially larger than the number of variables, or when far fewer that all pairs are constrained to be distinct values.
Daniel Lichtblau
*It's late Saturday night, so reverse anything I got backwards. Also please fix all typos while you are at it.
Why not supply a uniqueness constraint directly?
k = {a, b, c, d, e, f, g};
uniqueness = {a != b != e};
sl = Reduce[
a != 2 && f == a + b && g == c - d && f == (d + e)/2 && f == e + g &&
First[And ### {0 < # < 8 & /# k}] && First#uniqueness , k,
Integers]//Timing
Out[1]= {0.046791, a == 3 && b == 2 && c == 7 && d == 6 && e == 4 && f == 5 && g == 1}
From a cursory glance at your constraints above, most of the uniqueness requirements are self satisfied by the other constraints and setting a≠b≠e fixes all the remaining. There is no need to test for everything. For e.g.,
f = a + b ⇒ f ≠ a & f ≠ b
f = e + g ⇒ f ≠ e & f ≠ g
2f = d + e ⇒ f ≠ d ∵ f ≠ e ⇒ g ≠ d
c = g + d ⇒ c ≠ g & c ≠ d
and so on... You can probably work that out in detail.
I understand this is probably just a test example, and I don't have a smart and fast one stop answer that you can use without thinking about the problem.

Resources