@@ -153,6 +153,28 @@ public def mkPropagateEqTrueProof (u v : Expr) (k : Weight) (huv : Expr) (k' : W
153153 else
154154 mkPropagateEqTrueProofCore u v k huv k'
155155
156+ def mkPropagateSelfEqTrueProofOffset (u : Expr) (k : Weight) : OrderM Expr := do
157+ let declName := match k.strict with
158+ | false => ``Grind.Order.le_eq_true_k
159+ | true => ``Grind.Order.lt_eq_true_k
160+ let h ← mkOrdRingPrefix declName
161+ return mkApp3 h u (toExpr k.k) eagerReflBoolTrue
162+
163+ def mkPropagateSelfEqTrueProofCore (u : Expr) : OrderM Expr := do
164+ let h ← mkLePreorderPrefix ``Grind.Order.le_eq_true
165+ return mkApp h u
166+
167+ /--
168+ Constructs a proof of `e = True` where `e` is a term corresponding to the edge `u --(k) --> u`
169+ with `k` non-negative
170+ -/
171+ public def mkPropagateSelfEqTrueProof (u : Expr) (k : Weight) : OrderM Expr := do
172+ if (← isRing) then
173+ mkPropagateSelfEqTrueProofOffset u k
174+ else
175+ assert! !k.strict
176+ mkPropagateSelfEqTrueProofCore u
177+
156178/--
157179`u < v → (v ≤ u) = False
158180-/
@@ -184,6 +206,50 @@ public def mkPropagateEqFalseProof (u v : Expr) (k : Weight) (huv : Expr) (k' :
184206 else
185207 mkPropagateEqFalseProofCore u v k huv k'
186208
209+ def mkPropagateSelfEqFalseProofOffset (u : Expr) (k : Weight) : OrderM Expr := do
210+ let declName := match k.strict with
211+ | false => ``Grind.Order.le_eq_false_k
212+ | true => ``Grind.Order.lt_eq_false_k
213+ let h ← mkOrdRingPrefix declName
214+ return mkApp3 h u (toExpr k.k) eagerReflBoolTrue
215+
216+ def mkPropagateSelfEqFalseProofCore (u : Expr) : OrderM Expr := do
217+ let h ← mkLeLtPrefix ``Grind.Order.lt_eq_false
218+ return mkApp h u
219+
220+ /--
221+ Constructs a proof of `e = False` where `e` is a term corresponding to the edge `u --(k) --> u` and
222+ `k` is negative.
223+ -/
224+ public def mkPropagateSelfEqFalseProof (u : Expr) (k : Weight) : OrderM Expr := do
225+ if (← isRing) then
226+ mkPropagateSelfEqFalseProofOffset u k
227+ else
228+ assert! k.strict
229+ mkPropagateSelfEqFalseProofCore u
230+
231+ def mkSelfUnsatProofCore (u : Expr) (h : Expr) : OrderM Expr := do
232+ let hf ← mkLeLtPreorderPrefix ``Grind.Order.lt_unsat
233+ return mkApp2 hf u h
234+
235+ def mkSelfUnsatProofOffset (u : Expr) (k : Weight) (h : Expr) : OrderM Expr := do
236+ let declName := if k.strict then
237+ ``Grind.Order.lt_unsat_k
238+ else
239+ ``Grind.Order.le_unsat_k
240+ let hf ← mkOrdRingPrefix declName
241+ return mkApp4 hf u (toExpr k.k) eagerReflBoolTrue h
242+
243+ /--
244+ Returns a proof of `False` using
245+ `u --(k)--> u` with proof `h` where `k` is negative
246+ -/
247+ public def mkSelfUnsatProof (u : Expr) (k : Weight) (h : Expr) : OrderM Expr := do
248+ if (← isRing) then
249+ mkSelfUnsatProofOffset u k h
250+ else
251+ mkSelfUnsatProofCore u h
252+
187253def mkUnsatProofCore (u v : Expr) (k₁ : Weight) (h₁ : Expr) (k₂ : Weight) (h₂ : Expr) : OrderM Expr := do
188254 let h ← mkTransCoreProof u v u k₁.strict k₂.strict h₁ h₂
189255 assert! k₁.strict || k₂.strict
0 commit comments