what is skolem constant and logic variable? - logic

In logic I see skolem constant many times, it said it is used to substitute existential variable occurrences. but what is special about skolem constant and why we do such substitution, what is that skolem constant for? why not just leave existential variable alone?
another question is what is logic variable, what is that for?
could any one explain to me.
Thanks in advance!

Related

Is a single constant value considered an expression?

After reading this answer on a CSS question, I wonder:
In Computer Science, is a single, constant value considered an expression?
In other words, is 7px an expression? What about just 7?
Quoting Wikipedia, emphasis mine:
An expression in a programming language is a combination of one or more explicit values, constants, variables, operators, and functions that the programming language interprets [...] and computes to produce [...] another value. This process, as for mathematical expressions, is called evaluation.
Quoting MS Docs, emphasis mine:
An expression is a sequence of one or more operands and zero or more operators that can be evaluated to a single value, object, method, or namespace. Expressions can consist of a literal value [...].
These both seems to indicate that values are expressions. However, one could argue that a value will not be evaluated, as it is already only a value, and therefore doesn't qualify.
Quoting Techopedia, emphasis mine:
[...] In terms of structure, experts point out that an expression inherently needs at least one 'operand’ or value that is acted on, and must have one or more operators. [...]
This suggests that even x does not qualify as expression as it is lacking one or more operators.
It depends on the exact definition of course, but under most definitions expressions are defined recursively with constants being one of the basis cases. So, yes, literal values are special cases of expressions.
You can look at grammars for various languages such as the one for Python
If you trace through the grammar you see that an expr can be an atom which includes number literals. The fact that number literals are Python expressions is also obvious when you consider productions like:
comparison: expr (comp_op expr)*
This is the production which captures expressions like x < 7, which wouldn't be captured if 7 isn't a valid expression.
In Computer Science, is a single, constant value considered an expression?
It depends entirely on the context. For example, FORTRAN, BASIC, and COBOL all have line numbers. Those are numeric constant values that are not expressions.
In other contexts (even within those languages) a numeric constant may be an expression.

arithmetic variables in prolog

I want to process arithmetic expressions with variables in it. Variables should be left as it is, and the other parts should be calculated. For example,
?-result(7*x,R).
R=7*x.
?-result(x+(2*3),R).
R=x+6.
How should I do this?

Mathematica custom notation / disable predefined function?

I cannot find how to use any variable name i want in mathematica.
(I've searched where i could but i cannot think of the correct terms to search for)
For example, I wanted to name one of my variables {pi}' (with {pi} I mean the greek pi, just cannot type it here).
However, there are problems. First, {pi} is already predefined as a constant equal to 3.14..
Second, the prime (') symbol is predefined as derivative.
So, {pi}' evaluates to 0& by default.
Another example would be, if i want to name my variable with a "0" in the exponent. However, I do not want mathematica to understand it as exponent, but just as name.
It would be fine if I could just deactivate that ' is interpreted as derivative, or that superscript is interpreted as exponent. But i would prefer some function which lets me define any collection of symbols as variable.
Can someone help?

Why do we need prefix, postfix notation

I know how each of them can be converted to one another but never really understood what their applications are. The usual infix operation is quite readable, but where does it fail which led to inception of prefix and postfix notation
Infix notation is easy to read for humans, whereas pre-/postfix notation is easier to parse for a machine. The big advantage in pre-/postfix notation is that there never arise any questions like operator precedence.
For example, consider the infix expression 1 # 2 $ 3. Now, we don't know what those operators mean, so there are two possible corresponding postfix expressions: 1 2 # 3 $ and 1 2 3 $ #. Without knowing the rules governing the use of these operators, the infix expression is essentially worthless.
Or, to put it in more general terms: it is possible to restore the original (parse) tree from a pre-/postfix expression without any additional knowledge, but the same isn't true for infix expressions.
Postfix notation, also known as RPN, is very easy to process left-to-right. An operand is pushed onto a stack; an operator pops its operand(s) from the stack and pushes the result. Little or no parsing is necessary. It's used by Forth and by some calculators (HP calculators are noted for using RPN).
Prefix notation is nearly as easy to process; it's used in Lisp.
At least for the case of the prefix notation: The advantage of using a prefix operator is that syntactically, it reads as if the operator is a function call
Another aspect of prefix/postfix vs. infix is that the arity of the operator (how many arguments it is applied to) no longer has to be limited to exactly 2. It can be more, or sometimes less (0 or 1 when defaults are implied naturally, like zero for addition/subtraction, one for multiplication/division).

Prolog; a question about notation in an assignment

I get hat isa/2 is a rule, that takes two objects or terms. But what would isa2/2 imply? That isa is defined twice?
isa2/2 simply refers to a predicate named isa2 taking 2 arguments, i.e. the first 2 is simply part of the name, not a special notation.

Resources