lean4-htt/tests/lean/run/grind_qpartition.lean
Leonardo de Moura 8cc4505bb1
feat: diagnostics for comm ring procedure in grind (#8224)
This PR adds diagnostic information for the commutative ring procedure
in `grind`.
2025-05-04 22:55:40 +00:00

28 lines
1.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

open Array
set_option grind.warning false
reset_grind_attrs%
attribute [grind] Vector.getElem_swap_of_ne
theorem qpartition_loop_spec₁ {n} (lt : αα → Bool) (lo hi : Nat)
(hlo : lo < n := by omega) (hhi : hi < n := by omega)
{ilo : lo ≤ i} {jh : j < n} {w : i ≤ j} (jhi : j ≤ hi := by omega)
(as : Vector α n) (hpivot : pivot = as[hi])
(q : ∀ k, (hk₁ : lo ≤ k) → (hk₂ : k < i) → lt as[k] as[hi]) (mid as')
(w_mid : mid = (qpartition.loop lt lo hi hhi pivot as i j ilo jh w).fst.1)
(hmid : mid < n)
(w_as : as' = (qpartition.loop lt lo hi hhi pivot as i j ilo jh w).2) :
∀ k, (h₁ : lo ≤ k) → (h₂ : k < mid) → lt as'[k] as'[mid] := by
sorry
grind_pattern qpartition_loop_spec₁ =>
qpartition.loop lt lo hi hhi pivot as i j ilo jh w, as'[k], as'[mid]
example {n} (lt : αα → Bool) (lo hi : Nat)
(hlo : lo < n := by omega) (hhi : hi < n := by omega) (w : lo ≤ hi := by omega)
(as : Vector α n) (mid as')
(w_mid : mid = (qpartition as lt lo hi hlo hhi).fst.1)
(hmid : mid < n)
(w_as : as' = (qpartition as lt lo hi hlo hhi).2) :
∀ i, (h₁ : lo ≤ i) → (h₂ : i < mid) → lt as'[i] as'[mid] := by
grind [qpartition]