First-order logic sentences that consist of 2 clauses

64 Views Asked by At

When predicates are given as the following,

Programmer(x)               x is a programmer
can_programming(x)          x is capable of programming
programming_language(x)     x is a programming language
more_difficult(x,y)         x is more difficult than y
can_use(x,y)                x can use y

and constants

Java            programming language Java
C               programming language C

and variable names are

x, y, z

, then I can express some simple sentences like

(a) All programmers are capable of programming

 ∀x can_programming(x)

(b) C is more difficult than any other language

∀x more_difficult(C, x)

, but when it comes to a little more complex sentences like

(c) In order to be able to write a program, you need to know at least one programming language
(d) Java is a programming language that all programmers can use, but there are also other programming languages besides Java
(e) Someone who can use Java can use all other programming languages, possibly excluding C
(f) Someone who can use a programming language that is more difficult than other languages, can use C

, I don't know how to combine the logic math symbols and predicates.

How do I do it?

1

There are 1 best solutions below

1
On

, then I can express some simple sentences like

(a) All programmers are capable of programming

∀x can_programming(x)

That says "Every thing is capable of programming." You need to restrict the statement to be about programmers.

$\forall x~[\operatorname{Programmer}(x)\to \operatorname{can\_programming}(x)]$

(b) C is more difficult than any other language

∀x more_difficult(C, x)

Likewise you need to restrict the statement to be about programming languages, and further to other languages than C.

$\forall x~[(\operatorname{programming\_language}(x)\land x\neq C)\to\operatorname{more\_difficult}(C,x)]$

In order to be able to write a program, you need to know at least one programming language.

First determine if this statement is specifically about "you", or about anyone?   Well, we'll assume it is general since we don't have a constant representing "you".

So "If anyone is capable of programming, then there exists a language that they can use." is

$$\forall y\exists x~[\operatorname{can\_programming}(y)\to(\operatorname{programming\_language}(x)\land\operatorname{can\_use}(y,x))]$$