Attic/MyInduction.thy
author Chengsong
Tue, 08 Nov 2022 23:24:54 +0000
changeset 621 17c7611fb0a9
parent 95 a33d3040bf7e
permissions -rw-r--r--
chap6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
fahadausaf <fahad.ausaf@icloud.com>
parents:
diff changeset
     1
theory MyInduction
fahadausaf <fahad.ausaf@icloud.com>
parents:
diff changeset
     2
imports Main
fahadausaf <fahad.ausaf@icloud.com>
parents:
diff changeset
     3
begin
29
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     4
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     5
fun itrev :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" where
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     6
"itrev [] ys = ys" |
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     7
"itrev (x#xs) ys = itrev xs (x#ys)"
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     8
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
     9
lemma "itrev xs [] = rev xs"
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    10
apply(induction xs)
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    11
apply(auto)
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    12
oops
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    13
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    14
lemma "itrev xs ys = rev xs @ ys"
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    15
apply(induction xs arbitrary: ys)
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    16
apply auto
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    17
done
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    18
2345ba5b4264 Proof Automation
fahadausaf <fahad.ausaf@icloud.com>
parents: 28
diff changeset
    19