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
1 answer

Testing for identical sets of values in SPARQL (double negation)

In a question-answering systems I need to compare the set of questions users have answered to match the sets of questions associated to profiles, to group users in these profiles. I am trying to find, in a single query, tuples profile;user, where…
ThomasFrancart
  • 470
  • 3
  • 13
1
vote
1 answer

Negating a backreference in regex

I have written such regular expression: (?(?\w+)+=(?["'`])(?(?:[^\k]|(?<=\\)\k)+\k)) but it doesn't work because of backreferencing inside [^]. I looked for solution on this thread and wrote…
user10265033
1
vote
2 answers

How can I filter for entries that do NOT contain a key-value pair within a nested array

Let's say I have the following JSON output: { "Stacks": [ { "StackName": "hello-world", "Tags": [ { "Key": "environment", "Value": "sandbox" }, …
Mike
  • 339
  • 1
  • 3
  • 14
1
vote
1 answer

precedence of negation in SWI prolog

Here is quote from from Blackburn and Bos book "Representation and Inference for Natural Language". :- op(900,yfx,>). % implication :- op(850,yfx,v). % disjunction :- op(800,yfx,&). % conjunction :- op(750, fy,-). % negation As expected negation…
user1700890
  • 7,144
  • 18
  • 87
  • 183
1
vote
1 answer

Why does the NEG instruction interfere with the Carry Flag?

I see this information on the site, During a negation (NEG), the carry flag is set unless the operand is zero, in which case it is cleared. But, it doesn't help me reason about the carry flag. Why does it behave this way and how does NEG trigger…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
1 answer

.gitignore wildcard suffix exclusion with negation for subfolder

I have a .gitignore which is like this: *.png *.jpg *.gif !0/*.png !0/*.jpg !0/*.gif I want to ignore all image files (.png, .jpg, .gif) in all folders but not in the folder /0/. All image files in this folder should not be ignored. I tried with…
Blackbam
  • 17,496
  • 26
  • 97
  • 150
1
vote
1 answer

what's the semantics of Prolog's implementation of negation with non-ground literals

I am familiar with Prolog's implementation of negation as NaF and that even its implementation of NaF is incomplete, esp. floundering with non ground negated literals. My question here is regarding the specific semantics. Suppose you have a clause…
Motorhead
  • 928
  • 6
  • 16
1
vote
2 answers

SED delete comments but leave specific negated comment strings

I'm trying to delete comments from file but what's important I want to leave specific strings: ## Something # START # END These has to stay with rest not commented lines and I want to remove rest with "d" - this is important. I don't want to use…
mike
  • 275
  • 1
  • 12
1
vote
1 answer

Prolog - using negation (declarative approach) to define member/2 to only succeed once for each number

I'm trying to write an alternative definition to member/2 which will won't return repetitions of numbers (i.e. will only succeed once for each element). I've currently got this code working using the cut procedurally: once_member(X,[H|T]) :- …
Carol
  • 65
  • 1
  • 5
1
vote
2 answers

Powershell: unexpected behavior of negated -like and -match conditionals

I have 2 folders in my windows folder, software, and softwaretest. So I have the main folder "software" if statement, then jump to the elseif - here I have the backup folder, so jump to the else... my problem is that I'm getting the write-host from…
Thomas BP
  • 1,187
  • 3
  • 26
  • 62
1
vote
1 answer

Is it possible to negate an element from receiving display:none using the :not pseudo-class in CSS?

more things...
In linked CSS file (using Chrome): @media print{ body:not(#myModal){ display:none; visibility:hidden; } #myModal{…
johnny
  • 19,272
  • 52
  • 157
  • 259
1
vote
2 answers

How to effectively convert positive number in base -2 to a negative one in base - 2?

Old question name: How to effectively split a binary string in a groups of 10, 0, 11? I have some strings as an input, which are binary representation of a number. For example: 10011 100111 0111111 11111011101 I need to split these strings (or…
Oleg Abrazhaev
  • 2,751
  • 2
  • 28
  • 41
1
vote
2 answers

Generate negated values in Prolog

Here is what I am trying to accomplish fact(f1p1, f1p2). fact(f2p1, f2p2). fact(f3p1, f3p2). factIsNotTrue(Param1, Param2) :- \+fact(Param1, Param2). I want the code above to produce the following ?- fact_is_not_true(f1p1, Param2). Param2 =…
sasha199568
  • 1,143
  • 1
  • 11
  • 33
1
vote
1 answer

Negate RE2 regular expression

Could you please help me to understand if RE2 allows to negate regular expressions (the same effect as "grep -v", i.e. "select everything that does not match a given expression")? For example, I could match (positive match):…
S.V
  • 2,149
  • 2
  • 18
  • 41
1
vote
1 answer

how to get Logical Not in shell?

I am testing whether command exist like this: if hash pm2 2>/dev/null; then echo "already exist" else npm install --global pm2 fi but in fact I just want to do this if not exist install it fi I tried this if [ ! hash pm2 2>/dev/null ];…
roger
  • 9,063
  • 20
  • 72
  • 119