From 1ecbf45d707b0ae4a03ec2291e9d88e5d12ad729 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Wed, 4 Nov 2026 03:00:16 +0100 Subject: [PATCH] Embed Bool functions of six arguments The Bool embedding's function lemmas stop at five arguments. Past that, a function keeps its Bool type while its applications are embedded as propositions, and the goal fails to elaborate or reaches cvc5 malformed. Add the sixth lemmas of both families, copies of the fifth, and test both families at five and six arguments. Adding embedding lemmas changes the order in which counter-examples list their assignments, so the Assoc and Comm expected files are regenerated. --- Smt/Preprocess/Embedding/Bool.lean | 22 ++++++++++++++++++++++ Test/Bool/Arity6.expected | 0 Test/Bool/Arity6.lean | 17 +++++++++++++++++ Test/Bool/Assoc.expected | 4 ++-- Test/Bool/Comm.expected | 2 +- 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 Test/Bool/Arity6.expected create mode 100644 Test/Bool/Arity6.lean diff --git a/Smt/Preprocess/Embedding/Bool.lean b/Smt/Preprocess/Embedding/Bool.lean index 62ca0e39..746f8b62 100644 --- a/Smt/Preprocess/Embedding/Bool.lean +++ b/Smt/Preprocess/Embedding/Bool.lean @@ -174,6 +174,17 @@ theorem forall_bool_in_as_prop₅ {p : (α₁ → α₂ → α₃ → α₄ → simp only [@Bool.decide_eq_true] at hf exact hf +@[embedding ↓] +theorem forall_bool_in_as_prop₆ {p : (α₁ → α₂ → α₃ → α₄ → α₅ → Bool → α₆) → Prop} : + (∀ f : α₁ → α₂ → α₃ → α₄ → α₅ → Bool → α₆, p f) ↔ (∀ f : α₁ → α₂ → α₃ → α₄ → α₅ → Prop → α₆, p fun a₁ a₂ a₃ a₄ a₅ b => f a₁ a₂ a₃ a₄ a₅ b) := by + constructor + · intro h f + apply h + · intro h f + have hf := h fun a₁ a₂ a₃ a₄ a₅ x => f a₁ a₂ a₃ a₄ a₅ x + simp only [@Bool.decide_eq_true] at hf + exact hf + @[embedding ↓] theorem forall_bool_out_as_prop₁ {p : (α₁ → Bool) → Prop} : (∀ f : α₁ → Bool, p f) ↔ (∀ f : α₁ → Prop, p (fun a₁ => f a₁)) := by @@ -229,4 +240,15 @@ theorem forall_bool_out_as_prop₅ {p : (α₁ → α₂ → α₃ → α₄ → simp only [@Bool.decide_eq_true] at hf exact hf +@[embedding ↓] +theorem forall_bool_out_as_prop₆ {p : (α₁ → α₂ → α₃ → α₄ → α₅ → α₆ → Bool) → Prop} : + (∀ f : α₁ → α₂ → α₃ → α₄ → α₅ → α₆ → Bool, p f) ↔ (∀ f : α₁ → α₂ → α₃ → α₄ → α₅ → α₆ → Prop, p (fun a₁ a₂ a₃ a₄ a₅ a₆ => f a₁ a₂ a₃ a₄ a₅ a₆)) := by + constructor + · intro h f + apply h + · intro h f + have hf := h (fun a₁ a₂ a₃ a₄ a₅ a₆ => f a₁ a₂ a₃ a₄ a₅ a₆) + simp only [@Bool.decide_eq_true] at hf + exact hf + end Smt.Preprocess.Embedding diff --git a/Test/Bool/Arity6.expected b/Test/Bool/Arity6.expected new file mode 100644 index 00000000..e69de29b diff --git a/Test/Bool/Arity6.lean b/Test/Bool/Arity6.lean new file mode 100644 index 00000000..d30fc93f --- /dev/null +++ b/Test/Bool/Arity6.lean @@ -0,0 +1,17 @@ +import Smt + +theorem out_arity_5 {α : Type} [Nonempty α] (r : α → α → α → α → α → Bool) (a b : α) + (h : ∀ x y z u v, r x y z u v = true → x ≠ y) (hab : r a b a b a = true) : a ≠ b := by + smt [h, hab] + +theorem out_arity_6 {α : Type} [Nonempty α] (r : α → α → α → α → α → α → Bool) (a b : α) + (h : ∀ x y z u v w, r x y z u v w = true → x ≠ y) (hab : r a b a b a b = true) : a ≠ b := by + smt [h, hab] + +theorem in_arity_5 {α : Type} [Nonempty α] (f : α → α → α → α → Bool → α) (a : α) + (h : ∀ x y z u (b : Bool), f x y z u b = x) : f a a a a true = a := by + smt [h] + +theorem in_arity_6 {α : Type} [Nonempty α] (f : α → α → α → α → α → Bool → α) (a : α) + (h : ∀ x y z u v (b : Bool), f x y z u v b = x) : f a a a a a true = a := by + smt [h] diff --git a/Test/Bool/Assoc.expected b/Test/Bool/Assoc.expected index 15b424ce..0c14ea54 100644 --- a/Test/Bool/Assoc.expected +++ b/Test/Bool/Assoc.expected @@ -1,6 +1,6 @@ Test/Bool/Assoc.lean:5:2: error: unable to prove goal, either it is false or you need to provide more facts. Here is a potential counter-example: - q = False - r = False f = fun _arg_1 _arg_2 => if _arg_1 then ¬_arg_2 else ¬_arg_1 ∧ ¬_arg_2 p = True + r = False + q = False diff --git a/Test/Bool/Comm.expected b/Test/Bool/Comm.expected index ac1acbfc..00797297 100644 --- a/Test/Bool/Comm.expected +++ b/Test/Bool/Comm.expected @@ -1,5 +1,5 @@ Test/Bool/Comm.lean:4:2: error: unable to prove goal, either it is false or you need to provide more facts. Here is a potential counter-example: q = True - f = fun _arg_1 _arg_2 => _arg_1 ∧ ¬_arg_2 p = False + f = fun _arg_1 _arg_2 => _arg_1 ∧ ¬_arg_2