Applying Answer Set Programming with Fuzzy Membership Functions: a Case Study
Summary
This paper presents a novel fuzzy-logic-based extension of Answer Set Programming (ASP) that integrates numerical information with qualitative reasoning using membership functions, demonstrated through a travel recommendation case study.
View Cached Full Text
Cached at: 07/07/26, 04:35 AM
# Applying Answer Set Programming with Fuzzy Membership Functions: a Case Study
Source: [https://arxiv.org/html/2607.03550](https://arxiv.org/html/2607.03550)
11institutetext:DIMES Dept\., University of Calabria, 87036 Rende \(CS\), Italy\.
11email:\{luca\.ferragina,ilenia\.galati,lorena\.gullone,francesco\.scarcello\}@unical\.it###### Abstract
Human reasoning often operates through qualitative concepts expressed by linguistic labels such ashigh,low,expensive, orcheap, whose interpretation depends on context and is usually vague, despite being rooted in numerical data\. This paper explores a novel fuzzy\-logic\-based qualitative extension of Answer Set Programming \(ASP\) to bridge numerical information and qualitative reasoning\. The underlying language, formally introduced in a separate work, provides a principled framework that avoids rigid thresholds and supports robust reasoning under vagueness\.
Focusing on a representative use case, we illustrate how the framework integrates numerically grounded inputs \(such as outputs of machine learning models\) with symbolic reasoning over qualitative labels\. Key features, including learning\-based membership functions and semantically enriched predicates, enable the combination of expert knowledge, contextual factors, and subjective interpretations within a unified declarative setting\.
## 1Introduction
Recent advances in machine learning have significantly enhanced the ability to extract patterns from unstructured data\. However, despite their predictive accuracy, such systems often remain difficult to interpret and audit, particularly in applications where decisions must be traceable and grounded in explicit assumptions\. In contrast, symbolic reasoning frameworks offer transparency and formal rigor, but they typically struggle to capture the continuous, noisy, and context\-dependent nature of real\-world information\. This gap becomes especially evident when expert knowledge is expressed through qualitative notions \(e\.g\.,*high*,*low*,*severe*,*acceptable*\) that are inherently vague, even when derived from numerical measurements\. Traditional approaches often rely on rigid thresholds to map numerical values to qualitative categories, leading to brittle behavior in which small variations in input may cause abrupt and unintuitive changes in outcomes\.
Fuzzy logic offers a natural foundation to address this issue by enabling reasoning with graded truth values\. In this work, we build on a novel qualitative, label\-based fuzzy extension of Answer Set Programming \(ASP\), introduced in a companion paper, which explicitly couples linguistic labels with numerically grounded information through membership functions\. In this framework, predicates are enriched with sets of qualitative labels, and their truth degrees are constrained both by data\-driven membership functions \(for input predicates\) and by semantic compatibility conditions \(for derived predicates\), expressed through admissible truth profiles\. Let us illustrate this point through a rule extracted from a program in a travel recommendation scenario:
๐๐๐๐๐๐๐๐๐โ\(X,C;affordable\)โ๐๐๐๐๐๐\(C\)โ๐๐๐๐๐\(F,C;cheap\)โ๐๐๐๐๐๐\(X,F\)โ๐๐๐๐๐\(X,H\)โ๐๐๐๐๐โ\(H,C;cโhโeโaโp\)\\begin\{split\}\\mathtt\{recommend\}\(X,C;\\textit\{affordable\}\)\\leftarrow&\\mathtt\{client\}\(C\)\\ \\odot\\mathtt\{price\}\(F,C;cheap\)\\ \\odot\\\\ &\\mathtt\{flight\}\(X,F\)\\ \\odot\\mathtt\{hotel\}\(X,H\)\\odot\\\\ &\\mathtt\{price\}\(H,C;cheap\)\\end\{split\}
The predicaterecommendhas labelsinfeasibleandaffordable, whilepriceis described bycheap,medium, andexpensive\. The rule assigns toaffordablea degree bounded by the aggregation \(via a t\-normโ\\odot, e\.g\.,โmin\\odot\_\{\\min\}\) of the body, thus reflecting that affordability depends on both flight and hotel being sufficiently cheap\.
Note this notion is vague, and the mapping from actual money values to the degree ofcheapnessis provided by suitable membership functions associated with the predicateprice\. Such mapping can be determined by those studies that relate the actual perceived value of money for different individuals, typically depending on their annual income\. That is, the notion ofcheapis not universal, but depends on contextual and subjective factors:$โ200\\mathdollar 200is a medium price for a rich customer, but it is very expensive for a low\-income customer\. Thus, in this fuzzy program, economic status is treated not as a passive filter but as a semantic dimension that adapts the concept definition\. In particular, the same travel package can therefore receive different graded valuations ofaffordabilityfrom different users\.
This example reflects a general setting where numerical information \(often produced by statistical or learning methods\) is integrated into a logical framework, allowing experts to express rules naturally while retaining control over graded outcomes\.
It is worthwhile noting that our language is a direct extension of classical, two\-valued ASP, and it naturally permits the definition and manipulation of crisp predicates and rules\. Whenever there are only crisp predicates, all fuzzy operators collapse to their classical counterparts, namely conjunction, disjunction, and negation, and we recover precisely Answer Sets semantics\.
The focus of this paper is on illustrating the practical effectiveness of this approach in a concrete setting, namely damage detection in the production line of screws, arising from a collaboration with an industrial partner\. In such environments, automated visual inspection systems produce numerical features \(such as defect size, shape irregularity, or color intensity\) derived from image processing and machine learning components\. These features must then be interpreted in qualitative terms that align with domain expertise, such as assessing whether a defect is*small*,*moderate*, or*severe*, and whether a screw is*repairable*or should be*discarded*\.
Our framework enables this transition by associating each qualitative label with a membership function that maps numerical observations to degrees of membership, thus preserving the inherent vagueness of the domain\. On top of these input predicates, higher\-level concepts are defined through declarative rules, while admissible truth profiles ensure that the resulting qualitative assessments remain semantically coherent\. This allows the system to detect inconsistencies when conflicting evidence arises, and to propagate partial information across related qualitative dimensions\.
We illustrate how this approach supports a full reasoning pipeline for quality control: from low\-level perception, through qualitative abstraction, to decision\-making actions such as*discard*,*rework*, or*accept*\. The example highlights how numerically grounded data and symbolic rules can be seamlessly integrated, yielding outcomes that are both flexible and aligned with domain\-specific interpretations\. While the formal properties of the language are proved in the companion work, this paper emphasizes its role in enabling a robust and expressive modeling of real\-world decision processes in a concrete use\-case\.
The main contributions of this paper are: \(i\) the instantiation of the proposed qualitative fuzzy ASP framework in a realistic industrial damage\-detection scenario, and \(ii\) the design and prototyping of a complete reasoning pipeline integrating data\-driven membership functions with rule\-based qualitative inference\.
## 2Related Works
The integration of uncertainty in rule\-based reasoning has evolved from quantitative extensions of logic programming to neuro\-symbolic approaches\. Early worksvan Emden \([1986](https://arxiv.org/html/2607.03550#bib.bib16)\)introduced attenuation factors, while Fuzzy Logic Programming \(FLP\)Vojtรกs \([2001](https://arxiv.org/html/2607.03550#bib.bib7)\); Ebrahim \([2001](https://arxiv.org/html/2607.03550#bib.bib18)\); Medinaet al\.\([2001](https://arxiv.org/html/2607.03550#bib.bib20)\); Achs and Kiss \([1995](https://arxiv.org/html/2607.03550#bib.bib17)\)adopted a truth\-functional view\. These ideas were later extended to structured formalisms such as Description Logics and Answer Set Programming \(ASP\)\.
Handling uncertainty with non\-monotonic negation has been studied in generalized logic programs\. Parametric Deductive Databases were extended inLoyer and Straccia \([2003](https://arxiv.org/html/2607.03550#bib.bib33),[2009](https://arxiv.org/html/2607.03550#bib.bib34)\)with approximate well\-founded semantics and lattice\-based frameworks\. In parallel, multi\-adjoint logic programming was enriched with non\-monotonic reasoningCornejoet al\.\([2018](https://arxiv.org/html/2607.03550#bib.bib35),[2020](https://arxiv.org/html/2607.03550#bib.bib36)\), providing expressive semantics and translations to simpler fragments\.
In fuzzy Description LogicsStraccia \([2001](https://arxiv.org/html/2607.03550#bib.bib28)\); Bobillo and Straccia \([2008](https://arxiv.org/html/2607.03550#bib.bib29)\); Lukasiewicz and Straccia \([2008](https://arxiv.org/html/2607.03550#bib.bib27)\), vagueness is modeled via membership functions while preserving decidability\. In ASP, fuzzy extensionsAlviano and Peรฑaloza \([2013](https://arxiv.org/html/2607.03550#bib.bib25)\); Janssenet al\.\([2009](https://arxiv.org/html/2607.03550#bib.bib26)\)generalize stable models using\[0,1\]\[0,1\]truth degrees\. CFASPJanssenet al\.\([2012](https://arxiv.org/html/2607.03550#bib.bib37)\)showed that many constructs can be reduced to a core language\. Further studies addressed negation and inconsistencyBlondeelet al\.\([2013](https://arxiv.org/html/2607.03550#bib.bib8)\); Van Nieuwenborghet al\.\([2006](https://arxiv.org/html/2607.03550#bib.bib9)\), introducing notions such as unfounded\-freeness\. Fuzzy Linguistic Logic ProgrammingLeet al\.\([2009](https://arxiv.org/html/2607.03550#bib.bib10)\)instead performs reasoning directly over linguistic terms\. More recently, fuzzy Datalog with existential rulesLanzingeret al\.\([2024](https://arxiv.org/html/2607.03550#bib.bib11)\)achieved high expressivity while retaining tractable data complexity\. Neuro\-symbolic AI complements these developments by combining learning and reasoning\.DeepProbLogManhaeveet al\.\([2021](https://arxiv.org/html/2607.03550#bib.bib21)\)andNeurASPYanget al\.\([2020](https://arxiv.org/html/2607.03550#bib.bib23)\), along withSLASHSkryaginet al\.\([2022](https://arxiv.org/html/2607.03550#bib.bib22)\), integrate neural outputs into probabilistic or ASP\-based reasoning, while Logic Tensor NetworksBadreddineet al\.\([2022](https://arxiv.org/html/2607.03550#bib.bib24)\)embed logical constraints into differentiable frameworks\. Note that all these approaches clarify, from different perspectives, how nonโmonotonic reasoning, uncertainty management, and graded truth can coexist\. However, they do not consider membership functions and qualitative labels as main components of the semantics of programs, which includes dealing with the implicit constraints based on how membership functions of qualitative labels may coโvary\.
## 3Preliminaries
In this section, we introduce the core elements of our language, including its syntax, the fundamental components of its semantics, and the main algorithm underlying the inference process\.
### 3\.1Syntax ofFLASP
A programฮ \\PiinFLASPincludes a set๐\\mathcal\{C\}of constants, a set of๐ฑ\\mathcal\{V\}variables, and a set๐ซ\\mathcal\{P\}of predicate symbols\. Constants and variables play the same role as in standard logic programming\. Predicates, however, are enriched with additional structure to capture linguistic terms and fuzzy information\.
As usual in Datalog, we distinguish two classes of predicate symbols in๐ซ\\mathcal\{P\}:
- โข*Input*\(or*extensional*, EDB\) predicates, whose truth degrees are given as inputs to the program;
- โข*Derived*\(or*intensional*, IDB\) predicates, whose truth degrees are obtained by rule\-based inference within the program\.
We writepโ\(๐ฑ;โ\)p\(\\mathbf\{x\};\\ell\)for the atom obtained frompp, an argument tuple๐ฑ\\mathbf\{x\}, and a labelโโฮp\\ell\\in\\Lambda\_\{p\}, and we read its truth degree as the*degree of membership*of๐ฑ\\mathbf\{x\}in the fuzzy concept named byโ\\ell\. Each predicate symbolp\(k\)โ๐ซp^\{\(k\)\}\\in\\mathcal\{P\}of aritykkis associated with a tripleโจฮp,Mp,ฮฃpโฉ\\langle\\Lambda\_\{p\},\\mathrm\{M\}\_\{p\},\\Sigma\_\{p\}\\rangle, whereฮp\\Lambda\_\{p\}is a finite set of*linguistic labels*describing the linguistic domain ofpp,Mp\\mathrm\{M\}\_\{p\}is a family of*membership functions*, andฮฃp\\Sigma\_\{p\}is a collection of*S\-norms*\.
For each labelโโฮp\\ell\\in\\Lambda\_\{p\}, the setฮฃp\\Sigma\_\{p\}provides an associated S\-norm๐ฎโ:\[0,1\]ร\[0,1\]โ\[0,1\]\\mathcal\{S\}\_\{\\ell\}:\[0,1\]\\times\[0,1\]\\rightarrow\[0,1\], which satisfies commutativity, associativity, monotonicity, and the boundary condition๐ฎโโ\(x,0\)=x\\mathcal\{S\}\_\{\\ell\}\(x,0\)=x\. Typical examples include the Gรถdel S\-norm, defined as๐ฎmaxโ\(x,y\)=maxโก\(x,y\)\\mathcal\{S\}\_\{\\max\}\(x,y\)=\\max\(x,y\), and the probabilistic sum, defined as๐ฎprobโ\(x,y\)=x\+yโxโ
y\\mathcal\{S\}\_\{\\mathrm\{prob\}\}\(x,y\)=x\+y\-x\\cdot y\. The S\-norm๐ฎโ\\mathcal\{S\}\_\{\\ell\}aggregates the contributions to the truth/membership value for labelโ\\ellfrom the rules defining atoms over predicatepp, while membership functions are used to determine the degree to which a given value satisfies a linguistic label\.
#### Membership Functions\.
For an EDB predicatepp, the familyMp\\mathrm\{M\}\_\{p\}contains, for each labelโโฮp\\ell\\in\\Lambda\_\{p\}, a membership functionฮผโ:๐โ\[0,1\]\\mu\_\{\\ell\}:\\mathbf\{D\}\\rightarrow\[0,1\], where๐\\mathbf\{D\}denotes the cartesian product of the domains of the underlying variables\. Each functionฮผโ\\mu\_\{\\ell\}assigns to a tuple๐ฑโ๐\\mathbf\{x\}\\in\\mathbf\{D\}a degree of membership in the fuzzy set associated with the labelโ\\ell\. Membership functions are fixed*a priori*, for instance on the basis of domain expertise or by means of machine learning techniques applied to dataMedasaniet al\.\([1998](https://arxiv.org/html/2607.03550#bib.bib3)\)\. The resulting membership degreeฮผโโ\(๐ฑ\)\\mu\_\{\\ell\}\(\\mathbf\{x\}\)is interpreted in the standard fuzzy\-set\-theoretic sense:ฮผโโ\(๐ฑ\)=0\\mu\_\{\\ell\}\(\\mathbf\{x\}\)=0denotes non\-membership,ฮผโโ\(๐ฑ\)=1\\mu\_\{\\ell\}\(\\mathbf\{x\}\)=1denotes full membership, and intermediate values express partial membership \(see Figure[1](https://arxiv.org/html/2607.03550#S4.F1)\)\.
It is convenient to viewMp\\mathrm\{M\}\_\{p\}as a single functionMp:๐โ\[0,1\]ฮp\\mathrm\{M\}\_\{p\}:\\mathbf\{D\}\\to\[0,1\]^\{\\Lambda\_\{p\}\}, where each component supplies the result for one label\. The set of all compatible label\-vectors,
ฮณp:=Mpโ\(๐\)โ\[0,1\]ฮp,\\gamma\_\{p\}\\;:=\\;\\mathrm\{M\}\_\{p\}\(\\mathbf\{D\}\)\\;\\subseteq\\;\[0,1\]^\{\\Lambda\_\{p\}\},is precisely the image ofMp\\mathrm\{M\}\_\{p\}, and plays for EDB predicates the same role as the admissible truth profile defined below for IDB predicates: it records which combinations of label\-truth degrees can actually occur\.
For a derived predicate IDBpp, we would like to compute membership values by means of program rules, according to the intended semantics of the program\. However, not every combination of truth values for the labels are logically meaningful, thus for IDB predicates we are interested in the membership\-values compatibility setฮณp\\gamma\_\{p\}\. With this respect, it is convenient to represent it in a parametric way, with respect to a parametertt, so thatฮณp\\gamma\_\{p\}is a mapping
ฮณp:\[ap,bp\]โ\[0,1\]ฮp,ฮณpโ\(t\)=\(ฮณpโ\(t\)โ\)โโฮp,\\gamma\_\{p\}:\[a\_\{p\},b\_\{p\}\]\\to\[0,1\]^\{\\Lambda\_\{p\}\},\\qquad\\gamma\_\{p\}\(t\)=\\bigl\(\\gamma\_\{p\}\(t\)\_\{\\ell\}\\bigr\)\_\{\\ell\\in\\Lambda\_\{p\}\},where the*closed interval*\[ap,bp\]\[a\_\{p\},b\_\{p\}\]is the parametrization domain, andโtโ\[0,1\]\\forall t\\in\[0,1\],ฮณpโ\(t\)=\(ฮณpโ\(t\)โ\)โโฮp\\gamma\_\{p\}\(t\)=\(\\gamma\_\{p\}\(t\)\_\{\\ell\}\)\_\{\\ell\\in\\Lambda\_\{p\}\}represents a coherent assignment of truth degrees to all labels ofpp\. Intuitively,ฮณp\\gamma\_\{p\}describes the intended semantic structure of the predicatepp: each labelโโฮp\\ell\\in\\Lambda\_\{p\}corresponds to one dimension of the truth space, and the curveฮณp\\gamma\_\{p\}encodes how these labels may consistently co\-vary\.
#### Terms, literals, rules, programs\.
A*term*is either a constantcโ๐c\\in\\mathcal\{C\}or a variablexโ๐ฑx\\in\\mathcal\{V\}\. A*fuzzy literal*is an expression of the formpโ\(๐ฑ;โ\)p\(\\mathbf\{x\};\\ell\)orยฌ๐ฉpโ\(๐ฑ;โ\)\\neg\_\{\\scriptscriptstyle\\mathcal\{N\}\}p\(\\mathbf\{x\};\\ell\), wherepโ๐ซp\\in\\mathcal\{P\}is a predicate symbol of aritykk,๐ฑ=\(x1,โฆ,xk\)\\mathbf\{x\}=\(x\_\{1\},\\dots,x\_\{k\}\)is a tuple of terms, andโโฮp\\ell\\in\\Lambda\_\{p\}is a linguistic label associated withpp\.111In the examples, we omit the label if there is only one label and it is irrelevant, for instance for crisp EDB predicates\.The former is referred to as a \(positive or*directed*\) atom, while the latter as a*negated*atom\. Formally, a negated atom is denoted as๐ฉโ\(p\)\\mathcal\{N\}\(p\)where๐ฉ:\[0,1\]โ\[0,1\]\\mathcal\{N\}:\[0,1\]\\rightarrow\[0,1\]is a decreasing function that satisfies๐ฉโ\(0\)=1\\mathcal\{N\}\(0\)=1and๐ฉโ\(1\)=0\\mathcal\{N\}\(1\)=0\. Typical negator examples include theลukasiewicz Negator๐ฉLโ\(x\)=1โx\\mathcal\{N\}\_\{L\}\(x\)=1\-xand theGรถdel Negator๐ฉGโ\(x\)=1โifโx=0\\mathcal\{N\}\_\{G\}\(x\)=1\\text\{ if \}x=0or๐ฉGโ\(x\)=0\\mathcal\{N\}\_\{G\}\(x\)=0otherwise\.
A*fuzzy Datalog rule*is an expression of the form
hโb1โ๐ฏโฏโ๐ฏbm,h\\leftarrow b\_\{1\}\\odot\_\{\\mathcal\{T\}\}\\cdots\\odot\_\{\\mathcal\{T\}\}b\_\{m\},where the headhhis a \(positive\) fuzzy atom and the body consists of a \(possibly empty\) conjunction of fuzzy literalsb1,โฆ,bmb\_\{1\},\\dots,b\_\{m\}\. The operatorโ๐ฏ\\odot\_\{\\mathcal\{T\}\}denotes conjunction interpreted via some T\-norm๐ฏ\\mathcal\{T\}\. Intuitively, the body specifies a set of conditions whose satisfaction contributes to the truth value of the head\.
For a rulerr, denote byHโ\(r\)H\(r\)its head atom and byBโ\(r\)B\(r\)the set of literals in its body whereB\+โ\(r\)B^\{\+\}\(r\)andBโโ\(r\)B^\{\-\}\(r\)denote, respectively, the sets of positive and of negated atoms occurring in the body ofrr\. Then, consider a \(ground\) atomhh, and denote byRhR\_\{h\}the set of rules havinghhas their head\.
We assume the existence of a reserved predicate๐๐๐๐ ๐กโ\(x;โc\)\\mathit\{const\}\(x;\\ell\_\{c\}\), wherexxis some constant term\. It is used to encode constant truth values within rules and is equipped with the membership functionโcโ\(x\)=1\\ell\_\{c\}\(x\)=1, assigning truth value11to any given termxx\. We write๐๐๐๐ ๐กโ\(v;โc\)\\mathit\{const\}\(v;\\ell\_\{c\}\)to inject the numeric truth valuevv\.
The logical conjunctionandis modeled by a T\-norm๐ฏ:\[0,1\]ร\[0,1\]โ\[0,1\]\\mathcal\{T\}:\[0,1\]\\times\[0,1\]\\rightarrow\[0,1\], which satisfies commutativity, associativity, monotonicity, and the boundary condition๐ฏโ\(x,1\)=x\\mathcal\{T\}\(x,1\)=x\. Commonly used examples include the Gรถdel T\-norm๐ฏminโ\(x,y\)=minโก\(x,y\)\\mathcal\{T\}\_\{\\min\}\(x,y\)=\\min\(x,y\), the product T\-norm๐ฏprodโ\(x,y\)=xโ
y\\mathcal\{T\}\_\{\\mathrm\{prod\}\}\(x,y\)=x\\cdot y, and the ลukasiewicz T\-norm๐ฏLโ\(x,y\)=maxโก\(0,x\+yโ1\)\\mathcal\{T\}\_\{L\}\(x,y\)=\\max\(0,x\+y\-1\)\.
A*fuzzy \(Datalog\) program*ฮ \\Piis a finite set of rules\. A*fact*is a rule with empty body\. The*grounding*of a programฮ \\Piis obtained by replacing all variables occurring inฮ \\Piwith constants from the domain\. A program is said to be*ground*if it contains no variables\. The*Herbrand domain*HCH\_\{C\}of a programฮ \\Piis the set of all constants appearing inฮ \\Pi\. The*Herbrand base*โฌฮ \\mathcal\{B\}\_\{\\Pi\}is the set of all ground fuzzy atoms that can be constructed from the predicate symbols in๐ซ\\mathcal\{P\}and the constants inHCH\_\{C\}\.
### 3\.2Semantics
A*fuzzy interpretation*โ\\mathcal\{I\}is a functionโ:โฌฮ โ\[0,1\]\\mathcal\{I\}:\\mathcal\{B\}\_\{\\Pi\}\\rightarrow\[0,1\]that assigns a truth degree to each ground atompโ\(๐;โ\)p\(\\mathbf\{C\};\\ell\)in the Herbrand baseโฌฮ \\mathcal\{B\}\_\{\\Pi\}\. The valueโโ\(pโ\(๐;โ\)\)\\mathcal\{I\}\\bigl\(p\(\\mathbf\{C\};\\ell\)\\bigr\)is interpreted as a truth degree of the atom with respect to the labelโ\\ell, or as a degree of membership to the fuzzy setโ\\ell\. As we discuss below, classical \(crisp\) atoms can be modeled as atoms with a membership function having binary values only\.
Denote bypโ\(๐;โ
\)p\(\\mathbf\{C\};\\cdot\)the basic unlabeled version of any ground atom with over predicateppand with terms๐\\mathbf\{C\}\. By abusing notation, we simply refer to it as an atom\.
#### Membership functions\.
An interpretationโ\\mathcal\{I\}is said to be*consistent*if, for every atompโ\(๐;โ
\)p\(\\mathbf\{C\};\\cdot\), the truth values over its linguistic labels are compatible according toฮณ\\gamma, that is,
\(โโ\(pโ\(๐;โ\)\)\)โโฮpโฮณp\\left\(\\ \\mathcal\{I\}\\bigl\(p\(\\mathbf\{C\};\\ell\)\\bigr\)\\ \\right\)\_\{\\ell\\in\\Lambda\_\{p\}\}\\in\\gamma\_\{p\}\(1\)
Equation \([1](https://arxiv.org/html/2607.03550#S3.E1)\) therefore requires that truth degrees ofpโ\(๐,โ
\)p\(\\mathbf\{C\},\\cdot\)according toโ\\mathcal\{I\}belong to the admissible regionฮณp\\gamma\_\{p\}\(or they are all zeroโrecall that๐ฮpโฮณ\\mathbf\{0\}^\{\\Lambda\_\{p\}\}\\in\\gamma, if this atom is false at all\)\. Note that we do not allow arbitrary and independent truth values to individual labels, because membership functions carry out semantic information\. Typically, e\.g\., it is impossible that an atom corresponding to some physical measure has a high membership value for both the label โfastโ and the label โslowโ\.
In our language, however, the membership functions encoded inฮณ\\gammaplay a much more central role than mere consistency checking: they are directly involved in the inference process, since once a truth value for a predicateppis derived for a label, the profileฮณp\\gamma\_\{p\}can propagate consistent truth values to other labels \(line[1](https://arxiv.org/html/2607.03550#algorithm1)of Algorithm[1](https://arxiv.org/html/2607.03550#algorithm1)\)\. More precisely, ifโโ\(pโ\(๐;โ\)\)=v\\mathcal\{I\}\(p\(\\mathbf\{C\};\\ell\)\)=v, then the profileฮณp\\gamma\_\{p\}determines a set of admissible tuples in\[0,1\]ฮp\[0,1\]^\{\\Lambda\_\{p\}\}containingvvas the component forโ\\ell, and the inference step selects \(e\.g\., minimally\) a tuple๐ญโฮณp\\mathbf\{t\}\\in\\gamma\_\{p\}such that๐ญโ\(โ\)โฅv\\mathbf\{t\}\(\\ell\)\\geq v, assigningโโ\(pโ\(๐;โโฒ\)\)โฅ๐ญโ\(โโฒ\)\\mathcal\{I\}\(p\(\\mathbf\{C\};\\ell^\{\\prime\}\)\)\\geq\\mathbf\{t\}\(\\ell^\{\\prime\}\)for every other labelโโฒโฮp\\ell^\{\\prime\}\\in\\Lambda\_\{p\}\.
By this mechanism, partial evidence derived for a single label can be extended to a semantically coherent interpretation over all labels, preserving the intended qualitative relationships encoded inฮณp\\gamma\_\{p\}and avoiding arbitrary or inconsistent assignments\.
This feature can also be exploited to allow a single predicateppto exhibit both a fuzzy and a crisp behavior\. For instance,ppcan be equipped with two labels, e\.g\.,fuzzyandcrisp, each associated with a different membership function: a continuous increasing function \(e\.g\., linear or even the identity on\[0,1\]\[0,1\]\) forfuzzy, and a0\-11step function at a fixed cutoff value forcrisp\(see Figure[2](https://arxiv.org/html/2607.03550#S4.F2)\)\. In this setting, the labelfuzzyis used in the head of fuzzy rules to derive graded truth values, while theฮณ\\gamma\-propagation mechanism automatically induces a corresponding Boolean value forpโ\(โ
;crisp\)p\(\\cdot;\\textit\{crisp\}\), which will be either11if the threshold degree exceeds the given cutoff, or0otherwise\.
By construction, the labelcrispthus exhibits a crisp behavior, which can be seamlessly used in subsequent \(standard ASP\) rule layers requiring Boolean semantics\. This pattern is indeed exploited in the program of Figures[3](https://arxiv.org/html/2607.03550#S4.F3),[4](https://arxiv.org/html/2607.03550#S4.F4)and[5](https://arxiv.org/html/2607.03550#S4.F5), where predicates such asdiscard,discount, andrepairare first derived fuzzily and then used within a purely crisp decision component, by means of their crisp \(binary valued\) labels\.
#### Models and Answer Sets\.
For a rulerr,โโ\(Bโ\(r\)\)\\mathcal\{I\}\(B\(r\)\)is obtained by applying the T\-norm๐ฏr\\mathcal\{T\}\_\{r\}to the interpretationโโ\(bi\)\\mathcal\{I\}\(b\_\{i\}\)of all literalsbiโBโ\(r\)b\_\{i\}\\in B\(r\)\. Recall that๐ฏr\\mathcal\{T\}\_\{r\}is associative and commutative\. Then,โโ\(Rh\)\\mathcal\{I\}\(R\_\{h\}\)denotes the application of the co\-norm associated withhhto the interpretation of all body rules defininghh, that is,โ\(Rh\)=๐ฎh\{โ\(B\(r\)โฃrโRh\}\\mathcal\{I\}\(R\_\{h\}\)=\\mathcal\{S\}\_\{h\}\\\{\\ \\mathcal\{I\}\(B\(r\)\\mid r\\in R\_\{h\}\\ \\\}\.
A*model*of a fuzzy programฮ \\Piis a consistent interpretationโ\\mathcal\{I\}\(in the sense of Equation \([1](https://arxiv.org/html/2607.03550#S3.E1)\)\) such that all rules inฮ \\Piare satisfied\. That is, for each head atomhh, it holds that
โโ\(h\)โฅโโ\(Rh\)\\mathcal\{I\}\(h\)\\geq\\mathcal\{I\}\(R\_\{h\}\)\(2\)We writeโโงฮ \\mathcal\{I\}\\models\\Pito denote thatโ\\mathcal\{I\}is a model ofฮ \\Pi\.
###### Definition 1\(Minimal model\)
An interpretationโ\\mathcal\{I\}for a programฮ \\Piis said to be*minimal*w\.r\.t\. a given set of interpretationsWW, if there exists no other interpretationโโฒโW\\mathcal\{I\}^\{\\prime\}\\in W\(โโฒโ โ\\mathcal\{I\}^\{\\prime\}\\neq\\mathcal\{I\}\), such thatโโฒโ\(pยฏ\)โคโโ\(pยฏ\)\\mathcal\{I\}^\{\\prime\}\(\\bar\{p\}\)\\leq\\mathcal\{I\}\(\\bar\{p\}\), for every ground atompยฏ\\bar\{p\}\.
An interpretationโ\\mathcal\{I\}is called a minimal model ofฮ \\Pi, if it is minimal w\.r\.t\. to the set of all models ofฮ \\Pi\.
It is easy to see that a program may have many minimal models, even infinitely many, or no model at all\. However, we are interested in those models that are maximally supported by the program rules\.
###### Definition 2\(Tight Interpretations\)
Letโ\\mathcal\{I\}andโโฒ\\mathcal\{I^\{\\prime\}\}be interpretations of a fuzzy programฮ \\Pi\. We say thatโ\\mathcal\{I\}is*tight*w\.r\.t\.โโฒ\\mathcal\{I^\{\\prime\}\}if, for every \(unlabeled\) atompโ\(๐;โ
\)p\(\\mathbf\{C\};\\cdot\), there is a maximal set of critical labels, whose membership values are the lowest possible to satisfy their defining rules w\.r\.t\. the givenโโฒ\\mathcal\{I^\{\\prime\}\}\. That is, for every such a labelโโ\\ell^\{\*\}, saidpยฏ=pโ\(๐;โโ\)\\bar\{p\}=p\(\\mathbf\{C\};\\ell^\{\*\}\), we haveโโ\(pยฏ\)=โโฒโ\(Rpยฏ\)\\mathcal\{I\}\(\\bar\{p\}\)=\\mathcal\{I^\{\\prime\}\}\(R\_\{\\bar\{p\}\}\)\. Ifโ=โโฒ\\mathcal\{I\}=\\mathcal\{I^\{\\prime\}\}, we just say it is a tight interpretation\.
Tight minimal models contain no superfluous truth information: decreasing the truth \(membership\) value of a label necessarily destroys model\-hood \(either by violating consistency or by failing to satisfy some rule\)\. They are maximally informative solutions compatible with both the rules of the program and the semantic constraints imposed byฮณ\\gamma\. If a program has a unique tight minimal model, that model is called the*least model*of the program\.
Given an interpretationโ\\mathcal\{I\}of a fuzzy programฮ \\Pi, define the*reduct*ฮ โ\\Pi^\{\\mathcal\{I\}\}ofฮ \\Piwith respect toโ\\mathcal\{I\}as the set of rulesPโiโ=\{rโโฃrโฮ \}Pi^\{\\mathcal\{I\}\}=\\\{\\,r^\{\\mathcal\{I\}\}\\mid r\\in\\Pi\\,\\\}, where each rulerโr^\{\\mathcal\{I\}\}is obtained fromrrby replacing every negated body atomยฌ๐ฉb\\neg\_\{\\scriptscriptstyle\\mathcal\{N\}\}bwith a \(positive\) atomcโoโnโsโtโ\(๐ฉโ\(โโ\(b\)\);โc\)const\(\\mathcal\{N\}\(\\mathcal\{I\}\(b\)\);\\ell\_\{c\}\)\. That is, we assume the truth values of negative literals are correct\. By construction,ฮ โ\\Pi^\{\\mathcal\{I\}\}is a positive fuzzy program\.
###### Definition 3\(Fuzzy answer set\)
An interpretationโ\\mathcal\{I\}is an*answer set*ofฮ \\Piifโ\\mathcal\{I\}is a*tight minimal model*of the reductฮ โ\\Pi^\{\\mathcal\{I\}\}\.
Input:Positive
ฮณ\\gamma\-monotonic fuzzy program
Output:Least model
โณโ\\mathcal\{M\}^\{\*\}\(orNoModel\)
1
2Construct the Herbrand base
โฌฮ \\mathcal\{B\}\_\{\\Pi\};
3Initialize
โโโฅ\\mathcal\{I\}\\leftarrow\\bot;
4repeat
//Deterministic one\-step operatorT^\\widehat\{T\}
5foreach*grounded atompโ\(๐;โ
\)p\(\\mathbf\{C\};\\cdot\)*do
//rule\-induced lower bounds
6foreach*โโฮp\\ell\\in\\Lambda\_\{p\}*do
7
bโโโโ\(Rpโ\(๐;โ\)\)b\_\{\\ell\}\\leftarrow\\mathcal\{I\}\(R\_\{p\(\\mathbf\{C\};\\ell\)\}\);
//unique tight propagation viaฮณp\\gamma\_\{p\}
8
Aโ\{tโ\[ap,bp\]โฃฮณpโ\(t\)โโฅbโโโโโฮp\}A\\leftarrow\\\{\\,t\\in\[a\_\{p\},b\_\{p\}\]\\mid\\gamma\_\{p\}\(t\)\_\{\\ell\}\\geq b\_\{\\ell\}\\ \\forall\\ell\\in\\Lambda\_\{p\}\\,\\\};
9if*A=โ
A=\\emptyset*then
10return*NoModel*
11
ฮฑโminโกA\\alpha\\leftarrow\\min A;
12foreach*โโฮp\\ell\\in\\Lambda\_\{p\}*do
13
โโฒโ\(pโ\(๐;โ\)\)โฮณpโ\(ฮฑ\)โ\\mathcal\{I\}^\{\\prime\}\(p\(\\mathbf\{C\};\\ell\)\)\\leftarrow\\gamma\_\{p\}\(\\alpha\)\_\{\\ell\};
14
15
โโโโฒ\\mathcal\{I\}\\leftarrow\\mathcal\{I\}^\{\\prime\};
16until*โโฒ=โ\\mathcal\{I\}^\{\\prime\}=\\mathcal\{I\}*;
return*โณโโโ\\mathcal\{M\}^\{\*\}\\leftarrow\\mathcal\{I\};*
Algorithm 1Fixpoint iteration\.Letโ\\mathcal\{I\}be an interpretation for a programฮ \\Pi\. LetWโW\_\{\\mathcal\{I\}\}be the set of interpretationsโโฒ\\mathcal\{I\}^\{\\prime\}that satisfy all rules according toโ\\mathcal\{I\}, that is, for every atomhยฏ\\bar\{h\},โโฒโ\(hยฏ\)โฅโโ\(Rhยฏ\)\\mathcal\{I\}^\{\\prime\}\(\\bar\{h\}\)\\geq\\mathcal\{I\}\(R\_\{\\bar\{h\}\}\)\.
We define the*immediate consequence operator*as the mappingTฮ :\[0,1\]โฌฮ โ๐ซโ\(\[0,1\]โฌฮ \)T\_\{\\Pi\}:\[0,1\]^\{\\mathcal\{B\}\_\{\\Pi\}\}\\rightarrow\\mathcal\{P\}\\bigl\(\[0,1\]^\{\\mathcal\{B\}\_\{\\Pi\}\}\\bigr\)such thatTฮ โ\(โ\)T\_\{\\Pi\}\(\\mathcal\{I\}\)is the set of the tight interpretations inWโW\_\{\\mathcal\{I\}\}that are minimal w\.r\.t\.WโW\_\{\\mathcal\{I\}\}\. Moreover, for a set of interpretations๐\\mathcal\{\\mathbf\{I\}\}, defineTฮ โ\(๐\)=\{Tฮ โ\(I\)โฃโโโ\}T\_\{\\Pi\}\(\\mathcal\{\\mathbf\{I\}\}\)=\\\{T\_\{\\Pi\}\(I\)\\mid\\mathcal\{I\}\\in\\mathcal\{\\mathbf\{\\mathcal\{I\}\}\}\\\}\.
###### Definition 4\(ฮณ\\gamma\-monotonic programs\)
A programฮ \\Piis called*ฮณ\\gamma\-monotonic*if, for each rulerโฮ r\\in\\Pithe component functionฮณpโ\(t\)โ:\[ap,bp\]โ\[0,1\]\\gamma\_\{p\}\(t\)\_\{\\ell\}:\[a\_\{p\},b\_\{p\}\]\\to\[0,1\]relative to the predicateppand the linguistic labelโ\\ellthat appears inHโ\(r\)H\(r\)is continuous and \(strictly\) increasing on\[ap,bp\]\[a\_\{p\},b\_\{p\}\]\.
It can be shown that theฮณ\\gamma\-monotonicity property of a programฮ \\Piguarantees the existence of a least model, which can be computed via Algorithm[1](https://arxiv.org/html/2607.03550#algorithm1)\. In contrast, non\-monotonic membership profiles may induce nondeterministic behavior, giving rise to multiple tight minimal models\.
Furthermore, as observed in other fuzzy logic\-based frameworksJanssenet al\.\([2012](https://arxiv.org/html/2607.03550#bib.bib37)\)even in the monotonic setting, the inference procedure may fail to terminate in a finite number of steps, due to a lack of convergence to the least model\. In the framework considered in this paper, however, this is not an issue because we restrict ourselves to a fragment that guarantees polynomial time evaluation \(for programs with stratified negation\)\.
## 4Case Study: Industrial Quality Control
In this section, we present a programฮ cโoโnโtโrโoโl\\Pi\_\{control\}for a case study arising from a collaboration with an industrial partner, aimed at analyzing images acquired from a screws production line\. The goal is threefold: \(i\) to detect the presence of damages, \(ii\) to assess their severity, and \(iii\) to determine the appropriate action for defective items\. As a benchmark, we rely on the well\-known MVTec datasetBergmannet al\.\([2021](https://arxiv.org/html/2607.03550#bib.bib42)\), which contains images of objects categorized as normal or defective, with various types of damages\.
The implemented system can be conceptually divided into two layers: the first, sub\-symbolic, is based on machine learning algorithms that provide the values for the membership functions of the input \(EDB\) predicates of the symbolic layer\. The latter, based on fuzzy reasoning, logically combines this information through the programฮ cโoโnโtโrโoโl\\Pi\_\{control\}, shown in Figures[3](https://arxiv.org/html/2607.03550#S4.F3),[4](https://arxiv.org/html/2607.03550#S4.F4), and[5](https://arxiv.org/html/2607.03550#S4.F5)\. to obtain the desired results according to the \(vague\) indications of domain experts\.
Note thatฮ cโoโnโtโrโoโl\\Pi\_\{control\}has two modules: the first one, which defines the fuzzy predicates linked to the sub\-symbolic methods that process input images, identifies anomalous products and extracts relevant linguistic features describing the detected damages\. The second one consists of crisp rules that, based on the inferred qualitative descriptions, support decision\-making about the handling of defective items\. In fact, the proposed language allows us to seamlessly combine rules and predicates with fuzzy values with rules having crisp truth values, which behave exactly as in standard ASP programs\.
Each item is defined by a tuple\(X,I\)\(X,I\), where each instance ofXXis a unique identifier associated with an image tensorII\. The information is enriched by a neural\-generated anomaly heatmapHHlinked to the imageII\. The anomaly heatmapHHhighlights pixels corresponding to potential surface defects\. This is described by the two facts๐๐๐๐๐๐โ\(X,I\)\\mathtt\{object\}\(X,I\)and๐๐๐๐๐๐๐ขโ\(I,H\)\\mathtt\{anomaly\}\(I,H\)\. Note that these facts are encoded by crisp predicates, indeed we omit linguistic labels in these predicates \(formally, we should use a dummy label, saytrue, with a binary membership function\)\.
The sub\-symbolic layer combines: \(i\) AE\-XADAngiulliet al\.\([2025](https://arxiv.org/html/2607.03550#bib.bib40)\), a recent explainable anomaly detection method based on autoencoders, and \(ii\) three instances of fuzzykk\-means clusteringNascimentoet al\.\([2000](https://arxiv.org/html/2607.03550#bib.bib41)\)\. The adoption of AE\-XAD is primarily motivated by its ability to produce interpretable anomaly heatmaps that highlight specific pixels corresponding to potential surface defects, providing localized and explainable visual evidence\. Furthermore, we rely on fuzzykk\-means to characterize each detected damage in terms of area dimension, shape eccentricity, color intensity, distance from the center of the image, and solidity\. The choice of a fuzzy clustering approach is crucial to manage the ambiguity of irregular shapes and physical defects\. Instead of forcing a rigid threshold, it provides graded truth degrees that naturally define the membership functions of the input EDB predicates \(area\_dimension,eccentricity,color\_intensity,distance, andsolidity\), preserving the vagueness of the domain\. The linguistic labels of these predicates are reported in the first block of Table[1](https://arxiv.org/html/2607.03550#S4.T1), and the corresponding membership functions are displayed in Figure[1](https://arxiv.org/html/2607.03550#S4.F1)\.



Figure 1:Membership functions of the predicatesarea\_dimension,eccentricity, andcolor\_intensity, obtained from sub\-simbolic components\.It is important to note that the raw truth degrees produced by sub\-symbolic components \(e\.g\., fuzzykk\-means\) may occasionally exhibit semantically unintuitive behaviors, such as assigning non\-zero degrees to bothsmallandlargewithout a clearly dominantmediumvalue, as observed for the predicatesarea\_dimension,eccentricity, andcolor\_intensityin the programฮ cโoโnโtโrโoโl\\Pi\_\{control\}\(see Figure[1](https://arxiv.org/html/2607.03550#S4.F1)\)\. Such phenomena are intrinsic to membership functions derived from machine learning systems\. However, as we show later, the symbolic fuzzy component of our framework is robust to these irregularities: by enforcing semantic constraints and leveraging well\-designed rules, it mitigates the imprecision of sub\-symbolic outputs, yielding more coherent, precise, and interpretable results\.
\(a\)Predicatesdiscardandrepair\.
\(b\)Predicatediscount\.
\(c\)Predicatesseverityanddefect\.
Figure 2:Membership functions for the predicatesdiscard,discount,repair, andseverity\. The predicatesdiscardandrepairare equipped with a simple fuzzy\-to\-crisp pattern, with a continuous label \(fuzzy\) and a corresponding Boolean label \(crisp\) obtained via a single cutoff\. The predicatediscountinstead adopts a multi\-threshold scheme, where three distinct step functions map the fuzzy degree to crisp decisions corresponding to different discount levels \(50% and 70%\)\. The predicatesseverityanddefectare entirely fuzzy \(no crisp labels\) withฮณ\\gamma\-monotonic truth profiles\.#### ฮ cโoโnโtโrโoโl\\Pi\_\{control\}Rules\.
The symbolic layer ofฮ cโoโnโtโrโoโl\\Pi\_\{control\}employs a set of rules to evaluate anomaly severity, classify defects, and determine the optimal handling strategy\. Initially, the framework assesses the overall severity of detected anomalies by evaluating their geometric and visual features, assigning, by means of the rules \([P1](https://arxiv.org/html/2607.03550#S4.Ex5)\) and \([P2](https://arxiv.org/html/2607.03550#S4.Ex6)\), high severity to anomalies with significant area, high eccentricity, or elevated color intensity, while classifying small, faint anomalies as low severity, through rule \([P3](https://arxiv.org/html/2607.03550#S4.Ex7)\)\. At the same level, the rules \([P4](https://arxiv.org/html/2607.03550#S4.Ex8)\), \([P5](https://arxiv.org/html/2607.03550#S4.Ex9)\), and \([3](https://arxiv.org/html/2607.03550#S4.Ex11)\) semantically distinguish between functional and aesthetic defects based on the physical traits of the screws\. Functional defects are typically characterized by low solidity or specific combinations of small size, low color intensity, and high distance from the center, whereas aesthetic damages are identified through high solidity, low distance, and medium color intensity\. In particular, note that the parts farthest from the center are precisely the head and the tip of the screw, whose possible absence in the image is clearly associated with defects that compromise the functionality of the screw under examination\.
Based on these inferred classifications and their corresponding truth degrees, the subsequent block of rules infers the appropriate handling actions\. Objects are flagged for discarding if they exhibit severe functional defects \(rules \([P7](https://arxiv.org/html/2607.03550#S4.Ex12)\) and \([P8](https://arxiv.org/html/2607.03550#S4.Ex13)\)\), or multiple critical aesthetic anomalies \(rule \([P9](https://arxiv.org/html/2607.03550#S4.Ex14)\)\)\. On the other hand, rule \([P10](https://arxiv.org/html/2607.03550#S4.Ex15)\) provides a recommendation for discounting of objects with high\-severity aesthetic damages\. Repair strategies, encoded in rules \([P11](https://arxiv.org/html/2607.03550#S4.Ex16)\) and \([P12](https://arxiv.org/html/2607.03550#S4.Ex17)\), are assigned based on the defect profile: internal repairs target minor aesthetic flaws lacking severe functional implications, while external repairs are reserved for minor functional defects requiring specialized processing\. That is, minor damages can be handled internally by the company, whereas more severe but still repairable damages must be delegated to specialized external companies\. Finally, items designated for external repair that do not meet the crisp discard criteria are automatically routed to an available repair company \(rule \([P13](https://arxiv.org/html/2607.03550#S4.Ex18)\)\) and the price of the items designated for discount is updated \(rules \([P14](https://arxiv.org/html/2607.03550#S4.Ex19)\), \([P15](https://arxiv.org/html/2607.03550#S4.Ex20)\), \([P16](https://arxiv.org/html/2607.03550#S4.Ex21)\)\)\.
We point out that these final rules behave precisely as in standard ASP, because all their body predicates use only binary \(crisp\) step membership functions, and thus will be either \(entirely\) true or \(entirely\) false in any interpretation of the program\. To see how this works, consider for instance the predicatediscard: the compatibilityฮณ\\gammaof membership functions \(see Figure[2](https://arxiv.org/html/2607.03550#S4.F2)\) implies that anyfuzzy\_levelvalue exceeding a certain threshold automatically sets the value11\(entirely true\) for the step membership function we have calledcrisp, which is then used in the subsequent rules \(e\.g\., rule \([P13](https://arxiv.org/html/2607.03550#S4.Ex18)\)\)\. The same happens for predicatesrepairanddiscount\.
Moreover, it is important to note that some rules ofฮ cโoโnโtโrโoโl\\Pi\_\{control\}exhibit peculiar labels containing the symbolsโฅ\\geqandโค\\leq\. For example, in the rule \([P5](https://arxiv.org/html/2607.03550#S4.Ex9)\), the predicatecolor\_intensityis used with the labelโคmโeโdโiโuโm\\leq medium\. Intuitively, this expression extends the linguistic notion ofat least medium\. Formally, these labels are in fact additional membership functions that are usually obtained by combining other membership functions of the same predicate\. In the considered program, this combination is performed by means of the probabilistic sum operator, e\.g\.,p\(;โฅ๐๐๐๐๐ข๐\)=p\(;๐๐๐๐๐ข๐\)\+p\(;โ๐๐โ\)โp\(;๐๐๐๐๐ข๐\)โ
p\(;โ๐๐โ\)\\mathit\{p\}\(;\\geq\\mathit\{medium\}\)=\\mathit\{p\}\(;\\mathit\{medium\}\)\+\\mathit\{p\}\(;\\mathit\{high\}\)\-\\mathit\{p\}\(;\\mathit\{medium\}\)\\cdot\\mathit\{p\}\(;\\mathit\{high\}\)\.
Table 1:Corresponding set of labels for each predicate\.ฮ cโoโnโtโrโoโl\\Pi\_\{control\}: Industrial Quality Control Program
๐๐๐๐๐๐๐๐ขโ\(X,H;hโiโgโh\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐\_๐๐๐๐๐๐๐๐๐\(I,H;large\)โmin๐๐๐๐๐๐๐๐๐๐๐๐ขโ\(I,H;hโiโgโh\)\\displaystyle\\begin\{split\}\\mathtt\{severity\}\(X,H;high\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\odot\_\{\\min\}\\\\ &\\mathtt\{area\\\_dimension\}\(I,H;large\)\\odot\_\{\\min\}\\\\ &\\mathtt\{eccentricity\}\(I,H;high\)\\end\{split\}\(P1\)๐๐๐๐๐๐๐๐ขโ\(X,H;hโiโgโh\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(I,H;โฅmedium\)โmin๐๐๐๐๐๐๐๐๐๐๐๐ขโ\(I,H;hโiโgโh\)\\displaystyle\\begin\{split\}\\mathtt\{severity\}\(X,H;high\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{color\\\_intensity\}\(I,H;\\geq medium\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{eccentricity\}\(I,H;high\)\\end\{split\}\(P2\)๐๐๐๐๐๐๐๐ขโ\(X,H;lโoโw\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(I,H;โคmedium\)โmin๐๐๐๐โ\_โ๐๐๐๐๐๐๐๐๐โ\(I,H;lโoโw\)\\displaystyle\\begin\{split\}\\mathtt\{severity\}\(X,H;low\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\ \\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{color\\\_intensity\}\(I,H;\\leq medium\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{area\\\_dimension\}\(I,H;low\)\\end\{split\}\(P3\)๐๐๐๐๐๐โ\(I,H,fโuโnโcโtโiโoโnโaโl;hโiโgโh\)โ๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐\_๐๐๐๐๐๐๐๐๐\(I,H;small\)โmin๐๐๐๐๐๐๐๐\(I,H;high\)โmin๐๐๐๐๐โ\_โ๐๐๐๐๐๐๐๐๐ขโ\(I,H;lโoโw\)\\displaystyle\\begin\{split\}\\mathtt\{defect\}\(I,H,functional;high\)\\leftarrow&\\\>\\mathtt\{anomaly\}\(I,H\)\\odot\_\{\\min\}\\\\ &\\mathtt\{area\\\_dimension\}\(I,H;small\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{distance\}\(I,H;high\)\\odot\_\{\\min\}\\\\ &\\mathtt\{color\\\_intensity\}\(I,H;low\)\\end\{split\}\(P4\)๐๐๐๐๐๐โ\(I,H,fโuโnโcโtโiโoโnโaโl;hโiโgโh\)โ๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(I,H;โคmedium\)โmin๐๐๐๐๐๐๐๐ข\(I,H;low\)โmin๐๐๐๐๐๐๐๐โ\(I,H;mโeโdโiโuโm\)\\displaystyle\\begin\{split\}\\mathtt\{defect\}\(I,H,functional;high\)\\leftarrow&\\\>\\mathtt\{anomaly\}\(I,H\)\\odot\_\{\\min\}\\\\ &\\mathtt\{color\\\_intensity\}\(I,H;\\leq medium\)\\odot\_\{\\min\}\\\\ &\\mathtt\{solidity\}\(I,H;low\)\\odot\_\{\\min\}\\\\ &\\mathtt\{distance\}\(I,H;medium\)\\end\{split\}\(P5\)๐๐๐๐๐๐โ\(I,H,aโeโsโtโhโeโtโiโc;hโiโgโh\)โ๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(I,H;medium\)โmin๐๐๐๐๐๐๐๐ข\(I,H;high\)โmin๐๐๐๐๐๐๐๐โ\(I,H;lโoโw\)\\displaystyle\\begin\{split\}\\mathtt\{defect\}\(I,H,aesthetic;high\)\\leftarrow&\\\>\\mathtt\{anomaly\}\(I,H\)\\odot\_\{\\min\}\\\\ &\\mathtt\{color\\\_intensity\}\(I,H;medium\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{solidity\}\(I,H;high\)\\odot\_\{\\min\}\\\\ &\\mathtt\{distance\}\(I,H;low\)\\end\{split\}
Figure 3:The Fuzzy Datalog programฮ cโoโnโtโrโoโl\\Pi\_\{control\}\. Defect identification\.ฮ cโoโnโtโrโoโl\\Pi\_\{control\}: Industrial Quality Control Program
๐๐๐๐๐๐๐โ\(X;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐๐\(I,H,functional;high\)โmin๐๐๐๐๐๐๐๐ขโ\(X,H;mโeโdโiโuโm\)\\displaystyle\\begin\{split\}\\mathtt\{discard\}\(X;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H,functional;high\)\\odot\_\{\\min\}\\\\ &\\mathtt\{severity\}\(X,H;medium\)\\end\{split\}\(P7\)๐๐๐๐๐๐๐โ\(X;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐๐\(I,H,functional;medium\)โmin๐๐๐๐๐๐๐๐ขโ\(X,H;hโiโgโh\)\\displaystyle\\begin\{split\}\\mathtt\{discard\}\(X;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H,functional;medium\)\\odot\_\{\\min\}\\\\ &\\mathtt\{severity\}\(X,H;high\)\\end\{split\}\(P8\)๐๐๐๐๐๐๐โ\(X;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H1\)โmin๐๐๐๐๐๐๐ข\(I,H2\)โmin๐๐๐๐๐๐\(I,H1,aesthetic;high\)โmin๐๐๐๐๐๐\(I,H2,aesthetic;high\)โminH1โ H2\\displaystyle\\begin\{split\}\\mathtt\{discard\}\(X;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\_\{1\}\)\\odot\_\{\\min\}\\\\ &\\mathtt\{anomaly\}\(I,H\_\{2\}\)\\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H\_\{1\},aesthetic;high\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H\_\{2\},aesthetic;high\)\\odot\_\{\\min\}\\\\ &H\_\{1\}\\neq H\_\{2\}\\end\{split\}\(P9\)๐๐๐๐๐๐๐๐โ\(X;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐๐\(I,H,aesthetic;high\)โmin๐๐๐๐๐๐๐๐ขโ\(X,H;hโiโgโh\)\\displaystyle\\begin\{split\}\\mathtt\{discount\}\(X;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H,aesthetic;high\)\\odot\_\{\\min\}\\\\ &\\mathtt\{severity\}\(X,H;high\)\\end\{split\}\(P10\)๐๐๐๐๐๐โ\(X,sโeโlโf;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐๐\(I,H,aesthetic;โคmedium\)โminยฌล๐๐๐๐๐๐โ\(I,H,fโuโnโcโtโiโoโnโaโl;hโiโgโh\)\\displaystyle\\begin\{split\}\\mathtt\{repair\}\(X,self;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H,aesthetic;\\leq medium\)\\ \\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{defect\}\(I,H,functional;high\)\\end\{split\}\(P11\)๐๐๐๐๐๐โ\(X,eโxโtโeโrโnโaโl;fโuโzโzโyโ\_โlโeโvโeโl\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐ข\(I,H\)โmin๐๐๐๐๐๐\(I,H,functional;low\)โminยฌล๐๐๐๐๐๐โ\(I,H,aโeโsโtโhโeโtโiโc;lโoโw\)\\displaystyle\\begin\{split\}\\mathtt\{repair\}\(X,external;fuzzy\\\_level\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{anomaly\}\(I,H\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{defect\}\(I,H,functional;low\)\\ \\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{defect\}\(I,H,aesthetic;low\)\\end\{split\}\(P12\)
Figure 4:The Fuzzy Datalog programฮ cโoโnโtโrโoโl\\Pi\_\{control\}\. Fuzzy possible evaluation\.ฮ cโoโnโtโrโoโl\\Pi\_\{control\}: Industrial Quality Control Program
๐๐๐๐โ\(X,A\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐\(X,external;crisp\)โminยฌล๐๐๐๐๐๐๐โ\(X;cโrโiโsโp\)โmin๐๐๐๐๐๐๐๐๐โ\_โ๐๐๐๐๐๐๐ขโ\(A\)\\displaystyle\\begin\{split\}\\mathtt\{send\}\(X,A\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{repair\}\(X,external;crisp\)\\ \\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discard\}\(X;crisp\)\\odot\_\{\\min\}\\mathtt\{available\\\_company\}\(A\)\\end\{split\}\(P13\)๐๐๐๐โ\(X,P\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐๐\_๐๐๐๐๐\(X,P0\)โmin๐๐๐๐๐๐๐๐\(X;disc50\)โminP=P0โ0\.5โminยฌล๐๐๐๐๐๐๐โ\(X;cโrโiโsโp\)\\displaystyle\\begin\{split\}\\mathtt\{sell\}\(X,P\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{original\\\_price\}\(X,P\_\{0\}\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{discount\}\(X;disc50\)\\ \\odot\_\{\\min\}P=P\_\{0\}\*0\.5\\ \\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discard\}\(X;crisp\)\\end\{split\}\(P14\)๐๐๐๐โ\(X,P\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐๐\_๐๐๐๐๐\(X,P0\)โmin๐๐๐๐๐๐๐๐\(X;disc70\)โminP=P0โ0\.7โminยฌล๐๐๐๐๐๐๐โ\(X;cโrโiโsโp\)\\displaystyle\\begin\{split\}\\mathtt\{sell\}\(X,P\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{original\\\_price\}\(X,P\_\{0\}\)\\ \\odot\_\{\\min\}\\\\ &\\mathtt\{discount\}\(X;disc70\)\\ \\odot\_\{\\min\}P=P\_\{0\}\*0\.7\\ \\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discard\}\(X;crisp\)\\end\{split\}\(P15\)๐๐๐๐โ\(X,P\)โ๐๐๐๐๐๐\(X,I\)โmin๐๐๐๐๐๐๐๐\_๐๐๐๐๐\(X,P\)โminยฌล๐๐๐๐๐๐๐\(X;crisp\)โminยฌล๐๐๐๐๐๐๐๐\(X;disc50\)โminยฌล๐๐๐๐๐๐๐๐โ\(X;dโiโsโcโ70\)\\displaystyle\\begin\{split\}\\mathtt\{sell\}\(X,P\)\\leftarrow&\\\>\\mathtt\{object\}\(X,I\)\\odot\_\{\\min\}\\mathtt\{original\\\_price\}\(X,P\)\\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discard\}\(X;crisp\)\\odot\_\{\\min\}\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discount\}\(X;disc50\)\\odot\_\{\\min\}\\\\ &\\neg\_\{\\scriptscriptstyle\\textit\{\\L \{\}\}\}\\mathtt\{discount\}\(X;disc70\)\\end\{split\}\(P16\)
Figure 5:The Fuzzy Datalog programฮ cโoโnโtโrโoโl\\Pi\_\{control\}\. Crisp decision\.
### 4\.1Examples of Evaluation
In this section, we present the derivation for two specific instances \(displayed in Figure[6](https://arxiv.org/html/2607.03550#S4.F6)\)\. In this application we explicitly evaluate the t\-norm and s\-norm using themโiโnminandmโaโxmaxoperators respectively, for every clause in the extendedฮ cโoโnโtโrโoโl\\Pi\_\{control\}program\. Themโiโnminoperator ensures that when aggregating multiple conditions in a rule body \(e\.g\., determining if a defect is highly severe\), the resulting truth degree is strictly bounded by the weakest piece of evidence\. Conversely, themโaโxmaxoperator \(s\-norm\) guarantees that when multiple, independent rules derive the same concept for an item, the strongest available evidence dictates the final classification\. This prevents severe defects from being smoothed out or averaged down by less critical features\.
In real\-world scenarios, the transition between qualitative conceptsโsuch as moving from a\(at least\) mediumto a\(at least\) highseverityโis rarely abrupt\. We adopt a*smooth approach*, as shown in Figure[2\(c\)](https://arxiv.org/html/2607.03550#S4.F2.sf3), which provides continuous transitions for such notions\.
We define our admissible monotonic truth profilesฮณ\\gammaby mapping each ordered labelโi\\ell\_\{i\}to a shifted logistic sigmoid\(Huybrechs and Trefethen,[2024](https://arxiv.org/html/2607.03550#bib.bib32)\):
fโ\(t;k,ci\)=ฯโ\(kโ\(tโci\)\)=11\+eโkโ\(tโci\)f\(t;k,c\_\{i\}\)=\\sigma\\big\(k\(t\-c\_\{i\}\)\\big\)=\\frac\{1\}\{1\+e^\{\-k\(t\-c\_\{i\}\)\}\}wherek\>0k\>0governs the steepness andciโ\(0,1\)c\_\{i\}\\in\(0,1\)determines the threshold center\. We fixk=20k=20, allowing the closed\-form inverse derivation of the parameter valuet=ci\+120โlnโก\(y1โy\)t=c\_\{i\}\+\\frac\{1\}\{20\}\\ln\\left\(\\frac\{y\}\{1\-y\}\\right\)\.
For a predicate likeseveritywith three ordinal labels \(๐๐๐ค\\mathit\{low\},๐๐๐๐๐ข๐\\mathit\{medium\},โ๐๐โ\\mathit\{high\}\), the profile maps a curve to each threshold using monotonically increasing centersc1=0\.20c\_\{1\}=0\.20,c2=0\.50c\_\{2\}=0\.50, andc3=0\.80c\_\{3\}=0\.80:
ฮณ๐ ๐๐ฃ๐๐๐๐ก๐ฆโ\(t\)=\(fโ\(t;20,0\.20\),fโ\(t;20,0\.50\),fโ\(t;20,0\.80\)\)\\gamma\_\{\\mathit\{severity\}\}\(t\)=\\big\(f\(t;20,0\.20\),\\;f\(t;20,0\.50\),\\;f\(t;20,0\.80\)\\big\)
The final decision stage of the pipeline is modeled through the predicatesdiscard,discount, andrepair\.
As explained above, these predicates are equipped with linguistic labels that enable a transition from fuzzy evaluations to crisp behaviors by means of their associated membership functions depicted in Figure[2](https://arxiv.org/html/2607.03550#S4.F2)\. In more detail, the predicatesdiscardandrepairare defined with two labels,fuzzy\_levelandcrisp: the former is associated with a continuous increasing membership function \(in our case, linear in\[0,1\]\[0,1\]\), while the latter is defined via a step function with a cutoff, fixed in this example at0\.50\.5\. This means that a fuzzy degree assigned todiscard\(X;fuzzy\_level\)\(X;\\textit\{fuzzy\\\_level\}\)\(respectivelyrepair\(X;fuzzy\_level\)\(X;\\textit\{fuzzy\\\_level\}\)\) is turned into a crisp value fordiscard\(X;crisp\)\(X;\\textit\{crisp\}\)\(respectivelyrepair\(X;crisp\)\(X;\\textit\{crisp\}\)\), which is11if the degree is at least0\.50\.5, and0otherwise\.
The predicatediscountfollows a similar approach, but it is associated with two crisp labels corresponding to different discount levels, namelydisc50anddisc70\. Each of these labels is defined by a step membership function with thresholds set to0\.40\.4and0\.70\.7, respectively\. As a result, the fuzzy degree computed fordiscount\(X;fuzzy\_level\)\(X;\\textit\{fuzzy\\\_level\}\)is mapped, via theฮณ\\gamma\-propagation mechanism, to either crisp discount decision depending on which thresholds are exceeded\.
Note that the threshold values associated with the fuzzy\-to\-crisp predicates are meant to capture a specific decision policy and are application\-dependent design parameters\. Future work will investigate data\-driven approaches for automatically learning these thresholds, in addition to the shape and parameters of the underlying membership functions\.
\(a\)Manipulated Front Anomaly\.
\(b\)Two Scratch Anomalies\.
Figure 6:Two input examples with corresponding AE\-XAD anomaly explanations\.#### Instance 1: Manipulated Front Anomaly\.
LetX1X\_\{1\}be the item featuring a single manipulated front anomalyHH\(as seen in Figure[6\(a\)](https://arxiv.org/html/2607.03550#S4.F6.sf1)\)\. In this scenario, the geometric evaluation maps the defect to a functional anomaly\.
We focus the explicit derivation on theseveritypredicate to showcase the continuous latent inference\. First, we compute the required compound labels via probabilistic sum \(aโb=a\+bโaโ
ba\\oplus b=a\+b\-a\\cdot b\):
๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(X1,H;โคmedium\)\\displaystyle\\mathtt\{color\\\_intensity\}\(X\_\{1\},H;\\leq medium\)=0\.998โ0\.002=0\.998\\displaystyle=0\.998\\oplus 0\.002=0\.998๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(X1,H;โฅmedium\)\\displaystyle\\mathtt\{color\\\_intensity\}\(X\_\{1\},H;\\geq medium\)=0\.002โ0\.000=0\.002\\displaystyle=0\.002\\oplus 0\.000=0\.002Next, we evaluate the lower bounds dictated by rules \([P1](https://arxiv.org/html/2607.03550#S4.Ex5)โ[P2](https://arxiv.org/html/2607.03550#S4.Ex6)\) using themin\\mint\-norm over the geometric memberships:
๐๐๐๐๐๐๐๐ขโ\(H;hโiโgโh\)\\displaystyle\\mathtt\{severity\}\(H;high\)โmaxโก\(minโก\(0\.020,0\.074\),minโก\(0\.002,0\.074\)\)=0\.020โ\([P1](https://arxiv.org/html/2607.03550#S4.Ex5),[P2](https://arxiv.org/html/2607.03550#S4.Ex6)\)\\displaystyle\\leftarrow\\max\\big\(\\min\(0\.020,0\.074\),\\min\(0\.002,0\.074\)\\big\)=0\.020\\qquad\\text\{\(\\ref\{rule:sev1\}, \\ref\{rule:sev2\}\)\}๐๐๐๐๐๐๐๐ขโ\(H;lโoโw\)\\displaystyle\\mathtt\{severity\}\(H;low\)โminโก\(0\.998,0\.909\)=0\.909โ\([P3](https://arxiv.org/html/2607.03550#S4.Ex7)\)\\displaystyle\\leftarrow\\min\(0\.998,0\.909\)=0\.909\\qquad\\text\{\(\\ref\{rule:sev3\}\)\}With the constraintsโ๐๐โโฅ0\.020\\mathit\{high\}\\geq 0\.020and๐๐๐คโฅ0\.909\\mathit\{low\}\\geq 0\.909, we map the evaluations to the latent statettusing the inverse sigmoid\. The constraint onโ๐๐โ\\mathit\{high\}\(c3=0\.80c\_\{3\}=0\.80\) imposestโฅ0\.80\+0\.05โlnโก\(0\.020/0\.980\)=0\.605t\\geq 0\.80\+0\.05\\ln\(0\.020/0\.980\)=0\.605\. This is strictly greater than the requirement for๐๐๐ค\\mathit\{low\}\(tโฅ0\.315t\\geq 0\.315\)\. Thus, substituting the strictest boundt=0\.605t=0\.605back into theฮณ๐ ๐๐ฃ๐๐๐๐ก๐ฆ\\gamma\_\{\\mathit\{severity\}\}profile provides the fully coherent semantic state
๐๐๐๐๐๐๐๐ขโ\(H;โ
\)โwith labelsโ\{lโoโw=0\.999,mโeโdโiโuโm=0\.892,hโiโgโh=0\.020\}\.\\mathtt\{severity\}\(H;\\cdot\)\\mbox\{ with labels \}\\\{low=0\.999,\\;medium=0\.892,\\;high=0\.020\\\}\.
The framework successfully infers a strong๐๐๐๐๐ข๐\\mathit\{medium\}severity \(interpreted as โat least mediumโ because these monotonic function encode a cumulative behavior\), despite the absence of an explicit rule, naturally bridging the gap between the๐๐๐ค\\mathit\{low\}andโ๐๐โ\\mathit\{high\}evaluations\.
Processing the morphological variables through rules \([P4](https://arxiv.org/html/2607.03550#S4.Ex8)โ[P5](https://arxiv.org/html/2607.03550#S4.Ex9)\) yields a confident classification for a functional defect \(๐๐๐๐๐๐โ\(I,H,fโuโnโcโtโiโoโnโaโl;hโiโgโh\)=0\.909\\mathtt\{defect\}\(I,H,functional;high\)=0\.909\), primarily driven by the anomalyโs localized area and its position at the objectโs boundaries\.
๐๐๐๐๐๐๐\(X1;fuzzy\_level\)\)โmin\(0\.909,0\.892\)=0\.892\\mathtt\{discard\}\(X\_\{1\};fuzzy\\\_level\)\)\\leftarrow\\min\(0\.909,0\.892\)=0\.892Because of the threshold profileฮณ๐๐๐ ๐๐๐๐\\gamma\_\{\\mathit\{discard\}\}\(with cutoff0\.50\.5\), we get a definitive crisp action:discardโ\(X1;๐๐๐๐ ๐\)=1\\mathrm\{discard\}\(X\_\{1\};\\mathit\{crisp\}\)=1\.
#### Instance 2: Two Scratch Anomalies \(Image[6\(b\)](https://arxiv.org/html/2607.03550#S4.F6.sf2)\)\.
LetX2X\_\{2\}be an item presenting two candidate anomaly regions identified by the sub\-symbolic layer, denoted asHAH\_\{A\}\(Component 1\) andHBH\_\{B\}\(Component 2\) \(Figure[6\(b\)](https://arxiv.org/html/2607.03550#S4.F6.sf2)\)\. We evaluate the severity profiles independently for both components\. ForHAH\_\{A\}, we compute the aggregated bounds via probabilistic sum \(๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(X2,HA;โคmedium\)=0\.043โ0\.953=0\.955\\mathtt\{color\\\_intensity\}\(X\_\{2\},H\_\{A\};\\leq medium\)=0\.043\\oplus 0\.953=0\.955\) and apply rules \([P1](https://arxiv.org/html/2607.03550#S4.Ex5)โ[P3](https://arxiv.org/html/2607.03550#S4.Ex7)\):
๐๐๐๐๐๐๐๐ขโ\(HA;hโiโgโh\)\\displaystyle\\mathtt\{severity\}\(H\_\{A\};high\)โmaxโก\(minโก\(0\.037,0\),minโก\(0\.953,0\)\)=0\.000\\displaystyle\\leftarrow\\max\\big\(\\min\(0\.037,0\),\\min\(0\.953,0\)\\big\)=0\.000๐๐๐๐๐๐๐๐ขโ\(HA;lโoโw\)\\displaystyle\\mathtt\{severity\}\(H\_\{A\};low\)โminโก\(0\.955,0\.264\)=0\.264\\displaystyle\\leftarrow\\min\(0\.955,0\.264\)=0\.264With boundshโiโgโhโฅ0high\\geq 0andlโoโwโฅ0\.264low\\geq 0\.264, the strictest latent state ist=0\.148t=0\.148\. Substituting this intoฮณ๐ ๐๐ฃ๐๐๐๐ก๐ฆ\\gamma\_\{\\mathit\{severity\}\}yields the following profile for the first component๐๐๐๐๐๐๐๐ขโ\(HA,โ
\)\\mathtt\{severity\}\(H\_\{A\},\\cdot\):\{lโoโw=0\.261,mโeโdโiโuโm=0\.001,hโiโgโh=0\.000\}\\\{low=0\.261,\\;medium=0\.001,\\;high=0\.000\\\}\. Conversely, for the regionHBH\_\{B\}, the probabilistic sum yields๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(X2,HB;โคmedium\)=0\.056โ0\.938=0\.941\\mathtt\{color\\\_intensity\}\(X\_\{2\},H\_\{B\};\\leq medium\)=0\.056\\oplus 0\.938=0\.941and๐๐๐๐๐\_๐๐๐๐๐๐๐๐๐ข\(X2,HB;โฅmedium\)=0\.938\\mathtt\{color\\\_intensity\}\(X\_\{2\},H\_\{B\};\\geq medium\)=0\.938\. Then,
๐๐๐๐๐๐๐๐ขโ\(HB;hโiโgโh\)\\displaystyle\\mathtt\{severity\}\(H\_\{B\};high\)โmaxโก\(minโก\(0\.038,0\.026\),minโก\(0\.938,0\.026\)\)=0\.026\\displaystyle\\leftarrow\\max\\big\(\\min\(0\.038,0\.026\),\\min\(0\.938,0\.026\)\\big\)=0\.026๐๐๐๐๐๐๐๐ขโ\(HB;lโoโw\)\\displaystyle\\mathtt\{severity\}\(H\_\{B\};low\)โminโก\(0\.941,0\.272\)=0\.272\\displaystyle\\leftarrow\\min\(0\.941,0\.272\)=0\.272Here, the constraint onhโiโgโhhighgoverns the latent inference, forcingtโฅ0\.80\+0\.05โlnโก\(0\.026/0\.974\)=0\.619t\\geq 0\.80\+0\.05\\ln\(0\.026/0\.974\)=0\.619\. The semantic state naturally bridges the evaluations:
๐๐๐๐๐๐๐๐ขโ\(HB,โ
\)โwith labelsโ\{lโoโw=0\.999,mโeโdโiโuโm=0\.915,hโiโgโh=0\.026\}\.\\mathtt\{severity\}\(H\_\{B\},\\cdot\)\\mbox\{ with labels \}\\\{low=0\.999,\\;medium=0\.915,\\;high=0\.026\\\}\.
Aggregating the truth degrees across the previous rule set, and applying step\-function profileฮณ๐๐๐ ๐๐๐๐\\gamma\_\{\\mathit\{discard\}\}yields๐๐๐๐๐๐๐โ\(X2;cโrโiโsโp\)=0\\mathtt\{discard\}\(X\_\{2\};crisp\)=0\. The framework safely avoids a false\-positive discard\.
Instead, the presence of a verified single aesthetic anomaly \(HBH\_\{B\}\) with a safely bounded severity enables the self\-repair policy\. Given the latent state ofHBH\_\{B\}, the cumulative label๐๐๐๐๐๐\(HB,aesthetical;โคmedium\)\\mathtt\{defect\}\(H\_\{B\},aesthetical;\\leq medium\)evaluates to1\.0001\.000\. Coupled with the ลukasiewicz negation of functional damages \(1โ0\.023=0\.9771\-0\.023=0\.977\), we obtain:
๐๐๐๐๐๐โ\(X2,sโeโlโf;fโuโzโzโyโ\_โlโeโvโeโl\)โminโก\(1\.000,0\.977\)=0\.977\\mathtt\{repair\}\(X\_\{2\},self;fuzzy\\\_level\)\\leftarrow\\min\(1\.000,0\.977\)=0\.977Throughฮณ๐๐๐๐๐๐\\gamma\_\{\\mathit\{repair\}\}, this yields๐๐๐๐๐๐โ\(X2,sโeโlโf;cโrโiโsโp\)=1\\mathtt\{repair\}\(X\_\{2\},self;crisp\)=1\.
The neuro\-symbolic pipeline leverages declarative geometric semantics to route each item to the most appropriate and cost\-effective recovery procedure\. The examples are handled correctly: the first is discarded by the system due to a recognized functional defect, while the second is self\-repaired, as expected for scratch anomalies\.
The choice of t\-norm and s\-norm, however, strongly affects the final outcome\. As an example, in Instance 1, the product or the ลukasiewicz t\-norm would prevent the expected discard decision despite a clearly defective screw, as both degrade the truth of a conjunction as its conditions grow, unlikemin\. Analogously,maxretains only the strongest supporting rule, whereas additive s\-norms may turn several weak signals into a strong conclusion, which is undesirable in this quality control scenario\.
The propagation by means of theฮณ\\gammafunction highlights a fundamental theoretical advantage of our framework: the shift from continuous fuzzy reasoning to crisp operational decisions comes easily\. Instead of relying on external procedural scripts, ad\-hoc defuzzification algorithms, or hardcoded post\-processing rules, the binarization may be handled entirely within the logical semantics\. Ambiguous neural outputs are gracefully absorbed by the continuous logic, naturally ending into deterministic boolean actions without ever breaking the end\-to\-end logical pipeline\.
## 5Conclusion
In this paper, we presented a case study of recently introduced qualitative fuzzy extension of Answer Set Programming, where predicates are equipped with finite linguistic labels and membership functions\. The prototype leverages the structure of this language to combine a machine learning\-based component with a set of symbolic rules to detect and localize damages in images obtained from a production line of screws, and to provide decision\-making pattern for damaged items\. The illustrated examples reveal the capacity of our language to incorporate the extremely effective, although potentially noisy, predictions of machine learning models with the rigor of symbolic reasoning into a formal, declarative pipeline\. The association of data\-driven membership functions with linguistic labels allows domain experts to encode their knowledge naturally, capturing the inherent vagueness of qualitative concepts without sacrificing logical power\.
## References
- \[1\]ร\. Achs and A\. Kiss\(1995\)Fuzzy extension of datalog\.Acta Cybern\.12\(2\),pp\. 153โ166\.External Links:[Link](https://cyber.bibl.u-szeged.hu/index.php/actcybern/article/view/3454)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p1.1)\.
- \[2\]M\. Alviano and R\. Peรฑaloza\(2013\)Fuzzy answer sets approximations\.Theory Pract\. Log\. Program\.13\(4\-5\),pp\. 753โ767\.External Links:[Link](https://doi.org/10.1017/S1471068413000471),[Document](https://dx.doi.org/10.1017/S1471068413000471)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[3\]F\. Angiulli, F\. Fassetti, L\. Ferragina, and S\. Nisticรฒ\(2025\)Explaining anomalies through semi\-supervised autoencoders\.Array28,pp\. 100537\.External Links:[Link](https://doi.org/10.1016/j.array.2025.100537),[Document](https://dx.doi.org/10.1016/J.ARRAY.2025.100537)Cited by:[ยง4](https://arxiv.org/html/2607.03550#S4.p5.2)\.
- \[4\]S\. Badreddine, A\. S\. dโAvila Garcez, L\. Serafini, and M\. Spranger\(2022\)Logic tensor networks\.Artif\. Intell\.303,pp\. 103649\.External Links:[Link](https://doi.org/10.1016/j.artint.2021.103649),[Document](https://dx.doi.org/10.1016/J.ARTINT.2021.103649)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[5\]P\. Bergmann, K\. Batzner, M\. Fauser, D\. Sattlegger, and C\. Steger\(2021\)The mvtec anomaly detection dataset: a comprehensive real\-world dataset for unsupervised anomaly detection\.International Journal of Computer Vision129\(4\),pp\. 1038โ1059\.Cited by:[ยง4](https://arxiv.org/html/2607.03550#S4.p1.1)\.
- \[6\]M\. Blondeel, S\. Schockaert, D\. Vermeir, and M\. De Cock\(2013\)Fuzzy answer set programming: an introduction\.InSoft Computing: State of the Art Theory and Novel Applications,R\. R\. Yager, A\. M\. Abbasov, M\. Z\. Reformat, and S\. N\. Shahbazova \(Eds\.\),Studies in Fuzziness and Soft Computing, Vol\.291,pp\. 209โ222\.External Links:[Link](https://doi.org/10.1007/978-3-642-34922-5%5C_15),[Document](https://dx.doi.org/10.1007/978-3-642-34922-5%5F15)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[7\]F\. Bobillo and U\. Straccia\(2008\)FuzzyDL: an expressive fuzzy description logic reasoner\.In2008 IEEE International Conference on Fuzzy Systems \(IEEE World Congress on Computational Intelligence\),pp\. 923โ930\.Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[8\]M\. E\. Cornejo, D\. Lobo, and J\. Medina\(2018\)Syntax and semantics of multi\-adjoint normal logic programming\.Fuzzy Sets Syst\.345,pp\. 41โ62\.External Links:[Link](https://doi.org/10.1016/j.fss.2017.12.009),[Document](https://dx.doi.org/10.1016/J.FSS.2017.12.009)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p2.1)\.
- \[9\]M\. E\. Cornejo, D\. Lobo, and J\. Medina\(2020\)Extended multi\-adjoint logic programming\.Fuzzy Sets Syst\.388,pp\. 124โ145\.External Links:[Link](https://doi.org/10.1016/j.fss.2019.03.016),[Document](https://dx.doi.org/10.1016/J.FSS.2019.03.016)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p2.1)\.
- \[10\]R\. Ebrahim\(2001\)Fuzzy logic programming\.Fuzzy Sets Syst\.117\(2\),pp\. 215โ230\.External Links:[Link](https://doi.org/10.1016/S0165-0114(98)00300-5),[Document](https://dx.doi.org/10.1016/S0165-0114%2898%2900300-5)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p1.1)\.
- \[11\]D\. Huybrechs and L\. N\. Trefethen\(2024\)Sigmoid functions, multiscale resolution of singularities, and hp\-mesh refinement\.Siam Review66\(4\),pp\. 683โ693\.Cited by:[ยง4\.1](https://arxiv.org/html/2607.03550#S4.SS1.p3.2)\.
- \[12\]J\. Janssen, S\. Schockaert, D\. Vermeir, and M\. De Cock\(2009\)General fuzzy answer set programs\.InInternational Workshop on Fuzzy Logic and Applications,pp\. 352โ359\.Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[13\]J\. Janssen, S\. Schockaert, D\. Vermeir, and M\. De Cock\(2012\)A core language for fuzzy answer set programming\.Int\. J\. Approx\. Reason\.53\(4\),pp\. 660โ692\.External Links:[Link](https://doi.org/10.1016/j.ijar.2012.01.005),[Document](https://dx.doi.org/10.1016/J.IJAR.2012.01.005)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1),[ยง3\.2](https://arxiv.org/html/2607.03550#S3.SS2.SSS0.Px2.p9.1)\.
- \[14\]M\. Lanzinger, S\. Sferrazza, P\. A\. Walega, and G\. Gottlob\(2024\)Fuzzy datalogโ\\existsover arbitrary t\-norms\.InLPAR 2024: Proceedings of 25th Conference on Logic for Programming, Artificial Intelligence and Reasoning, Port Louis, Mauritius, May 26\-31, 2024,N\. S\. Bjรธrner, M\. Heule, and A\. Voronkov \(Eds\.\),EPiC Series in Computing, Vol\.100,pp\. 426โ444\.External Links:[Link](https://doi.org/10.29007/cngw),[Document](https://dx.doi.org/10.29007/CNGW)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[15\]V\. H\. Le, F\. Liu, and D\. K\. Tran\(2009\)Fuzzy linguistic logic programming and its applications\.Theory Pract\. Log\. Program\.9\(3\),pp\. 309โ341\.External Links:[Link](https://doi.org/10.1017/S1471068409003779),[Document](https://dx.doi.org/10.1017/S1471068409003779)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[16\]Y\. Loyer and U\. Straccia\(2003\)The approximate well\-founded semantics for logic programs with uncertainty\.InMathematical Foundations of Computer Science 2003, 28th International Symposium, MFCS 2003, Bratislava, Slovakia, August 25\-29, 2003, Proceedings,B\. Rovan and P\. Vojtรกs \(Eds\.\),Lecture Notes in Computer Science,pp\. 541โ550\.External Links:[Link](https://doi.org/10.1007/978-3-540-45138-9%5C_48),[Document](https://dx.doi.org/10.1007/978-3-540-45138-9%5F48)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p2.1)\.
- \[17\]Y\. Loyer and U\. Straccia\(2009\)Approximate well\-founded semantics, query answering and generalized normal logic programs over lattices\.Ann\. Math\. Artif\. Intell\.55\(3\-4\),pp\. 389โ417\.External Links:[Link](https://doi.org/10.1007/s10472-008-9099-0),[Document](https://dx.doi.org/10.1007/S10472-008-9099-0)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p2.1)\.
- \[18\]T\. Lukasiewicz and U\. Straccia\(2008\)Managing uncertainty and vagueness in description logics for the semantic web\.Journal of Web Semantics6\(4\),pp\. 291โ308\.Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[19\]R\. Manhaeve, S\. Dumancic, A\. Kimmig, T\. Demeester, and L\. D\. Raedt\(2021\)Neural probabilistic logic programming in DeepProbLog\.Artificial Intelligence298,pp\. 103504\.External Links:[Link](https://doi.org/10.1016/j.artint.2021.103504),[Document](https://dx.doi.org/10.1016/J.ARTINT.2021.103504)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[20\]S\. Medasani, J\. Kim, and R\. Krishnapuram\(1998\)An overview of membership function generation techniques for pattern recognition\.Int\. J\. Approx\. Reason\.19\(3\-4\),pp\. 391โ417\.External Links:[Link](https://doi.org/10.1016/S0888-613X(98)10017-8),[Document](https://dx.doi.org/10.1016/S0888-613X%2898%2910017-8)Cited by:[ยง3\.1](https://arxiv.org/html/2607.03550#S3.SS1.SSS0.Px1.p1.11)\.
- \[21\]J\. Medina, M\. Ojeda\-Aciego, and P\. Vojtรกลก\(2001\)A procedural semantics for multi\-adjoint logic programming\.InPortuguese Conference on Artificial Intelligence,pp\. 290โ297\.Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p1.1)\.
- \[22\]S\. Nascimento, B\. Mirkin, and F\. Moura\-Pires\(2000\)A fuzzy clustering model of data and fuzzy c\-means\.InNinth IEEE International Conference on Fuzzy Systems\. FUZZ\-IEEE 2000 \(Cat\. No\. 00CH37063\),Vol\.1,pp\. 302โ307\.Cited by:[ยง4](https://arxiv.org/html/2607.03550#S4.p5.2)\.
- \[23\]A\. Skryagin, W\. Stammer, D\. Ochs, D\. S\. Dhami, and K\. Kersting\(2022\)Neural\-probabilistic answer set programming\.InProceedings of the 19th International Conference on Principles of Knowledge Representation and Reasoning, KR 2022, Haifa, Israel, July 31 \- August 5, 2022,G\. Kern\-Isberner, G\. Lakemeyer, and T\. Meyer \(Eds\.\),External Links:[Link](https://proceedings.kr.org/2022/48/)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[24\]U\. Straccia\(2001\)Reasoning within fuzzy description logics\.Journal of artificial intelligence research14,pp\. 137โ166\.Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[25\]M\. H\. van Emden\(1986\)Quantitative deduction and its fixpoint theory\.J\. Log\. Program\.3\(1\),pp\. 37โ53\.External Links:[Link](https://doi.org/10.1016/0743-1066(86)90003-8),[Document](https://dx.doi.org/10.1016/0743-1066%2886%2990003-8)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p1.1)\.
- \[26\]D\. Van Nieuwenborgh, M\. De Cock, and D\. Vermeir\(2006\)Fuzzy answer set programming\.InLogics in Artificial Intelligence, 10th European Conference, JELIA,M\. Fisher, W\. van der Hoek, B\. Konev, and A\. Lisitsa \(Eds\.\),Lecture Notes in Computer Science, Vol\.4160,pp\. 359โ372\.External Links:[Link](https://doi.org/10.1007/11853886%5C_30),[Document](https://dx.doi.org/10.1007/11853886%5F30)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.
- \[27\]P\. Vojtรกs\(2001\)Fuzzy logic programming\.Fuzzy Sets Syst\.124\(3\),pp\. 361โ370\.External Links:[Link](https://doi.org/10.1016/S0165-0114(01)00106-3),[Document](https://dx.doi.org/10.1016/S0165-0114%2801%2900106-3)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p1.1)\.
- \[28\]Z\. Yang, A\. Ishay, and J\. Lee\(2020\)NeurASP: embracing neural networks into answer set programming\.InProceedings of the Twenty\-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020,C\. Bessiere \(Ed\.\),pp\. 1755โ1762\.External Links:[Link](https://doi.org/10.24963/ijcai.2020/243),[Document](https://dx.doi.org/10.24963/IJCAI.2020/243)Cited by:[ยง2](https://arxiv.org/html/2607.03550#S2.p3.1)\.Similar Articles
Answer Set Programming Energised! End-to-End Neurosymbolic Reasoning and Learning with ASP and Energy Based Models
This paper presents a general neurosymbolic reasoning and learning methodology that modularly integrates Answer Set Programming with an Energy Based Model substrate, supporting joint optimization in continuous latent space and end-to-end training. It demonstrates applications on MNIST, CLEVR, and MOT benchmarks.
@_akhaliq: Program-as-Weights A Programming Paradigm for Fuzzy Functions
Introduces 'Program-as-Weights', a new programming paradigm designed for fuzzy functions, shared by @_akhaliq.
Answer-Set-Programming-based Abstractions for Reinforcement Learning
This paper presents an Answer Set Programming (ASP) based implementation of the CARCASS framework for constructing abstractions in reinforcement learning, demonstrating its effectiveness on Blocks World and Minigrid domains.
Distilling Answer-Set Programming Rules from LLMs for Neurosymbolic Visual Question Answering
This paper presents a method for distilling answer-set programming rules from large language models to enhance neurosymbolic visual question answering, showing that only a few examples are needed to generate correct rules.
Program-as-Weights: A Programming Paradigm for Fuzzy Functions
Program-as-Weights (PAW) introduces a programming paradigm where a 4B compiler translates natural-language specifications into compact neural artifacts executable by a 0.6B interpreter, achieving performance comparable to 32B models with drastically lower memory and inference cost.