doc-src/IsarImplementation/Thy/Logic.thy
changeset 39846 cb6634eb8926
parent 39840 3eb0694e6fcb
child 39861 b8d89db3e238
equal deleted inserted replaced
39845:50f42116ebdb 39846:cb6634eb8926
   119   \begin{mldecls}
   119   \begin{mldecls}
   120   @{index_ML_type class: string} \\
   120   @{index_ML_type class: string} \\
   121   @{index_ML_type sort: "class list"} \\
   121   @{index_ML_type sort: "class list"} \\
   122   @{index_ML_type arity: "string * sort list * sort"} \\
   122   @{index_ML_type arity: "string * sort list * sort"} \\
   123   @{index_ML_type typ} \\
   123   @{index_ML_type typ} \\
   124   @{index_ML map_atyps: "(typ -> typ) -> typ -> typ"} \\
   124   @{index_ML Term.map_atyps: "(typ -> typ) -> typ -> typ"} \\
   125   @{index_ML fold_atyps: "(typ -> 'a -> 'a) -> typ -> 'a -> 'a"} \\
   125   @{index_ML Term.fold_atyps: "(typ -> 'a -> 'a) -> typ -> 'a -> 'a"} \\
   126   \end{mldecls}
   126   \end{mldecls}
   127   \begin{mldecls}
   127   \begin{mldecls}
   128   @{index_ML Sign.subsort: "theory -> sort * sort -> bool"} \\
   128   @{index_ML Sign.subsort: "theory -> sort * sort -> bool"} \\
   129   @{index_ML Sign.of_sort: "theory -> typ * sort -> bool"} \\
   129   @{index_ML Sign.of_sort: "theory -> typ * sort -> bool"} \\
   130   @{index_ML Sign.add_types: "(binding * int * mixfix) list -> theory -> theory"} \\
   130   @{index_ML Sign.add_types: "(binding * int * mixfix) list -> theory -> theory"} \\
   147   described above.
   147   described above.
   148 
   148 
   149   \item @{ML_type typ} represents types; this is a datatype with
   149   \item @{ML_type typ} represents types; this is a datatype with
   150   constructors @{ML TFree}, @{ML TVar}, @{ML Type}.
   150   constructors @{ML TFree}, @{ML TVar}, @{ML Type}.
   151 
   151 
   152   \item @{ML map_atyps}~@{text "f \<tau>"} applies the mapping @{text "f"}
   152   \item @{ML Term.map_atyps}~@{text "f \<tau>"} applies the mapping @{text
   153   to all atomic types (@{ML TFree}, @{ML TVar}) occurring in @{text
   153   "f"} to all atomic types (@{ML TFree}, @{ML TVar}) occurring in
   154   "\<tau>"}.
   154   @{text "\<tau>"}.
   155 
   155 
   156   \item @{ML fold_atyps}~@{text "f \<tau>"} iterates the operation @{text
   156   \item @{ML Term.fold_atyps}~@{text "f \<tau>"} iterates the operation
   157   "f"} over all occurrences of atomic types (@{ML TFree}, @{ML TVar})
   157   @{text "f"} over all occurrences of atomic types (@{ML TFree}, @{ML
   158   in @{text "\<tau>"}; the type structure is traversed from left to right.
   158   TVar}) in @{text "\<tau>"}; the type structure is traversed from left to
       
   159   right.
   159 
   160 
   160   \item @{ML Sign.subsort}~@{text "thy (s\<^isub>1, s\<^isub>2)"}
   161   \item @{ML Sign.subsort}~@{text "thy (s\<^isub>1, s\<^isub>2)"}
   161   tests the subsort relation @{text "s\<^isub>1 \<subseteq> s\<^isub>2"}.
   162   tests the subsort relation @{text "s\<^isub>1 \<subseteq> s\<^isub>2"}.
   162 
   163 
   163   \item @{ML Sign.of_sort}~@{text "thy (\<tau>, s)"} tests whether type
   164   \item @{ML Sign.of_sort}~@{text "thy (\<tau>, s)"} tests whether type
   352 
   353 
   353 text %mlref {*
   354 text %mlref {*
   354   \begin{mldecls}
   355   \begin{mldecls}
   355   @{index_ML_type term} \\
   356   @{index_ML_type term} \\
   356   @{index_ML "op aconv": "term * term -> bool"} \\
   357   @{index_ML "op aconv": "term * term -> bool"} \\
   357   @{index_ML map_types: "(typ -> typ) -> term -> term"} \\
   358   @{index_ML Term.map_types: "(typ -> typ) -> term -> term"} \\
   358   @{index_ML fold_types: "(typ -> 'a -> 'a) -> term -> 'a -> 'a"} \\
   359   @{index_ML Term.fold_types: "(typ -> 'a -> 'a) -> term -> 'a -> 'a"} \\
   359   @{index_ML map_aterms: "(term -> term) -> term -> term"} \\
   360   @{index_ML Term.map_aterms: "(term -> term) -> term -> term"} \\
   360   @{index_ML fold_aterms: "(term -> 'a -> 'a) -> term -> 'a -> 'a"} \\
   361   @{index_ML Term.fold_aterms: "(term -> 'a -> 'a) -> term -> 'a -> 'a"} \\
   361   \end{mldecls}
   362   \end{mldecls}
   362   \begin{mldecls}
   363   \begin{mldecls}
   363   @{index_ML fastype_of: "term -> typ"} \\
   364   @{index_ML fastype_of: "term -> typ"} \\
   364   @{index_ML lambda: "term -> term -> term"} \\
   365   @{index_ML lambda: "term -> term -> term"} \\
   365   @{index_ML betapply: "term * term -> term"} \\
   366   @{index_ML betapply: "term * term -> term"} \\
   381   \item @{text "t"}~@{ML_text aconv}~@{text "u"} checks @{text
   382   \item @{text "t"}~@{ML_text aconv}~@{text "u"} checks @{text
   382   "\<alpha>"}-equivalence of two terms.  This is the basic equality relation
   383   "\<alpha>"}-equivalence of two terms.  This is the basic equality relation
   383   on type @{ML_type term}; raw datatype equality should only be used
   384   on type @{ML_type term}; raw datatype equality should only be used
   384   for operations related to parsing or printing!
   385   for operations related to parsing or printing!
   385 
   386 
   386   \item @{ML map_types}~@{text "f t"} applies the mapping @{text
   387   \item @{ML Term.map_types}~@{text "f t"} applies the mapping @{text
   387   "f"} to all types occurring in @{text "t"}.
   388   "f"} to all types occurring in @{text "t"}.
   388 
   389 
   389   \item @{ML fold_types}~@{text "f t"} iterates the operation @{text
   390   \item @{ML Term.fold_types}~@{text "f t"} iterates the operation
   390   "f"} over all occurrences of types in @{text "t"}; the term
   391   @{text "f"} over all occurrences of types in @{text "t"}; the term
   391   structure is traversed from left to right.
   392   structure is traversed from left to right.
   392 
   393 
   393   \item @{ML map_aterms}~@{text "f t"} applies the mapping @{text "f"}
   394   \item @{ML Term.map_aterms}~@{text "f t"} applies the mapping @{text
   394   to all atomic terms (@{ML Bound}, @{ML Free}, @{ML Var}, @{ML
   395   "f"} to all atomic terms (@{ML Bound}, @{ML Free}, @{ML Var}, @{ML
   395   Const}) occurring in @{text "t"}.
   396   Const}) occurring in @{text "t"}.
   396 
   397 
   397   \item @{ML fold_aterms}~@{text "f t"} iterates the operation @{text
   398   \item @{ML Term.fold_aterms}~@{text "f t"} iterates the operation
   398   "f"} over all occurrences of atomic terms (@{ML Bound}, @{ML Free},
   399   @{text "f"} over all occurrences of atomic terms (@{ML Bound}, @{ML
   399   @{ML Var}, @{ML Const}) in @{text "t"}; the term structure is
   400   Free}, @{ML Var}, @{ML Const}) in @{text "t"}; the term structure is
   400   traversed from left to right.
   401   traversed from left to right.
   401 
   402 
   402   \item @{ML fastype_of}~@{text "t"} determines the type of a
   403   \item @{ML fastype_of}~@{text "t"} determines the type of a
   403   well-typed term.  This operation is relatively slow, despite the
   404   well-typed term.  This operation is relatively slow, despite the
   404   omission of any sanity checks.
   405   omission of any sanity checks.