Physics Forums

Physics Forums (
-   Set Theory, Logic, Probability, Statistics (
-   -   First-order logic : repesenting graphs (

nounou Apr22-05 12:19 PM

First-order logic : repesenting graphs
How can we write a sentence in first-order logic that says that a graph has exactly 6 edges? i.e. G= (V,E) (logically implies) iff |E|=6 :eek:

Hurkyl Apr22-05 02:33 PM

Start simple. Replace 6 with 0. Can you figure out how?
Replace 6 with 1. Can you figure out how?
Replace 6 with 2. Can you figure out how?

nounou Apr22-05 03:35 PM

Actually no. I'm having trouble to represent the number of edges. I can express that there is an edge in a graph:

There_Exists_x There_exists_y edge(x,y).

but how can I express that there are n edges in the graph.

Any ideas ?

Hurkyl Apr22-05 03:43 PM

Hrm. Your variables, then, must range over the vertices of the graph, and you assume that there is exactly one edge between a given pair of vertices?

Anyways, so you've managed to solve (the complement of) my first problem: how to express that a graph has no edges.

So let's move onto the next: how to express that a graph has a single edge... have you ever expressed before the notion that there is one (and only one) object that satisfies a given property?

nounou Apr22-05 04:03 PM

Im sorry. I dont know how to. I'm not so good at this.Any hints?

Hurkyl Apr22-05 04:05 PM

You've never had to express something like:

"This equation has a unique solution"?

nounou Apr22-05 04:06 PM

Ok... So, what does this have to do with that?

Hurkyl Apr22-05 04:10 PM

You want to say "This graph has a unique edge". :tongue2:

nounou Apr22-05 04:14 PM

Ok. But a certain number of edges. I'm sorry if Im not getting what u mean. I'm not a mathematician by any means. Can u give me a simple sentence ?just to help me start and I will build up on it.

Hurkyl Apr22-05 04:19 PM

I'm saying that you should fully tackle the question of expressing the statement "This graph has exactly one edge" before moving on to the tougher statement "This graph has exactly six edges".

You've already given a sample statement: You encoded: "This graph has at least one edge" as:

Ex Ey: edge(x, y)

Maybe you should explicitly write out the solution to my first exercise before moving onto the next: how can you encode: "This graph has zero edges"?

nounou Apr22-05 04:32 PM

Ex Ey: ~edge(x,y)

Is this what u mean ?

Hurkyl Apr22-05 04:36 PM

That's not correct. For example, take this graph:

A B---C

This graph has three vertices and one edge.

Your statement "Ex Ey: ~edge(x, y)" is true for this graph -- for example, I can select x=A and y=B, and then "~edge(A, B)" is a true statement. However, the graph obviously does not have zero edges!

In English, your statement says: "There exists a pair of vertices that don't have an edge between them". Do you see why?

nounou Apr22-05 04:43 PM

Yes I do. Maybe i can use

ForAll_x ForAll_y : ~edge(x, y)


Hurkyl Apr22-05 04:47 PM

Yes, that one's exactly right. It says "For any pair of vertices, there does not exist an edge between them."

Now onto exactly one edge...

You already know how to say "This graph has at least one edge".

I suggested considering the statement "This equation has a unique solution" because the expression of this statement in logic involves a useful trick that applies directly here...

Another way to think about it is this: can you say "This graph does not have two distinct edges"?

Or what about it's complement? "This graph has at least two distinct edges"

nounou Apr22-05 04:51 PM

I have no clue. :cry: Do u have any hints on how to express that it has 2 distinct edges ?

Hurkyl Apr22-05 04:59 PM

Okay, suppose you know that your graph has only one edge.

I take two sheets of paper. On the first sheet of paper, I write down the name of an edge in your graph. On the second sheet of paper, I write down the name of an edge in your graph.

What can you tell me about the two sheets of paper?

nounou Apr22-05 06:10 PM

they contain the same edge, since my graph has only one edge

Ex Ey edge(x,y) , x=y


Hurkyl Apr22-05 06:27 PM


they contain the same edge, since my graph has only one edge
Bingo -- and as you realize, what you need to do is to figure out how to encode that into your statement!

In other words, if we've written down the names of two edges, the names should be the same.

All times are GMT -5. The time now is 04:37 AM.

Powered by vBulletin Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2014 Physics Forums