Stream: Beginner Questions

Topic: quickcheck found a counter-example


view this post on Zulip Lekhani Ray (Jul 26 2022 at 19:48):

Hello,

I am trying to solve the following lemma

lemma (in th8b) lem_mul_2: "times (suc m) n = plus (times n m) m"
  apply(induction n rule: p1)

p1 lookd like (also added other code for context

locale th1 =
  fixes
    zero :: "'a"
    and suc :: "'a ⇒ 'a"
  assumes
    "suc n ≠ zero"
    and "suc n = suc m ⟶ n = m"

locale th2 = th1 +
  fixes
    plus :: "'a ⇒ 'a ⇒ 'a"
  assumes
     arith_1: "plus n zero = n"
    and plus_suc: "plus n (suc m) = suc ( plus n m)"

locale th3 = th2 +
  fixeslocale th8b = th3 +
  assumes p1:
"⋀x. ((⋀x . p zero ∧ ( p x ⟶ p (suc x)))) ⟹ p x"

    times :: "'a ⇒ 'a ⇒ 'a"
  assumes
    times_1: "times n zero = zero"
    and times_suc: "times n (suc m) =  plus (times n m) n"

locale th8b = th3 +
  assumes p1:
"⋀x. ((⋀x . p zero ∧ ( p x ⟶ p (suc x)))) ⟹ p x"

However, quickcheck gives me a counter-example

m = 0
x__ = 0

which obviously tells me something is wrong with the way I have written the lemma. However
a. I cannot pinpoint the mistake
b. Logically, I do not see the mistake.

Thank you in advance for the help!


Last updated: Apr 25 2024 at 20:15 UTC