doc-src/IsarRef/Thy/document/Spec.tex
changeset 41434 710cdb9e0d17
parent 41249 26f12f98f50a
child 41435 12585dfb86fe
equal deleted inserted replaced
41433:1b8ff770f02c 41434:710cdb9e0d17
   513   instantiated specification and is called \emph{locale
   513   instantiated specification and is called \emph{locale
   514   interpretation}.  Interpretation is possible in locales \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}, theories (command \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}) and
   514   interpretation}.  Interpretation is possible in locales \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}, theories (command \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}) and
   515   also within a proof body (command \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}).
   515   also within a proof body (command \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}).
   516 
   516 
   517   \begin{matharray}{rcl}
   517   \begin{matharray}{rcl}
   518     \indexdef{}{command}{sublocale}\hypertarget{command.sublocale}{\hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
       
   519     \indexdef{}{command}{interpretation}\hypertarget{command.interpretation}{\hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
   518     \indexdef{}{command}{interpretation}\hypertarget{command.interpretation}{\hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
   520     \indexdef{}{command}{interpret}\hypertarget{command.interpret}{\hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{28}{\isacharparenleft}}state{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{7C}{\isacharbar}}\ proof{\isaliteral{28}{\isacharparenleft}}chain{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
   519     \indexdef{}{command}{interpret}\hypertarget{command.interpret}{\hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}proof{\isaliteral{28}{\isacharparenleft}}state{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{7C}{\isacharbar}}\ proof{\isaliteral{28}{\isacharparenleft}}chain{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
       
   520     \indexdef{}{command}{sublocale}\hypertarget{command.sublocale}{\hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}theory\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}\ proof{\isaliteral{28}{\isacharparenleft}}prove{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} \\
   521     \indexdef{}{command}{print\_interps}\hypertarget{command.print-interps}{\hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
   521     \indexdef{}{command}{print\_interps}\hypertarget{command.print-interps}{\hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}}\isa{{\isaliteral{22}{\isachardoublequote}}\isaliteral{5C3C5E7375703E}{}\isactrlsup {\isaliteral{2A}{\isacharasterisk}}{\isaliteral{22}{\isachardoublequote}}} & : & \isa{{\isaliteral{22}{\isachardoublequote}}context\ {\isaliteral{5C3C72696768746172726F773E}{\isasymrightarrow}}{\isaliteral{22}{\isachardoublequote}}} \\
   522   \end{matharray}
   522   \end{matharray}
   523 
   523 
   524   \indexouternonterm{interp}
   524   \indexouternonterm{interp}
   525   \begin{rail}
   525   \begin{rail}
   526     'sublocale' nameref ('<' | subseteq) localeexpr
   526     'interpretation' localeexpr equations?
   527     ;
       
   528     'interpretation' localeepxr equations?
       
   529     ;
   527     ;
   530     'interpret' localeexpr equations?
   528     'interpret' localeexpr equations?
   531     ;
   529     ;
       
   530     'sublocale' nameref ('<' | subseteq) localeexpr equations?
       
   531     ;
       
   532     equations: 'where' (thmdecl? prop + 'and')
       
   533     ;
   532     'print_interps' nameref
   534     'print_interps' nameref
   533     ;
   535     ;
   534     equations: 'where' (thmdecl? prop + 'and')
   536   \end{rail}
   535     ;
   537 
   536   \end{rail}
   538   \begin{description}
   537 
       
   538   \begin{description}
       
   539 
       
   540   \item \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ expr{\isaliteral{22}{\isachardoublequote}}}
       
   541   interprets \isa{expr} in the locale \isa{name}.  A proof that
       
   542   the specification of \isa{name} implies the specification of
       
   543   \isa{expr} is required.  As in the localized version of the
       
   544   theorem command, the proof is in the context of \isa{name}.  After
       
   545   the proof obligation has been dischared, the facts of \isa{expr}
       
   546   become part of locale \isa{name} as \emph{derived} context
       
   547   elements and are available when the context \isa{name} is
       
   548   subsequently entered.  Note that, like import, this is dynamic:
       
   549   facts added to a locale part of \isa{expr} after interpretation
       
   550   become also available in \isa{name}.
       
   551 
       
   552   Only specification fragments of \isa{expr} that are not already
       
   553   part of \isa{name} (be it imported, derived or a derived fragment
       
   554   of the import) are considered in this process.  This enables
       
   555   circular interpretations to the extent that no infinite chains are
       
   556   generated in the locale hierarchy.
       
   557 
       
   558   If interpretations of \isa{name} exist in the current theory, the
       
   559   command adds interpretations for \isa{expr} as well, with the same
       
   560   qualifier, although only for fragments of \isa{expr} that are not
       
   561   interpreted in the theory already.
       
   562 
   539 
   563   \item \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}}
   540   \item \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}}
   564   interprets \isa{expr} in the theory.  The command generates proof
   541   interprets \isa{expr} in the theory.  The command generates proof
   565   obligations for the instantiated specifications (assumes and defines
   542   obligations for the instantiated specifications (assumes and defines
   566   elements).  Once these are discharged by the user, instantiated
   543   elements).  Once these are discharged by the user, instantiated
   567   facts are added to the theory in a post-processing phase.
   544   facts are added to the theory in a post-processing phase.
   568 
   545 
   569   Additional equations, which are unfolded during
   546   Additional equations, which are unfolded during
   570   post-processing, may be given after the keyword \hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}}.
   547   post-processing, may be given after the keyword \hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}}.
   571   This is useful for interpreting concepts introduced through
   548   This is useful for interpreting concepts introduced through
   572   definition specification elements.  The equations must be proved.
   549   definitions.  The equations must be proved.
   573 
   550 
   574   The command is aware of interpretations already active in the
   551   The command is aware of interpretations already active in the
   575   theory, but does not simplify the goal automatically.  In order to
   552   theory, but does not simplify the goal automatically.  In order to
   576   simplify the proof obligations use methods \hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}}
   553   simplify the proof obligations use methods \hyperlink{method.intro-locales}{\mbox{\isa{intro{\isaliteral{5F}{\isacharunderscore}}locales}}}
   577   or \hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}}.  Post-processing is not applied to
   554   or \hyperlink{method.unfold-locales}{\mbox{\isa{unfold{\isaliteral{5F}{\isacharunderscore}}locales}}}.  Post-processing is not applied to
   580   case of a locale with import, parts of the interpretation may
   557   case of a locale with import, parts of the interpretation may
   581   already be active.  The command will only process facts for new
   558   already be active.  The command will only process facts for new
   582   parts.
   559   parts.
   583 
   560 
   584   Adding facts to locales has the effect of adding interpreted facts
   561   Adding facts to locales has the effect of adding interpreted facts
   585   to the theory for all active interpretations also.  That is,
   562   to the theory for all interpretations as well.  That is,
   586   interpretations dynamically participate in any facts added to
   563   interpretations dynamically participate in any facts added to
   587   locales.
   564   locales.  Note that if a theory inherits additional facts for a
       
   565   locale through one parent and an interpretation of that locale
       
   566   through another parent, the additional facts will not be
       
   567   interpreted.
   588 
   568 
   589   \item \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}} interprets
   569   \item \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}} interprets
   590   \isa{expr} in the proof context and is otherwise similar to
   570   \isa{expr} in the proof context and is otherwise similar to
   591   interpretation in theories.  Note that rewrite rules given to
   571   interpretation in theories.  Note that rewrite rules given to
   592   \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} should be explicitly universally quantified.
   572   \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} after the \hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}} keyword should be
       
   573   explicitly universally quantified.
       
   574 
       
   575   \item \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}name\ {\isaliteral{5C3C73756273657465713E}{\isasymsubseteq}}\ expr\ {\isaliteral{5C3C57484552453E}{\isasymWHERE}}\ eqns{\isaliteral{22}{\isachardoublequote}}}
       
   576   interprets \isa{expr} in the locale \isa{name}.  A proof that
       
   577   the specification of \isa{name} implies the specification of
       
   578   \isa{expr} is required.  As in the localized version of the
       
   579   theorem command, the proof is in the context of \isa{name}.  After
       
   580   the proof obligation has been discharged, the facts of \isa{expr}
       
   581   become part of locale \isa{name} as \emph{derived} context
       
   582   elements and are available when the context \isa{name} is
       
   583   subsequently entered.  Note that, like import, this is dynamic:
       
   584   facts added to a locale part of \isa{expr} after interpretation
       
   585   become also available in \isa{name}.
       
   586 
       
   587   Only specification fragments of \isa{expr} that are not already
       
   588   part of \isa{name} (be it imported, derived or a derived fragment
       
   589   of the import) are considered in this process.  This enables
       
   590   circular interpretations provided that no infinite chains are
       
   591   generated in the locale hierarchy.
       
   592 
       
   593   If interpretations of \isa{name} exist in the current theory, the
       
   594   command adds interpretations for \isa{expr} as well, with the same
       
   595   qualifier, although only for fragments of \isa{expr} that are not
       
   596   interpreted in the theory already.
       
   597 
       
   598   Equations given after \hyperlink{keyword.where}{\mbox{\isa{\isakeyword{where}}}} amend the morphism through
       
   599   which \isa{expr} is interpreted.  This enables to map definitions
       
   600   from the interpreted locales to entities of \isa{name}.  This
       
   601   feature is experimental.
   593 
   602 
   594   \item \hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} lists all
   603   \item \hyperlink{command.print-interps}{\mbox{\isa{\isacommand{print{\isaliteral{5F}{\isacharunderscore}}interps}}}}~\isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} lists all
   595   interpretations of \isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} in the current theory or proof
   604   interpretations of \isa{{\isaliteral{22}{\isachardoublequote}}locale{\isaliteral{22}{\isachardoublequote}}} in the current theory or proof
   596   context, including those due to a combination of a \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}} or \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} and one or several
   605   context, including those due to a combination of a \hyperlink{command.interpretation}{\mbox{\isa{\isacommand{interpretation}}}} or \hyperlink{command.interpret}{\mbox{\isa{\isacommand{interpret}}}} and one or several
   597   \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}} declarations.
   606   \hyperlink{command.sublocale}{\mbox{\isa{\isacommand{sublocale}}}} declarations.