Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


SSL Syntax.thy   Sprache: Isabelle

 

(*:maxLineLen=78:*)

theory Syntax
imports Base
begin

chapter ‹Concrete syntax and type-checking›

text ‹
 Pure ‹λ›-calculus as introduced in \chref{ch:logic} is an adequate
 foundation for logical languages --- in the tradition of ∗‹higher-order
 abstract syntax
› --- but end-users require additional means for reading and
 printing of terms and types. This important add-on outside the logical core
 is called ∗‹inner syntax› in Isabelle jargon, as opposed to the ∗‹outer
 syntax
› of the theory and proof language cite‹"isabelle-isar-ref"›.

 For example, according to cite‹church40› quantifiers are represented as
 higher-order constants ‹All :: ('a → bool) → bool› such that ‹All (λx::'a. B
 x)
› faithfully represents the idea that is displayed in Isabelle as ‹∀x::'a.
 B x
› via @{keyword "binder"} notation. Moreover, type-inference in the style
 of Hindley-Milner cite‹hindleymilner› (and extensions) enables users to
 write ‹∀x. B x› concisely, when the type ‹'a› is already clear from the
 context.🚫‹Type-inference taken to the extreme can easily confuse users.
 Beginners often stumble over unexpectedly general types inferred by the
 system.
›

 ┉
 The main inner syntax operations are ∗‹read› for parsing together with
 type-checking, and ∗‹pretty› for formatted output. See also
 \secref{sec:read-print}.

 Furthermore, the input and output syntax layers are sub-divided into
 separate phases for ∗‹concrete syntax› versus ∗‹abstract syntax›, see also
 \secref{sec:parse-unparse} and \secref{sec:term-check}, respectively. This
 results in the following decomposition of the main operations:

 ▪ ‹read = parse; check›

 ▪ ‹pretty = uncheck; unparse›

 For example, some specification package might thus intercept syntax
 processing at a well-defined stage after ‹parse›, to a augment the resulting
 pre-term before full type-reconstruction is performed by ‹check›. Note that
 the formal status of bound variables, versus free variables, versus
 constants must not be changed between these phases.

 ┉
 In general, ‹check› and ‹uncheck› operate simultaneously on a list of terms.
 This is particular important for type-checking, to reconstruct types for
 several terms of the same context and scope. In contrast, ‹parse› and
 ‹unparse› operate separately on single terms.

 There are analogous operations to read and print types, with the same
 sub-division into phases.
 
›


section ‹Reading and pretty printing \label{sec:read-print}›

text ‹
 Read and print operations are roughly dual to each other, such that for the
 user ‹s' = pretty (read s)› looks similar to the original source text ‹s›,
 but the details depend on many side-conditions. There are also explicit
 options to control the removal of type information in the output. The
 default configuration routinely looses information, so ‹t' = read (pretty
 t)
› might fail, or produce a differently typed term, or a completely
 different term in the face of syntactic overloading.
 
›

text %mlref ‹
 \begin{mldecls}
 @{define_ML Syntax.read_typs: "Proof.context -> string list -> typ list"} \\
 @{define_ML Syntax.read_terms: "Proof.context -> string list -> term list"} \\
 @{define_ML Syntax.read_props: "Proof.context -> string list -> term list"} \\[0.5ex]
 @{define_ML Syntax.read_typ: "Proof.context -> string -> typ"} \\
 @{define_ML Syntax.read_term: "Proof.context -> string -> term"} \\
 @{define_ML Syntax.read_prop: "Proof.context -> string -> term"} \\[0.5ex]
 @{define_ML Syntax.pretty_typ: "Proof.context -> typ -> Pretty.T"} \\
 @{define_ML Syntax.pretty_term: "Proof.context -> term -> Pretty.T"} \\
 @{define_ML Syntax.string_of_typ: "Proof.context -> typ -> string"} \\
 @{define_ML Syntax.string_of_term: "Proof.context -> term -> string"} \\
 \end{mldecls}

 🚫 🚫‹Syntax.read_typs›~‹ctxt strs› parses and checks a simultaneous list
 of source strings as types of the logic.

 🚫 🚫‹Syntax.read_terms›~‹ctxt strs› parses and checks a simultaneous list
 of source strings as terms of the logic. Type-reconstruction puts all parsed
 terms into the same scope: types of free variables ultimately need to
 coincide.

 If particular type-constraints are required for some of the arguments, the
 read operations needs to be split into its parse and check phases. Then it
 is possible to use 🚫‹Type.constraint› on the intermediate pre-terms
 (\secref{sec:term-check}).

 🚫 🚫‹Syntax.read_props›~‹ctxt strs› parses and checks a simultaneous list
 of source strings as terms of the logic, with an implicit type-constraint
 for each argument to enforce type typ‹prop›; this also affects the inner
 syntax for parsing. The remaining type-reconstruction works as for 🚫‹Syntax.read_terms›.

 🚫 🚫‹Syntax.read_typ›, 🚫‹Syntax.read_term›, 🚫‹Syntax.read_prop› are
 like the simultaneous versions, but operate on a single argument only. This
 convenient shorthand is adequate in situations where a single item in its
 own scope is processed. Do not use 🚫‹map o Syntax.read_term› where 🚫‹Syntax.read_terms› is actually intended!

 🚫 🚫‹Syntax.pretty_typ›~‹ctxt T› and 🚫‹Syntax.pretty_term›~‹ctxt t›
 uncheck and pretty-print the given type or term, respectively. Although the
 uncheck phase acts on a simultaneous list as well, this is rarely used in
 practice, so only the singleton case is provided as combined pretty
 operation. There is no distinction of term vs.\ proposition.

 🚫 🚫‹Syntax.string_of_typ› and 🚫‹Syntax.string_of_term› are convenient
 compositions of 🚫‹Syntax.pretty_typ› and 🚫‹bool›, 🚫‹real›, or 🚫‹string›. Tools may declare options in
 🚫‹
 strings, as long as there is no further formatting and line-breaking
 involved.


 🚫‹Syntax.string_of_term› are the most important operations in practice.

 ┉
 Note that the string values that are passed in and out are annotated by the
 system, to carry further markup that is relevant for the Prover IDE cite‹"isabelle-jedit"›. User code should neither compose its own input strings,
 nor try to analyze the output strings. Conceptually this is an abstract
 datatype, encoded as concrete string for historical reasons.

 The standard way to provide the required position markup for input works via
 the outer syntax parser wrapper 🚫‹Parse.inner_syntax›, which is already
 part of 🚫< ^
  obtained from one of the latter may be directly passed to the corresponding
  read operation: this yields PIDE markup of the input and precise positions
  for warning and error messages.
\<close>


section \<open>Parsing and unparsing \label{sec:parse-unparse}\<close>

text \<open>
  Parsing and unparsing converts between actual source text and a certain
  \<^emph>\<open>pre-term\<close> format, where all bindings and scopes are already resolved
 
Thus  offreevariablesor constants are  in
  the sense of the logical context, but type information might be still
  missing. Pre-terms support an explicit language of \<^emph>\<open>type constraints\<close> that
  may be augmented by user code to guide the later \<^emph>\<open>check\<close> phase.

  Actual parsing is based on traditional lexical analysis and Earley parsing
  for arbitrary context-free grammars. The user can specify the grammar
  declaratively via mixfix annotations. Moreover, there are \<^emph>\<open>syntax
  translations\<close> that can be augmented by the user, either declaratively via
  @ \ecref{secpure-meth-att}), but apply rules by elim-resolution,
  parse_translation}, @{command print_translation} \<^cite>\<open>"isabelle-isar-ref"\<close>. The final scope-resolution is performed by the system,
  accordingdestruct-  resolution <cite\>i-\close.Theoptional argument( 0java.lang.StringIndexOutOfBoundsException: Index 158 out of bounds for length 158
  by the context.
\closeforward   facts.

text
  \begin{mldecls}
 {define_ML Syntax.arse_typ:Proofcontext-string-typ}\java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
@define_ML Syntaxparse_term P.context- string- "\
  @{define_ML Syntax.parse_prop: "
Proof.  rules given as arguments are taken into accou java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 73
  @{define_ML Syntax.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
  @define_MLS.:".context >term - ."} \
  \end{mldecls}

  \<^descr> \<^ML>\<open>Syntax.parse_typ\<close>~\<open>ctxt str\<close> parses a source string java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  isreadytobeusedwith subsequentcheckoperations.

  \<^descr> \<^of `\open,<>'method combinator (f. s{:proof-meth}java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
  is ready to be   \<^descr> @{method ~<pen>s\<  a realtime elayof\opens< .This

  \<^descr> \<^ML>\<open>Syntax.parse_prop\<close>~\<open>ctxt str\<close> parses ajava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
   ready  beused with subsequent check operations.The inner syntax
  category is \<^typ>\<    { tagged} & : & \<pen>attribute\<close>\
  that this @{attribute_def}&:&\open>attribute\<close \0.5exjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70

  \<^descr> \<^ @a }&:&\open>attribute\<lose \
  operations, to turn    { }&:&\open>attribute\close> \

  <descr>\^\o>yntax.nparse_term<~<cT<> unparses a termafter uncheck
  operations, to turn it into :  <opena\<lose>\
  propositions  @attribute_def Pure)elim_format    <attribute\close> \


  These operations always operate on a single item; use the combinator \<^ML>\<\nd{atharrayjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
<


section \<open>Checking and unchecking \label{sec:term-check}\<close>

java.lang.StringIndexOutOfBoundsException: Range [11, 4) out of bounds for length 12
  These operations define  @{ttribute THEN}([ @{ }'
' { thm}
  terms in the sense of the logical;

  The \<^emph>\<open>check\<close> phase is meant(@attribute unfoldedjava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 66
  of ``    @{attribute }@syntaxint}?
  not just type-checking in the narrow sense. The \<^emph>\<open>uncheck\<close> java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 10
  dual t type-nformation  printingjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58

  A typical add-on   serve as formal comm.The firststringis   name, the
}mechanism\^\<>"isabelleisar-ef"\<lose.Here user 
  syntactic definitions that are managed by the system as polymorphic  same name.
  bindings. These java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 0
  >uncheck\<close> phase, without affecting the type-assignment of the given
  terms.

  \<^medskip>
The   of type checking   the  --additional
  check/uncheck modules might   also \<^ML_infix>\<open>RS\<close \^ite>\<pen>isabelleimplementation\close.

  For example,<>{java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 143
  treats certain type instances of overloaded constants according to the
  ``  expand and fold back again the given definitions throughout a rule.
  \<descr {java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 102
  by certain locale parameters. See also \<^cite>\  into \^prop\of\<quiv <>x .t\close,which ensures that @method simp} always
\close>

text %mlref \<open>
  \begin{  \<^descr> @{att rotated}\<open>n\close> rotate the premises of a theorem by \<open>n\<close> (default
  @{define_ML Syntax.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 5
  @{define_ML Syntax.\<^descr> @{attribute (Pure) elim_formata rule into elimination
  @{define_ML Syntax  rule ,by resolving withthe \^rop>\<>PROP A \Longrightarrow>(A\java.lang.StringIndexOutOfBoundsException: Range [113, 106) out of bounds for length 133
  @  B<>.
  @{define_ML java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 2
  }

  \<^descr> \<  java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 28
  as types of the logic. Typically, this involves normalization of type
  synonyms.

  \<^descr> \<^ML>\<open>Syntax.check_terms\<close>~\<open>ctxt   mainly tuning opretty  theoremsjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  as terms of java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  normalization term abbreviations. subsection \<open>Low-level equational reasoning\<close>
  treated in the same  begin{

 java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 76
  standard approach@method_def hypsubst} &:&<>method\close \
  into that of terms; all arguments are appended into one list of terms    {ethod_def}    <>method<>\java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  is java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  \<^descr> \<^ML>\<open>Syntax.check_props\<close>~\<@@method  '
'asm )) \<newline> ('( ({syntaxnat})''?@syntax thm}
as of the , sucht  termsareconstrainedby  \^typ><open>prop\<lose.Theremainingcheck operation  s \<ML><>.\<close>
  above.

  \<^descr> \<^
  of the logic, in

  \ <\>.\~<ctxt\ a ofjava.lang.StringIndexOutOfBoundsException: Range [114, 115) out of bounds for length 114
 prettyprinting There is  distinction for
  propositions here.


  These operations always\{ec:)   java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 69
<><singleton>   a single item.
\<close>

end

Messung
CHZG
969610097

¤ Dauer der Verarbeitung: 0.4 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,187,975
#Domains=976,265