lean4-htt/tests/lean/run/lcnfCache.lean
jrr6 62f14514da
refactor: update built-in tactic error messages (#9633)
This PR updates various error messages produced by or associated with
built-in tactics and adapts their formatting to current conventions.
2025-07-31 14:16:57 +00:00

38 lines
1.3 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.

def List.pwFilter {α} (R : αα → Prop) [DecidableRel R] (l : List α) : List α :=
l.foldr (fun x IH => if ∀ y ∈ IH, R x y then x :: IH else IH) []
def List.dedup {α} [DecidableEq α] : List α → List α :=
List.pwFilter (· ≠ ·)
def Multiset.{u} : Type u → Type u :=
fun α => Quotient (List.isSetoid α)
def Multiset.ofList {α} : List α → Multiset α :=
Quot.mk _
def Multiset.map {α β} (f : α → β) (s : Multiset α) : Multiset β :=
Quot.liftOn s (fun l : List α => Multiset.ofList (l.map f)) fun _l₁ _l₂ p => Quot.sound (p.map f)
def Multiset.dedup {α} [DecidableEq α] (s : Multiset α) : Multiset α :=
Quot.liftOn s (fun l => Multiset.ofList l.dedup) fun l₁ l₂ p => Quot.sound (by sorry)
def Multiset.card {α} : Multiset α → Nat := Quot.lift List.length fun _l₁ _l₂ => List.Perm.length_eq
def test (_ : Unit) : Bool :=
let m := Multiset.ofList [0, 1]
let m := Multiset.map (fun i => i) m
let m := m.dedup
m.card < 2
/--
error: Tactic `native_decide` evaluated that the proposition
(let p := fun i => i;
(Multiset.map (fun i => i) (Multiset.ofList [0, 1])).dedup).card <
2
is false
-/
#guard_msgs in
theorem claim :
( let p : Nat → Nat := fun i => i;
(Multiset.map (fun i => i) (Multiset.ofList [0,1])).dedup).card < 2 := by
native_decide