import Problem455Undecidability /-! My own restatement of Volkov Problem 2.1 (negative answer), written from scratch with my own definitions of table validity, table evaluation, semantic consequence and "finitely based". Only the syntax type of binary terms (`var i` | `mul s t`, no constants) and Mathlib's `Partrec` are reused. The bridge to the claimant's endpoint is proved below. -/ namespace MyCheck open P455BinaryTerms abbrev Tbl := List (List Nat) /-- product of i and j read off the Cayley table (0 outside the table) -/ def ent (M : Tbl) (i j : Nat) : Nat := (M.getD i []).getD j 0 /-- a nonempty square table, entries in range, associative -/ def IsSemigroupTable (M : Tbl) : Prop := M ≠ [] ∧ (∀ r ∈ M, r.length = M.length ∧ ∀ x ∈ r, x < M.length) ∧ ∀ a b c, a < M.length → b < M.length → c < M.length → ent M (ent M a b) c = ent M a (ent M b c) def evT (M : Tbl) (f : Nat → Nat) : Term → Nat | .var i => f i | .mul s t => ent M (evT M f s) (evT M f t) /-- s = t is an identity of the table: equal under every assignment into its elements -/ def Holds (M : Tbl) (s t : Term) : Prop := ∀ f : Nat → Nat, (∀ i, f i < M.length) → evT M f s = evT M f t def evA {A : Type} (mul : A → A → A) (f : Nat → A) : Term → A | .var i => f i | .mul s t => mul (evA mul f s) (evA mul f t) /-- s = t holds in every magma (hence every semigroup) satisfying all equations of R -/ def Cons (R : List (Term × Term)) (s t : Term) : Prop := ∀ (A : Type) (mul : A → A → A), (∀ p ∈ R, ∀ f : Nat → A, evA mul f p.1 = evA mul f p.2) → ∀ f : Nat → A, evA mul f s = evA mul f t def FinitelyBased (M : Tbl) : Prop := ∃ R : List (Term × Term), ∀ s t, Holds M s t ↔ Cons R s t -- bridge lemmas theorem ent_eq (M : Tbl) (i j : Nat) : ent M i j = P455Table.entry M i j := by simp [ent, P455Table.entry, List.getD_eq_getElem?_getD] theorem valid_of (M : Tbl) (h : P455TableSemantics.SemigroupTable M) : IsSemigroupTable M := by obtain ⟨pos, sq, assoc⟩ := h refine ⟨?_, sq, ?_⟩ · intro e; subst e; simp at pos · intro a b c ha hb hc; simp only [ent_eq]; exact assoc a b c ha hb hc theorem val_eq {M : Tbl} (ok : P455TableSemantics.SemigroupTable M) (a : Nat → Fin M.length) (s : Term) : (P455StatementAudit.val ok a s).val = evT M (fun x => (a x).val) s := by induction s with | var i => rfl | mul s t ihs iht => simp only [P455StatementAudit.val, P455StatementAudit.product, evT, ihs, iht, ent_eq] theorem holds_iff {M : Tbl} (ok : P455TableSemantics.SemigroupTable M) (s t : Term) : Holds M s t ↔ ∀ a : Nat → Fin M.length, P455StatementAudit.val ok a s = P455StatementAudit.val ok a t := by constructor · intro h a; apply Fin.ext; rw [val_eq, val_eq]; exact h _ (fun i => (a i).isLt) · intro h f hf have := congrArg Fin.val (h (fun i => ⟨f i, hf i⟩)) simpa only [val_eq] using this theorem evA_eq {A : Type} (mul : A → A → A) (f : Nat → A) (s : Term) : evA mul f s = P455SemanticConsequence.ev mul f s := by induction s with | var i => rfl | mul s t ihs iht => simp [evA, P455SemanticConsequence.ev, ihs, iht] theorem cons_iff (R : List (Term × Term)) (s t : Term) : Cons R s t ↔ P455SemanticConsequence.entails (fun u v => (u, v) ∈ R) s t := by simp only [Cons, P455SemanticConsequence.entails, P455SemanticConsequence.satisfies, evA_eq] constructor · intro h A mul hR; exact h A mul (fun p hp f => hR p.1 p.2 hp f) · intro h A mul hR; exact h A mul (fun u v huv f => hR (u, v) huv f) /-- Volkov Problem 2.1 / Tarski's problem for semigroups, negative answer, in my own words. -/ theorem no_algorithm : ¬ ∃ p : Tbl →. Bool, Partrec p ∧ ∀ M, IsSemigroupTable M → ∃ b ∈ p M, (b = true ↔ FinitelyBased M) := by rintro ⟨p, hp, hyp⟩ apply P455Undecidability.finite_semigroup_finite_basis_undecidable refine ⟨p, hp, fun M ok => ?_⟩ obtain ⟨b, hb, spec⟩ := hyp M (valid_of M ok) refine ⟨b, hb, spec.trans ?_⟩ simp only [FinitelyBased, holds_iff ok, cons_iff] end MyCheck #print axioms MyCheck.no_algorithm #print axioms P455Undecidability.finite_semigroup_finite_basis_undecidable