Java School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a Java Expert!

Join 300,495 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,849 people online right now. Registration is fast and FREE... Join Now!




Java / Logic Problem

 

Java / Logic Problem, Need help proving something...

bshak1

1 Dec, 2008 - 03:04 PM
Post #1

New D.I.C Head
*

Joined: 18 Nov, 2008
Posts: 10



Thanked: 1 times
My Contributions
I am asked to prove that M is true AND P is NOT true.
Prove: M && !P

These are the statements that I am given to solve this riddle:

1. If (J && R) then H (is true)
2. If (R is true then H is true) is true then M is true.
3. !(P || !J)

Here is what I have so far:
Based on number 3, It is not P or not J. Therefore J must be true AND P must be false. I have proven the second part of what I need to prove, that P is false.

To prove that M is true, I need to prove that H is true. To prove that H is true, J and R must be true. J is true, so I need to find a way to prove that R is true. Can anyone solve this riddle?

User is offlineProfile CardPM
+Quote Post


Gloin

RE: Java / Logic Problem

1 Dec, 2008 - 03:47 PM
Post #2

Expert Schmexpert...
Group Icon

Joined: 4 Aug, 2008
Posts: 3,528



Thanked: 143 times
Dream Kudos: 75
My Contributions
From 3, J is true, this you know. This means that 1 says: If (True && R) then H, which is the same as: if (R is true then H is true). Now that is the condition in 2 to make M true and finally from 3 you get that P is false. Which you were supposed to prove.
User is offlineProfile CardPM
+Quote Post

bshak1

RE: Java / Logic Problem

1 Dec, 2008 - 03:53 PM
Post #3

New D.I.C Head
*

Joined: 18 Nov, 2008
Posts: 10



Thanked: 1 times
My Contributions
QUOTE(Gloin @ 1 Dec, 2008 - 03:47 PM) *

From 3, J is true, this you know. This means that 1 says: If (True && R) then H, which is the same as: if (R is true then H is true). Now that is the condition in 2 to make M true and finally from 3 you get that P is false. Which you were supposed to prove.



Thanks, but I still don't know how to prove that R is true. I must prove that R is true, to make H true. Once I can prove H true, then M is necessarily true. But how do I prove R is true?
User is offlineProfile CardPM
+Quote Post

Martyr2

RE: Java / Logic Problem

1 Dec, 2008 - 03:56 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,246



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Another way to look at it to prove that Gloin is on the right track is that through formal logic simplification. Since you have proven that J is true that to be in the AND operation with R (a conjunction) R too must be true. Joined by AND you can apply the Simplification rule which states J is true R is True and because of that R being true dictates that H is then true in number 2. Since R is true equals H being true, the line in 2 then proves that M is true.

Another spin on things. smile.gif


User is offlineProfile CardPM
+Quote Post

bshak1

RE: Java / Logic Problem

1 Dec, 2008 - 04:01 PM
Post #5

New D.I.C Head
*

Joined: 18 Nov, 2008
Posts: 10



Thanked: 1 times
My Contributions
QUOTE(Martyr2 @ 1 Dec, 2008 - 03:56 PM) *

Another way to look at it to prove that Gloin is on the right track is that through formal logic simplification. Since you have proven that J is true that to be in the AND operation with R (a conjunction) R too must be true. Joined by AND you can apply the Simplification rule which states J is true R is True and because of that R being true dictates that H is then true in number 2. Since R is true equals H being true, the line in 2 then proves that M is true.

Another spin on things. smile.gif



That's very interesting, Martyr2 and Gloin. I'm still not sure if that works, but it is worth a shot.
User is offlineProfile CardPM
+Quote Post

KYA

RE: Java / Logic Problem

1 Dec, 2008 - 04:08 PM
Post #6

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 11,192



Thanked: 489 times
Dream Kudos: 2825
Expert In: C, C++, Java

My Contributions
Yes! I love discrete math!

Knights and Knaves am I right? smile.gif
User is offlineProfile CardPM
+Quote Post

Martyr2

RE: Java / Logic Problem

1 Dec, 2008 - 04:09 PM
Post #7

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,246



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Well think of it this way... they give you three statements. They make one of them easy to solve... in this case number 3. This leads to two conclusions, J is true, P is false. Since the other two statements don't use P, you have to assume that you must use J in statement 1 as your next logical step. J being in a conjunct with R is a statement that if J is true then R must be true as well since it is the only way that H can be true and therefore M being true.

Learning Center Smart Tour - Logic - Simplification Rule for conjuncts

That is what I am going by. There is no other way to prove that R is true because no other statements are used to relate to the result of R. So we have to go based strictly on its relationship to J in line 1 and because its relationship with AND.

These logic problems always chain like this. They give you a straight out statement that you must then branch out into the others. The only choice here is to move J up into statement 1 and get its relationship to R.

And yet another way is that if J is true so is R because of the AND Operator and that we apply Modus Ponens to the conjunction so that if it is true then H has to be true...But perhaps that is too far.

smile.gif

This post has been edited by Martyr2: 1 Dec, 2008 - 04:13 PM
User is offlineProfile CardPM
+Quote Post

KYA

RE: Java / Logic Problem

1 Dec, 2008 - 04:15 PM
Post #8

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 11,192



Thanked: 489 times
Dream Kudos: 2825
Expert In: C, C++, Java

My Contributions
I like this problem, it doesn't branch out like other ones can do, the logic is essentially a one way tunnel underground to the answer.
User is offlineProfile CardPM
+Quote Post

bshak1

RE: Java / Logic Problem

1 Dec, 2008 - 04:32 PM
Post #9

New D.I.C Head
*

Joined: 18 Nov, 2008
Posts: 10



Thanked: 1 times
My Contributions
@Martyr2

Thanks a lot! I think this will work.

@KYA
What are you talking about (Knights and Knaves)?
User is offlineProfile CardPM
+Quote Post

KYA

RE: Java / Logic Problem

1 Dec, 2008 - 04:51 PM
Post #10

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 11,192



Thanked: 489 times
Dream Kudos: 2825
Expert In: C, C++, Java

My Contributions
Knights and Knaves
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:53AM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month