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
0
votes
2 answers

how to know all true in prolog

Just started to learn Prolog, and cannot figure out how to get the result which involves "all true", for example: preAction(4, 3). preAction(4, 2). preAction(2, 1). action(4). action(2). action(1). takeAction(X) :- action(X), preAction(X,…
lMolly
  • 19
  • 2
0
votes
1 answer

C++: Vector - Ambiguous overload of "operator -"

I have ambiguously overloaded the member function operator- of my vector (mathematics) class. Can I resolve this issue? At the moment I am a bit stuck as to how to proceed. Code: class vector { double mx, my; // Constructor not written for…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
0
votes
1 answer

Regex Negate non-contiguous Pattern

I want to match the word fleece where it is NOT followed (either immediately, or further on) by the word snow Input data: Mary had a little lamb, its fleece was white as snow balls The following regex's don't work as they all match, and shouldn't.…
Santrix
  • 875
  • 8
  • 10
0
votes
4 answers

Does PHP negation check with `!` coprrespond to `!=` or to `!==`?

In PHP, is if(!$foo) equivalent with if($foo != true) or with if($foo !== true) or is it even something completly different of both?
Foo Bar
  • 1,764
  • 4
  • 24
  • 43
0
votes
0 answers

Is there any inherent difference between these two python negations

>>> a = [1, 2, 3] >>> 4 not in a True >>> not 4 in a True Is there any foolproof way to remember 1. when to use which and 2. which is more prone to errors?
Sunil Kundal
  • 143
  • 1
  • 2
  • 8
0
votes
1 answer

R treats the subset as factor variables instead of numeric variables

In a comlex dataframe I am having a column with a net recalled salary inclusive NAs that I want to exclude plus a column with the year when the study was conducted ranging from 1992 to 2010, more or less like this: q32 pgssyear 2000 1992 1000…
Asiack
  • 47
  • 8
0
votes
2 answers

PHP Negating Regular Expression

I have tried lots and lots of solutions but unfortunately, nothing works for me. The following is my code. This will output 10-01,10-02 Now, what i want is to…
user_g
  • 35
  • 1
  • 7
0
votes
1 answer

How to add tags to negated words till next punctuation mark in R

I need some help to figure out how we can simulate in R the solution for adding a tag "NOT_" to every word that follows the negation word till the next punctuation mark. A solution for Python code can be found here How to add tags to negated words…
0
votes
2 answers

Prolog: Art Theft. Solving a logic puzzle

Just starting to get into Prolog as artificial intelligence is quite interesting and different than alot of other programming languages out there, and I've stumbled upon a logic puzzle: http://www.brainbashers.com/showpuzzles.as and wondering how i…
0
votes
5 answers

if statement negation python 2.7.8

Hi I'm fairly new to coding and I'm stuck on negation and how to properly implement it. I've been going through a textbook teaching myself and I'm stuck "Write an if statement that negates n, if and only if it is less than 0" I've tried and…
Alex
  • 17
  • 1
0
votes
1 answer

acl2 equality with negation

I'm having some trouble with acl2, trying to prove the following: (thm (implies (acl2-numberp x) (equal (* -2 x) (* 2 (- x))))) which results in: ACL2 !>(thm (implies (acl2-numberp x) (equal (* -2 x) (* 2 (- x))))) *1 (the initial Goal, a key…
0
votes
1 answer

Double Not operator

I saw this line of code in a book: !!(document.all && document.uniqueID); Why is it necessary to use the double not operator? Do not the && operator already transform the result to a Boolean?
tt0686
  • 1,771
  • 6
  • 31
  • 60
0
votes
1 answer

Globbing don't work with negation and two wildcards

I have this file structure user@laptop:/my/folder$ ls control changelog patches postrm source copyright.in mime postinst rules and want to list all files without dot in name. Don't want use grep. Reverse look…
Ľubomír Mlích
  • 649
  • 6
  • 12
0
votes
2 answers

Negation in JavaScript

Can someone explain why Javascript gives the following results? ~3 = -4 ~3.346346 = -4 ~-3 = 2
Skip
  • 6,240
  • 11
  • 67
  • 117
0
votes
1 answer

Drools constraint object does not exist whose member field contains a value other than P

I realize the title is crazy, but it really is the best I could think of. If anyone has better suggestions please leave them in the comments and I'll edit. This question is a followup to the question asked here : Drools Constraint object other than…
melchoir55
  • 6,842
  • 7
  • 60
  • 106