The Hitchhiker’s Guide to
Logical Verificationwhere tactic α is the type of metaprograms returning a value of type α. (The terms “tactic” and “metaprogram” are often used interchangeably in Lean.) Often, metaprograms only have side efects on the state metaprogramming framework is that we do not need to learn another programming language to write metaprograms. We can work with the same constructs and notation used to define ordinary objects in Lean’s library library. Everything in that library is available for metaprogramming purposes (e.g., Z, list). Metaprograms can be written and debugged in the same interactive en- vironment, encouraging a style where formal0 码力 | 215 页 | 1.95 MB | 1 年前3
Programming in Lean
Release 3.4.2functionality of Lean itself. To that end, Lean allows us to mark metaprograms with the keyword meta. This does two things: • Metaprograms can use arbitrary recursive calls, with no concern for termination termination. 1 Programming in Lean, Release 3.4.2 • Metaprograms can access metaconstants, that is, primitive functions and objects that are implemented internally in Lean and are not meant to be trusted by programming language • as a system for verifying properties of programs • as a system for writing metaprograms, that is, programs that extend the functionality of Lean itself 2 Chapter 1. Introduction CHAPTER0 码力 | 51 页 | 220.07 KB | 1 年前3
Agda User Manual v2.5.2checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 151 页 | 152.49 KB | 1 年前3
Agda User Manual v2.5.3checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 185 页 | 185.00 KB | 1 年前3
Agda User Manual v2.5.4.2checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 216 页 | 207.61 KB | 1 年前3
Agda User Manual v2.5.4.1checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 216 页 | 207.64 KB | 1 年前3
Agda User Manual v2.5.4checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 216 页 | 207.63 KB | 1 年前3
Agda User Manual v2.5.2AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting normal function: thm : ¬ P NP thm = by-magic Unquoting Declarations While macros let you write metaprograms to create terms, it is also useful to be able to create top-level definitions. You can do this0 码力 | 107 页 | 510.49 KB | 1 年前3
Agda User Manual v2.6.0.1checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 256 页 | 247.15 KB | 1 年前3
Agda User Manual v2.6.0checking computations (see below) can fail with an error, which is a list of ErrorParts. This allows metaprograms to generate nice errors without having to implement pretty printing for reflected terms. -- Error AGDAERRORPARTTERM termErr #-} {-# BUILTIN AGDAERRORPARTNAME nameErr #-} Type checking computations Metaprograms, i.e. programs that create other programs, run in a built-in type checking monad TC: postulate metaprogram (TC computation). To run a metaprogram in a term position you use a macro. To run metaprograms to create top-level definitions you can use the unquoteDecl and unquoteDef primitives (see Unquoting0 码力 | 256 页 | 246.87 KB | 1 年前3
共 36 条
- 1
- 2
- 3
- 4













