Paper/Paper.thy
changeset 1746 ec0afa89aab3
parent 1743 925a5e9aa832
child 1747 4abb95a7264b
equal deleted inserted replaced
1745:26c4653d76d1 1746:ec0afa89aab3
    35 
    35 
    36 
    36 
    37 section {* Introduction *}
    37 section {* Introduction *}
    38 
    38 
    39 text {*
    39 text {*
    40   @{text "(1, (2, 3))"}
    40 %%%  @{text "(1, (2, 3))"}
    41 
    41 
    42   So far, Nominal Isabelle provides a mechanism for constructing
    42   So far, Nominal Isabelle provides a mechanism for constructing
    43   alpha-equated terms, for example
    43   alpha-equated terms, for example
    44 
    44 
    45   \begin{center}
    45   \begin{center}
  1202   whether the @{text "x\<^isub>i"} is the body of one or more binding clauses. 
  1202   whether the @{text "x\<^isub>i"} is the body of one or more binding clauses. 
  1203   In this case we first calculate the set @{text "bnds"} as follows: 
  1203   In this case we first calculate the set @{text "bnds"} as follows: 
  1204   either the corresponding binders are all shallow or there is a single deep binder.
  1204   either the corresponding binders are all shallow or there is a single deep binder.
  1205   In the former case we take @{text bnds} to be the union of all shallow 
  1205   In the former case we take @{text bnds} to be the union of all shallow 
  1206   binders; in the latter case, we just take the set of atoms specified by the 
  1206   binders; in the latter case, we just take the set of atoms specified by the 
  1207   corrsponding binding function. The value for @{text "x\<^isub>i"} is then given by:
  1207   corresponding binding function. The value for @{text "x\<^isub>i"} is then given by:
  1208   %
  1208   %
  1209   \begin{equation}\label{deepbody}
  1209   \begin{equation}\label{deepbody}
  1210   \mbox{%
  1210   \mbox{%
  1211   \begin{tabular}{c@ {\hspace{2mm}}p{7cm}}
  1211   \begin{tabular}{c@ {\hspace{2mm}}p{7cm}}
  1212   $\bullet$ & @{text "{atom x\<^isub>i} - bnds"} provided @{term "x\<^isub>i"} is an atom\\
  1212   $\bullet$ & @{text "{atom x\<^isub>i} - bnds"} provided @{term "x\<^isub>i"} is an atom\\
  1293   "Let"}-clause we want to bind all atoms given by @{text "set (bn as)"} in
  1293   "Let"}-clause we want to bind all atoms given by @{text "set (bn as)"} in
  1294   @{text t}. Therefore we have to subtract @{text "set (bn as)"} from @{text
  1294   @{text t}. Therefore we have to subtract @{text "set (bn as)"} from @{text
  1295   "fv\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are
  1295   "fv\<^bsub>trm\<^esub> t"}. However, we also need to add all atoms that are
  1296   free in @{text "as"}. This is what the purpose of the function @{text
  1296   free in @{text "as"}. This is what the purpose of the function @{text
  1297   "fv\<^bsub>bn\<^esub>"} is.  In contrast, in @{text "Let_rec"} we have a
  1297   "fv\<^bsub>bn\<^esub>"} is.  In contrast, in @{text "Let_rec"} we have a
  1298   recursive binder where we want to also bind all occurences of the atoms
  1298   recursive binder where we want to also bind all occurrences of the atoms
  1299   @{text "bn as"} inside @{text "as"}. Therefore we have to subtract @{text
  1299   @{text "bn as"} inside @{text "as"}. Therefore we have to subtract @{text
  1300   "set (bn as)"} from @{text "fv\<^bsub>assn\<^esub> as"}, as well as from
  1300   "set (bn as)"} from @{text "fv\<^bsub>assn\<^esub> as"}, as well as from
  1301   @{text "fv\<^bsub>trm\<^esub> t"}. An interesting point in this example is
  1301   @{text "fv\<^bsub>trm\<^esub> t"}. An interesting point in this example is
  1302   that an assignment ``alone'' does not have any bound variables. Only in the
  1302   that an assignment ``alone'' does not have any bound variables. Only in the
  1303   context of a @{text Let} or @{text "Let_rec"} will some atoms become bound.  
  1303   context of a @{text Let} or @{text "Let_rec"} will some atoms become bound.  
  1407   then we generate just @{text "x\<^isub>i = y\<^isub>i"}.
  1407   then we generate just @{text "x\<^isub>i = y\<^isub>i"}.
  1408 
  1408 
  1409   {\bf TODO (I do not understand the definition below yet).} 
  1409   {\bf TODO (I do not understand the definition below yet).} 
  1410 
  1410 
  1411   The alpha-equivalence relations for binding functions are similar to the alpha-equivalences
  1411   The alpha-equivalence relations for binding functions are similar to the alpha-equivalences
  1412   for their respective types, the difference is that they ommit checking the arguments that
  1412   for their respective types, the difference is that they omit checking the arguments that
  1413   are bound. We assumed that there are no bindings in the type on which the binding function
  1413   are bound. We assumed that there are no bindings in the type on which the binding function
  1414   is defined so, there are no permutations involved. For a binding function clause 
  1414   is defined so, there are no permutations involved. For a binding function clause 
  1415   @{text "bn (C x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, two instances of the constructor are equivalent
  1415   @{text "bn (C x\<^isub>1 \<dots> x\<^isub>n) = rhs"}, two instances of the constructor are equivalent
  1416   @{text "C x\<^isub>1 \<dots> x\<^isub>n \<approx> C y\<^isub>1 \<dots> y\<^isub>n"} if:
  1416   @{text "C x\<^isub>1 \<dots> x\<^isub>n \<approx> C y\<^isub>1 \<dots> y\<^isub>n"} if:
  1417   \begin{center}
  1417   \begin{center}
  1492   "C"}$^\alpha_{1..m}$ from the raw term-constructors @{text
  1492   "C"}$^\alpha_{1..m}$ from the raw term-constructors @{text
  1493   "C"}$_{1..m}$. Similarly for the free-variable functions @{text
  1493   "C"}$_{1..m}$. Similarly for the free-variable functions @{text
  1494   "fv_ty"}$^\alpha_{1..n}$ and the binding functions @{text
  1494   "fv_ty"}$^\alpha_{1..n}$ and the binding functions @{text
  1495   "bn"}$^\alpha_{1..k}$. However, these definitions are of not much use for the 
  1495   "bn"}$^\alpha_{1..k}$. However, these definitions are of not much use for the 
  1496   user, since the are formulated in terms of the isomorphism we obtained by 
  1496   user, since the are formulated in terms of the isomorphism we obtained by 
  1497   cerating a new type in Isabelle/HOL (remember the picture shown in the 
  1497   creating a new type in Isabelle/HOL (remember the picture shown in the 
  1498   Introduction).
  1498   Introduction).
  1499 
  1499 
  1500   {\bf TODO below.}
  1500   {\bf TODO below.}
  1501 
  1501 
  1502   then define the quotient types @{text "ty\<^isub>1\<^isup>\<alpha> \<dots> ty\<^isub>n\<^isup>\<alpha>"}.  To lift
  1502   then define the quotient types @{text "ty\<^isub>1\<^isup>\<alpha> \<dots> ty\<^isub>n\<^isup>\<alpha>"}.  To lift
  1570   \end{proof}
  1570   \end{proof}
  1571 
  1571 
  1572 % Very vague...
  1572 % Very vague...
  1573   \begin{lemma} For each lifted type @{text "ty\<^isup>\<alpha>\<^isub>i"}, for every @{text "x"}
  1573   \begin{lemma} For each lifted type @{text "ty\<^isup>\<alpha>\<^isub>i"}, for every @{text "x"}
  1574    of this type:
  1574    of this type:
  1575   \begin{center}
  1575   \begin{equation}
  1576   @{term "supp x = fv_ty\<^isup>\<alpha>\<^isub>i x"}.
  1576   @{term "supp x = fv_ty\<^isup>\<alpha>\<^isub>i x"}.
  1577   \end{center}
  1577   \end{equation}
  1578   \end{lemma}
  1578   \end{lemma}
  1579   \begin{proof}
  1579   \begin{proof}
  1580   We will show this by induction together with equations that characterize
  1580   We will show this by induction together with equations that characterize
  1581   @{term "fv_bn\<^isup>\<alpha>\<^isub>"} in terms of @{term "alpha_bn\<^isup>\<alpha>"}. For each of @{text "fv_bn\<^isup>\<alpha>"}
  1581   @{term "fv_bn\<^isup>\<alpha>\<^isub>"} in terms of @{term "alpha_bn\<^isup>\<alpha>"}. For each of @{text "fv_bn\<^isup>\<alpha>"}
  1582   functions this equaton is:
  1582   functions this equation is:
  1583   \begin{center}
  1583   \begin{center}
  1584   @{term "{a. infinite {b. \<not> alpha_bn\<^isup>\<alpha> ((a \<rightleftharpoons> b) \<bullet> x) x}} = fv_bn\<^isup>\<alpha> x"}
  1584   @{term "{a. infinite {b. \<not> alpha_bn\<^isup>\<alpha> ((a \<rightleftharpoons> b) \<bullet> x) x}} = fv_bn\<^isup>\<alpha> x"}
  1585   \end{center}
  1585   \end{center}
  1586 
  1586 
  1587   In the induction we need to show these equations together with the goal
  1587   In the induction we need to show these equations together with the goal
  1623   $\bullet$ & @{text "\<pi> \<bullet>bn\<^isub>k x\<^isub>i"} provided @{text "bn\<^isub>k x\<^isub>i"} is @{text "rhs"}\\
  1623   $\bullet$ & @{text "\<pi> \<bullet>bn\<^isub>k x\<^isub>i"} provided @{text "bn\<^isub>k x\<^isub>i"} is @{text "rhs"}\\
  1624   \end{tabular}
  1624   \end{tabular}
  1625   \end{center}
  1625   \end{center}
  1626 
  1626 
  1627   The definition of @{text "\<bullet>bn"} is respectful (simple induction) so we can lift it
  1627   The definition of @{text "\<bullet>bn"} is respectful (simple induction) so we can lift it
  1628   and obtain @{text "\<bullet>bn\<^isup>\<alpha>"}. A property that shows that this defnition is correct is:
  1628   and obtain @{text "\<bullet>bn\<^isup>\<alpha>"}. A property that shows that this definition is correct is:
  1629 
  1629 
  1630 %% We could get this from ExLet/perm_bn lemma.
  1630 %% We could get this from ExLet/perm_bn lemma.
  1631   \begin{lemma} For every bn function  @{text "bn\<^isup>\<alpha>\<^isub>i"},
  1631   \begin{lemma} For every bn function  @{text "bn\<^isup>\<alpha>\<^isub>i"},
  1632   \begin{center}
  1632   \begin{eqnarray}
  1633   @{text "\<pi> \<bullet> bn\<^isup>\<alpha>\<^isub>i l = bn\<^isup>\<alpha>\<^isub>i(p \<bullet>bn\<^isup>\<alpha>\<^isub>i l)"}
  1633   @{term "\<pi> \<bullet> bn\<^isup>\<alpha>\<^isub>i x"} & = & @{term "bn\<^isup>\<alpha>\<^isub>i(p \<bullet>bn\<^isup>\<alpha>\<^isub>i x)"}\\
  1634   \end{center}
  1634   @{term "fv_bn\<^isup>\<alpha>\<^isub>i x"} & = & @{term "fv_bn\<^isup>\<alpha>\<^isub>i(p \<bullet>bn\<^isup>\<alpha>\<^isub>i x)"}
       
  1635   \end{eqnarray}
  1635   \end{lemma}
  1636   \end{lemma}
  1636   \begin{proof} By induction on the lifted type it follows from the definitions of
  1637   \begin{proof} By induction on the lifted type it follows from the definitions of
  1637     permutations on the lifted type and the lifted defining eqautions of @{text "\<bullet>bn"}.
  1638     permutations on the lifted type and the lifted defining equations of @{text "\<bullet>bn"}
       
  1639     and @{text "fv_bn"}.
  1638   \end{proof}
  1640   \end{proof}
  1639 
  1641 
  1640 *}
  1642 *}
  1641 
  1643 
  1642 text {*
  1644 text {*
  1842   \item non-emptiness
  1844   \item non-emptiness
  1843   \item positive datatype definitions
  1845   \item positive datatype definitions
  1844   \item finitely supported abstractions
  1846   \item finitely supported abstractions
  1845   \item respectfulness of the bn-functions\bigskip
  1847   \item respectfulness of the bn-functions\bigskip
  1846   \item binders can only have a ``single scope''
  1848   \item binders can only have a ``single scope''
       
  1849   \item in particular "bind a in b, bind b in c" is not allowed.
  1847   \item all bindings must have the same mode
  1850   \item all bindings must have the same mode
  1848   \end{itemize}
  1851   \end{itemize}
  1849 *}
  1852 *}
  1850 
  1853 
  1851 (*<*)
  1854 (*<*)