Translating Natural Language to First-Order Logic for Logical Fallacy Detection
72 comments
·March 4, 2025zozbot234
tgv
I've worked on classical NLP models for quite some time, and this indeed looks way too simple to be of any practical use. If you mention Montague, I'm going to refer you to "Pedro owns a donkey," the poster kid sentence for Discourse Representation Theory. That's 1980s work, and for simple sentences it's already complicated beyond what the OP article suggests, and fails on anything remotely complex. I think it goes 2nd order the moment a complement is introduced (I think that ...).
And even if you can translate a sentence into a predicate, you haven't begun understanding what lies behind all those predicates. E.g., "Zelensky is ready to work under Trump's 'strong leadership' after 'regrettable' showdown." What good does it do to have that in FOP?
[1] https://plato.stanford.edu/archIves/sum2011/entries/discours...
WaxProlix
Even beyond that you have a ton of pragmatics post-grice to deal with. Computing implicatures is complex and requires a lot of knowledge about context etc. The truth value of a statement and the 'truth value' of a speech act are pretty different things - not sure it's really feasible to convert between them.
zozbot234
It looks like classic models of NLP semantics mostly punt on the "logical" point of view precisely due to these difficulties, and focus mostly on the more surface level problem of describing how each word of the source text correlates with a deeper description of the "meaning" of the text as a whole. So it is simply assumed that the meaning of the text as a whole must be derived compositionally from the meaning of each part (usually described by a somewhat ad-hoc "frame" structure), but exactly what that entails in a "logical" sense is left unspecified. UMR (Universal Meaning Representations) seems to be a typical example of such a system https://github.com/umr4nlp/umr-guidelines/blob/master/guidel... The expected use case seems to be something like building a common intermediate language for an automated translation system; individual meaning elements can then be "mapped" in a useful way, even across different languages, but there's not much interest apparently in "inferring" further knowledge from what one already has, or even on verifying that any given inference is valid (as proposed by OP).
a-dub
would be interesting if they had adversarial/null llms attempting the noisy nlp reductions as well. then one could make arguments about the sturdiness of the noisy bit.
lapcat
See also for example V.H. Dudman on the interpretation of "If" sentences: https://www.scribd.com/document/478756656/Dudman-1984-Condit...
cs702
It could be useful for domains in which all or at least many problems are solvable (i.e., they can be stated and satisfied) with first-order logic.
It could also be useful as a lower-level component of general-purpose systems that internally rely on chains of thought computed by sub-component LLMs.
ColinWright
It was Gottfried Leibniz who envisaged the end of philosophic disputes, replacing argument with calculation.
"if controversies were to arise, there would be no more need of disputation between two philosophers than between two calculators. For it would suffice for them to take their pencils in their hands and to sit down at the abacus, and say to each other (and if they so wish also to a friend called to help): Let us calculate."
franktankbank
Although, demanding even a shred of self-consistency goes a long way in short circuiting bad argumentation.
dmos62
I have a pet theory that most inefficiency is about self-consistency (or lack thereof), whether that's in human-human or human-machine communications (e.g. program code).
dmos62
I wonder if anyone else thought that that's how most of the world worked when they were a kid. I thought that most people would reason through everything, and if they couldn't, they would take it home as sort of homework and finish it there.
bloomingkales
Well, we can have AI do what we do but it will never be tied to an emotion. You can feel a lot just adding 2+2 (maybe someone held a gun to your head once). What does philosophy say about philosophy without emotion? What use is it to us without our human context?
soulofmischief
If only. Ethics are reached via consensus. Two calculators can indeed produce different results if the axioms supporting them differ.
And good luck calculating some of these axioms, such as "Why is it my duty not to kill someone?" You could argue, "Well in the end, a society enabling such behavior at scale would be no society at all," to which one might reply, "I have no interest in letting others do as I do.", and you can't calculate away violent sociopaths. The rest of us derive our principles from functioning mammalian emotional circuits, but at some level we rest our case on subjective axioms.
kennysoona
Those axioms can still be evaluated, quantified and compared, and eventually calculated.
yifanl
Based on what criteria? A set of meta-axioms?
glenstein
>Ethics are reached via consensus
This is probably too big a topic for a whole side-branch on this, but modern meta-ethics teaches a range of possible approaches. Some notions of ethics are relativist, and are about the fact that moral norms are produced by some given society. But under some constructions that's just a procedural truism rather than a position on the content or the nature of morality itself.
Then you have moral realism, a perfectly respected position, which can encompass things like utilitariansim and other ism's. And this might seem silly derail, and I'm trying not to, but this is important at the end of the day, because "ethics is reached via consensus" can mean a lot of things that cash out with completely different practical implications. It's the difference between, for instance, deciding we need to be consensus oriented and vote, or be research oriented and concerned with deepening our scientific understanding of things like insect consciousness and whether the physical effects of sleep deprivation fall under the traditional definition of torture.
>And good luck calculating some of these axioms
Not wrong, they can easily get computationally intractable. So I think one has to account to some degree for uncertainty. Here again, I worry that the intended upshot is supposed to be that we simply give up or treat the project of moral understanding like a cosmically impossible non-starter. I like to think there's a middle ground between where we presently stand and the hypothetical future where we've got perfect knowledge.
lo_zamoyski
> Ethics are reached via consensus.
Absolutely not! This is cultural relativism, and frankly, it would be circular: how exactly are we converging on a consensus if not from some preexisting sense of the good?
The only defensible objective basis for the good is the nature of a thing and what actualizes the potentials determined by that nature, thus actualizing the thing as the kind of thing it is. Morality, only possible for things that have the capacity to comprehend their options for action (intellect) and choose freely among them (will) on the basis of that understanding, therefore concerns the question of whether an act performed by a thing furthers or frustrates the actualization of that thing.
By cutting off my arm for no proportionate reason, I do an immoral thing, because it is my nature to have that arm, but if I have gangrene in that arm that threatens my life, then removing the gangrene with the undesirable side effect of losing an arm is morally justifiable, even if the loss of the arm is not good per se.
Murdering a human being is gravely immoral, because it directly contradicts my nature as a social human being in a very profound and profoundly self-destructive way. However, killing a would-be murderer in defense of my life or that of another is a morally very good deed; it is in accord with my social nature, and indeed can be said to actualize it more fully in some respect.
> The rest of us derive our principles from functioning mammalian emotional circuits
Please refrain from making such silly pseudoscientific and pseudophilosophical statements.
That being said, calculation is insufficient, because such calculation is formal: it explicitly excludes the conceptual content of propositions. But concepts are the material "carriers" of comprehension of what things are. We can also analyze concepts. Now, we can say that we can calculate a formal deduction according to formal rules, but we cannot calculate a concept or its analytical products. This is the produce of abstraction from concreta. Formal systems abstract from these. They are blind to conceptual content, on purpose. And having used a formalism to derive a conclusion, we must interpret the result, that is, we must reassign concepts to symbols that stand in for them. So formal systems are useful tools, but they are tools.
kazinator
"reached via" is not the same thing as "derived from".
giardini
Prolog has always had DCGs (Definite Clause Grammars) that allow you to write rules that resemble natural language grammar structures to parse and generate English sentences:
tiberius_p
First order logic can only detect formal logic fallacies. Informal logic fallacies like ad hominem, strawman, red herring, etc. are cast in language. They can't me defined and resolved mathematically. The model should be fine tuned with examples of these informal fallacies and counter-arguments to them. Even so it won't be able to detect them in all cases, but it will at least have some knowledge about them and how to reply to them. This knowledge could be further be refined with in context learning and other prompt engineering strategies.
jfengel
I would expect a true logical fallacy detector to take any natural text and spit out "unsupported assumption, unsupported assumption" over and over and over.
languagehacker
It sounds like the data set they use is designed to teach what logical fallacies are, which makes sense that it would do fine with it. I doubt this would do well against real-world language with things like structural ambiguity, anaphoric resolution, and dubious intent.
FloorEgg
Not familiar with FOL as a formalism, and would love to see this in action. I feel like it's a big part of the solution to propaganda.
The other part seems to be values obfuscation, and I wonder if this would help with that too.
If Joe says that nails are bad, it can mean very different things if Joe builds houses for a living and prefers screws, or if Joe is anti development and thinks everyone should live in mud huts.
Propaganda will often cast a whole narrative that can be logically consistent, but entirely misrepresents a person or people's values (their motivations and the patterns that explain their actions), and there will be logical fallacies at the boundaries of the narrative.
We need systems that can detect logical fallacies, as well as value system inconsistencies.
jfengel
You know First Order Logic. It's just ordinary logic; it's the default thing people think of when they say "logic".
But it's also not very useful for human reasoning. It's good for math and logic puzzles and bad at anything else. It's bad at time, at belief, at negation. None of those things act like you expect them to.
andrewdb
A prompt that I like to use for this:
---
Intake the following block of text and then formulate it as a steelmanned deductive argument. Use the format of premises and conclusion. After the argument, list possible fallacies in the argument. DO NOT fact check - simply analyze the logic. do not search.
After the fallacies list, show the following:
1. Evaluate Argument Strength: Assess the strength of each premise and the overall argument.
2. Provide Counterarguments: Suggest possible counterarguments to the premises and conclusion.
3. Highlight Assumptions: Identify any underlying assumptions that need examination.
4. Suggest Improvements: Recommend ways to strengthen the argument's logical structure.
5. Test with Scenarios: Apply the argument to various scenarios to see how it holds up.
6. Analyze Relevance: Check the relevance and connection between each premise and the conclusion.
Format the argument in the following manner:
Premise N: Premise N Text
ETC
Conclusion:
Conclusion text
[The block of text to evaluate]
FloorEgg
Nice prompt, I've been doing something similar but not this robust. I'll give this a spin.
Thanks again!
janalsncm
Maybe. One problem we have now is that fact checking is a lot more expensive than bullshitting. If we had a program that could bring things closer to parity it would be nice.
But also, a lot of propaganda isn’t false per se but simply blown out of proportion, or underproportioned in cases of inconvenient truths. The truth is a distribution of events, and editors continuously choose how to skew that distribution.
(One of my very interesting possessions is an old Chinese state-owned newspaper. As far as I could tell, their main tool wasn’t lying, but simply omission.)
For example, if you wanted to push a narrative that e.g. pit bulls are the most dangerous problem in America, you would just post a nonstop stream of pit bull attack videos. It taps into cognitive biases people have which aren’t propositional logic statements.
More broadly, the world is stochastic, at least in the way we experience it. So our brains have to make sense of that, which is an opportunity for narratives to creep in.
mirekrusin
You can require that factual statements require source reference.
Statement that "pit bulls are the most dangerous problem in America" requires source data (ie. cause of death or serious injuries in 2024 in USA).
Publications can be signed by authorities (ie. university or government body).
IMHO sooner or later we will (have to) end up with system like that.
Every information will be signed and level of trust will be automatically established based on your preference who you trust.
FloorEgg
So maybe the solution is to have these FOL capabilities close to the user and far from the information source.
FOL values analysis of information streams, that manifest as user interface for configuring the algorithms that decide what information is surfaced to you in media.
This is why I said this sort of thing might be part of a solution. The whole solution would involve other significant parts.
drdeca
You mention the world being (at least subjectively) stochastic. This brings to mind the idea that a model of probability rather than just logic, might be more beneficial?
The example you gave of focusing excessively on some topic in order to make it seem like a bigger deal…
hm, is there a way we could formalize such things in a way like how formal fallacies are formalized?
It seems more difficult than classifying common formal fallacies.
But, might it be possible?
janalsncm
The problem is that “news” is not a random sampling of all events. It is biased by the very fact that someone has to decide the event is notable.
And even if you were to witness a random sampling of all events via some kind of clockwork orange mechanism, your brain has saliency biases as well.
You might find the wiki page on cognitive bias interesting https://en.m.wikipedia.org/wiki/Cognitive_bias
naasking
This won't "solve" propaganda or misinfo IMO. Checking logical consistency and eliminating fallacies still wouldn't address the selective presentation or omission of facts, for instance, and the notion that it could avoid misrepresenting a person or their values assumes that someone has already accurately and fully captured a detailed description of a person's values. But that's the whole problem!
This is just the formal specification problem all over again. Verifying software against a spec is good and useful, but verification doesn't tell you whether the spec itself correctly captured the desired objective, it can only tell you whether the spec is logically consistent and that you implemented it faithfully.
drdeca
I don’t think it would take you long to learn FOL, and I think it is a good formalism to have some familiarity with.
It’s pretty much the default modern formulation of general-purpose formal logic.
RGamma
It would work as well the internet bringing us more enlightenment. Besides, points of contention tend to form around ethics, whose axioms are unprovable if non-cognitivism is true (and we have no reason to believe it isn't).
heyitsguay
Humans aren't rational actors who get tricked into embracing propaganda by subtle logical fallacies. This will be of no more help than fact checking.
It's a neat project on its own, tbc, I just have very low expectations of broader impact.
FloorEgg
I disagree with your first point. People are far more rational than you are making them out to be, it's just that they are rational within their own value system, not yours.
Also today's propaganda is capable of adapting itself to each audience member's value system to make it more palatable, and then gradually nudge the audience towards the desired narrative/beliefs/values. The systems that distribute the propaganda are already analyzing people's values and using that information to manipulate people. I think that information asymmetry is part of the problem. I could be wrong, but I think flipping that dynamic around so the public can see the true values of the subjects of propaganda may help neutralize a lot of propaganda.
As far as what impact this specific project will have, I have no idea. You may be right. I'm curious about its limitations and how it can be applied.
kubb
I thought so too, but recently so many people dropped or adapted their core beliefs to be able to support and defend people in power that they really love that it made me change my mind. Now I think that value systems are malleable and are formed by whatever makes us feel good. And the logical consistency on top is very optional.
naasking
Humans are not fully rational, but they're more rational than many assume. For instance, many thought the illusory truth effect showed that people are biased towards believing things they hear many times over, which is great for propagandists, but it turns out this is only true when they are in a "high quality information" environment. This is quite rational! They should update towards believing repeated statements when the environment they're in has shown itself to be reliable. When the environment they're in has shown itself to be unreliable, the illusory truth effect basically disappears.
kennysoona
How does that explain conservatives doubling down on whatever they hear even if it's obviously false? I guess because they wrongly consider some "low quality information" environments "high quality information" environments?
aeturnum
I think you're envisioning this in a pessimistic way.
I totally agree that the end conclusion "this statement is fallacious" is pretty useless. But I assume that a working process would also yield the chain of judgements (A is right, B is right, C is wrong, etc). I think that would be VERY useful.
People who become captured by propaganda and lies generally are not sold on 100% of the propaganda. There are certain elements they care more about and others they can ignore. A way to deprogram people through conversation is to just ask them to explain things about their views and ask them to reconcile them with reality. The reconciliation is painful for them and that pain keeps people "in" irrational beliefs - but it's also how people find their way out. Once they no longer associate themselves with the conspiracy, they can discard beliefs associated with it...provided they can think through them.
I think being able to automatically decompose a fact check into the elements of what "is true" and "is false" in a statement would be HUGE. An essential tool in helping people escape from information swamps.
rahimnathwani
The paper links the code repo: https://github.com/lovishchopra/NL2FOL
But I don't see a pretrained model in there, so I'm not sure what to pass as `your_nli_model_name`:
python3 src/nl_to_fol.py --model_name <your_model_name> --nli_model_name <your_nli_model_name> --run_name <run_name> --dataset --length
janalsncm
If we check the script, it seems to support open ai models and llama https://github.com/lovishchopra/NL2FOL/blob/main/src/nl_to_f...
It would have been a lot cooler if this was set up as a pretrained model using RL to translate.
rahimnathwani
That's for --model_name, not --nli_model_name:
https://github.com/lovishchopra/NL2FOL/blob/4635a81f216da2ad...
nli_tokenizer = AutoTokenizer.from_pretrained(args.nli_model_name)
nli_model = AutoModelForSequenceClassification.from_pretrained(args.nli_model_name)
EigenLord
This is very cool and definitely a step in the right direction, however, the question remains where exactly this formalizing module should be placed in the stack. As an external api, it's clear that the model is not "thinking" in these logical terms, it just provides a translation step. I'd argue it would be better placed during inference test-time compute (as seen in these so-called reasoning models). Better yet, this formalizing step would happen at a lower level entirely, internal to the model, but that would probably require totally new architectures.
qgin
I don't know how much potential this has to solve propaganda / bad faith arguments because you can just say "that logic program is biased" and handwave the entire thing away.
But you could imagine a role for this in arbitration or legal settings.
biggoodwolf
0 in all three cases
analog31
Doesn't Goedel's Theorem forbid building a logic checker?
drdeca
No.
Gödel’s theorem forbids something that in general tells you whether a statement is true or not. (As in, a method which would work for every possible statement within a system.) It certainly doesn’t preclude something that checks if a proof is correct, any more than it precludes checking whether some calculation is done correctly (I.e. it doesn’t preclude it at all) .
It says that there are statements which the proof system doesn’t have a proof of the statement being true nor of it being false. It doesn’t mean you can’t have a proof system.
bubblyworld
Not Gödel's theorem, but inference for first-order logic is undecidable in general for other reasons. You can still get pretty far with heuristics though. Don't let perfect be the enemy of good =P
I'm pretty sure that the semantics of natural language are a lot more complex than can be accounted for by these seemingly very ad-hoc translations into comparatively straightforward FOL formulas, as are given in this paper. A common approach for the understanding of NL semantics from a strictly formal POV is Montague semantics https://en.wikipedia.org/wiki/Montague_grammar https://plato.stanford.edu/entries/montague-semantics/ - even a cursory look at these references is enough to clarify the level of complexity that's involved. Very loosely speaking one generally has to work with multiple "modalities" at the same time each of which, when understood from the POV of ordinary FOL, introduces its own separate notion of abstract "possible worlds" (representing, e.g. an agent's set of beliefs) and ways in which these "worlds" can relate to one another. More complex cases will usually degenerate in some sort of very generic "game semantics" https://en.wikipedia.org/wiki/Game_semantics https://plato.stanford.edu/entries/logic-games/ where any given use of natural language is merely seen as a "game" (in the abstract strategic, game-theoretical sense) with its own set of possibly very ad-hoc 'rules'. The philosopher Ludwig Wittgenstein https://en.wikipedia.org/wiki/Ludwig_Wittgenstein https://plato.stanford.edu/entries/wittgenstein/ gave quite a good description of both of these approaches (from a very naïve approach based on a supposedly straightforward translation to some kind of abstract logic, to a far richer one based on notions of strategies and games) to a "formal" understanding of natural language, throughout his extensive philosophical inquiry.
Which is to say, I'm not sure how this paper's results are generally expected to be all that useful in practice.