Questions tagged [logic]

For challenges pertaining to mathematical logic and boolean algebra.

24 questions
430 views

Existential Golf

Math has a lot of symbols. Some might say too many symbols. So lets do some math with pictures. Lets have a paper, which we will draw on. To start the paper is empty, we will say that is ...
151 views

3-inverter with two NOT gates [closed]

Introduction I recently came across an oral exam where the candidates were asked to find a logical circuit than can negate 3 inputs A,B,C using only two NOT gates. ...
1k views

(A → B) → (¬B → ¬A)

Well I think it is about time we have another proof-golf question. This time we are going to prove the well known logical truth $(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)$ To do ...
434 views

Gerrymandering with Logic Gates

The majority function is a boolean function which takes three boolean inputs and returns the most common. For instance if maj(x,y,z) is the majority function and <...
360 views

Generate random LTL Formulae [closed]

An LTL Formula l is defined by the following grammar (where <x> describes the non-terminal symbol x): ...
362 views

Quickly Prove Me Wrong!

Introduction This is the evolution of this previous challenge which was about checking satisfieability of normal formulae in conjunctive normal form (CNF). However, this problem is NP-complete and ...
4k views

Be the First 1 (leave only the first Truthy)

Intro Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's eighth problem. I have explicit ...
48 views

Skip or delete lines between two keywords in a file using python [closed]

The problem is I need to skip or delete all the lines between the two keywords in a file and the keyword pair will appear many times in the file.The file looks something like this ...
58 views

Cheeky bus driver [duplicate]

The bus driver picks up the children from their homes every morning for school. All the homes are positioned around a circular street and the bus driver has to stop at every home exactly once. One ...
28k views

Mathematics is fact. Programming is not

In mathematics an exclamation mark ! often means factorial and it comes after the argument. In programming an exclamation mark !...
5k views

CodeGolf Challenge PWSSHHHH! You wake up in a cryogenics lab in the year 3000. Upon being escorted to the assignment office to receive your career chip, presumably that of a delivery boy, a probe ...
755 views

Convert a logical expression to conjunctive normal form

Goal: Write a complete program or function which takes a formula in propositional logic (henceforth referred to as a logical expression or expression) and outputs that formula in conjunctive normal ...
504 views

Combinatory Conundrum!

Introduction: Combinatory Logic Combinatory logic (CL) is based off of things called combinators, which are basically functions. There are two basic "built-in" combinators, ...
3k views

Count trailing truths

Inspired by, and in memory of, my dear friend and colleague, Dan Baronet, 1956 – 2016. R.I.P. He found the shortest possible APL solution to this task: Task Given a Boolean list, count the number ...
683 views

Prove DeMorgan's laws

Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws. The Rules of Natural Deduction Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P ...
5k views

Invert a boolean array

A nice simple one Input Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long. ...
424 views

How secure are my locks?

You have been assigned the task of installing new locks to the company's building. However, the locks you use are quite unusual: they require some combination of keys to open. Now, you want to figure ...
317 views

Given a truth table, output a Stackylogic program that satisfies it

Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased: Stackylogic takes ...
2k views

Run Stackylogic

Stackylogic is a logic-based programming language I made up that take in 0's and 1's for input and outputs a single ...
3k views

Prove me wrong!

Introduction Your mission in life is simple: Prove people wrong on the internet! To do this you usually carefully analyze their statements and point out the contradiction in them. It's time to ...
271 views

Solving variants of the blue-eyes puzzle

The original "Blue Eyes" puzzle is given here (and below). A group of people with assorted eye colors live on an island. They are all perfect logicians -- if a conclusion can be logically deduced,...
1k views

Back to the basics! You're in you comp sci class again, except wiser and golfier. You have the tools, you have the power… but do you have the skill? Probably. Crash Course for the non-Computer ...