Nominal/Ex/Exec/Paper.thy
author Cezary Kaliszyk <cezarykaliszyk@gmail.com>
Tue, 22 May 2012 14:55:58 +0200
changeset 3173 9876d73adb2b
permissions -rw-r--r--
Executing Lambda Terms
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3173
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     1
(*<*)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     2
theory Paper imports Lambda_Exec begin
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     3
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     4
notation (latex output)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     5
      Name ("\<nu>_")
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     6
  and subst ("_ [_ := _]" [90, 90, 90] 90)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     7
  and Lam ("\<^raw:$\lambda$>_. _" [50, 50] 50)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     8
(*  and atom ("_")*)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
     9
  and swap ("'(_ _')" [1000, 1000] 1000)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    10
(*and Umn ("\<^raw:$U^{\mbox{>_\<^raw:}}_{\mbox{>_\<^raw:}}$>" [205,205] 200)*)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    11
  and all (binder "\<forall>" 10)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    12
  and fresh ("_ \<FRESH> _" [55, 55] 55)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    13
  and Set.empty ("\<emptyset>")
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    14
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    15
declare [[show_question_marks = false]]
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    16
(*>*)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    17
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    18
section {* Introduction *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    19
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    20
section {* General Algorithm *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    21
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    22
section {* Executing the Foundations of Nominal Logic *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    23
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    24
subsection {* Executable Permutations *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    25
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    26
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    27
\begin{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    28
\item Definitions of permutation as a list: application of a permutation,
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    29
  validity of a permutation and equality of permutations
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    30
  @{thm [display, indent=5] perm_apply_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    31
  @{thm [display, indent=5] valid_perm_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    32
  @{thm [display, indent=5] perm_eq_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    33
\item Quotient type
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    34
  @{text [display, indent=5] "quotient_type 'a gperm = \"('a \<times> 'a) list\" / partial: \"perm_eq\""}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    35
\item Definitions of composing permutations and inverse permutation as well
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    36
  as showing that:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    37
  @{text [display, indent=5] "instantiation gperm :: (type) group_add"}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    38
\item Proper representation and abstraction functions to make the @{text "code_abstype"}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    39
  @{thm [display, indent=5] dest_perm_raw_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    40
  @{thm [display, indent=5] mk_perm_raw_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    41
\item Code abstract equations of permutation composition, inverse, zero, swapping etc
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    42
\end{itemize} *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    43
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    44
subsection {* Sort-respecting Permutations *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    45
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    46
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    47
\begin{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    48
\item The type of sorted atoms
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    49
\item Definition of sort-respecting
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    50
  @{thm [display, indent=5] sort_respecting_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    51
\item typedef and definitions of the basic operations
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    52
\item showing that the sort-respecting ones are also a group\_add and that the
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    53
  code equations can be reused.
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    54
\end{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    55
*}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    56
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    57
subsection {* Concrete atom types *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    58
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    59
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    60
\begin{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    61
\item bijection to natural numbers
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    62
  @{thm [display, indent=5] Name_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    63
  @{thm [display, indent=5] nat_of_name_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    64
\item @{text "code_datatype"}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    65
\item equality of variables and a code equation for concrete variables
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    66
  @{thm [display, indent=5] equal_name_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    67
  @{thm [display, indent=5] equal_name_code}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    68
\item code equations for @{term atom} and application of a permutation
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    69
  @{thm [display, indent=5] atom_name_code}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    70
  @{thm [display, indent=5] permute_name_code}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    71
\end{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    72
 *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    73
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    74
section {* Executing the Lambda Terms *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    75
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    76
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    77
\begin{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    78
\item Defining a representation type: LN
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    79
\item Abstraction with an accumulator
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    80
  @{thm [display, indent=5] ln_lam_aux.simps}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    81
  @{thm [display, indent=5] ln_lam_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    82
\item Representation, with a helper
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    83
  @{thm [display, indent=5] subst_ln_nat.simps}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    84
  @{thm [display, indent=5] lam_ln_ex.simps}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    85
\item A helper function \& proof that equal:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    86
  @{thm [display, indent=5] lam_ln_aux.simps}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    87
  @{thm [display, indent=5] lam_ln_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    88
  @{thm [display, indent=5] lam_ln_ex}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    89
\item Code abstype
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    90
  @{thm [display, indent=5] ln_abstype}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    91
\item equality and permutations for the abstract type
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    92
  @{thm [display, indent=5] equal_lam_def}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    93
  @{thm [display, indent=5] lam_ln_ex.eqvt[symmetric]}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    94
\end{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    95
*}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    96
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    97
subsection {* Executing substitution *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    98
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
    99
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   100
\begin{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   101
\item Substitution on the representation:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   102
  @{thm [display, indent=5] subst_ln.simps}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   103
\item equality of substitutions:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   104
  @{thm [display, indent=5] subst_code}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   105
\end{itemize}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   106
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   107
Example of execution:
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   108
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   109
@{text value} @{term "subst ((N0 \<leftrightarrow> N1) \<bullet> (App (Var N0) (Lam [N1]. (Var N1)))) N1 (Var N0)"}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   110
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   111
*}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   112
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   113
section {* Conclusion\label{sec:conclusion} *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   114
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   115
subsection {* Future Work *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   116
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   117
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   118
  Efficiency: Use more efficient representation for permutations than
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   119
  lists. Might be useful for bigger permutations, but for permuttaions
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   120
  of up to 3 elements does not make much sense *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   121
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   122
subsection {* Related Work *}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   123
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   124
text {*
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   125
  Locally Nameless~\cite{LocallyNameless}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   126
*}
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   127
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   128
(*<*)
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   129
end
9876d73adb2b Executing Lambda Terms
Cezary Kaliszyk <cezarykaliszyk@gmail.com>
parents:
diff changeset
   130
(*>*)