Questions tagged [negation]

Negation is the logic operation that inverses a value, also seen as a NOT operation. Functions in specific languages may operate with negation to specific uses. For questions specific to the use of complement patterns in regular expressions, use [regex-negation] instead.

Negation is the logic operation that inverses a value, also seen as a NOT operation. Negation may be implemented by specific languages to provide functions capable of operating with values for specific uses.

Read also the wikipedia article on Negation.

248 questions
1
vote
2 answers

Negation in prolog query is not working

HI i have a simple knowledge database defined as: carClass('X1','Oil','small'). carClass('X2','gas','big'). carClass('X3','Petrol','big'). carClass('X4','oil','small'). carClass('X5','Oil','small'). carClass('X6','gas','big'). I am trying to write…
kshitij singh
  • 363
  • 2
  • 10
  • 19
1
vote
0 answers

Difference between "//span[not(text()='a')]" and "//span[text()!='a']"

I am using Selenium and Java to write a test. What is the difference between List wes = wait.until(ExpectedConditions. visibilityOfAllElementsLocatedBy(By.xpath("//span[not(text()='a')]"))); and List wes =…
1
vote
1 answer

Negate complete regex

Forcing a certain url structure "type/name" and my working regex is: ([a-z]+\/?[a-z]+\/?)+ Now I want to remove all other characters from the string via preg_replace and therefore negate the pattern above. Simple cases like [^a-z] work fine but for…
flowdee
  • 593
  • 6
  • 11
1
vote
2 answers

negative regex for perl string substitution

I'm trying to shorten all multiple spaces to one space, except for the first occurence of spaces (indentation). I've found that this code will replace the first occurences: $_ =~ s/^ +/ /; So I thought, its negation will do what I want. But it does…
lmocsi
  • 550
  • 2
  • 17
1
vote
4 answers

"If Not 'someCondition' Else" Logic

I have a few co-workers who implement if-else logic in a way I've not seen before, and it kind of baffles me. They write... If Then Else Console.WriteLine("Hello, World") ...instead of If Not Then …
Delfino
  • 967
  • 4
  • 21
  • 46
1
vote
1 answer

Regex, not statement

Heyho, I have the regex ([ ;(\{\}),\[\'\"]?)(_[a-zA-Z_\-0-9]*)([ =;\/*\-+\]\"\'\}\{,]?) to match every occurrence of _var Problem is that it also matches strings like test_var I tried to add a new matching group negating any word character but…
Christian Klemm
  • 1,455
  • 5
  • 28
  • 49
1
vote
1 answer

LDAP More than one negation operators in filter

I try to write a LDAP filter with two negations. I need all users who are not disabled AND don't belong to OU=Abt99 . This is my filter at the…
The_Sheep
  • 69
  • 2
  • 7
1
vote
2 answers

Negating expressions

Is there any difference between these two statements: ! (name == "bob") and name != "bob" To me, it seems like they both do the same thing. How are they different, if at all?
1
vote
1 answer

SQlite3 fts negate search

Hi and thanks for looking! I'm searching for articles which contain certain strings with full text search, something like this: SELECT * FROM Articles_fts WHERE body MATCH 'monkey OR banana OR "hungry gorilla"'; My real search is much longer (22…
1
vote
1 answer

javafx 8 fxml negation

Using FXML with JavaFx 8. I have few ToggleButtons in toggleGroup, defined as: I want to disable OK button, when no operater is selected. Actually, I want to negate the disable expression in ok button:
esmin
  • 491
  • 7
  • 14
1
vote
1 answer

Prolog ~ Resolution involving the negation of some other statement?

I have the following code, where I define is_max as the negation of is_below. rank(mary,1). rank(juan,2). rank(john,3). rank(jane,4). is_below(X) :- rank(X,A), rank(Y,B), A
killajoule
  • 3,612
  • 7
  • 30
  • 36
1
vote
1 answer

(F) Lex, how do I match negation?

Some language grammars use negations in their rules. For example, in the Dart specification the following rule is used: ~('\'|'"'|'$'|NEWLINE) Which means match anything that is not one of the rules inside the parenthesis. Now, I know in flex I can…
Oscar Del Ben
  • 4,485
  • 1
  • 27
  • 41
1
vote
2 answers

Prolog negation with more solutions

I've got a little problem and don't know where to find a solution. You probably heard of problem of flying birds: bird(eagle). bird(penguin). can_fly(penguin):-!,fail. can_fly(X):-bird(X). I tried to modify and use this knowledge for some "love…
tcigler
  • 126
  • 8
1
vote
3 answers

Jquery/css not selector does not work

I'm trying to exclude one block from my jquery selection. I have the following html structure:
...
1
vote
0 answers

Library for negation of logical expressions?

Given that I have an conditional expression like: a > 9, do you know if a library exists, which can negate the condition correctly to: a <= 9. ? The problem: I have a constraint solver, lp_solve, which I feed with constraints, i.e. conditions. Then…
dynamokaj
  • 471
  • 7
  • 19