{Q}
changes based on {P}
(Given {P}S{Q}
)? Is this a trivial or special case of a known kind of Hoare Expression? A simple Hoare-like scenario:
const P = 0
let q = 0
if (P === 0) q++
const Q = q < 2
Suppose Q
is Curried or transformed into Higher-Order Function?
let P = 0
let q = 0
let Q = false
// S
const R = Math.random()
const qQ = f => (...args) => f(args)
const A = q => q === 0
const B = q => q > 1
const C = q => q < 0
if (R < .5) P++
if (P === 1) Q = qQ(B)(q)
if (P === 0) {
q+=2
Q = qQ(C)(q)
}
console.log(P)
console.log(q)
console.log(Q)
Condition P
is subject to change and Q
accepts a variant Higher-Order Function that changes the evaluation of q
(despite the resolved value of q
being true
under B
):
# Where P is 1
1
0
false
# Where P is 0
0
2
false
In the above scenario
P
,Q
, andq
are bounded by a finite range of possibilities (and so give rise to the kinds of Modal Semantics alluded to above) despite the evaluationQ
to be modified.
It looks like there's some fairly nascent research on these topics (less than 20 years old, Higher Order Functions, etc.):
I have some questions (and regrettably I haven't looked into the literature too much) and my curiosity has gotten the better of me here:
S
doesn't halt or the mutability of Q
continues indefinitely?Q
's evaluation calls P
?Strings
and eval
(them, the randomly generated but syntactically-valid) somewhere in P
, S
, or Q
- do we have many Modal universes semantics-wise? (That's certainly allowed in JavaScript.)Q
presumably would require some Measurement or resultant Quantum State. (Quantum Measurement/Observation seems to align with the idea of Evaluating some condition or State.)S
(its output) changes that output?