0

Here is a theory I've taken from Isabelle Tutorial. It has ways to prove theorems but I was wondering how one would call the app function below with two lists.

theory ToyList
imports Main
begin
     datatype 'a list = Nil |  Cons 'a "'a list"

     fun app :: "'a list ⇒ 'a list ⇒ 'a list"  where 
                 "app Nil ys   = ys" |
                 "app (Cons x xs) ys = Cons x (app xs ys)"

I tried theorem app_test[simp] : "app (xs @ ys ) @ zs = xs @ ys @ zs" and other ways but didn't work.

bazinga
  • 983
  • 6
  • 9
  • 2
    What do you mean by "call"? What do you want to do? Evaluate the function on two concrete example lists? Then you can do something like `value "app (Cons 1 Nil) (Cons 2 Nil)"` – Manuel Eberl May 25 '15 at 10:06
  • I mean how do I use the app function with lists? Yes, I mean evaluate on example lists. – bazinga May 25 '15 at 13:48
  • As I said: you can use the `value` command, which I am sure is explained in the tutorial as well. You can also set up a lemma like `app (Cons 1 Nil) (Cons 2 Nil) = Cons 1 (Cons 2 Nil)` and prove it with `simp`. – Manuel Eberl May 26 '15 at 05:34

0 Answers0