Skip to content

Commit 73a6f3d

Browse files
committed
Replay "Issue 2100 follow up (#2574)"
This reverts commit 97494af.
1 parent 619f6f3 commit 73a6f3d

File tree

3 files changed

+51
-26
lines changed

3 files changed

+51
-26
lines changed

kore/src/Kore/ASTVerifier/SentenceVerifier.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import Kore.ASTVerifier.PatternVerifier as PatternVerifier
4848
import Kore.ASTVerifier.SortVerifier
4949
import Kore.ASTVerifier.Verifier
5050
import qualified Kore.Attribute.Axiom as Attribute (
51-
Axiom (..),
51+
Axiom,
5252
parseAxiomAttributes,
5353
)
5454
import qualified Kore.Attribute.Hook as Attribute

kore/src/Kore/Equation/Sentence.hs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,38 @@ data MatchEquationError variable
6565
deriving anyclass (Debug)
6666

6767
instance InternalVariable variable => Pretty (MatchEquationError variable) where
68-
pretty (NotEquation term) = "The given term is not an equation:\n" <> unparse term
69-
pretty (RequiresError notPred) = "The equation's requires clause is not a predicate:\n" <> pretty notPred
70-
pretty (ArgumentError notPred) = "The equation's argument clause is not a predicate:\n" <> pretty notPred
71-
pretty (AntiLeftError notPred) = "The equation's anti-left clause is not a predicate:\n" <> pretty notPred
72-
pretty (EnsuresError notPred) = "The equation's ensures clause is not a predicate:\n" <> pretty notPred
73-
pretty FunctionalAxiom = "The term is a functional axiom"
74-
pretty ConstructorAxiom = "The term is a constructor axiom"
75-
pretty SubsortAxiom = "The term is a subsort axiom"
68+
pretty (NotEquation term) =
69+
Pretty.vsep
70+
[ "The given term is not an equation:"
71+
, unparse term
72+
]
73+
pretty (RequiresError notPred) =
74+
Pretty.vsep
75+
[ "The equation's requires clause is not a predicate:"
76+
, pretty notPred
77+
, "This is a frontend bug. Please report this error at https://github.com/kframework/k/issues."
78+
]
79+
pretty (ArgumentError notPred) =
80+
Pretty.vsep
81+
[ "The equation's argument clause is not a predicate:"
82+
, pretty notPred
83+
, "This is a frontend bug. Please report this error at https://github.com/kframework/k/issues."
84+
]
85+
pretty (AntiLeftError notPred) =
86+
Pretty.vsep
87+
[ "The equation's anti-left clause is not a predicate:"
88+
, pretty notPred
89+
, "This is a frontend bug. Please report this error at https://github.com/kframework/k/issues."
90+
]
91+
pretty (EnsuresError notPred) =
92+
Pretty.vsep
93+
[ "The equation's ensures clause is not a predicate:"
94+
, pretty notPred
95+
, "This is a frontend bug. Please report this error at https://github.com/kframework/k/issues."
96+
]
97+
pretty FunctionalAxiom = "The term is a functional axiom."
98+
pretty ConstructorAxiom = "The term is a constructor axiom."
99+
pretty SubsortAxiom = "The term is a subsort axiom."
76100

77101
matchEquation ::
78102
forall variable.

kore/src/Kore/Equation/Validate.hs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ validateAxiom attrs verified =
113113
pack $
114114
show $
115115
Pretty.vsep
116-
[ "Head of LHS of Not Simplification axiom is not a non-constructor function symbol. This is the LHS symbol:"
116+
[ "Expected function symbol, but found constructor symbol:"
117117
, unparse sym
118118
]
119119

120120
checkVarFunctionArguments =
121121
failOnJust
122122
eq
123-
"LHS of NotSimplification axiom contains non-variable:"
123+
"Expected variable, but found:"
124124
$ asum $ getNotVar <$> termLikeF
125125

126126
getNotVar (TermLike.Var_ _) = Nothing
@@ -129,7 +129,7 @@ validateAxiom attrs verified =
129129
checkArg _ Nothing = return ()
130130
checkArg eq (Just arg) =
131131
traverse_
132-
( failOnJust eq "Found invalid subterm of Axiom equation argument:"
132+
( failOnJust eq "Found invalid subterm in argument of function equation:"
133133
. checkArgIn
134134
)
135135
$ Predicate.getMultiAndPredicate arg
@@ -144,20 +144,7 @@ validateAxiom attrs verified =
144144
_
145145
| TermLike.isConstructorLike term -> descend
146146
TermLike.App_ sym _
147-
| or
148-
[ Symbol.isConstructorLike sym
149-
, Symbol.isAnywhere sym && Symbol.isInjective sym
150-
, Map.isSymbolConcat sym
151-
, Map.isSymbolElement sym
152-
, Map.isSymbolUnit sym
153-
, Set.isSymbolConcat sym
154-
, Set.isSymbolElement sym
155-
, Set.isSymbolUnit sym
156-
, List.isSymbolConcat sym
157-
, List.isSymbolElement sym
158-
, List.isSymbolUnit sym
159-
] ->
160-
descend
147+
| isGoodSymbol sym -> descend
161148
| otherwise -> Just term
162149
TermLike.InternalBytes_ _ _ -> Nothing
163150
TermLike.InternalBool_ _ -> Nothing
@@ -170,6 +157,20 @@ validateAxiom attrs verified =
170157
_ -> Just term
171158
where
172159
_ :< termF = Recursive.project term
160+
isGoodSymbol sym =
161+
or
162+
[ Symbol.isConstructorLike sym
163+
, Symbol.isAnywhere sym && Symbol.isInjective sym
164+
, Map.isSymbolConcat sym
165+
, Map.isSymbolElement sym
166+
, Map.isSymbolUnit sym
167+
, Set.isSymbolConcat sym
168+
, Set.isSymbolElement sym
169+
, Set.isSymbolUnit sym
170+
, List.isSymbolConcat sym
171+
, List.isSymbolElement sym
172+
, List.isSymbolUnit sym
173+
]
173174
descend = asum $ findBadArgSubterm <$> termF
174175

175176
failOnJust _ _ Nothing = return ()

0 commit comments

Comments
 (0)