nick8325 / jukebox

A theorem prover
BSD 3-Clause "New" or "Revised" License
13 stars 0 forks source link

Deep copy of Formulas. #5

Open jparsert opened 6 years ago

jparsert commented 6 years ago

Essentially what the title says. I have the problem that the following returns a list with two indentical elements:

foo (Or [l, r]) = Or [foo r, foo l] foo (Not f) = Not (foo f)
.....

bar (And [l, r]) = And [foo r, foo l] bar (Not f) = Not (foo f)
....

combine fm = [fm, foo fm, bar fm]

I suspect that is because I am working "manipulating" the same ast. So I am wondering how/if I can deep copy fm, or if there is a more elegant way of going about this. In this case I want a list with 3 elements where the first one is the original formula, the second one is one where binary disjunctions are swapped and the third one where binary conj. are swapped.