Predicate logic to prove equality of two formulas

In summary, the conversation discusses writing a program to prove the equivalence of a given mathematical formula and a student's answer. Possible approaches include using context-free grammars, simplification procedures, and transformation algorithms. Maxima is also suggested as a potential tool for this task.
  • #1
budihart
1
0
Hi All,

I'm trying to write a program that will prove that a certain mathematical formula that is entered by a student is the same as the goal formula that I want.

For example, if the goal formula is: 2 * X + Y

then any of this student's answer can be considered correct:
-> X + X + Y
-> X - 5 + X + Y + 5
-> X/Y * Y + Y + X
-> Y + X * 2
and so on.

I have a thought that I can solve this problem by converting this mathematical formula to a predicate logic. But I still cannot figure out, how can I actually do it.

Any help is really appreciated.

Many thanks
 
Physics news on Phys.org
  • #2
budihart said:
Hi All,

I'm trying to write a program that will prove that a certain mathematical formula that is entered by a student is the same as the goal formula that I want.

For example, if the goal formula is: 2 * X + Y

then any of this student's answer can be considered correct:
-> X + X + Y
-> X - 5 + X + Y + 5
-> X/Y * Y + Y + X
-> Y + X * 2
and so on.

I have a thought that I can solve this problem by converting this mathematical formula to a predicate logic. But I still cannot figure out, how can I actually do it.

Any help is really appreciated.

Many thanks

Hey budihart and welcome to the forums.

The best way I recommend to doing this systematically is to user context-free grammars for representing these kinds of things.

What you do in order to show equivalence is to have procedures that simplify expressions as well as allow isomorphisms or 'equivalent transformations' between representations.

The simplification function part of your system will do things like implement all the algebraic functionality like expanding everything out into its full expanded parts while getting rid of redundancies (example X + X = 2X not X + X). You can do this with fairly simple algorithms for the algebra, and you can use a recursive procedure to collect common terms together.

The transformation part of the algorithm allows you to do more advanced things like recognize things that are equivalent but algebraicly hard or impossible to show. Something like say e^x and its taylor series expansion (1 + x + x^2/2 + ...) is one way, but you can make this as complex as you want by allowing integral and derivative expansions and all kinds of series expansions.

I know you probably won't do the second part, but if you want to extend it and make it powerful with a simple design, this is what I would recommend.

The language itself would best be represented with a binary tree. Each node would have some kind of operator and the tree itself would expand both left and right down to the leaves where each node has the information for that particular thing. It could be a number, a variable of different types, a linguistic expression, an integral or other evaluation, a series expansion, and so on.

If you use C++, you can create a class system that allows you to extend the node types and deal with specialized simplification and transformation.

The binary tree example is a good way to design for example, simple calculator programs that take expressions (including with parentheses) and expand them out to give a final answer.

If you need more clarification don't hesitate to ask.
 
  • #3
budihart said:
Hi All,

I'm trying to write a program that will prove that a certain mathematical formula that is entered by a student is the same as the goal formula that I want.

For example, if the goal formula is: 2 * X + Y

then any of this student's answer can be considered correct:
-> X + X + Y
-> X - 5 + X + Y + 5
-> X/Y * Y + Y + X
-> Y + X * 2
and so on.

I have a thought that I can solve this problem by converting this mathematical formula to a predicate logic. But I still cannot figure out, how can I actually do it.

Any help is really appreciated.

Many thanks

Hi budihart,

Adding to chiro's answer, you can write your program in just a few lines of code using Maxima as the core engine.

Now, if you are actually interested in how to do that yourself chiro has already given you a few hints; In CS this kind of analysis is called parsing. If you want to learn more about the theory behind parsing you can download a free book about parsing techniques from this site http://dickgrune.com/Books/PTAPG_1st_Edition/

Also, since Maxima is a FOSS project you can hack their code in whatever way you want and see how their parsers work too.

So Good Luck!

Edit: Maybe this question should be moved to the Computing & Technology forum, people checking that forum might have something else to say.
 
Last edited:

1. What is predicate logic?

Predicate logic is a type of mathematical logic that deals with the relationships between objects using predicates, which are statements or properties that can be either true or false. It is used to formalize arguments and reasoning in fields such as mathematics, computer science, and philosophy.

2. How is predicate logic used to prove equality of two formulas?

Predicate logic is used to prove equality of two formulas by breaking them down into their constituent parts, such as predicates and variables, and then showing that they are logically equivalent. This is done by using axioms, inference rules, and other logical tools to manipulate the formulas until they are shown to be the same.

3. What are some common axioms used in predicate logic?

Some common axioms used in predicate logic include the law of identity, which states that anything is equal to itself, and the law of substitution, which allows for the replacement of equal terms within a formula. These axioms, along with others, form the basis for proving equality of two formulas.

4. Can predicate logic be used to prove equality of formulas in any branch of science?

Yes, predicate logic can be used to prove equality of formulas in any branch of science that relies on logical reasoning. This includes mathematics, computer science, physics, and many others. As long as the formulas can be broken down into their logical components, predicate logic can be used to prove their equality.

5. Are there any limitations to using predicate logic to prove equality of two formulas?

There are some limitations to using predicate logic to prove equality of two formulas. For example, some formulas may be too complex to be easily broken down into their logical components, making it difficult to apply axioms and inference rules. In addition, predicate logic relies on the assumptions of soundness and completeness, which may not always hold in every situation.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
21
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
40
Views
6K
Back
Top