doc-src/TutorialI/Inductive/document/Advanced.tex
author paulson
Wed, 21 Feb 2001 12:57:55 +0100
changeset 11173 094b76968484
parent 10950 aa788fcb75a5
child 11187 c6e49929e544
permissions -rw-r--r--
revisions in response to comments by Tobias
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
     1
%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
     2
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
     3
\def\isabellecontext{Advanced}
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
     4
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
     5
\isacommand{theory}\ Advanced\ =\ Even:\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
     6
\isanewline
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
     7
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
     8
\isacommand{datatype}\ 'f\ gterm\ =\ Apply\ 'f\ "'f\ gterm\ list"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
     9
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    10
\isacommand{datatype}\ integer_op\ =\ Number\ int\ |\ UnaryMinus\ |\ Plus\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    11
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    12
\isacommand{consts}\ gterms\ ::\ "'f\ set\ \isasymRightarrow \ 'f\ gterm\ set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    13
\isacommand{inductive}\ "gterms\ F"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    14
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    15
step[intro!]:\ "\isasymlbrakk \isasymforall t\ \isasymin \ set\ args.\ t\ \isasymin \ gterms\ F;\ \ f\ \isasymin \ F\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    16
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isasymLongrightarrow \ (Apply\ f\ args)\ \isasymin \ gterms\ F"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    17
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    18
\isacommand{lemma}\ gterms_mono:\ "F\isasymsubseteq G\ \isasymLongrightarrow \ gterms\ F\ \isasymsubseteq \ gterms\ G"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    19
\isacommand{apply}\ clarify\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    20
\isacommand{apply}\ (erule\ gterms.induct)
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    21
\begin{isamarkuptxt}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    22
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    23
\ 1.\ \isasymAnd x\ args\ f.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    24
\isaindent{\ 1.\ \ \ \ }\isasymlbrakk F\ \isasymsubseteq \ G;\ \isasymforall t\isasymin set\ args.\ t\ \isasymin \ gterms\ F\ \isasymand \ t\ \isasymin \ gterms\ G;\ f\ \isasymin \ F\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    25
\isaindent{\ 1.\ \ \ \ }\isasymLongrightarrow \ Apply\ f\ args\ \isasymin \ gterms\ G%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    26
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    27
\end{isamarkuptxt}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    28
\isacommand{apply}\ blast\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    29
\isacommand{done}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    30
\begin{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    31
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    32
\ \ \ \ \ \isasymlbrakk a\ \isasymin \ even;\ a\ =\ 0\ \isasymLongrightarrow \ P;\ \isasymAnd n.\ \isasymlbrakk a\ =\ Suc\ (Suc\ n);\ n\ \isasymin \ even\isasymrbrakk \ \isasymLongrightarrow \ P\isasymrbrakk \ \isasymLongrightarrow \ P%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    33
\rulename{even.cases}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    34
\end{isabelle}
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    35
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    36
Just as a demo I include
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    37
the two forms that Markus has made available. First the one for binding the
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    38
result to a name%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    39
\end{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    40
\isacommand{inductive_cases}\ Suc_Suc_cases\ [elim!]:\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    41
\ \ "Suc(Suc\ n)\ \isasymin \ even"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
    42
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    43
\isacommand{thm}\ Suc_Suc_cases%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    44
\begin{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    45
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    46
\ \ \ \ \ \isasymlbrakk Suc\ (Suc\ n)\ \isasymin \ even;\ n\ \isasymin \ even\ \isasymLongrightarrow \ P\isasymrbrakk \ \isasymLongrightarrow \ P%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    47
\rulename{Suc_Suc_cases}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    48
\end{isabelle}
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    49
10457
dd669bda2b0c updated;
wenzelm
parents: 10365
diff changeset
    50
and now the one for local usage:%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    51
\end{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    52
\isacommand{lemma}\ "Suc(Suc\ n)\ \isasymin \ even\ \isasymLongrightarrow \ P\ n"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    53
\isacommand{apply}\ (ind_cases\ "Suc(Suc\ n)\ \isasymin \ even")\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    54
\isacommand{oops}\isanewline
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    55
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    56
\isacommand{inductive_cases}\ gterm_Apply_elim\ [elim!]:\ "Apply\ f\ args\ \isasymin \ gterms\ F"
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    57
\begin{isamarkuptext}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    58
this is what we get:
10457
dd669bda2b0c updated;
wenzelm
parents: 10365
diff changeset
    59
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    60
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    61
\ \ \ \ \ \isasymlbrakk Apply\ f\ args\ \isasymin \ gterms\ F;\ \isasymlbrakk \isasymforall t\isasymin set\ args.\ t\ \isasymin \ gterms\ F;\ f\ \isasymin \ F\isasymrbrakk \ \isasymLongrightarrow \ P\isasymrbrakk \ \isasymLongrightarrow \ P%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    62
\rulename{gterm_Apply_elim}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    63
\end{isabelle}
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    64
\end{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    65
\isacommand{lemma}\ gterms_IntI\ [rule_format,\ intro!]:\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    66
\ \ \ \ \ "t\ \isasymin \ gterms\ F\ \isasymLongrightarrow \ t\ \isasymin \ gterms\ G\ \isasymlongrightarrow \ t\ \isasymin \ gterms\ (F\isasyminter G)"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    67
\isacommand{apply}\ (erule\ gterms.induct)
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    68
\begin{isamarkuptxt}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    69
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    70
\ 1.\ \isasymAnd args\ f.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    71
\isaindent{\ 1.\ \ \ \ }\isasymlbrakk \isasymforall t\isasymin set\ args.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    72
\isaindent{\ 1.\ \ \ \ \isasymlbrakk \ \ \ }t\ \isasymin \ gterms\ F\ \isasymand \ (t\ \isasymin \ gterms\ G\ \isasymlongrightarrow \ t\ \isasymin \ gterms\ (F\ \isasyminter \ G));\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    73
\isaindent{\ 1.\ \ \ \ \ \ \ }f\ \isasymin \ F\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    74
\isaindent{\ 1.\ \ \ \ }\isasymLongrightarrow \ Apply\ f\ args\ \isasymin \ gterms\ G\ \isasymlongrightarrow \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    75
\isaindent{\ 1.\ \ \ \ \isasymLongrightarrow \ }Apply\ f\ args\ \isasymin \ gterms\ (F\ \isasyminter \ G)
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    76
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    77
\end{isamarkuptxt}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    78
\isacommand{apply}\ blast\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    79
\isacommand{done}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    80
\begin{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    81
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    82
\ \ \ \ \ mono\ f\ \isasymLongrightarrow \ f\ (A\ \isasyminter \ B)\ \isasymsubseteq \ f\ A\ \isasyminter \ f\ B%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    83
\rulename{mono_Int}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    84
\end{isabelle}
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    85
\end{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    86
\isacommand{lemma}\ gterms_Int_eq\ [simp]:\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    87
\ \ \ \ \ "gterms\ (F\isasyminter G)\ =\ gterms\ F\ \isasyminter \ gterms\ G"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    88
\isacommand{by}\ (blast\ intro!:\ mono_Int\ monoI\ gterms_mono)\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    89
\isanewline
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    90
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    91
\isacommand{consts}\ integer_arity\ ::\ "integer_op\ \isasymRightarrow \ nat"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    92
\isacommand{primrec}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    93
"integer_arity\ (Number\ n)\ \ \ \ \ \ \ \ =\ \#0"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    94
"integer_arity\ UnaryMinus\ \ \ \ \ \ \ \ =\ \#1"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    95
"integer_arity\ Plus\ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ \#2"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
    96
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    97
\isacommand{consts}\ well_formed_gterm\ ::\ "('f\ \isasymRightarrow \ nat)\ \isasymRightarrow \ 'f\ gterm\ set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
    98
\isacommand{inductive}\ "well_formed_gterm\ arity"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
    99
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   100
step[intro!]:\ "\isasymlbrakk \isasymforall t\ \isasymin \ set\ args.\ t\ \isasymin \ well_formed_gterm\ arity;\ \ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   101
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ length\ args\ =\ arity\ f\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   102
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isasymLongrightarrow \ (Apply\ f\ args)\ \isasymin \ well_formed_gterm\ arity"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   103
\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   104
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   105
\isacommand{consts}\ well_formed_gterm'\ ::\ "('f\ \isasymRightarrow \ nat)\ \isasymRightarrow \ 'f\ gterm\ set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   106
\isacommand{inductive}\ "well_formed_gterm'\ arity"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   107
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   108
step[intro!]:\ "\isasymlbrakk args\ \isasymin \ lists\ (well_formed_gterm'\ arity);\ \ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   109
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ length\ args\ =\ arity\ f\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   110
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isasymLongrightarrow \ (Apply\ f\ args)\ \isasymin \ well_formed_gterm'\ arity"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   111
\isakeyword{monos}\ lists_mono\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   112
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   113
\isacommand{lemma}\ "well_formed_gterm\ arity\ \isasymsubseteq \ well_formed_gterm'\ arity"\isanewline
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   114
\isacommand{apply}\ clarify%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   115
\begin{isamarkuptxt}
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   116
The situation after clarify
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   117
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   118
\ 1.\ \isasymAnd x.\ x\ \isasymin \ well_formed_gterm\ arity\ \isasymLongrightarrow \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   119
\isaindent{\ 1.\ \isasymAnd x.\ }x\ \isasymin \ well_formed_gterm'\ arity%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   120
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   121
\end{isamarkuptxt}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   122
\isacommand{apply}\ (erule\ well_formed_gterm.induct)
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   123
\begin{isamarkuptxt}
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   124
note the induction hypothesis!
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   125
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   126
\ 1.\ \isasymAnd x\ args\ f.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   127
\isaindent{\ 1.\ \ \ \ }\isasymlbrakk \isasymforall t\isasymin set\ args.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   128
\isaindent{\ 1.\ \ \ \ \isasymlbrakk \ \ \ }t\ \isasymin \ well_formed_gterm\ arity\ \isasymand \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   129
\isaindent{\ 1.\ \ \ \ \isasymlbrakk \ \ \ }t\ \isasymin \ well_formed_gterm'\ arity;\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   130
\isaindent{\ 1.\ \ \ \ \ \ \ }length\ args\ =\ arity\ f\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   131
\isaindent{\ 1.\ \ \ \ }\isasymLongrightarrow \ Apply\ f\ args\ \isasymin \ well_formed_gterm'\ arity%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   132
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   133
\end{isamarkuptxt}
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   134
\isacommand{apply}\ auto\isanewline
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   135
\isacommand{done}\isanewline
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   136
\isanewline
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   137
\isanewline
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   138
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   139
\isacommand{lemma}\ "well_formed_gterm'\ arity\ \isasymsubseteq \ well_formed_gterm\ arity"\isanewline
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   140
\isacommand{apply}\ clarify%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   141
\begin{isamarkuptxt}
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   142
The situation after clarify
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   143
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   144
\ 1.\ \isasymAnd x.\ x\ \isasymin \ well_formed_gterm'\ arity\ \isasymLongrightarrow \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   145
\isaindent{\ 1.\ \isasymAnd x.\ }x\ \isasymin \ well_formed_gterm\ arity%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   146
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   147
\end{isamarkuptxt}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   148
\isacommand{apply}\ (erule\ well_formed_gterm'.induct)
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   149
\begin{isamarkuptxt}
10878
b254d5ad6dd4 auto update
paulson
parents: 10696
diff changeset
   150
note the induction hypothesis!
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   151
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   152
\ 1.\ \isasymAnd x\ args\ f.\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   153
\isaindent{\ 1.\ \ \ \ }\isasymlbrakk args\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   154
\isaindent{\ 1.\ \ \ \ \isasymlbrakk }\isasymin \ lists\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   155
\isaindent{\ 1.\ \ \ \ \isasymlbrakk \isasymin \ \ }(well_formed_gterm'\ arity\ \isasyminter \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   156
\isaindent{\ 1.\ \ \ \ \isasymlbrakk \isasymin \ \ (}\isacharbraceleft x.\ x\ \isasymin \ well_formed_gterm\ arity\isacharbraceright );\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   157
\isaindent{\ 1.\ \ \ \ \ \ \ }length\ args\ =\ arity\ f\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   158
\isaindent{\ 1.\ \ \ \ }\isasymLongrightarrow \ Apply\ f\ args\ \isasymin \ well_formed_gterm\ arity%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   159
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   160
\end{isamarkuptxt}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   161
\isacommand{apply}\ auto\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   162
\isacommand{done}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   163
\begin{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   164
\begin{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   165
\ \ \ \ \ lists\ (A\ \isasyminter \ B)\ =\ lists\ A\ \isasyminter \ lists\ B%
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   166
\end{isabelle}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   167
\end{isamarkuptext}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   168
%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   169
\begin{isamarkuptext}
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   170
the rest isn't used: too complicated.  OK for an exercise though.%
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   171
\end{isamarkuptext}
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   172
\isacommand{consts}\ integer_signature\ ::\ "(integer_op\ *\ (unit\ list\ *\ unit))\ set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   173
\isacommand{inductive}\ "integer_signature"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   174
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   175
Number:\ \ \ \ \ "(Number\ n,\ \ \ ([],\ ()))\ \isasymin \ integer_signature"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   176
UnaryMinus:\ "(UnaryMinus,\ ([()],\ ()))\ \isasymin \ integer_signature"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   177
Plus:\ \ \ \ \ \ \ "(Plus,\ \ \ \ \ \ \ ([(),()],\ ()))\ \isasymin \ integer_signature"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   178
\isanewline
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   179
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   180
\isacommand{consts}\ well_typed_gterm\ ::\ "('f\ \isasymRightarrow \ 't\ list\ *\ 't)\ \isasymRightarrow \ ('f\ gterm\ *\ 't)set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   181
\isacommand{inductive}\ "well_typed_gterm\ sig"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   182
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   183
step[intro!]:\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   184
\ \ \ \ "\isasymlbrakk \isasymforall pair\ \isasymin \ set\ args.\ pair\ \isasymin \ well_typed_gterm\ sig;\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   185
\ \ \ \ \ \ sig\ f\ =\ (map\ snd\ args,\ rtype)\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   186
\ \ \ \ \ \isasymLongrightarrow \ (Apply\ f\ (map\ fst\ args),\ rtype)\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   187
\ \ \ \ \ \ \ \ \ \isasymin \ well_typed_gterm\ sig"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   188
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   189
\isacommand{consts}\ well_typed_gterm'\ ::\ "('f\ \isasymRightarrow \ 't\ list\ *\ 't)\ \isasymRightarrow \ ('f\ gterm\ *\ 't)set"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   190
\isacommand{inductive}\ "well_typed_gterm'\ sig"\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   191
\isakeyword{intros}\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   192
step[intro!]:\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   193
\ \ \ \ "\isasymlbrakk args\ \isasymin \ lists(well_typed_gterm'\ sig);\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   194
\ \ \ \ \ \ sig\ f\ =\ (map\ snd\ args,\ rtype)\isasymrbrakk \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   195
\ \ \ \ \ \isasymLongrightarrow \ (Apply\ f\ (map\ fst\ args),\ rtype)\ \isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   196
\ \ \ \ \ \ \ \ \ \isasymin \ well_typed_gterm'\ sig"\isanewline
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   197
\isakeyword{monos}\ lists_mono\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   198
\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   199
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   200
\isacommand{lemma}\ "well_typed_gterm\ sig\ \isasymsubseteq \ well_typed_gterm'\ sig"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   201
\isacommand{apply}\ clarify\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   202
\isacommand{apply}\ (erule\ well_typed_gterm.induct)\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   203
\isacommand{apply}\ auto\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   204
\isacommand{done}\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   205
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   206
\isacommand{lemma}\ "well_typed_gterm'\ sig\ \isasymsubseteq \ well_typed_gterm\ sig"\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   207
\isacommand{apply}\ clarify\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   208
\isacommand{apply}\ (erule\ well_typed_gterm'.induct)\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   209
\isacommand{apply}\ auto\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   210
\isacommand{done}\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   211
\isanewline
10469
7813f5ccfb18 auto update
paulson
parents: 10457
diff changeset
   212
\isanewline
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   213
\isacommand{end}\isanewline
a17cf465d29a auto generated
paulson
parents:
diff changeset
   214
\isanewline
11173
094b76968484 revisions in response to comments by Tobias
paulson
parents: 10950
diff changeset
   215
\end{isabelle}
10365
a17cf465d29a auto generated
paulson
parents:
diff changeset
   216
%%% Local Variables:
a17cf465d29a auto generated
paulson
parents:
diff changeset
   217
%%% mode: latex
a17cf465d29a auto generated
paulson
parents:
diff changeset
   218
%%% TeX-master: "root"
a17cf465d29a auto generated
paulson
parents:
diff changeset
   219
%%% End: