callensxavier commited on
Commit
082683d
·
verified ·
1 Parent(s): 3cd1783

Upload ltn_constraints.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. ltn_constraints.py +13 -3
ltn_constraints.py CHANGED
@@ -31,9 +31,19 @@ class FuzzyLogicGatekeeper:
31
  truth = np.exp(-self.beta * drift)
32
  return float(np.clip(truth, 0.0, 1.0))
33
 
34
- def evaluate_fuzzy_satisfaction(self, p_unitary: float, p_energy: float) -> float:
 
 
 
 
 
 
 
 
 
35
  """
36
  Evaluates the global fuzzy logic satisfaction using Product t-norm:
37
- $$I(\\phi \\land \\psi) = I(\\phi) \\times I(\\psi)$$
38
  """
39
- return float(p_unitary * p_energy)
 
 
31
  truth = np.exp(-self.beta * drift)
32
  return float(np.clip(truth, 0.0, 1.0))
33
 
34
+ def gauge_invariant(self, discrepancy: float) -> float:
35
+ """
36
+ Fuzzy predicate: gauge_invariant(v)
37
+ Evaluates the truth value in [0.0, 1.0] that local gauge symmetry is perfectly preserved.
38
+ $$I(\\text{gauge\\_invariant}(v)) = e^{-\\beta \\cdot \\text{discrepancy}}$$
39
+ """
40
+ truth = np.exp(-self.beta * discrepancy)
41
+ return float(np.clip(truth, 0.0, 1.0))
42
+
43
+ def evaluate_fuzzy_satisfaction(self, p_unitary: float, p_energy: float, p_gauge: float = 1.0) -> float:
44
  """
45
  Evaluates the global fuzzy logic satisfaction using Product t-norm:
46
+ $$I(\\phi \\land \\psi \\land \\chi) = I(\\phi) \\times I(\\psi) \\times I(\\chi)$$
47
  """
48
+ return float(p_unitary * p_energy * p_gauge)
49
+